Increasing size of your ebs volume is pretty easy. resize2fs does the trick. Here is the detailed procedure to increase size of your ebs volume.

First detach the volume and take a snapshot of the volume. If you already have a snapshot and haven’t made any changes after that, no need to take a new snapshot.


No create a new volume from this snapshot. Let’s say your original volume was 10G and you wanted to increase its size to 20G.

ec2-create-volume -z us-east-1a --size 20 --snapshot snap-xxxxxxxx

The command will output id of the new volume. Use that id in the following command to attach the volume to any instance you have up.

ec2-attach-volume vol-yyyyyyyy --instance i-xxxxxxxx --device /dev/sdh

Make sure that ec2-describe-volumes show the state of the instance as attached. Once the volume is attached, mount it at a path say /mnt/data. I am assuming here that your volume had ext3 filesystem.

mkdir /mnt/data
echo '/dev/sdh /mnt/data ext3 defaults,noatime 0 0' >> /etc/fstab
mount /mnt/data

Mounting the volume is necessary as otherwise you wont’ be able to execute the following (resize2fs) command.
Now execute the following command to resize the volume

resize2fs /dev/sdh

You should see the following output (sizes you see might be different):

Filesystem at /dev/sdh is mounted on /mnt/data; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/sdh to 5505024 (4k) blocks.
The filesystem on /dev/sdh is now 5505024 blocks long.

The command should execute in a minute or two for 20G size. That’s it, you can verify your new size by executing:

df -h

This should show you that the volume’s new size. That’s it!

Share and Enjoy:
  • Sphinn
  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Facebook
  • LinkedIn
  • StumbleUpon