Linux software raid 1 – can more than two devices be used

linuxraidsoftware-raid

I have a batch of linux servers using software raid 1 that need to have both disks swapped. While this can be done one disk at a time, I'd like to know if it is possible to do both at once with a process like the following, to reduce the outages needed:

1) connect new drives via USB
2) Add both new drives to the array, rebuilding data to them
3) install grub on new drives
4) shutdown and swap drives

This plan requires the ability to mirror the information in the aray across 4 devices, and a quick test shows that mdadm makes all devices after the first two in a RAID 1 aray spare disks. Is there anyway to override this, or do I need to go with two outages to swap disks over one-by-one?

Best Answer

Yes, you can grow a RAID-1 set to include as many drives as you like. What you need to do is add the new drives as spares, and then run mdadm /dev/mdX --grow -n 4 (or however many devices you want to have in the set). They'll then be synced to, and you can go play swapsies at your leisure once that's done.

Related Topic