19.3.4 Creating Logical Volume Snapshots

You can also use lvcreate with the --snapshot option to create a snapshot of an existing logical volume such as mylv in the volume group myvg, for example:

# lvcreate --size 500m --snapshot --name mylv-snapshot myvg/mylv
  Logical volume “mylv-snapshot” created

You can mount and modify the contents of the snapshot independently of the original volume or preserve it as a record of the state of the original volume at the time that you took the snapshot. The snapshot usually takes up less space than the original volume, depending on how much the contents of the volumes diverge over time. In the example, we assume that the snapshot only requires one quarter of the space of the original volume. You can use the value shown by the Snap% column in the output from the lvs command to see how much data is allocated to the snapshot. If the value of Snap% approaches 100%, indicating that a snapshot is running out of storage, use lvresize to grow it. Alternatively, you can reduce a snapshot's size to save storage space. To merge a snapshot with its original volume, use the lvconvert command, specifying the --merge option.

To remove a logical volume snapshot from a volume group, use the lvremove command as you would for a logical volume:

# lvremove volume_group/logical_volume_snapshot

For more information, see the lvcreate(8) and lvremove (8) manual pages.