LVM snapshot and Automatically Extend LVM Snapshots

Argomenti vari di carattere sistemistico
Post Reply
daniele
Posts: 333
Joined: 04 Mar 2009, 13:59

LVM snapshot and Automatically Extend LVM Snapshots

Post by daniele »

ORIGINAL ARTICLE(S):
1) Chapter 10. Snapshot of logical volumes
2) https://dustymabe.com/2012/03/04/automatically-extend-lvm-snapshots/


Creating LVM snapshots

1) Create a logical volume named origin from the volume group vg001:

Code: Select all

lvcreate -L 1G -n origin vg001
Logical volume "origin" created.
2) Create a snapshot logical volume named snap of /dev/vg001/origin that is 100 MB in size:

Code: Select all

lvcreate --size 100M --name snap --snapshot /dev/vg001/origin
Logical volume "snap" created.
3) Display the origin volume and the current percentage of the snapshot volume being used:

Code: Select all

lvs -a -o +devices
LV      VG    Attr       LSize  Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
 origin vg001  owi-a-s---  1.00g                                                  /dev/sde1(0)
  snap vg001  swi-a-s--- 100.00m     origin 0.00                                 /dev/sde1(256)
4) Optional: Extend the snapshot before its space becomes 100% full and becomes invalid by using any one of the following options:

snapshot_autoextend_threshold
Extends the snapshot after its usage exceeds the value set for this parameter. By default, it is set to 100, which disables automatic extension. The minimum value of this parameter is 50.
snapshot_autoextend_percent
Adds an additional space to the snapshot, which is the percent of its current size. By default, it is set to 20.

In the following example, after setting the following parameters, the created 1G snapshot extends to 1.2G when its usage exceeds 700M:

Example Automatically extend the snapshot

Code: Select all

vi /etc/lvm.conf
snapshot_autoextend_threshold = 70
snapshot_autoextend_percent = 20
Post Reply