Increase the size of EBS volume (Root Volume )in your EC2 instance

Vineet Kumar
3 min readOct 27, 2021

If you are familiar with Amazon EC2 and EBS volume, you might have experiences modifying the size of EBS volume. AWS provide an easy way to increase the size of your EBS volume. In fact, we could increase it without detaching the volume or restarting the instance. That’s quite a nice work done there because we would not need to have a downtime for our instance.

Let’s exercise. Assume we have volume name test.

Create snapshot

It is best practice to create a snapshot of your volume in case something bad happens.

  1. Go to your Create Snapshot in Elastic Block Storage from your EC2 Dashboard Left side menus.
  2. Click Create Snapshot link.
  3. Select Resource Type Volume
  4. In Volume section choose volume which you want to take snapshot
  5. Click button Create Snapshot.
  6. Go grab some snack while it is in progress.
Create Snapshot

Increase the volume

This is how we will increase the volume size. Make sure your snapshot is finished.

Let’s assume that previous volume size is 8GB and we want increase it to 10GB.

  1. Go to your Volume in Elastic Block Storage section from your EC2 Dashboard Left side menus.
  2. Select volume which you want to increase the size (In our case volume name is test so select test volume) and got to Action Drop down and choose Modify instance as shown in below image
Select Volume which you want to increase

Now fill up the storage which you want to increase as shown in following image

Extend Volume

Extending OS file system

After you finish modifying volume, you need to extend OS file system in order to see your increased volume size. The example below is the command I used for Ubuntu OS.

  1. SSH into you instance.
  2. Type df -h to check volume size; You will still have 8GB of volume size.
  3. Type lsblk ; Your increased volume will be shown just above your current volume, e.g. xvda1 is your current volume with 8GB size and xvda with 10GB size. (NOTE:
  4. Extend the partition by typing sudo growpart /dev/xvda 1 ; Note that dev/xvda is the partition name and 1 is the partition number.
  5. Run The following command to check root filesystem:
    [ec2-user ~]$
    sudo file -s /dev/xvda1
    if filesystem is belong to ext4 then
    Extend the volume by typing
    sudo resize2fs /dev/xvda1 .
    and if filesystem belongs to xfs then run following command
    Extend the volume by typing
    [ec2-user ~]$ sudo xfs_growfs -d /
  6. Type df -h to check volume size; It will show 10GB of volume size.
  7. Enjoy