Ubuntu, by default, may leave a significant portion of disk space unused during installation. This guide will walk you through the process of extending your default Logical Volume Management (LVM) space to make better use of available resources. This is particularly useful when you're running out of space on your root filesystem.
-
Open a terminal and use the command
df -h
to check the free space on your root filesystem. Identify the available space and assess whether you need to extend your storage.df -h
-
To determine the free space in your Volume Group (VG), use the command
vgdisplay
. Look for the "Free" field, which indicates the amount of space available for extension.vgdisplay
If no free space is available, proceed to the next section.
-
Run
lvdisplay
to check the current size of the Logical Volume (LV).lvdisplay
-
Extend the LV to the maximum available space using the
lvextend
command.lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
-
Confirm the changes by running
lvdisplay
again.lvdisplay
-
Verify the almost full root filesystem using
df -h
.df -h
-
Extend the filesystem to cover the increased LV size using
resize2fs
.resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
-
Confirm the successful extension by running
df -h
once more.df -h
For a more detailed study or guide, visit Ubuntu: Extend your default LVM space.
Note: Be cautious and ensure you have backups before making significant changes to your system's storage configuration.