Last Updated: February 25, 2016
· dnegstad

Resize your attached EBS storage when restoring from a smaller snapshot

The one's more of a DevOps tip, but if you're a smaller team, that's probably one of your coders anyway. When restoring from an EBS snapshot on a linux based AWS instance, if you restore to a larger drive than the original image was taken on, you're not going to have access to all that new space right away.

Once you've attached your new EBS drive to a machine, SSH in and run the following command:

sudo resize2fs [device]

Where [device] is whatever you mounted the new drive as (something along the lines of /dev/sdf or /dev/sdh)

Depending on the size difference between the original image and the new drive, the process can take a little while, so it can be a good idea to run this command in a screen instance so it won't get interrupted if you disconnect or timeout from your SSH session. Once the command has finished running, simply run df and verify that your available storage matches up with what you'd expect from your new drive.