Resizing the default EBS volume to desired volume size in Amazon EC2 cloud

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers. We can create virtual machine which are called instances with a easy control panel given by amazon. But it has limitation too, when you create a instance in Amazon with Linux as operating system, / partition will be not more than 15GB. Once the instance is launched, it is quite tricky to increase the size for / partition of  that instance. Here are some steps to increase the size of / partition of running instance.

  • Create a snapshot of the instance which has ebs volume 15GB. I took the snapshot while it was running.
  • From the snapshot,create a volume of our required size. I created a 100GB volume from the snapshot.
  • Shudown the running instance.
  • Detach the 15GB EBS volume from the instance.
  • Attach 100GB EBS volume to the  instance as /dev/sda1.
  • Start the instance with new 100GB volume. This will still show 15GB.
  • Run the command resize2fs  /dev/sda1 . Restart the system, it mounted as 100GB / partition.

Hope this information is useful.

 

 

Leave a Reply