“Practice does not make perfect. Only perfect practice makes perfect.” - Vince Lombardi

How to resize an AWS EBS volume

I have been using Amazon’s cloud services for a large project I am working on, and I have to say…it is pretty sweet! Here is a little gotcha, however, that might help someone down the road.

The issue I had was that the default instance I was using had only 15Gb of EBS storage and, since I was storing a lot of videos, that ended up being chewed up pretty quickly. The process to grow and EBS volume is not exactly written out in the FAQs I saw (even thought that seems a pretty obvious newbie kind of thing to want to do). I figure out that you can create a new volume, and attach it to an instance. Furthermore, I found that you can take a snapshot of an existing volume and use it as the basis for the new volume. In the EC2 control panel, the steps are:

  1. Stop (not Terminate) your running instance.
  2. Create a snapshot of the volume used by your instance.
  3. Create a new volume from the snapshot, increasing the size to whatever you want.
  4. Detach the existing volume from your instance.
  5. Attach the new volume to your instance, to the same mount point.
  6. Restart your instance, and reattach your elastic IP (odd that it does not keep it attached).

At this point, you have your new volume running, but here is the trick. Since you used a smaller snapshot to clone your new volume, the file system still thinks the size is the smaller volume size. To prove, and fix, this, use ssh to get into your instance, then do the following:

  • #df -h (to see the current volume size)
  • #sudo resize2fs /dev/sda1 (or whatever your mount point is, to resize the file system)
  • #df -h (to see the new volume size)

I hope this helps someone, as it helped me when I read it on the Alestic web site.

Tags: , Categories: Cloud
Trackback URL for this post: https://tomotvos.ca/cloud/how-to-resize-an-aws-volume/trackback/

Comments are closed on this post.

Copyright © 2010-2015 Tom Otvos. All rights reserved.