How to increase the disk space of an AWS EC2 Ubuntu instance

Sometimes there could be a need to increase the disk space of your servers. It is always recommended to take a snapshot of the volume before you extend it or increase the disk size. Also, it is not advisable to decrease the disk size. Increasing the size of a volume does not increase the size of the partition, its file system must be extended. One needs to use a file system-specific command to resize the file system of the volume. 

In this article, we will increase the disk space of the boot volume (root partition) with the filesystem of type ext4 of Ubuntu 20.04 Server.


  1. AWS Account(Create if you don’t have one).
  2. An EC2 Ubuntu 20.04 server Instance(Click here to learn to create an EC2 Instance)

What will we do?

  1. Check current disk space.
  2. Modify the disk size of the root Volume.
  3. Extend the Filesystem.

Check current disk space

Let's first check the current disk space, information about available block devices using lsblk and blkid command.

df -h



Current disk space

In the above screenshot, you can see that the current disk size of / (root) is 7.7 GBs(approx 8 GBs). We will try to increase the size of this disk.

Modify the disk size of the Volume

Go to the EC2 instance -- > Volume attached to the instance.

Check EC2 instance

Here you see the volume, click on "Actions" --> "Modify Volumes".

Modify EBS Volume

On the pop-up screen, specify the desired size. I have specified 30 GBs, earlier it was 8 GBs. Click on the "Modify" button, this will change the disk size to 30GBs.

Specify the required disk space

Confirm the modification by clicking on the "Yes" option.

Confirm modification

You will see that the disk has been modified.

Till this point we have just changed the disk size, it is not yet available for use. Now we need to extend the volume's file system to make use of the new storage capacity.

Successful EBS modification

Extend the Filesystem.

At this point, if you check the disk space you will see that the / volume still has 7.7 GBs.

df -h

To extend the volume size, get information about the block devices attached to your instance using the lsblk command


Check the file system type, use the following command.


In our case, the file system is of type ext4 of the volume

Use the following command to extend the volume of the ext4 type.

sudo resize2fs /dev/xvda1

If you check the disk size this time, you will see that the disk has been extended and now we have 28 GBs(Approx 30 GBs) for / partition.

df -h

Increase the disk space of EC2 Ubuntu instance

If you see some other file system than ext4, visit the official documentation of AWS here.


In this article, we saw the steps to increase the disk size of the boot volume and extend the file system of type ext4. It is always advisable to take a snapshot of the disk before increasing its size, and it is also advisable that one should avoid decreasing the disk size.

Share this page:

3 Comment(s)

Add comment

Please register in our forum first to comment.


By: Aleix

This made my day. Great content that fully solve my problem.

Just one observation, in the steps being listed extending the file system, there is a step missing: sudo growpart /dev/xvda 1

This step is present in the screenshot provided by not listed in the explanation.

By: Kevin Waterson

No longer valid. Modify Volume in Actions no longer exists.

By: Terry

Nice explantion.  Just what I needed.  Thanks!