Linux fails to reassemble RAID array after disk upgrade
I have an Ubuntu (9.10) machine with 4 SATA disks. Each disk is partitioned identically, with the first few gigabytes set aside for a RAID 1 array (/dev/md0
) for the boot volume, and the remainder set aside for RAID 5 (/dev/md1
).
Recently, I upgraded to larger drives by repeatedly failing and removing a drive, replacing it with the larger one, partitioning it, and rebuilding onto it, per the instructions here. This all completed successfully.
However, the first time I reboot after upgrading, Ubuntu kicks me out to an initfs shell, claiming it can't find the root device. On checking /proc/mdstat
, I discover that it's somehow assembled the entire drives (/dev/sda
, /dev/sdb
etc) into a single RAID 5 volume under /dev/md1
, instead of assembling the partitions into their own arrays. Doing mdadm --stop /dev/md1; mdadm --assemble --scan
fixes it, and both volumes are assembled correctly (and mount without issues).
What's going wrong, and how can I fix it?
Solution 1:
Make sure you have /etc/mdadm.conf
with proper configuration for your array. Even though Linux kernel can detect and assemble mdadm arrays automatically, sometimes it does funny things. Having /etc/mdadm.conf
eliminates the uncertainty. Here is how mine looks like:
DEVICE /dev/sdb /dev/sdc
ARRAY /dev/md0 metadata=0.90 UUID=b8fdfd55:524cecb2:2d164f4f:84bee133
The ARRAY line comes from output of this command:
mdadm --examine --scan
Hope this helps.