Linux – Enlarged partition, filesystem still reports old size


I resized the root partition with GParted, from 20 GB to 40 GB, but the filesystem still reports a size of 20 GB.

How can I use all 40 GB?


The resized partition was an LVM Physical Volume (/dev/sda2), and the boot partition is ext4 (/dev/sda1).

Best Answer

Assuming the common case of an ext2/3/4 filesystem, the answer would be resize2fs, part of the e2fsprogs package. It can even run on mounted partitions.


resize2fs /dev/sda3

where /dev/sda3 is the partition you want to resize. This automatically expands the filesystem to occupy the whole partition.


In your case, with LVM, there are additional steps necessary:

  1. Resize the Physical Volume with pvresize /dev/sda2
  2. Look at either mount, /etc/fstab or vgdisplay or lvdisplay to get your root filesystems volume name. It should be something like /dev/MyVolumeGroup/MyRootVolume.
  3. Add the free space to your volume with the following command: lvextend -l +100%FREE /dev/MyVolumeGroup/MyRootVolume.
  4. Then, resize the filesystem: resize2fs /dev/MyVolumeGroup/MyRootVolume

After this procedure, you should be able to utilize the newly added space.

Related Question