resize RAID partitions
Ensure that the RAID array is consistent and synchronized by entering
cat /proc/mdstat
If your RAID array is still synchronizing according to the output of this command, you must wait until synchronization is complete before continuing.
sudo mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sda1
To succeed, both the fail and remove actions must be specified.
Increase the size of the partition, using a disk partitioner
Re-add the partition to the RAID array. For example, to add /dev/sda1
….
sudo mdadm -a /dev/md0 /dev/sda1
Wait until the RAID is synchronized and consistent before continuing with the next partition.
Repeat these steps for each of the remaining component devices in the array. Ensure that you modify the commands for the correct component partition.
If you get a message that tells you that the kernel could not re-read the partition table for the RAID, you must reboot the computer after all partitions have been resized to force an update of the partition table.
Remove second disk’s paritions from the RAID array:
sudo mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sdb1
sudo mdadm /dev/md1 --fail /dev/sda5 --remove /dev/sdb5
sudo mdadm /dev/md2 --fail /dev/sda6 --remove /dev/sdb6
sudo mdadm /dev/md3 --fail /dev/sda7 --remove /dev/sdb7
Check the size of the array and the device size known to the array by entering
sudo mdadm -D /dev/md0 | grep -e "Array Size" -e "Dev Size"
Increase the size of the array to the maximum available size by entering
sudo mdadm --grow /dev/md0 -z max --assume-clean
The array uses any space that has been added to the devices, but this space will not be synchronized. This is recommended for RAID 1 because the synchronization is not needed. It can be useful for other RAID levels if the space that was added to the member devices was pre-zeroed.
Recheck the size of your array and the device size known to the array by entering
sudo mdadm -D /dev/md0 | grep -e "Array Size" -e "Dev Size"
If your array was not resized as you expected, you must reboot, then try this procedure again.
You can increase the size of the file system to the maximum space available or specify an exact size. When specifying an exact size for the file system, ensure that the new size satisfies the following conditions:
- The new size must be greater than the size of the existing data; otherwise, data loss occurs.
- The new size must be equal to or less than the current RAID size because the file system size cannot extend beyond the space available.
Increase the size of the partition on second disk, using a disk partitioner
Re-add the partition to the RAID array. For example, to add /dev/sdb1..x enter:
sudo mdadm -a /dev/md0 /dev/sdb1
sudo mdadm -a /dev/md1 /dev/sdb5
sudo mdadm -a /dev/md2 /dev/sdb6
sudo mdadm -a /dev/md3 /dev/sdb7
Resize RAID partition to max size
sudo resize2fs -p /dev/md0
sudo resize2fs -p /dev/md1
sudo resize2fs -p /dev/md2
sudo resize2fs -p /dev/md3
WHEN ALL PARTITIONS ARE REBUILDED run:
mdadm --detail --scan >> /etc/mdadm.conf