User Tools

Site Tools


soft:lvm

LVM - Logical volume manager

Thin volumes

It's better to use thin provisioned volumes to have snapshots comes for free (copy on write) and are better for SSDs

Thin provisioned volumes are created from a “pool”.

lvcreate -L 100G --thin vg/thin

Then create volume within the pool:

lvcreate -n myvol -T vg/thin -V 10G

Then to take a snapshot:

lvcreate -kn -n myvol_snap -s vg/myvol

To restore the snapshot

lvremove vg/myvol
lvrename vg/myvol_snap vg/myvol

Non-Thin volumes

Create a volume:

lvcreate -L10G -n myvol vg

Take a snapshot, you MUST give a size here, the diff between snapshot and original volume will be stored here. In case of this space being consumed, the snapshot is corrupted :/

lvcreate -L2G -s -n myvol_snap vg/myvol

To restore the snapshot

lvconvert --merge vg/myvol_snap

Backup using lvm snapshots

soft/lvm.txt · Last modified: 2019/10/11 10:16 by phil