Skip to content

When an md Device Goes Missing

For any number of bugs/reasons, udev might miss one of your md devices, even if you have arrays specified in /etc/mdadm.conf. More on fixing this in the future. In the meantime, you can create the md device by hand, but what’s easier is to let mdadm do it for you. First a simple example – you have a /dev/md3 defined in /etc/mdadm.conf but it didn’t get detected on startup. Try this:

 mdadm --assemble --auto=md /dev/md3

Now, let’s create a complex example: one of the RAID members of a pair has died, the md device didn’t get created, you have no mdadm.conf, and you need to get the array online. If /dev/sdc1 is the remaining good member, and /dev/md4 is where it’s supposed to be, you can re-create the array like this:

mdadm --create --auto=md /dev/md4 --level=1 --raid-devices=2 /dev/sdc1 missing

So, how about getting this to work at boot time? OK, add something like this to your /etc/rc.d/rc.local file:

# try looking for raid set again
/sbin/mdadm --assemble --scan --auto
if [ -b /dev/md3 ]; then
    mount /dev/md3 /mnt/backup -o data=journal,noatime

Yeah, it defeats some of the benefits of the /etc/fstab file, but it at least lets you get your arrays online at boot time. When udev gets fixed this should be unnecessary.