LVM allow create snapshots of our system of an easy and fast way. A snapshot consist in a copy of the state at a particular point in time.
When we create a snapshot, initially only contains a hard links of our current data. Every time that a file or directory are modified that are linked by the snapshot, LVM automatically will clone the data to the snapshot. This policy also can known as copy on write (COW), with this way we can make a snapshot of 2 GB of a volume with 30 GB of size, while the changes are less than 2 GB.

 


I’ve one volume group of 80 GB named open2storage:

# vgdisplay


And one volume of 30 GB:

# lvdisplay

Now I’ll create the snapshot of the volume lv30 with 2 GB of size:

# lvcreate -L 2G -s -n lv30.snap /dev/open2storage/lv30

After create the snapshot and making changes on the original volume, we can see the status of the snapshot and the percentage of use:

# lvdisplay


We can mount the snapshot volume and backup the data with (tar, dd, cpio…):

# mount /dev/open2storage/lv30.snap /mnt/www-backup/

 

Manage LVM snapshots
Tagged on:     

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow

Get every new post delivered to your Inbox

Join other followers: