lvm.7 (2010 10)

l
lvm(7) lvm(7)
The logical volume and all of its snapshots together form a snapshot tree. The logical volume of which
the snapshots were taken is referred to as the "original" logical volume. Only a single snapshot can be
created at a time, which means that one cannot create point-in-time copies of more than one logical
volume at a time.
Also, snapshots can only be created off normal logical volumes, and not off snapshot logical volumes.
On the snapshot tree, the original logical volume and its snapshot logical volumes maintain a successor-
predecessor relationship with each other. When a snapshot is created off a logical volume, on the
snapshot tree, the original logical volume is the successor of the snapshot logical volume and the snapshot
is the predecessor of the original volume.
Consider a logical volume lv1 with a snapshot s1. When the next snapshot s2 is created, s2 would be the
new successor for the s1 snapshot, and it would be the new predecessor for the original logical volume lv1.
When one more snapshot s3 is created, the snapshot tree will be represented as follows, with the arrow
pointing to the successor:
lv1 <- s3 <- s2 <- s1
When created, a snapshot shares all its data with that of the original logical volume. The snapshot gets a
copy of its own data only when a write (copy before write) occurs onto itself or its successor. This process
is referred to as data unsharing.
In order to support snapshots in volume groups 2.2 and higher, LVM introduced a new configuration
parameter, unshare unit (with the
-U option in vgcreate). The unshare unit represents the smallest
unit at which data can be unshared between a logical volume and its snapshots.
The unshare unit can be configured only during creation of a volume group. See vgcreate (1M) for details.
Two types of snapshots are supported.
Fully-Allocated Snapshot
When a fully allocated snapshot is created, the number of extents required for the snapshot is allo-
cated immediately, just like for a normal logical volume. However, the data contained in the original
logical volume is not copied over to these extents. The copying of data occurs through the data
unsharing process.
Space-Efficient Snapshot
When a space-efficient snapshot is created, the user is expected to specify the number of extents that
LVM needs to set aside to be used for unsharing in the future. These extents are referred to as pre-
allocated extents. Refer to lvcreate (1M) and lvextend (1M) for details. After the snapshot creation, the
user can further increase the number of pre-allocated extents.
When the number of extents in the pre-allocated extent pool falls below a certain threshold, a message
is logged in the system’s
syslog, and an event is published to the listening subsystems.
If the automatic increase of pre-allocated extents is enabled, then the number of pre-allocated extents
gets automatically incremented by the threshold value. The threshold value can be set or changed
using
lvcreate and lvchange commands. See lvcreate (1M) and lvchange (1M) for more informa-
tion. Note that lvmpud daemon must be running for this to succeed. Please refer to lvmpud (1M) for
more information on the daemon.
For default allocation policy, the threshold is reached when the number of free extents in the pre-
allocated pool is less than or equal to the configured threshold percentage of the total number of
extents in the pre-allocated pool.
For striped allocation policy, the threshold is reached when the number of full extent stripes that can
be formed using free pre-allocated extents is less than or equal to the value calculated as below:
threshold value = (threshold percentage of total pre-allocated extents rounded to stripes width ) / (
stripes width )
For distributed allocation policy, the threshold is reached when the number of free extents in the pre-
allocated pool is less than or equal to the configured threshold percentage of the total number of
extents in the pre-allocated pool or when more than half of the number of free extents in the pre-
allocated pool is from the same physical volume.
If a write requires an unshare operation to be performed on the snapshot, but there is no available
extent in the pre-allocated extent pool, then the snapshot gets marked as
over-committed.
4 Hewlett-Packard Company 4 HP-UX 11i Version 3: October 2010