For this example, suppose that you have resized the boot volume of an instance, such as a T2 micro instance, from 10 GB to 20 GB. Step1- Login to aws console and go to EC2 services.
Step 2- In the EC2 console select volumes.
Step 3- Then select the volume you want to resize and click on action > Modify Volume.
Step 4- Then in Modify volume tab change size from 10 G to 20 G (as per your requirement).
Step 5 – Click on modify.
Step
6- Click on yes for confirmation.
Step 7- To extend the file system of EBS volume on Linux. Connect to the instance.
Step 8 - To verify the file system in use for each volume, use the df -hT command. In the output, you can see the root volume of the instance is 10 G.
Step 9 -To check whether the volume has a partition that must be extended, use the lsblk command to display information about the block devices attached to your instance.
Step 10 - Output shows, the root volume, /dev/xvda, has a partition, /dev/xvda1. While the size of the volume is 20 GB, the size of the partition is still 10 GB and must be extended.
Step 11- Use the growpart command to extend the partition. Notice that there is a space between the device name and the partition number.
sudo growpart /dev/xvda 1
Step 12- To verify that the partitions reflect the increased volume size, use the lsblk command again.
Step 13- To verify the size of the file system for each volume, use the df -h command. In this example output, file systems reflect the original volume size, 10 GB.
Step 14- To extend the file system on volume, use the xfs_growfs command. Here / is the volume mount points shown in the output for df -h.
sudo xfs_growfs -d /
Step 15- In case instead of xfs we are using ext4 volumes we can use resize2fs command.
sudo resize2fs /dev/xvda1
Step16- To verify that file system reflects the increased volume size, use the df -h command again.
0 on: "Resize boot volume of a Linux EC2 instance."