AWS ec2 root volume increase: Expanding elastic root volume on aws ubuntu instance not working

前端 未结 3 879
暗喜
暗喜 2021-02-15 23:58

I\'ve followed aws doc for expanding elastic root volume and got my root volume size increased from 8 GB to 20 GB, which i confirmed using lsblk.

NAM

3条回答
  •  广开言路
    2021-02-16 01:02

    The reason for your output is because you are missing a step.

    The resize2fs program does not manipulate the size of partitions. If you wish to enlarge a filesystem, you must make sure you can expand the size of the underlying partition first... https://linux.die.net/man/8/resize2fs

    Once you've increased the size of your volume either from using the AWS Console ( UI ) or using the command line aws ec2 modify-volume --volume-id ID_OF_DEVICE --size NEW_SIZE (modify volume command line documentation)

    You still need to tell the operating system that you want to allocate more space to the partition ( in this case the root partition /) So the correct sequence to get it work is as shown:

    Extend the partition in a partition table to fill available space

    (1) sudo growpart /dev/xvda 1 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/expand-linux-partition.html

    Expand an ext2, ext3, ext4 file system

    (2)sudo resize2fs /dev/xvda1

    More on AWS recognizing expanded volume

提交回复
热议问题