Friday, February 8, 2013

Adding storage to root volume of Ubuntu Amazon EBS Instance

Recently I had to increase the size of root volume of my EBS based Amazon instance. After performing search on Google I got the reply from a Amazon executive.

You can expand the existing root EBS volume for an EBS-backed Ubuntu instance.
Here are the following steps you need to perform.

  • Stop the instance.
  • Create a snapshot of the root EBS volume.
  • Create an EBS volume from that snapshot with the new desired size. (Please ensure it is in the same Availability Zone as the instance)
  • Detach the root EBS volume of the instance.
  • Now attach the newly created EBS volume to /dev/sda1 on the instance.
  • Now start the instance and then login again.
  • Enter 'df -h' to see the current size of the root volume. You should see the new size coming into picture for the /dev/sda1 or /dev/xdva1. If you are still not getting the new size then execute the following command. 
  • Enter 'sudo resize2fs /dev/sda1' or 'sudo resize2fs /dev/xvda1' to get the rest of the expanded disk depending on your instance.
  • Enter 'df -h' again to see the new size of the root volume. Now you should see the new size coming into picture for the /dev/sda1 or /dev/xdva1 as per your instance configuration.
Please note that some of the recent ubuntu instances don't need to execute the resize2fs command. 

Sphere: Related Content