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,
To show you this demo, I have running AWS EC2 instance called "demo1" with Amazon Linux OS and its Instance ID is i-0cee0da5dc18a112e.
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.
It is already having a AWS EBS volume of 2Gb is mounted on /mnt.
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.
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.
Enter the volume size you preferred to extend. (Eg.: As per my example, i am extending to 4gb from 2gb) and click on "Modify".
Once clicked on "Yes". Refresh the AWS EBS Volume to confirm the size increased at AWS Management Console end.
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.
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
Above command shows that filesystem of our volume is xfs, hence we have to use xfs_growfs command.
sudo xfs_growfs /dev/xvdf
Once it is resized, use df -h command to verify the size extended or not at the partition table.
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.
DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online
Keep practicing and have fun. Leave your comments if any.
Stay connected with us on social networking sites, Thank you.
0 Comments