How to Resize Attached EBS Volumes of Linux Instance without downtime on AWS

Amazon Elastic Block Store (EBS) is a block storage storage solution designed for the EC2 instance. EBS provides high durability as well as high availability, which is ensured by the replication of data in various Availability Zones (AZs). EBS can be easily backed up using Snapshots, which can later be used to restore data if needed.

EBS Elastic Volumes allows you to increase volume size while the volume is still attached to EC2 instance and in use, making the resizing process a lot easier and faster. Elastic Volumes also provides the option to completely change the volume type and adjust its performance with no downtime. Here, you will learn how to resize attached EBS Volumes of Linux Instance on AWS without downtime.

Resizing EBS Volumes

Let’s suppose a company is running a production environment on an EC2 instance with a small application which doesn’t require many resources. Since this application uses little storage, a small EBS volume storage is sufficient.

resizing ebs volume ec2 aws

As business grows, It is likely to add more AWS resources, making it necessary to grow your EBS volume to support more data. You would prefer to do this with no downtime. In this situation you have to extend the size of the attached EBS volume.

First, go to your volume and choose “Modify Volume” under “Actions.

resizing ebs volume ec2 aws amazon

You will see an option to change both the volume type and disk size . You can also switch to Provisioned IOPS SSD (io1) if required and increase the size & IOPS to desired size. After putting your desired values, click on modify button.

Note : if you are resizing root volume, you won’t be offered the option to change to Throughput Optimized HDD (st1) or Cold HDD (sc1).

resizing ebs volume ec2 aws amazon

Next you will see a confirmation window and choose yes. Then close the dialogue box.

resizing ebs volume ec2 aws amazon

resizing ebs volume ec2 aws amazon

Starting EBS Resizing Process

Here we are extending the volume to 15GB. Volume will now begin the optimization process, which you can see on the console.

resizing ebs volume ec2 aws amazon

resizing ebs volume ec2 aws amazon

This process takes time to optimize the volume depends on the volume size. In this case, the process took 10-15 minutes. After it was over, the volume state color turned green again, showing that the resizing has finished.

resizing ebs volume ec2 aws amazon

After the volume has been resized, the EC2 instance and the system both need to be adjusted to adapt to the new size. You can only do this adjustment either as a root or a user with sudo privileges.

Resizing File System on EC2 Instance

The first step in this process is checking the partition size. To expand the file system, make sure partition has grown to the desired volume size. Use the following growpart command to confirm.

resizing ebs volume ec2 aws amazon

The above screenshot shows that the volume has been extended. however, the primary partition is still at the volume’s previous size. Here you need to resize the file system to get the extended size.

Before you start resizing the file system, make sure you know which file system you are working on. If you don’t know this, you can find out using the following command:

resizing ebs volume ec2 aws amazon

If you were using latest XFS file system, you could extend it using the “xfs_growfs /dev/xvda1” command. This package should already be in the system. If not, then you can install it yourself as part of the “xfsprogs” package.

In our case, since the file system is ext4, we have to rely on the resize2fs utility. Using this, we can proceed to extend the file system to match the volume and the partition size of 15GB. We will target the “/”, since that is where “/dev/xvda1” has been mounted.

resizing ebs volume ec2 aws amazon

The volume is now fully resized and ready to be used. No downtime required for this process.

You can also extend the partition and file system size after you have already grown the volume on the AWS side by simply rebooting your instance. When the operating system comes back up, it will modify everything itself. This will, of course, cause a small amount of downtime.


Finally, you have successfully extended your EBS volume size with no downtime. Stay tuned for more AWS and other cloud tutorials. Thanks!!

Read Also : How to Upload, View, Copy, Move and Delete Objects in Bucket

Share on:

Ravindra Kumar

Hi, This is Ravindra. I am founder of TheCodeCloud. I am AWS Certified Solutions Architect Associate & Certified in Oracle Cloud as well. I am DevOps and Data Science Enthusiast.

Recommended Reading..

2 thoughts on “How to Resize Attached EBS Volumes of Linux Instance without downtime on AWS”

Leave a Comment