Resizing the EBS Volume in AWS

Hansi Welivita
2 min readMar 11, 2021

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.

Image Courtesy — https://www.daniloaz.com/en/partitioning-and-resizing-the-ebs-root-volume-of-an-aws-ec2-instance/

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,

Selecting the storage tab

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.

--

--

Hansi Welivita

Im a DevOps Engineer who is trying to enhance my knowledge as well as help my fellow DevOps acquaintances with knowledge on job related tasks!