Re-sizing EBS volume

By | May 29, 2013

In this blog am explaining how to re-size the EBS volume (not root volume) attached to an EC2 instance.

  • Log-in to the AWS management console
  • Select the region where the EBS volume already created.
  • Go to the volumes section, click on the exact volume which you need to re-size and create a snapshot from that volume.
  • After creating the snapshot, go to the snapshot section and create new volume with new size. After sometimes you can see new volume is available on the selected region.
  • Then login to the server and unmount the volume. (say the volume attached is /dev/sdc)

[root@server]# umount /dev/sdc

Then go the volumes section on aws management console and detach the existing volume from your server, then attach the newly created volume. Please note that while attaching the volume put the device name as before the old volume used. (That means if old volume is attached to the server as /dev/sdc, then the new volume should be attached as /dev/sdc). You can see this on /etc/fstab or the command “df -h” will show you the device name.

  • After attaching the new volume from management console, login to the server and execute “mount -a” (should have /etc/fstab entry there) or manually mount the volume using “mount” command.

[root@server]# mount -a
[root@server]# mount /dev/sdc /test

  • Execute “df -h” and you can see volume is attached , but the size of volume is still old. So now we need to re-size the file system.

To re-size the file sytem do the following things

[root@server]# resize2fs /dev/sdc

On some servers you need to execute  “e2fsck”  before “resize2fs”

[root@server]#  e2fsck -f /dev/sdc
[root@server]#  resize2fs /dev/sdc

Done !!!   Please check and make sure the newly created volume size is available on your server.

Leave a Reply

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