I am having trouble assembling a small RAID5 due to a recurring reordering of /dev/sd[a-f] on boot (Debian7).
md0 was initially using sd[abc]1, it contains a LUKS device, which in turn contains a ext4 filesystem. Both the ext4 filesystem (verified with fsck) as well as all disks sd[abc] (verified with smartctl) are functional.
Currently, the RAID devices are not sd[abc]1 but sd[abd]1. mdadm --examine recognises all of them properly (same UUID, same event count), but shows sdc1 as being part of the array, even when examining /dev/sdd1.
I assume that if a reboot gives me the original order, everything will work again.
Now I see two solutions, both of which I cannot find how to implement:
- stop Debian from reordering
- make sure mdadm does not rely on an exact match of /dev/sd[a-f]1 for the devices
How can I achieve one of those two, or what else could I do to get mdadm running?
DEVICE /dev/sd[abcef]1 CREATE owner=root group=disk mode=0660 auto=yes HOMEHOST <system> MAILADDR root ARRAY /dev/md0 UUID=b00e130c:359e5dfc:461cb5c0:61dedce4
I just found out something rather trivial, that I don't remember reading anywhere explicitly and did not know before: Passing the matching RAID devices in the correct order (which may differ from the previous one) helps when assembling .. at least manually. In my case (another reboot gave me sd[bcd]1 for the devices, in that order):
# mdadm --assemble -v /dev/md0 /dev/sd[bcd]1 mdadm: looking for devices for /dev/md0 mdadm: /dev/sdb1 is identified as a member of /dev/md0, slot 0. mdadm: /dev/sdc1 is identified as a member of /dev/md0, slot 1. mdadm: /dev/sdd1 is identified as a member of /dev/md0, slot 2. mdadm: added /dev/sdc1 to /dev/md0 as 1 mdadm: added /dev/sdd1 to /dev/md0 as 2 mdadm: added /dev/sdb1 to /dev/md0 as 0 mdadm: /dev/md0 has been started with 3 drives.
mdadm --detail and mdadm --examine now also show the proper device names in their listings, e.g. it now also correctly reports sdd1 being part of the array when examining sdd1.
I just noticed I was actually missing sdd1 in mdadm.conf. While that is definitely not right, I also tried explicitly listing all devices in the call to madam as well as scanning, i.e.
mdadm --assemble /dev/md0 /dev/sd[abcd]1 and
mdadm --assemble --scan. Both didn't assemble.