Stopping mdadm assemble on ubuntu boot
14 Jun 2013
Soft raid setup with mdadm
I have a Raid-6 running and it currently has 6 drives. My Mobo has 6 sata ports, one of which is used up for the boot drive (not involved in the array). The sixth array drive is on a PCI sata/raid card. The server is headless, which is important because I do not want degraded array events to cause it to drop into busybox on boot.
I have a recurrent problem where my raid will drop one of the disks at boot. It will still assemble (dirty) because I had that configured when I used dpkg-reconfigure mdadm. The server is headless, so dropping into busybox wasn’t an option for me. After boot up, I can re-add the missing drive, but this causes a rebuild because the other 5 drives are in one state (5-1) and the lone drive is in another state (6 clean). My theory is that the sata card drive doesn’t come up quick enough for the assemble. dmesg seems to support this idea because mdadm starts its assemble and then several lines down the log the lone drive is mentioned and recognized.
- Make the assemble wait longer
- Don’t assemble at boot, assemble by hand after boot.
I opted for choice two for now. It is important that you do not pick this solution if your root filesystem (i.e. ubuntu itself) is on the raid array. I have a seperate boot drive so I do not need assembly before boot.
To get mdadm to not assemble on boot.
- I deleted(moved) all of mdadm config files out out of /etc/mdadm/ (don’t know if this was necessary)
- I commented out this line in /lib/udev/rules/85-md-raid.rules (note I am on 11.10)
- Update initramfs
- Cleaned out my fstab entries because these would hang up the boot if the raid volume can’t be found. If you set up fstab, just comment out the ones pertaining to your raid array.
Sidenote: During this little venture I had to drop in a video card and hook up a monitor in order to get through the busybox and such. I decided now was as good a time as any to upgrade to 12.04.2 LTS (been putting it off because I didn’t want to do it over SSH). As a known benefit I would get an upgraded mdadm version (v3.2.5).
- Reboot and the mdadm array should not assemble at boot. You can now assemble by hand at the prompt
- Re-add the one drive
We should be clean and running fine now.
If you are getting a complete rebuild you might try upgrading your distro or just mdadm (as I think that the newer version might be better at re-adding, not 100% on this). I had the newer mdadm version and I didn’t have to completely rebuild.