Search code examples
linuxamazon-web-servicesubuntuamazon-ec2amazon-ebs

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


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.

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 20G 0 disk └─xvda1 202:1 0 8G 0 part /

But updated size not reflecting in the df -h command, even after i explicitly resize the device using the sudo resize2fs /dev/xvda1 command as my file system type is ext4 which i checked using sudo file -s /dev/xvd* command. sudo resize2fs /dev/xvda1 command giving below output :-

sudo resize2fs /dev/xvda1 resize2fs 1.42.12 (29-Aug-2014) The filesystem is already 2096635 (4k) blocks long. Nothing to do!

Let me know, what i need to do for OS to pickup the size in my volume.

Thanks


Solution

  • /dev/xvda1 is an 8 GiB partition on a 20 GiB device and there are no other partitions on the volume. In this case, the partition must be resized in order to use the remaining space on the volume.

    After you resize the partition, you can extend the file system (via sudo resize2fs /dev/xvda1) to occupy all of the space on the partition.