Skip to main content

Posts

Showing posts from April, 2017

How to SHRINK an Amazon AWS EBS volume safely with no data loss

Note: This guide assumes your volume is based on a Linux file system such as ext4. If you're using a different file system, you may still be able to shrink the volume but your mileage may vary.

To get to the guide, scroll down and skip the prologue.
Prologue Once my 1 year free trial with Amazaon AWS was over, I found that I'm paying for 30 GB of storage space while I'm actually using only about 5 GB. Hence I decided to shrink it down to about 7 GB or so. My plan is to just monitor the usage and see if I can reduce the usage or expand the volume later as needed.

Searching for guides on Google, the top hit was this blog post. But I found that the instructions are actually terrible. Here are the problems with it:

The guide tells you to FORMAT the volume with your existing data. YES! That's ridiculous, but it's true. It's this command: sudo mkfs -t ext4 /dev/xvdf. I did it and destroyed my data, but lucky for me, I had made a snapshot. No problem, just restore the s…