Skip to content

Resizing AWS EC2 instances volumes

Recently, I hit the maximum volume size in my server and needed to expand more. It was fairly easy to expand with AWS console, you will just go to your instance and look for instance ID, then go to Volumes:

From there you can resize your EBS volumes. But the moment I have successfully resize it, when I went to SSH on my server and check for my parition size using command “df -h”,

the new size didn’t show up. And is still at 8GB. I resize it to 20GB. So what happen was, the root device (EBS volume) had already increased to 20GB but the partition is still using only 8GB. Amazon was not clear on this so I have to do more work. In seems that we need to run 2 more commands to get things to reflect to our partition:

first we run: sudo growpart /dev/xvda 1

Then second we run: sudo resize2fs /dev/xvda1

With this commands in sequence, there is no need for you to restart your instance hence there is no downtime. The commands above is telling our partition to use the whole root available volume which is now 20GB.

So if we check again by running df -h

we should see the changes reflected to our partition

Published inservers

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *