In this article we are going to cover AWS Increase EBS Volume Size Without Downtime/without rebooting the EC2 Instance/resize the EBS volume size without rebooting the EC2 Instance.
Table of Contents
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
Verify the Volume ID which you want to modify size.
Step #2: AWS Increase EBS Volume Size
Go to your volume and choose “Modify Volume” under “Actions.”
Modify Volume page will appear, give the Size
Verify the size once.
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
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
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*
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
Run below below command if partition is expanded
lsblk
To extent the file system, use the resize2fs command as shown below
sudo resize2fs /dev/xvda1
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.
Related Articles:
Reference: