How do I extend an EBS volume with RAID partitions?

3 minute read
0

I want to extend an Amazon Elastic Block Store (Amazon EBS) volume with RAID partitions.

Resolution

Note: It's not a best practice to use RAID 1, RAID 5, and RAID 6 for Amazon EBS. For more information, see RAID configuration on Linux and RAID configuration options.

Prerequisites:

1.    Run the following command to view current RAID-level information. In the following example command, replace /dev/RAID-DEVICE with the mapping for your RAID configuration.

$ sudo mdadm --detail /dev/RAID-DEVICE

2.    Increase the size of EBS volumes that are part of the RAID configuration. For example, if you have two 10 GiB EBS volumes in the RAID 0 partition, then modify the volumes to the desired volume extension size. To add 40 GiB, increase the size by 20 GiB on each volume.

3.    Run the following command to unmount the file system. In the following example command, replace MOUNT-PATH with the correct path for your use case.

$ sudo umount /MOUNT-PATH

4.    Run the following command to stop the RAID device. You must stop the RAID device before you reassemble the RAID volumes. In the following example command, replace RAID-DEVICE with the mapping of your RAID configuration.

$ sudo mdadm --stop /dev/RAID-DEVICE

5.    Run the following command to integrate and reassemble the volumes with the updated sizes. In the following example command, replace RAID-DEVICE with the mapping of your RAID configuration. Replace LIST-OF-DEVICES with the EBS volumes' device names, such as /dev/sdb or /dev/sdc.

$ sudo mdadm --assemble --update=devicesize /dev/RAID-DEVICE LIST-OF-DEVICES

6.    Run the following command to verify that the RAID configuration has the new size:

$ sudo mdadm --detail /dev/RAID-DEVICE

The preceding command's output displays the combined increased size under Array Size.

7.    Run the following command to mount the file system. In the following example command, replace TYPE with the file system, such as ext3, ext4, or xfs. Replace RAID-DEVICE with the mapping of your RAID configuration and MOUNT-PATH with the correct mount path.

$ sudo mount -t TYPE /dev/RAID-DEVICE /MOUNT-PATH

8.    Run the following command to increase the file system size. Replace all example values with your values.

For xfs file systems

$ sudo xfs_growfs /MOUNT-PATH

For other file systems, including ext3 and ext4

$ sudo resize2fs /MOUNT-PATH

9.    Run the following command to confirm the extended EBS volumes with RAID partitions:

$ df -h
AWS OFFICIAL
AWS OFFICIALUpdated 10 months ago