Amazon AWS

Increasing EBS disk space to a running EC2 instance

One of the best parts of running a cloud solution is the ability to make some “hardware” level changes without even a reboot.

First, in the AWS Console, go to the EBS Volume Screen and hopefully you have labelled your EBS volumes with human readable labels (or you will have to click on each volume and see what instance it is attached to)

Right click and select Modify Volume and change its Size

Modify EBS Volume Size

Then SSH into the instance and if it is the only volume attached, you should be able to run the two command below:

sudo growpart /dev/xvda 1
sudo resize2fs /dev/xvda1

If you have a newer EC2 instance with NVM storage, it will look more like this:

> sudo growpart /dev/nvme1n1 1
CHANGED: partition=1 start=2048 old: size=16775135 end=16777183 new: size=25163743,end=25165791
> sudo resize2fs /dev/nvme1n1p1
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/nvme1n1p1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/nvme1n1p1 is now 3145467 (4k) blocks long.

If you have multiple volumes attached or the above command fails, you will need to find the drive name by using lsblk

ec2-user@ec2:~/.ssh$ lsblk
xvda 202:0 0 40G 0 disk
└─xvda1 202:1 0 20G 0 part /

I'm a 31 year old UIUC Computer Engineer building mobile apps, websites and hardware integrations with an interest in 3D printing, biotechnology and Arduinos.

View Comments
There are currently no comments.