BY ON Nov 22, 2017

Resize Amazon EC2 Root Partition

We faced recently this issue and this is how we solved it. Any better ideas?

Yesterday, a client’s website started showing some errors. The reason: root partition was full. All their infrastructure is based in Amazon EC2, using CentOS 6.3.

Amazon’s documentation shows us how to resize a root partition with little downtime, but sadly it took me more than what I thought.

Everything was ok until I had to use the resize command:

sudo resize2fs /dev/xvde1

Everytime I tried, it showed:

The filesystem is already — blocks long. Nothing to do!

Searching the web, I yielded that no necessary extra steps had to be done, but many had the same problem. I reached to this question in Stackoverflow that saved my life:

What happened was I needed to delete all partitions including swap in order to create a new partition that will get to use all the space in the new volume. I feared of the data, but had the previously created snapshot. When finished going through the steps I had the data and the space I couldn’t get after creating the bigger volume.