As per subject.
When converting from RAID-1 to RAID-5 using mdadm, why must a RAID 1 array contain 2 devices and not more than 2 devices? I don't understand RAID strong enough to pinpoint a reason.
Background: My three RAID-1 arrays contain 3 devices each, my goal is to remove one device from two of the arrays, and attach the spare devices to the remaining RAID-1 array. That will leave two RAID-1 arrays with 2 devices each, and the remaining RAID array with 4 devices. The goal is take the 4 device RAID-1 array and convert that to RAID-5. This is not a discussion about which RAID architectures are better or worse, just the process to change a RAID-1 array to a RAID-5 array.
Best Answer
There is no migration path from RAID-1 to RAID-5, except for the special case with two disks, where RAID-1 conveniently is the same as RAID-4 and RAID-5 (because the parity of a single bit is the bit itself), so the migration code just changes the RAID level without touching the data.
After converting to RAID-5, you can add more disks to the array — this migration path exists.
So your migration plan would be:
/usr/share/mdadm/checkarray …
)--grow … -l5
)--grow … --add …
)--grow … -n4
).¹ That is tricky, because there is no good way to reduce the number of disks. You can, from a rescue system, overwrite the RAID superblock and use the
--assume-clean
option to avoid a rebuild, but you need to use the same superblock version as before (usemdadm --examine …
on one of the component devices to find out).