Farmi
Farmi

Reputation: 153

EC2 root volume expansion for CentOS7

My EC2 is running with CentOS 7 HVM community image which comes default as xfs file system, and I had a root volume with 10GB which I extended to 15GB after detaching > creating snap > reattaching to /dev/sda1 but I noticed that I did not had to run any kind of resize command just like with ext file system we have to run resize2fs and partition now shows 15GB without doing anything. While there is a command xfs_growfs but even that I did not run.

So, is this normal behavior of how xfs is expanded in EC2 world(and others), or something else?

Regards, Farmi

Upvotes: 0

Views: 958

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269091

This is normal behaviour on the Amazon Linux AMI.

From Amazon Linux AMI 2014.03 Release Notes:

Cloud-Init 0.7.2

Cloud-Init has been updated to the 0.7 series, adding a number of useful features. One example is dracut-modules-growroot, which automatically resizes your root filesystem on boot.

I note that CentOS 7 (x86_64) with Updates HVM says:

Starting with CentOS-7 we now include cloud-init support in all CentOS AMI's

So, it is likely that your disk image is using this version of cloud-init that does the automatic resize.

Please note that Amazon Linux AMIs are based on CentOS, so you may want to use them instead of the CentOS AMI, since they are directly updated by AWS.

Upvotes: 1

Related Questions