Tuesday 12 June 2012

Increasing the size of an EC2 root EBS volume


AWS EC2 AMI advertises that it comes with a 160G, but the loaded EBS only has 8G available. I only realised this once I started getting storage errors from my apps as the 8G cap was being hit. These are the steps I took to expand the root volume:

In the AWS console:

1. Create snapshot of the root volume (this will take a while)

2. Create a new volume from the snapshot with increased size (I put mine to 150G)

3. Stop the instance (you will get a warning about anything written to the ephemeral file system being lost. I lost my s3fs mount to S3. All my other data stayed)

4. Detach the root volume

5. Attach your new volume to the instance - set the device to /dev/sda1 (default root device)

6. Start up the Instance

7. If you had an elastic IP you will have to reattach that

8. ssh into your instance and, as root, run the following command:

resize2fs /dev/sda1

9. run df -h to see your newly super-sized (actually, the size it *should* have been from the start!) volume. You should see something like this:


Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            148G  7.9G  139G   6% /
tmpfs                 830M     0  830M   0% /dev/shm

No comments:

Post a Comment