CentOS7 的 EC2 根卷扩展

EC2 root volume expansion for CentOS7

我的 EC2 是 运行 CentOS 7 HVM 社区镜像,默认为 xfs 文件系统,我有一个 10GB 的根卷,在分离 > 创建快照 > 重新附加到 /dev/sda1 但我注意到我不必 运行 任何类型的调整大小命令,就像我们必须 运行 resize2fs 和分区现在显示 15GB 一样,我们必须 运行 resize2fs 而无需执行任何操作。虽然有一个命令 xfs_growfs 但即便如此我也没有 运行.

那么,这是 xfs 在 EC2 世界(和其他世界)中扩展的正常行为,还是其他?

此致, 法米

这是 Amazon Linux AMI 上的正常行为。

来自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.

我注意到 CentOS 7 (x86_64) with Updates HVM 说:

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

因此,您的磁盘映像可能正在使用此版本的 cloud-init,它可以自动调整大小。

请注意,Amazon Linux AMI 基于 CentOS,因此您可能希望使用它们而不是 CentOS AMI,因为它们由 AWS 直接更新。