User Tools

Site Tools


soft:lvm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
soft:lvm [2019/07/14 14:04]
phil created
soft:lvm [2019/10/11 10:16]
phil
Line 1: Line 1:
 ====== LVM - Logical volume manager ====== ====== 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''
 +
 +
 +
 +<code>
 +pvcreate /dev/sdX
 +vgcreate vg0 /dev/sdX
 +</code>
 +
 +===== 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".
 +
 +<code>
 +lvcreate -L 100G --thin vg/thin
 +</code>
 +
 +Then create volume within the pool:
 +
 +<code>
 +lvcreate -n myvol -T vg/thin -V 10G
 +</code>
 +
 +
 +Then to take a snapshot:
 +
 +<code>
 +lvcreate -kn -n myvol_snap -s vg/myvol
 +</code>
 +
 +To restore the snapshot
 +
 +<code>
 +lvremove vg/myvol
 +lvrename vg/myvol_snap vg/myvol
 +</code>
 +
 +
 +==== Non-Thin volumes ====
 +
 +Create a volume:
 +
 +<code>
 +lvcreate -L10G -n myvol vg
 +</code>
 +
 +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 :/
 +
 +<code>
 +lvcreate -L2G -s -n myvol_snap vg/myvol
 +</code>
 +
 +
 +To restore the snapshot
 +
 +<code>
 +lvconvert --merge vg/myvol_snap
 +</code>
 +
 +
 +=== 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
  
soft/lvm.txt ยท Last modified: 2019/10/11 10:16 by phil