We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Extend EBS boot disk on AWS without an instance reboot

Learn how to – Extend EBS boot disk on AWS without an instance reboot.

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

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

Confirm that you want to grow disk.

A successful message should look like below

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.

Recommended Video courses to Learn AWS Cloud

Other disk management articles available are:

Other AWS articles available in our blog are:


Your Cart is Empty

Back To Shop