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

Unfortunately it is not possible to increase the size of an Amazon EBS root device storage volume while the Amazon EC2 instance is running - Eric Hammond has written a detailed (I'm inclined to say the 'canonical' ;) article about Resizing the Root Disk on a Running EBS Boot EC2 Instance:

As long as you are ok with a little down time on the EC2 instance (few minutes), it is possible to change out the root EBS volume with a larger copy, without needing to start a new instance.

If you properly prepare the steps he describes (I highly recommend to test them with a throw away EC2 instance first to get acquainted with the procedure), you should be able to finish the process with a few minutes downtime only indeed.

Good luck!


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 the size.

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 to 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:

  • In the case of an ext4 file system:

    sudo resize2fs /dev/xvda1
    
  • In the case of an XFS file system:

    apt-get install xfsprogs
    sudo xfs_growfs /dev/xvda1
    

A late answer to this 5-year-old question

AWS has just announced a new EBS feature called Elastic Volumes, which allows you to increase volume size, adjust performance, or change the volume type while the volume is in use.

You can read more about it on AWS Blog here.


You just need to create its snapshot first and from that snapshot need to create another volume and once new volume ready, detach the old volume from the instance and attach the new volume. Make sure to stop the instance before start this process and restart the instance once its done.

Refer http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html