A logical volume, also called a linear volume, is just one type of volume we can create; LVM also lets us create snapshot volumes. A snapshot volume is associated with a logical volume and keeps track of changes made to the logical volume's data. We can then merge the snapshot back into the logical volume to roll back the data. This recipe will show you how to do just that.
This recipe requires a CentOS system with administrative privileges provided by logging in with the root
account or using sudo
. It assumes that a logical volume has been configured and sufficient storage exists in its volume group for the snapshot.
The following commands show you how to work with LVM snapshots. Before you begin, you should verify that there is sufficient storage available in the volume group to support the snapshot using vgs
.
Use
lvcreate -s
to create a snapshot volume:lvcreate -s -L 100M -n myvolsnap vg0/myvol
A snapshot volume may be deleted using...