LVM

Register a physical device

pvcreate <dev>

Create a volumne group

vgcreate <vgname> <dev>

Add a new device to a volumne group

vgextend <vgname> <dev>

Display all volumne groups

vgdisplay

Which device is in which volumne group

pvs

Just show free space of volumne groups

vgs

Create a logical device

lvcreate -L 10G -n <name> <vgname>

Resize a logical device

lvresize -L +/-1G /dev/vgname/lvname
  • Dont forget to do a resize of the filesystem
  • Shrinking usually requires umounting

Create a snapshot from lvname

lvcreate -L 1G -n snap --snapshot /dev/vgname/lvname

Troubleshooting

  • Rescan
pvscan
lvscan
  • Check that volumes / volume groups are active (Attr a)
lvs / pvs
  • Reactivate all
vgchange -ay