Expand a Linux MD RAID 10 array to use larger disks
Complete the following steps for each disk; replace /dev/sda1
with other disks as necessary. You must complete all of these steps for one disk before you can proceed to the next disk.
- Mark the disk as failed so that MD stops using it:
mdadm --manage /dev/md127 --fail /dev/sda1
- Remove the disk from the array:
mdadm --manage /dev/md127 --remove /dev/sda1
- Physically replace the disk.
- Partition the new disk using type
0xDA
with one partition spanning the entire disk. - Add the new disk to the array:
mdadm --manage /dev/md127 --add /dev/sda1
MD will rebuild the array once you add the replacement disk. Make sure the rebuild is complete before you proceed to the next disk. You can check the status of the array by running cat /proc/mdstat
.
Once all of the disks have been replaced and the array rebuilt, expand the array to fill the maximum capacity of all of the disks with mdadm --grow /dev/md127 --size=max
. You can resize the filesystem from there to fill the expanded RAID; in your case, use the xfs_growfs
command.
More information on how to grow an MD array is available on the Linux RAID wiki.
As with any other disk manipulation task, you should take a backup before you begin.
You'd want to swap out each disk one by one firstly.
To do this you'd 'fail' each disk, and replace it with it's new 8Tb replacement, infact if you have the spare ports, you can add the extra disks, then have mdadm 'replace' in place instead of removing a disk from the raid and having a higher risk of failure.
This question details the best way I can find of doing it 'safely'
Once you've done this, you'll want to simply expand the existing FS into the newly created space. It appears the command for this is 'xfs_growfs' however I haven't got experience with xfs to explain how exactly you'd do this.
As always, have backups ready (and raid isn't a backup!).