LVM stands for Logical Volume Management. It is a system of managing logical volumes, or filesystems, that is much more advanced and flexible than the traditional method of partitioning a disk into one or more segments and formatting that partition with a filesystem.

There are 3 concepts that LVM manages:

  • Volume Groups
  • Physical Volumes
  • Logical Volumes

First, prepare the hdd or ssd or nvme with fdisk

How to

fdisk /dev/sdc

Create a Volume Group

vgcreate vgname /dev/sdcX

Create a Physical Volume

pvcreate /dev/sdc1

Create a Logical Volume and specify size (-L)

lvcreate -n lvname -L 1500G vgname

OR Create a Logical Volume and specify %

lvcreate -n lvname -L 10%VG vgname

Format the partition

mkfs.ext4 /dev/vgname/lvname

Extend metadata

lvextend --poolmetadatasize +1G vgname/lvname

extend lvm partition

lvextend --resizefs --size +30GB /dev/vg0/backups

(optional, not compatible with proxmox) Add it to fstab for auto mount

mkdir /mnt/mountname
echo '/dev/vgname/lvname /mnt/mountname ext4 defaults 0 2' >> /etc/fstab
mount -a