Adding drives to a RAID 10 Array

How would I grow a RAID10 array using mdadm?

Obviously I would need to add 2 drives at a time, or would it have to be 4 drives?

I have a feeling its just a bad idea.

Or would be just wiser to just opt for RAID5?


Solution 1:

Last time I checked, mdadm won't let you --grow raid10. I glanced over mdadm's manpage now and it still says: Currently supported growth options including changing the active size of component devices and changing the number of active devices in RAID levels 1/4/5/6, changing the RAID level between 1, 5, and 6, changing the chunk size and layout for RAID5 and RAID5, as well as adding or removing a write-intent bitmap.

Solution 2:

To grow RAID 10 you need mdadm in version min. 3.3 and kernel version min 3.5. You need also an even number of disks - unpaired ones can only work as a spare or, eventually, to grow into degradated mode (not tested).

Here goes the example of growing RAID 10 from 4 drives to 6 using mdadm 3.3-2ubuntu2 @ Linux 4.2.0-10-generic. Tested with ext4 data on it, filesystem was unmounted, ext4 was extended after the RAID grow without any issue.

~$ cat /proc/mdstat
md126 : active raid10 sdd1[1] sdc1[0] sdf1[3] sde1[2]
976428032 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]
bitmap: 0/8 pages [0KB], 65536KB chunk

~$ sudo mdadm /dev/md126 --add /dev/sdi1 /dev/sdj1
mdadm: added /dev/sdi1
mdadm: added /dev/sdj1
~$ sudo mdadm --grow /dev/md126 --raid-devices=6

~$ cat /proc/mdstat
md126 : active raid10 sdj1[5] sdi1[4] sdd1[1] sdc1[0] sdf1[3] sde1[2]
1464642048 blocks super 1.2 512K chunks 2 near-copies [6/6] [UUUUUU]
bitmap: 0/6 pages [0KB], 131072KB chunk