One of the most important decisions when building a server is to decide on the allocations of disk space to volumes, partitions and filesystems. Get that wrong can run out of space very quickly.
With LVM the whole disk will be allocated as a single volume group (VG) and logival volumes (LV) created to hold tje /usr/ root / and /home file systems, so in the case of running out of space on the /home file system and still have plenty in /usr, then it would be easy to shrink the /usr and extend the /home logical volume.
Logical Volume Management (LVM) is the default installation method for all Linux distros and has significant advantages over traditional partition management without much hassle compared to the traditional way.
The structure of the LVM consists of:
One or more entire hard disks or partitions are configured as Physical Volumes (PV's)
A volume group (VG) is created using one or more PV's. You can think of a volume group as a SINGLE STORAGE unit
Multiple Logical Volumes (LV's) can be created in a VG. Each LV is somewhat the same as a traditional partition (with the advantage that it can be resized up or down)
Creating Physical Volumes, Volume Groups and Logical Volumes.
In this article we will use 3 disks of 8GB each (/dev/sdb, /etc/sdc, /etc/sdd) to create 3 PV
# We need to resize the logical volume to use all the existing and free space of
the volume group
$ lvm
lvm> lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
lvm> exit
# And then, we need to resize the file system to use the new available space in
the logical volume
$ resize2fs /dev/ubuntu-vg/ubuntu-lv
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 58
The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 120784896 (4k) blocks long.
# Finally, you can check that you now have available space:
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 786M 1.2M 785M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 454G 3.8G 432G 1% /