vgs - Display information about volume groups (free space etc.)
lvs - Display information about logical volumes
lvdisplay - display attributes of a logical volume
lvremove - remove a logical volume


apt-get intall -y lvm2

create volume group

pvcreate /dev/md1
vgcreate vg2 /dev/md1

create lvm volume

lvcreate --name VOLUME_NAME --size 4G vg2
# lvcreate -n NAME -l 100%FREE vg0
mkfs.ext3 /dev/vg2/VOLUME_NAME

renamee lvm

lvrename /dev/vg01/mx-swap /dev/vg01/


# delete all VG
vgs --noheadings -o vg_name | xargs -L1 vgremove -y
# delete all PV
pvs --noheadings -o pv_name | xargs -L1 pvremove /dev/nvme0n1 --force --force -y

Activatie volume group

vgchange -ay <VG_NAME>

Disable all LVMs

vgchange -an

Restore LVM

pvcreate --uuid "5a3727b0-8d1c-4f41-b0fe-eea17baac244" --restorefile /etc/lvm/archive/ /dev/sda1
vgcfgrestore vg1

Clear VG

lvchange -an LV_NAME
vgchange -an VG_NAME

Thin pool

lvcreate -L 250G --thinpool kvm system

Resize LV and filesystem

lvresize -r -L 120G /dev/mapper/containers_kvm--stage

Restart LVM

systemctl stop lvm2-lvmetad
rm /run/lvm/*
rm /etc/lvm/{archive,backup}/*
systemctl start lvm2-lvmetad

Remove PV

vgremove /dev/mapper/data
pvremove /dev/sdb

Resize swap

swapoff -a
lvresize /dev/system/swap -L 64G
mkswap /dev/system/swap 
swapon -a