Resizing the EBS Volume in AWS
Hi Guys after along time with a busy schedule I planned to write this which is very useful for most of the DevOps engineers as well as others who are accessing the AWS console. This can be identified from your monitoring facilities.
First of all when you identify that your instance is running out of disk space, all you have to do is to go to the EC2 instances page,
Select the desired instance → click on the storage tab → Click on the Volume id
Now once you enter the Volume page, select Actions → Modify Volume
You can edit the volume and expand but shrinking isn't permitted. After this you need to open up a terminal and log into to the server using ssh.
The become the sudo user by sudo su
Then enter df -hT to verify the file system for each volume and use lsblk to identify the partitions that should be expanded.
Now use the growpart command to extend the partition for example use sudo growpart /dev/xvda 1 this can be either /dev/nvme0n1p1.
To extend the file system for each volume use sudo resize2fs /dev/xvda1.
The to check if it has successfully extended use df -hT again.