On AWS, you can increase EBS volume size, adjust performance, or change the volume type while the volume is in use. The change should guarantee zero downtime, and without any effect on the application operations.

In this example, I’ll extend the boot disk of a CentOS 7 server from 8 GB to 20 GB

Step 1: Resize boot Volume on EBS

Login to AWS console and navigate to:

EBS > Volumes > Right Click on volume name > Modify Volume

extend ebs volume min

Change the size from 8 to 20 or whichever value you want to grow to, then click “Modify

extend ebs volume 02 min

Confirm that you want to grow disk.

extend ebs modify volume 01 min

A successful message should look like below

extend ebs modify volume 02 min

Step 2: Login to the server via ssh and extend / partition

SSH into your EC2 instance and check block device current size.

# lsblk 
xvda          202:0    0    20G  0 disk 
└─xvda1       202:1    0    8G   0 part /

You can see /dev/xvda1 is still 8 GB in size. We need to resize it to 20 GB using the growpartcommand.

Install cloud utils

On Ubuntu / Debian system, run

sudo apt install -y cloud-guest-utils

For CentOS server, run

sudo yum -y install cloud-utils-growpart

For those new to growpart, it is Linux command line tool used to extend a partition in a partition table to fill available space.

Help page can be viewed by passing -h argument.

# growpart -h
growpart disk partition
   rewrite partition table so that partition takes up all the space it can
    -h | --help       print Usage and exit
         --fudge F    if part could be resized, but change would be
                      less than 'F' bytes, do not resize (default: 1048576)
    -N | --dry-run    only report what would be done, show new 'sfdisk -d'
    -v | --verbose    increase verbosity / debug
    -u | --update  R  update the the kernel partition table info after growing
                      this requires kernel support and 'partx --update'
                      R is one of:
                       - 'auto'  : [default] update partition if possible
                       - 'force' : try despite sanity checks (fail on failure)
                       - 'off'   : do not attempt
                       - 'on'    : fail if sanity checks indicate no support

    - growpart /dev/sda 1
      Resize partition 1 on /dev/sda

In our case, we will run

sudo growpart /dev/xvda 1

New disk size should be 20 GB

# lsblk
xvda          202:0    0    20G  0 disk
└─xvda1       202:1    0    20G  0 part /

Step 3: Resize `/` partition to fill all space

The last step is to resize the file system to grow all the way to fill added space

For ext4 file system, use resize2fs

sudo resize2fs /dev/xvda1

If your filesystem is xfs, an XFS file system may be grown while mounted using the xfs_growfscommand:

sudo xfs_growfs /

Both of these commands will grow the file system to the maximum size supported by the device.

Confirm new size using df -h

# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/xvda1              20G  8.2G   12G  41% /

Congratulations!, you managed to extend a mounted / partition without any downtime.

AWS Recommended courses:

Other disk management articles available are:

How to resize an ext2/3/4 and XFS root partition without LVM

How to extend root filesystem using LVM on Linux.

How to extend/increase KVM Virtual Machine (VM) disk size

Other AWS articles available in our blog are:

Create AWS S3 Upload and List Objects Policy without Delete Action

How to Configure Cpanel Backups to S3 Object Store

How to Install and Use AWS CLI on Linux – Ubuntu / Debian / CentOS

How to Reset RDS Master User Password on AWS

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here