How to Extend AWS EBS Volume Size without Unmounting

This post will help you with how to extend AWS EBS Volume Size that is already mounted on AWS EC2 Instances.

How to Extend AWS EBS Volume Size without Unmounting


We may get some situations to resize our mounted AWS EBS Volume to increase or extend the volume size without unmounting.  End of the post, you would be able to understand,

1. How to identify the AWS EBS Volume ID?

2. How to modify AWS EBS Volume?

3. How to resize the AWS EBS Volume?

4. How to resize and modify the partition tables on OS Kernel?


Also You can watch this tutorial demo video on our YouTube Channel.

"How to Extend AWS EBS Volume Size without Unmounting"

How to Extend AWS EBS Volume Size without Unmounting


To show you this demo, I have running AWS EC2 instance called "demo1" with Amazon Linux OS and its Instance ID is i-0cee0da5dc18a112e.

extend aws ebs volume

It is already having a AWS EBS volume of 2Gb is mounted on /mnt.

how to extend aws ebs volumes online

So we are going to increase this 2gb volume and it is having dummy data.


Step 1: Select correct AWS EC2 Instance & Find out AWS EBS Volume ID

Make sure to select the correct AWS EC2 instance and go to Storage tab to find all the volumes mounted on AWS EC2 instance.

resize aws ebs volume

Identify the volume ID. (As per our example, size of the volume should be 2Gb.)

aws ebs volume online resizing

Click on the Volume ID to which you are going to increase it.

Step 2: Modify AWS EBS Volume Size

Make sure the volume is selected. Go to Actions, click on Modify Volume.

increase aws ebs volume without unmounting

Enter the volume size you preferred to extend. (Eg.: As per my example, i am extending to 4gb from 2gb) and click on "Modify".

aws ebs volume expansion

Click on "yes" to confirm that we want to extend the volume anyway.

extend aws ebs volume size on os file system

Once clicked on "Yes". Refresh the AWS EBS Volume to confirm the size increased at AWS Management Console end.

aws ebs volume online resize

So volume is extended from 2gb to 4gb successfully on AWS Console.

Step 3: Increase / Extend volume size on Disk Partition Tables

Make sure the volume size is showing correctly at OS kernel level using lsblk command.

df command output not showing correct volume size

lsblk command shows the exact size we have extended. But df -h command still shows old size, Disk Partion table wont use the newly allocated space until we resize the disk partition table at OS kernel level.

So Lets resize it. We must use correct resize command based on the filesystem it has. If it is ext3, ext4 filesystem, resize2fs can be used. If it is xfs filesystem, xfs_growfs should be used.

To get the filesystem type, use mount command.

sudo mount

sudo mount command shows linux filesystem

Above command shows that filesystem of our volume is xfs, hence we have to use xfs_growfs command.

sudo xfs_growfs /dev/xvdf

xfs_growfs linux command resize aws ebs volume

Once it is resized, use df -h command to verify the size extended or not at the partition table.

resize2fs linux command resize aws ebs volume

Thats it, we have successfully extended the AWS EBS volume without unmounting the filesystem from 2gb to 4gb.

Hope you have got an idea How to Extend AWS EBS Volume Size without Unmounting.

Keep practicing and have fun. Leave your comments if any.

Also Request you to go through the below recommended tutorial, if you are interested in learning.

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

Post a Comment

0 Comments