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 multiple volumes attached or the above command fails, you will need to find the drive name by using either df or lsblk

ec2-user@ec2:~/.ssh$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 992M 0 992M 0% /dev
tmpfs 200M 21M 180M 11% /run
/dev/xvda1 20G 20G 41M 100% /
ec2-user@ec2:~/.ssh$ lsblk
xvda 202:0 0 40G 0 disk
└─xvda1 202:1 0 20G 0 part /

I'm a 29 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.

This site uses Akismet to reduce spam. Learn how your comment data is processed.