Extending a Linux File System after resizing the volume

Ping Cheng
1 min readJan 21, 2021

This is a log to keep a note to help myself on resizing the linux file system in the future. This usually is a step need to do after you upsized your EBS volume attached to your EC2 instance.

Firstly, adjust the volume size on the AWS, and wait for the complete of volume resizing progress. Usually your service on the affected EC2 would stop serving as the hard drive would disconnect for a moment.

After the resizing is complete, you can use this command to check if the disk is resized

lsblk

It will display the new size if the resizing was done correctly. Then, use this command to extend the disk.

sudo growpart /dev/xvdf 1

After that, resize the volume to the new capacity, I am using the xfs file system, other file systems may use a different command.

sudo xfs_growfs -d /mnt

And then, the disk should be correctly expanded and ready to use. You can use this command to check the new volume size.

df -h

--

--

Ping Cheng

A passionate developer, a boy’s father, live in Mel