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 http://aws.amazon.com/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)
[[email protected]]# 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.
- 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
[[email protected]]# resize2fs /dev/sdc
On some servers you need to execute “e2fsck” before “resize2fs”
Done !!! Please check and make sure the newly created volume size is available on your server.