This shows you the differences between two versions of the page.
Last revision Both sides next revision | |||
soft:lvm [2019/07/14 14:04] phil created |
soft:lvm [2019/07/14 21:40] phil |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== LVM - Logical volume manager ====== | ====== LVM - Logical volume manager ====== | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | |||
+ | * List Physical Volumes: '' | ||
+ | * List Volume Groups: '' | ||
+ | * List Volumes: '' | ||
+ | |||
+ | |||
+ | |||
+ | < | ||
+ | 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 " | ||
+ | |||
+ | < | ||
+ | lvcreate -s 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/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== 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/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | === Backup using lvm snapshots === | ||
+ | |||
+ | * [[soft: | ||
+ | * http:// | ||