Language:

Search

AWS Increase EBS Volume Size Without Downtime [2 Steps]

  • Share this:

What is EBS Volume in AWS EC2 ?

Amazon EC2 EBS volume is a durable, block-level storage device that you can attach to a single EC2 instance.It is a block storage system which is used to store persistent data.

Amazon EBS – Volume Types

  • General Purpose SSD
  • Provisioned IOPS SSD
  • Throughput Optimized HDD
  • Magnetic

Step #1: Login to AWS Management Console

First login to AWS Management console, then go to EC2 Console, click on storage of EC2 instance, click on disk for which you want to modify EBS volume size

AWS Increase EBS Volume Size Without Downtime [2 Steps] 1

Verify the Volume ID which you want to modify size.

AWS Increase EBS Volume Size Without Downtime [2 Steps] 2

Step #2: AWS Increase EBS Volume Size

Go to your volume and choose “Modify Volume” under “Actions.”

AWS Increase EBS Volume Size Without Downtime [2 Steps] 3

Modify Volume page will appear, give the Size

AWS Increase EBS Volume Size Without Downtime [2 Steps] 4

Verify the size once.

AWS Increase EBS Volume Size Without Downtime [2 Steps] 5

Note: EBS Volume once increased, It cannot be reduced.

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

The first step in this process is checking the partition size using below command

lsblk

AWS Increase EBS Volume Size Without Downtime [2 Steps] 6

Note that there is a space between “/dev/xvda” and “1.” “1” refers to the partition number.

Next, the file system size needs to be checked. In the screenshot below, you will notice that it is still only registering 30GB, even though both the volume and partition have been resized.

df -h

AWS Increase EBS Volume Size Without Downtime [2 Steps] 7

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

sudo file -s /dev/xvd*

AWS Increase EBS Volume Size Without Downtime [2 Steps] 8

If you were using an ext4 (or even older ext2 or ext3) file system, you could extend it using the “resize2fs /dev/xvda1” command.

In our case, since the file system is XFS, we have to rely on the “xfs_growfs” tool, which should already be in the system. If not, you can install it yourself as part of the “xfsprogs” package.

Using this, we can proceed to extend the file system to match the volume and the partition size of 30GB. We will target the “/”, since that is where “/dev/xvda1” has been mounted.

To expand the partition, use the command shown in the screenshot below. After you do so, you will see that the partition has grown to match the volume size.

sudo growpart /dev/xvda 1

AWS Increase EBS Volume Size Without Downtime [2 Steps] 9

Run below below command if partition is expanded

lsblk

AWS Increase EBS Volume Size Without Downtime [2 Steps] 10

To extent the file system, use the resize2fs command as shown below

sudo resize2fs /dev/xvda1

AWS Increase EBS Volume Size Without Downtime [2 Steps] 11

Conclusion:

In this article we have covered AWS Increase EBS Volume Size Without Downtime/without rebooting the EC2 Instance/resize the EBS volume size without rebooting the EC2 Instance.

Sushan Shrestha

Sushan Shrestha

Join me on a captivating journey as I unravel the complexities of maintaining digital infrastructures, troubleshooting labyrinthine networks, and safeguarding the virtual realms from the shadows. Together, we'll explore the challenges and where every click and command shapes the digital destiny.