# Tertiary RAID10 Assembly at boot [SOLVED]

## splurben

I have a four drive MD RAID10 setup. This is not and doesn't need to be bootable, it is for network data storage. But I'd obviously like it to fully reassemble after a reboot. Is there something I can modify in the boot procedure to ensure this RAID starts fully, or do I need to append a boot script to make this RAID more durable.

The RAID was created with: 

```
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sd[bc]1

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sd[de]1

mdadm --create /dev/md2 --chunk=64 --level=0 --raid-devices=2 /dev/md[01]

```

During boot, /dev/md0 and /dev/md1 are automatically assembled, but the second stage, /dev/md2 isn't assembled.

DMESG shows: 

```
mdadm: /dev/md0 has been started with 2 drives.

mdadm: /dev/md1 has been started with 2 drives.

 * Starting mdadm monitor ...
```

The final array assembly (/dev/md2) of the two sub-assemblies (/dev/md[01]) doesn't happen during boot but can be initiated on the command line later with: 

```
mdadm --assemble /dev/md2 /dev/md[01]
```

I'm guessing there needs to be a timed delay in the boot to allow /dev/md0 and /dev/md1 to come up so that /dev/md2 can start, however, there may be other requirements for such a hierarchical RAID.

The pertinent rc.log entries are: 

```
 * Starting up RAID devices ...

mdadm: /dev/md0 has been started with 2 drives.

mdadm: /dev/md1 has been started with 2 drives.

 [ !! ]
```

I'm assuming the [ !! ] at the end of this section is the failure to assemble /dev/md2 although I can't find an option to increase rc.log verbosity.

RAID10 is definitely enabled in the kernel: 

```
thialfi2 init.d # grep RAID10 /usr/src/linux/.config

CONFIG_MD_RAID10=y
```

Contents of /etc/mdadm.conf 

```
DEVICE /dev/sd?1

#MAILADDR root@mydomain.tld

#PROGRAM /usr/sbin/handle-mdadm-events

ARRAY /dev/md0 metadata=1.01 name=thialfi2:0 UUID=85dc1afa:47d93175:d768cc8a:6a4c6e83

ARRAY /dev/md1 metadata=1.01 name=thialfi2:1 UUID=029782b6:21f14355:fd3770cc:d43730ea

ARRAY /dev/md2 metadata=1.01 name=thialfi2:2 UUID=219c8b1a:8924c71f:25c8345d:b00e8210
```

Emerge info:

```
Portage 2.2_rc67 (default/linux/amd64/10.0, gcc-4.4.3, glibc-2.11-r1, 2.6.33-gentoo-r1 x86_64)

=================================================================

System uname: Linux-2.6.33-gentoo-r1-x86_64-Intel-R-_Core-TM-_i5_CPU_750_@_2.67GHz-with-gentoo-2.0.1

Timestamp of tree: Fri, 16 Apr 2010 18:45:01 +0000

distcc 3.1 x86_64-pc-linux-gnu [enabled]

ccache version 2.4 [enabled]

app-shells/bash:     4.1_p5

dev-java/java-config: 2.1.10

dev-lang/python:     2.6.5-r1, 3.1.2-r2

dev-util/ccache:     2.4-r8

dev-util/cmake:      2.8.1

sys-apps/baselayout: 2.0.1

sys-apps/openrc:     0.6.1-r1

sys-apps/sandbox:    2.2

sys-devel/autoconf:  2.13, 2.65

sys-devel/automake:  1.7.9-r2, 1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:  2.20.1

sys-devel/gcc:       4.4.3

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   2.2.6b

virtual/os-headers:  2.6.33

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="*"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config /var/lib/hsqldb"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"

CXXFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests ccache distcc distlocks fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"

GENTOO_MIRRORS="http://ftp.iinet.net.au/linux/Gentoo"

LANG="en_GB.UTF-8"

LC_ALL="en_GB.UTF-8"

LDFLAGS="-Wl,-O1"

LINGUAS="en_AU en_GB en_US en"

MAKEOPTS="-j29"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage/layman/techwolf /usr/local/portage"

SYNC="rsync://thor.localdomain/gentoo-portage"

USE="X a52 aac acl acpi alsa amd64 apache2 apm avi bash-completion berkdb bzip2 cdr cli cracklib crypt css cups cxx dbus dri dv dvb dvd dvdr dvdread encode exif fame ffmpeg firefox flac foomaticdb fortran freetype2 ftp gdbm gif gpm gstreamer gtk hal hddtemp iconv icu idn imagemagick imap imlib ipod java javascript jbig jpeg jpeg2k kerberos lame lash lcms ldap libg++ libsamplerate lm_sensors mad matroska mbox midi mime mjpeg mmx mng modules mp3 mpeg mplayer mudflap multilib musepack mysql mythtv ncurses nls nptl nptlonly nsplugin offensive ogg openal openexr opengl openmp pam pcre pdf perl plotutils png posix ppds pppd python qt3support quicktime readline reflection samba session smp sndfile speex spell spl sse sse2 ssl ssse3 startup-notification svg sysfs tcpd tetex theora threads tidy tiff tk truetype truetype-fonts type1-fonts unicode usb v4l v4l2 vcd vim-syntax vnc vorbis wifi winbind wmf xcb xcomposite xface xfce xfce4 xine xinetd xml xorg xpm xulrunner xv xvid xvmc zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_AU en_GB en_US en" LIRC_DEVICES="serial_igor_cesko serial" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="ati radeon" 

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
```

Cheers for any help on this.

Kirk

----------

## cyrillic

If you wanted to use the kernel's RAID10 module, then you should have created the array in one step, instead of nesting RAID0 and RAID1 arrays.

```
mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/sd[bcde]1 
```

----------

## splurben

Cheers, I'll mark this solved.

----------

