15

I've got Ubuntu 18.04 Server in Virtual Box, and once I've ran out of 10 GB of allocated space on virtual disk, I've increased the size of the virtual disk to 17 GB and resized the root partition with parted's resizepart command (and done so while partition is in use, and yes I know it's bad practice, but it's a virtual machine for development, all code committed to github and I've a clone of the machine just in case).

Everything seems to have worked: lsblk and udisksctl properly report the new size, but df is still stuck at reporting the old 10 GB and 100% usage (even after reboot). Why is it so and what can I do about this odd df's behavior ?

1 Answers1

37

There’s probably a more specific duplicate somewhere, but I can’t find it.

The reason df isn’t showing any extra space is that it measures the free space inside the file system; it doesn’t care about partitions, logical volumes etc. So far, you’ve resized the disk and the partition; you also need to resize the file system:

sudo resize2fs /dev/sda1
Stephen Kitt
  • 434,908
  • 1
    Bingo! Do note that resize2fs is for ext2|3|4 filesystems. For XFS for example, you must use the xfs__growfs command: sudo xfs_growfs / would grow the root mount point to use all new available space. – pmdci Jul 24 '21 at 17:44
  • I needed to force resize2fs for it to work: resize2fs -f /dev/sda1 – Jacob Bruinsma Dec 09 '21 at 21:35