Resizing EBS Root Device on Amazon AWS EC2 Instance

Tue, Jan 15, 2013


aws[1]This is just a quick one as I’m working hard on a big migration at the moment, but I’m sure it will come in handy in the future and with others. So we were having problems with the EBS disk being full, so I decided to up the disk space. The process is really quite simple.

  1. Login to AWS -> EC2
  2. Shut down your EC2 instance
  3. Click Snapshots on the left hand side and create a snapshot of your main root ebs volume
  4. Once completed, click volumes on the left and create a new volume (with the new disk size and the snapshot you just created)
  5. On the volumes page, make a note of the disk location (probably /dev/sda1)
  6. Detach the smaller volume
  7. Attach the larger volume (using the the ref noted above (probably /dev/sda1))
  8. Boot the EC2 instance
  9. Now login to the EC2 instance. If you run df -h, you will see the disk still thinks it is the same size as before. Make a note of the Filesystem (probably /dev/xvda1)
  10. Run resize2fs -p /dev/xvda1 where /dev/xvda1 is the Filesystem noted above
  11. runĀ df -h. You should now see that the main partition is the size of the new volume you created.

As always, I accept no responsibility for damage caused, loss of data, loss of anything. You use these instructions at your own risk.

Leave a Reply