mdadm woes

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-functionsas follows:

 degraded_arrays()
 {
+ udevadm settle
  mdadm --misc --scan --detail --test >/dev/null 2>&1
  return $((! $?))
 }

And also notice a comment from David Kenny:

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s