2009-09-24

RAID1 on Ubuntu: Array fails to assemble on boot

A few days after getting my RAID1 devices running smoothly, I rebooted to apply some package updates, and the boot process stopped due to an e2fsck problem. Again.
e2fsck 1.41.4 (27-Jan-2009)
e2fsck: Invalid argument while trying to open /dev/md0

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
I remembered seeing this before, and it took me a minute to remember that this appears when e2fsck is run on a stopped RAID device, but there was no reason for it since I'd configured both my arrays in /etc/mdadm/mdadm.conf, so they ought to have been assembled at that point in the boot process. I did some googling and came across this post which describes my situation almost exactly: I have two RAID1 arrays, md0 and md1, and one of them would assemble normally during boot and the other would not. I verified the UUIDs in mdadm.conf using the following command and rebooted; same thing.
sudo mdadm --detail /dev/md0
What the author found to work was to list the devices by name instead of identifying the array by UUID. Here's the relevant part of my mdadm.conf:

#using UUID should work, but sometimes it won't assemble
#ARRAY /dev/md0 level=raid1 num-devices=2 UUID=f681d44d:b911ec03:365ac6b3:afec0e5e
ARRAY /dev/md0 level=raid1 num-devices=2 devices=/dev/sdb1,/dev/sda1
#same here
#ARRAY /dev/md1 level=raid1 num-devices=2 UUID=15fb5e21:d0a12da4:365ac6b3:afec0e5e
ARRAY /dev/md1 level=raid1 num-devices=2 devices=/dev/sde1,/dev/sdd1
This has been working well for me as well, but there will be issues if device names ever change, which seems possible any time a drive is added or removed from the system, in my experience. I suspect the UUID wouldn't change in that case.

halcyon@hierax:~$ mdadm --version
mdadm - v2.6.7.1 - 15th October 2008

No comments:

Post a Comment