Start by checking your root filesystem free space with
df -h
As you can see I am only using 14% of my ~49GB volume, but we’ll pretend I’m close to 100% and need to make that 49GB volume larger.
To check for existing free space on your Volume Group (where it is left by the installer default settings), run the command
vgdisplay
and check for free space. Here you can see I have 49.25GB of free space ready to be used. If you don’t have any free space, move on to the next section to use some free space from an extended physical (or virtual) disk.
To use up that free space on your Volume Group (VG) for your root Logical Volume (LV), first run the
lvdisplay
command and check the Logical Volume size, then run
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
to extend the LV to the maximum size usable, then run
lvdisplay
one more time to make sure it changed.
At this point you have increased the size of the block volume where your root filesystem resides, but you still need to extend the filesystem on top of it. First, run
df -h
to verify your (almost full) root file system, then run
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
to extend your filesystem, and run
df -h
one more time to make sure you’re successful.
And that’s it. You just allocated the free space left behind by the Ubuntu installer to your root filesystem. If this is still not enough space, continue on to the next section to allocate more space by extending an underlying disk.