Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I increase the EBS volume size of a running instance? [closed]

I have a server running the recent Ubuntu AMIs from Canonical. The size of the EBS boot volume is 8GB. I know that I can resize EBS volumes by taking a snapshot, creating a new volume and expanding the partition on it. How can I increase the size of the volume while the machine is running? If this is not possible, what is the preferred method for increasing the boot volume size with minimal downtime?

like image 638
j0nes Avatar asked Mar 07 '12 15:03

j0nes


People also ask

Can we increase EBS volume size without downtime?

With Amazon EBS Elastic Volumes, you can increase the volume size, change the volume type, or adjust the performance of your EBS volumes. If your instance supports Elastic Volumes, you can do so without detaching the volume or restarting the instance.

Can we increase EBS volume size in AWS?

With Elastic Volumes, you can dynamically increase the size, increase or decrease the performance, and change the volume type of your Amazon EBS volumes without detaching them.


1 Answers

We can increase the volume size with the new EBS Feature Elastic volumes, post that we need to follow the following steps to use the increase size as shown here

Assume your volume was 16G and you increased it to 32GB.

    $lsblk NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda    202:0    0  32G  0 disk └─xvda1 202:1    0  16G  0 part / 

To extend xvda1 from 16GB t0 32GB, we need growpart. growpart is available as part of cloudutils

sudo apt install cloud-utils 

Post installation of cloud-utils, execute the growpart command

sudo growpart /dev/xvda 1 

Now lsblk, will show

    $ lsblk NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda    202:0    0  32G  0 disk └─xvda1 202:1    0  32G  0 part / 

but df -h will show only 16GB

Final command for extending xvda1 to 32GB is

sudo resize2fs /dev/xvda1 

In case of XFS file system,

sudo xfs_growfs /dev/xvda1 Thanks egg

like image 166
tk120404 Avatar answered Oct 07 '22 01:10

tk120404