There is an issue with Genkernel's initramfs when using RAID devices. When I build the image, I pass genkernel an mdadm.conf with the raid sets as I want them numbered. I cannot boot because init is unable to mount ROOT. I'm booting with GRUB and I specify my RAIDed real_root on the kernel cmdline. The problem is that the /init script calls the setup_md_device before calling mdadm within the startVolumes function. In turn, setup_md_device reads the REAL_ROOT variable (/dev/md5 in my case) and creates the node since there are no md devices at startup. It runs: mknod /dev/md5 b 9 5 mdstart /dev/md5 I don't know how the last command works (mdstart), but it causes all the other raid devices to autostart. I immediately see these md devices: /dev/md124 /dev/md126 /dev/md4 /dev/md5 where /dev/md124 is the real ROOT, /dev/md126 is /boot, /dev/md5 is noting. So I patched the /init script with: [ "${USE_MDADM}" != 1 ] && setup_md_device but maybe a better option would be to do something like: if [ "${USE_MDADM}" != 1 ] || [ ! -e /etc/mdadm.conf ]; then setup_md_device fi When I boot with this custom initramfs I can finally get to the login prompt and my RAID sets are correctly numbered. # cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] [raid0] [raid1] [raid10] [linear] [multipath] md5 : active raid1 sda5[0] sdb5[1] 196241920 blocks [2/2] [UU] bitmap: 2/2 pages [8KB], 65536KB chunk md4 : active raid1 sda4[0] sdb4[1] 37033920 blocks [2/2] [UU] md3 : active raid1 sda3[0] sdb3[1] 524224 blocks [2/2] [UU] md1 : active raid1 sda1[0] sdb1[1] 1984 blocks [2/2] [UU] unused devices: <none> # cat /etc/mdadm.conf ARRAY /dev/md1 metadata=0.90 UUID=9f998969:ad1c2cdc:c44c77eb:7ee19756 ARRAY /dev/md3 metadata=0.90 UUID=4874966d:031521b4:c44c77eb:7ee19756 ARRAY /dev/md4 metadata=0.90 UUID=c387f968:cec279b4:c44c77eb:7ee19756 ARRAY /dev/md5 metadata=0.90 UUID=1597ab49:c0c079f2:c44c77eb:7ee19756 # genkernel --version 3.4.52.4 # genkernel --mdadm --mdadm-config=/etc/mdadm.conf initramfs
Created attachment 463814 [details, diff] patch for linuxrc
I just realized that mdstart is a Gentoo patch for busybox. It makes the call: ioctl(fd, RAID_AUTORUN, part); That seems to be causing me trouble.
Controlling name in /dev top level directory is not support. Use /dev/md/<your-desired-name> instead. I.e. booting with $ cat /etc/mdadm.conf ARRAY /dev/md/boot metadata=1.0 name=gentoo-test-vm:boot UUID=b23a10ab:9dc12e17:cd7586dd:a42dbef8 ARRAY /dev/md/123 metadata=1.2 name=gentoo-test-vm:data UUID=0b153d25:ab%21216:4144798f:052b1b49 will create /dev/md/boot and /dev/md/123.