Resize EBS volume attached to Amazon Web Services EC2 instance

Resizing EBS volume

Unfortunately, you can not currently resize an EBS volume on the fly. However, you can pretty easily resize with a quick reboot. The process is as follows:

  1. Create a snapshot of your current volume
  2. Create a new volume from that snapshot (bigger of course)
  3. Restart your instance using the new volume
  4. Resize the “partition” on that volume

The first three items can be done in the AWS interface. Number four is done in the command line with root access.

Once everything is up and running again df seems to say that you don’t have any more space. But of course since the volume came from a snapshot of a smaller “partition” it was not too shocking to see…

1
2
3
4
 df -h
Filesystem Size Used Avail Use% Mounted on
[...]
/dev/xvdf 8.0G 3.5G 4.5G 44% /some/mount/point

The command line tool you want is resize2fs

1
sudo resize2fs /dev/xvdf

And now everything should be happy…

1
2
3
4
 df -h
Filesystem Size Used Avail Use% Mounted on
[...]
/dev/xvdf 45G 3.5G 41G 8% /some/mount/point
Category(s): Amazon Web Services, EBS, EC2
Tags: , , , , ,

One Response to Resize EBS volume attached to Amazon Web Services EC2 instance

  1. Thank you so much!! Finally managed to get these partitions going.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

 

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free