After migrating a software RAID 5 to Ubuntu LTS 12.04, the system wouldn’t come up again after rebooting. I believe Chris Siebenmann to splendidly have analysed [1] the problem: a race condition with udev losing the race.
His solution is to:
Change /usr/share/initramfs-tools/scripts/mdadm-functions
as follows:
degraded_arrays() { + udevadm settle mdadm --misc --scan --detail --test >/dev/null 2>&1 return $((! $?)) }
However, I did manage to prevent Ubuntu from auto-assembling my RAID6 array by doing the following:
sudo mv /lib/udev/rules.d/64-md-raid.rules ~ sudo update-initramfs -k all -u sudo reboot
Note that depending on the version of Ubuntu Server you’re running, the file may be called /lib/udev/rules.d/85-mdadm.rules
, since some cleanup has been done (see Ubuntu Bug #1002357).
After hours of troubleshooting, my system boots up now without dropping to the initramfs shell, and I can assemble the array manually or in a startup script:
sudo mdadm --assemble /dev/md0 --scan --no-degraded
Resources
[1] Ubuntu 12.04 can’t reliably boot with software RAID (and why)
http://utcc.utoronto.ca/~cks/space/blog/linux/Ubuntu1204SoftwareRaidFail?showcomments#comments