Hi All, today we will see in this tutorial how to extend EBS volume for Amazon Ec2 instance.
AWS is one of best cloud service provider currently available. It has increased its services from the past few years considering IaaS.


It is required to extend the EBS volume of an EC2 instance when it is not able to hold the current data. Before extending of EBS Volume was a lengthier process, now AWS has simplified with the new action button.
Before for extending, we have to create a snapshot of the volume, they have to create a volume of new with snapshot data and attach to the existing instance. Now AWS provides an easy way to perform this action.

So, Here are the steps to how to do it.

Step 1: Select the Ec2 instance and select the volume.

Step 2: Once you selected the EBS volume, click on the action button and select Modify EBS option.

Step 3: You will be getting the same as below screenshot. Enter the size need to be extended.

Step 4: Once you extend you can see the state of AWS EBS volume will start from 0%. This process will take some time, depends on the size and data in the Disk. So be patient.

Step 5: Once you state changes to in use, Login to the Linux instance using Putty or command line.

Step 6: Execute the below command, to see a new size is applied or not

lsblk
xvdf 202:80 0 35G 0 disk
└─xvdf1 202:81 0 20G 0 part

Step 7: From the above output you can see that new size is applied to the partition, it still shows 20G. So now we need to extend the partition size to use the full size, ie 35G.

Step 8: Execute the below command to extend the partition size

 

growpart /dev/xvdf 1

Where 1 is the partition number.

 

growpart /dev/xvdf 1
CHANGED: disk=/dev/xvdf partition=1: start=4096 old: size=14773086,end=16777182 new: size=72346190,end=73400286

Step 9: Now you can see them from the below output, partition uses the entire newly allocated Size.

lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
...
xvdf 202:80 0 35G 0 disk
└─xvdf1 202:81 0 35G 0 par

Step 10: Next we need to resize the file system to make the newly allocated size to use. Execute the below command to do this.

 

resize2fs /dev/xvdf1

Now you can see the mount location will be using the newly allocated size.

© 2018, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points
Categories: AWSLinux

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.