I created an Amazon EC2 instance using an AWS Community RightImage CentOS 7 (x64) image. The default image occupies 7GB space. I'm eligible for AWS free-tier and I've created a base disk accordingly of 30GB. I want the filesystem to expand and occupy this entire volume. I'm following this guide: enter link description here from Amazon.

When I execute file to get the filesystem, here's what I get: [root@ip-xxx ~]# file -s /dev/xvd*

/dev/xvda:  x86 boot sector; partition 1: ID=0x83, active, starthead 31, startsector 2000, 20969520 sectors, code offset 0x63
/dev/xvda1: Linux rev 1.0 ext3 filesystem data, UUID=7f80f47c-521a-4280-99dc-d00273f53fe6, volume name "ROOT" (needs journal recovery) (large files)

lsblk clearly shows that there's remaining space on the disk...

[root@ip-xxx ~]# lsblk
xvda    202:0    0  30G  0 disk 
`-xvda1 202:1    0  10G  0 part /

But when I run resize2fs, it says nothing to do...

[root@ip-xxx ~]# resize2fs -p /dev/xvda1
resize2fs 1.42.9 (28-Dec-2013)
The filesystem is already 2621190 blocks long.  Nothing to do!

What am I missing here? How do I extend the filesystem to the full size of the disk?

Thank you,

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


You need to extend your partition first. "resize2fs" is a filesytem tool, not a partitioning tool. Use a tool like fdisk or parted on your base disk (xvda) to first extend your partition to the end of the disk.

To do this using parted: https://www.gnu.org/software/parted/manual/html_node/parted_31.html

To do this using fdisk: https://access.redhat.com/articles/1190213

After doing this, you may then resize your filesystem.

While it is technically possible to do this to an online root partition, I would not recommend it. This is best done while the native system is offline (using a live system to operate on it instead).

Always back up your data before doing anything like this.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.