====== LVM - Logical volume manager ======
* https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/index
* https://wiki.archlinux.org/index.php/LVM
* https://wiki.gentoo.org/wiki/LVM
* List Physical Volumes: ''pvs''
* List Volume Groups: ''vgs''
* List Volumes: ''lvs''
pvcreate /dev/sdX
vgcreate vg0 /dev/sdX
===== 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:burp|script for BURP backup program]]
* http://ed.zehome.com/2018/sauvegarde-lvm-simple-partie-2/ backup block device limiting impact on CPU and disk I/O