I want to extend an Amazon Elastic Block Store (Amazon EBS) volume with RAID 0 partitions.
Short description
Important: If you don't require RAID 0 partitions, then you can use General Purpose SSD (gp3) volumes for higher volume-level quotas and improved performance. For more information, see Amazon EBS increases the maximum size and provisioned performance of General Purpose (gp3) volumes.
Resolution
Note: It isn't a best practice to use RAID 1, RAID 5, and RAID 6 for Amazon EBS. For more information, see Amazon EBS and RAID configuration.
Prerequisites:
Extend the EBS volume
- To view current RAID-level information, run the following command:
sudo mdadm --detail /dev/RAID_DEVICE
Note: Replace /dev/RAID_DEVICE with the mapping for your RAID configuration.
- Increase the size of EBS volumes that are part of the RAID configuration.
Note: For example, if you have two 10 GiB EBS volumes in the RAID 0 partition, then modify the volumes to the volume extension size that you want. To add 40 GiB, increase the size by 20 GiB on each volume.
- To unmount the file system, run the following command:
sudo umount /MOUNT_PATH
Note: Replace MOUNT_PATH with your mount path.
- To stop the RAID device, run the following command:
sudo mdadm --stop /dev/RAID_DEVICE
Note: Replace RAID_DEVICE with the mapping of your RAID configuration. You must stop the RAID device before you reassemble the RAID volumes.
- To integrate and reassemble the volumes with the updated sizes, run the following command:
sudo mdadm --assemble --update=devicesize /dev/RAID_DEVICE LIST_OF_DEVICES
Note: Replace RAID_DEVICE with the mapping of your RAID configuration. Replace LIST_OF_DEVICES with the device names of your EBS volumes, such as /dev/sdb or /dev/sdc.
- To verify that the RAID configuration has the new size, run the following command:
sudo mdadm --detail /dev/RAID_DEVICE
Note: Replace RAID_DEVICE with the mapping of your RAID configuration. The preceding command's output displays the combined increased size under Array Size.
- To mount the file system, run the following command:
sudo mount -t TYPE /dev/RAID_DEVICE /MOUNT_PATH
Note: 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 your mount path.
- To extend the file system size, run one of the following commands.
For xfs file systems:
sudo xfs_growfs /MOUNT_PATH
Note: Replace MOUNT_PATH with your mount path.
For other file systems, including ext3 and ext4:
sudo resize2fs /MOUNT_PATH
Note: Replace MOUNT_PATH with your mount path.
- To verify that you have successfully extended the file system size, run the following command:
df -h