Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Using LVM Logical Volume Snapshots: Technical White Paper

Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

Using LVM logical volume snapshots

Technical white paper

Table of contents
Using LVM logical volume snapshots ...................................................................................................... 1
Abstract .............................................................................................................................................. 2
Audience ............................................................................................................................................ 2
HP-UX LVM snapshot overview .............................................................................................................. 2
Types of snapshot logical volumes ...................................................................................................... 2
Snapshot uses .................................................................................................................................. 3
Difference between snapshot logical volumes and split logical volumes .................................................. 3
Snapshot tree .................................................................................................................................. 4
Data unsharing on snapshot logical volumes ....................................................................................... 4
Creating and administering snapshots .................................................................................................... 7
Creating snapshots........................................................................................................................... 8
Extending the pre-allocated extent pool............................................................................................. 10
Enabling the automatic increase of pre-allocated extents ..................................................................... 12
Changing the Attributes of a Snapshot Logical Volume ....................................................................... 14
Changing the attributes of a logical volume having snapshots ............................................................. 16
Deleting logical volumes on a snapshot tree ...................................................................................... 16
Displaying Snapshot Information ...................................................................................................... 18
Importing volume groups with snapshots ........................................................................................... 26
Reconfiguring a volume group using vgmodify................................................................................... 27
Migration of volume group version using vgversion ............................................................................ 27
pvmove , vgmove, and lvmove commands ........................................................................................ 28
vgreduce command ........................................................................................................................ 28
lvsplit and lvmerge commands ......................................................................................................... 28
vgchange command ....................................................................................................................... 28
Configurable location for the volume group configuration file .............................................................. 29
Limitations when using snapshots ......................................................................................................... 29
Common use examples....................................................................................................................... 30
Recommended practices ..................................................................................................................... 32
Error messages .................................................................................................................................. 32
Performance numbers ......................................................................................................................... 35
Read performance.......................................................................................................................... 35
Write performance ......................................................................................................................... 36
Configuration file size ........................................................................................................................ 38
For more information .......................................................................................................................... 39
Feedback.......................................................................................................................................... 39
Abstract
Beginning with the HP-UX 11i v3 March 2010 Update release, LVM supports Version 2.2 volume
groups. This update also enables you to create snapshots of logical volumes belonging to Version 2.2
volume groups.
This white paper explains how to create and administer the snapshots, limitations when using
snapshots, and recommended practices.

Audience
The document is intended for system administrators, operators, and customers who want to create and
use snapshot logical volumes belonging to Version 2.2 volume groups. It is assumed that you have a
basic knowledge of LVM.

HP-UX LVM snapshot overview


A snapshot is a point-in-time (PIT) image of data. Typically, a snapshot is created almost
instantaneously and is immediately available for use by applications. While the original copy can
change because of writes made to it, the snapshot retains the data contained in the original copy at
the point in time when the snapshot was created.
The logical volume from which the snapshot is created is referred to as the original logical volume.
When created, a snapshot shares all of its data with the original logical volume. The snapshot gets a
copy of its own data only when a write occurs onto itself or the original logical volume. LVM supports
read-only and read-write snapshots. By default, a read-only snapshot is created unless explicitly
specified during snapshot creation.
Snapshots are a special type of logical volume and contribute to the limit of maximum number of
logical volumes in a volume group (for example, 2047 logical volumes for a Version 2.2 volume
group). The size of a snapshot logical volume is the same as the size of the original logical volume.
Snapshots inherit their allocation policies from the original logical volume unless specified explicitly.
However, the contiguous allocation policy is not supported for space-efficient snapshots. The
allocation policy of a space-efficient snapshot is set to default allocation when the original logical
volume is configured for contiguous allocation. For more information, see Creating snapshots

Types of snapshot logical volumes


HP-UX LVM supports the following snapshots:
• Fully-allocated snapshots
• Space-efficient snapshots

Fully-allocated snapshots
When a fully-allocated snapshot is created, the number of extents or the total storage capacity
required for the snapshot is allocated immediately, just like for a normal logical volume. The data
contained in the original logical volume is not copied to these extents. The copying of data happens
on an on-demand basis as and when data on the original logical volume or snapshot logical
volume changes.

Space-efficient snapshots
Unlike a fully-allocated snapshot, when a space-efficient snapshot is created, all the extents of the
snapshot are not allocated immediately. The user has to explicitly specify the number of extents that

2
LVM needs to set aside for copying over data from the original logical volume in future. These extents
are referred to as pre-allocated extents. When some data is unshared on a space-efficient snapshot,
an extent that satisfies the allocation policy of the snapshot is picked from the pool of pre-allocated
extents and data from the original logical volume is copied over to this extent. The success of a
space-efficient snapshot lies in provisioning for the right number of pre-allocated extents. For more
information, see Creating snapshots

Snapshot uses
You typically use snapshots for the following:
• Backup
Because a snapshot is created almost instantaneously, you can use it to create multiple point-in-time
images of the logical volume without having to disrupt the applications using the logical volumes.
You mount the snapshot image on a backup server and use it as a normal volume for backup
purposes. This greatly reduces the application downtime required to back up the volumes.

• Restore
If the original logical volume image is corrupted, you can use its snapshot to restore the original
logical volume back to an image represented by the snapshot. Although LVM currently does not
support instant restore, you can manually copy the snapshot contents to the original logical volume.

• Data mining
You can run data mining applications on the snapshot without affecting the performance of the
original logical volume.

• Testing of applications
You can create a snapshot of the production data and test prototype applications on the snapshot.
If the snapshot is corrupted during testing, you can delete and recreate it for further testing.

Difference between snapshot logical volumes and split logical volumes


Prior to the HP-UX 11iv3 March 2010 update release, LVM supported an equivalent of snapshot
capability using the lvsplit and lvmerge commands. The differences between using the snapshot
feature over using lvsplit and lvmerge commands are as follows:
• You can split only mirrored logical volumes to create a snapshot image of a logical volume. For
snapshots, the original logical volume need not be mirrored.
• When a logical volume is split, the number of mirror copies associated with the original logical
volume is reduced by one, reducing the level of redundancy. For snapshots, the mirror copies
associated with the original logical volume and its snapshot are independent of each other, and
can be specified during creation.
• A split logical volume is fully allocated and does not share any data with the original logical
volume. Snapshots, at the point of creation, share all their data with the original logical volume.
You can achieve space efficiency by creating space-efficient snapshots.
• For split logical volumes, there is some control over the physical extents to be involved. For
space-efficient snapshots, you cannot choose the physical extents to be used on demand for
data unsharing.
• There is very little performance degradation for writes to split logical volumes. However, there is
some performance degradation associated with the first write that causes copying of data over from
the original logical volume to the snapshot logical volume.

3
• You can create multiple snapshots using lvsplit, but they do not contain any information
required to associate the split logical volumes with the original logical volume. For snapshots, the
association with the original logical volume is maintained. Also, the snapshot creation time is very
useful in determining the point-in-time property of the snapshots.
• You can atomically split multiple mirrored logical volumes using lvsplit, but you can create a
snapshot of only one logical volume at a point in time.

Snapshot tree
You can create only a single snapshot at one time, but can create multiple snapshots of a single
logical volume over a period of time. You can also only create a snapshot off an original logical
volume, but not off another snapshot logical volume. The original logical volume and all its snapshot
logical volumes are together referred to as a snapshot tree.
Each logical volume on the snapshot tree maintains a successor and predecessor relationship with the
snapshots before and after it is on the tree. When you create a snapshot off an original logical
volume, the original logical volume is the successor of the snapshot logical volume and the snapshot is
the predecessor of the original volume on the snapshot tree. For example, if you have an original
logical volume LV with snapshot S0, S0 is the predecessor of LV and LV is the successor of S0.
When the next snapshot S1 is created, S1 becomes the predecessor of LV and successor of S0. LV
becomes the successor of S1and S0 becomes the predecessor of S1. The following diagram
represents this successor-predecessor relationship of snapshots.

Figure 1: Snapshot tree

LV S1 S0

In this tree representation of snapshots, every snapshot shares data only with its successor. When a
write I/O comes to the snapshot, only this snapshot and its predecessor get a copy of the data. When
a write I/O comes to the original logical volume, only its predecessor gets a copy of the data (see the
following section). Without this tree relationship, every snapshot directly shares data with the original logical
volume and any write I/O on the original logical volume requires each of its snapshots to have its own copy
of the data being modified. The tree representation uses the space in the volume group more efficiently.

Data unsharing on snapshot logical volumes


By definition, a snapshot shares all of its data with the original logical volume, until an attempt is
made to change the data on either of them. At this point, data is first copied over from the original
logical volume to the snapshot in order to maintain its point-in-time characteristic of the snapshot. This
copying over of the original data is referred to as data unsharing.
To support snapshots, a new configuration parameter called the unshare unit is introduced for Version
2.2 volume groups. It is the smallest unit for which data can be unshared between a logical volume
and its snapshots. You configure the unshare unit only during creation of a volume group. The
supported values are 512 KB, 1024 KB, 2048 KB, and 4096 KB. For more information,
see vgcreate(1M).

4
When a write comes to the original logical volume on the snapshot tree, the unshare units to which
the write is destined are unshared first. This means that the data in these unshare units are copied to
its predecessor before the write to the original logical volume proceeds. This is referred to as a copy-
before-write operation (CBW). When a write comes to a snapshot logical volume, two CBW
operations might be required.
Building on the snapshot tree depicted in Figure1, Figure 2 shows the contents of the unshare units of
each logical volume on the snapshot tree. The arrow indicates that the data in the unshare unit is
shared with its successor. The initial contents of the original logical volume LV was the same as that of
its first snapshot S0. For example, S0 and S1 initially shared all their data with the original logical
volume LV and a write comes to S1’s second unshare unit containing B. Because S1 shares data with
its successor (LV) and predecessor (S0) for this unshare unit, the original data B is copied to S1 from
LV, then to S0 from LV, and then the new data X is written to S1. At this point, S0 and S1 have the
second unshare unit completely unshared. If a subsequent write Y comes to the third unshare unit of
the original logical volume LV, the original data C is copied over from LV to S1 and then the write Y
is allowed to proceed. Only the third unshare unit of S1 is unshared; S0 still shares this data with S1.

Figure 2: Snapshot tree unshare units

A A A

B X B

Y C C

D D D

LV S1 S0

If a data unshare operation fails, the data contained in the snapshot logical volume no longer remains
point-in-time. Such a snapshot logical volume is marked as inoperative. After a snapshot becomes
inoperative, subsequent read and write operations on the snapshot fail. When a space-efficient
snapshot logical volume becomes inoperative, its pre-allocated extents are freed and available as free
extents in the volume group.
When a snapshot that has a file system mounted on it becomes inoperative, you cannot access the file
system contents or list the files in the file system. However, if the file system is mounted as read-only on
a snapshot logical volume (that is configured as read-write or read-only), you can access the file
system contents even after the snapshot becomes inoperative. Mounting a file system on an
inoperative snapshot fails.
For a fully-allocated snapshot, the extent to which the data is unshared is already allocated at the time
of snapshot creation. For a space-efficient snapshot, the extent is picked from the pre-allocated pool of
extents, such that the extent or the set of extents picked satisfies the allocation policy of the snapshot.
As subsequent data unsharing continues to pick extents from the pre-allocated pool, there might be an
instance when no extent can be picked from the pre-allocated pool either because all the extents in
the pool have been used up or the remaining extents in the pool do not satisfy the allocation policy of
the snapshot logical volume. In these cases, the snapshot is referred to as over-committed. It is also

5
marked as inoperative because the data unshare operation fails to complete. After a snapshot is
marked inoperative, all its predecessors that share data with this snapshot are also marked as
inoperative. A fully-allocated snapshot can never become over-committed because all snapshot extents
are allocated at the time of snapshot creation. Figure 3 shows the different snapshot states.

Figure 3: Snapshot state diagram

Operative
Failed to find an appropriate • I/O or data unshare on
extent in the pre-allocated the snapshot failed.
pool. (space-efficient • If the snapshot shares data
snapshots only) with its successor and the
successor is marked as
inoperative.

Over-commit,
Inoperative
Inoperative

To prevent a space-efficient snapshot from becoming over-committed, LVM internally maintains a


threshold value for the number of extents in the pre-allocated pool. The threshold value is computed
based on one of following allocation policies:
• Non-contiguous allocation policy
The threshold is reached when the number of free extents in the pre-allocated pool is less than or
equal to 20 percent of the total number of extents in the pre-allocated pool.

• Striped allocation policy


The threshold is reached when the free extents in the pre-allocated pool form less than 2 full
extent stripes. With HP-UX 11i v3 October 2010 web release, 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 20 percent of the total pre-allocated extents rounded up to the stripe width divided by
the stripe width.

• Distributed allocation policy


The threshold is reached when the number of free extents in the pre-allocated pool is less than or
equal to 20 percent 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.

Note
Contiguous allocation policy is not supported for a space-efficient snapshot.

When the number of extents in the pre-allocated pool reaches the threshold value, LVM prints the
following message in the syslog:

6
LVM: WARNING: Snapshot LV (VG 128 0x000000, LV Number: 6) threshold value
reached. Please increase the number of pre-allocated extents for this
snapshot LV
You can easily identify the snapshot logical volume by the volume group and logical volume numbers
in the message. LVM also publishes an LVM_EV_SNAPLV_THRESHOLD_REACHED event.
HP recommends that you monitor the syslog for the message or subscribe to the event. When the
threshold is reached, increase the number of extents in the pre-allocated pool to prevent the snapshot
from becoming over-committed. For more information, see Extending the pre-allocated extent pool
Beginning with the HP-UX 11i v3 September 2010 Update release, LVM provides a feature to
automatically increase the pre-allocated extents when the threshold value is reached and provides an
option to set the threshold value. For more information, see Enabling the automatic increase of pre-
allocated extents

Note
Although you can increase the number of extents in the pre-allocated pool,
you cannot reduce them.

Data unsharing can occur on a read-only and read-write snapshot logical volume. On a read-only
snapshot logical volume, data unsharing can occur because of a write I/O on its successor. On a
read-write snapshot logical volume, data unsharing can occur because of a write on the snapshot or
its successor. In either case, if the snapshot is space efficient, HP recommends you monitor for the
threshold of number of extents in its pre-allocated extent pool. Also, in case of deletion of a single
snapshot, data might get unshared on the predecessor of the snapshot being deleted. If the
predecessor is a space efficient snapshot, HP recommends you monitor for the threshold of
number of extents in its pre-allocated extent pool. For more information,
see Deleting logical volumes on a snapshot tree
If a logical volume has snapshots associated with it, there might be an increase in the latencies
associated with reads and writes on the original logical volume or the snapshot. The increased
latency is not incurred after the first write on a unshare unit. For more information on the performance
of I/Os on snapshot logical volumes, see Performance numbers

Creating and administering snapshots


LVM supports the creation of snapshot logical volumes on Version 2.2 and higher volume groups. To
configure the unshare unit, a new -U option is introduced in the vgcreate command. The supported
values are 512 KB, 1024 KB, 2048 KB, and 4096 KB. If the –U option is not used when creating the
volume group, the unshare unit is set to the default value of 1024 KB. The unshare unit cannot be
greater than the size of the physical extent of the volume group. After this value is set, you cannot
change it.
The total capacity of the snapshots you can create in a volume group is referred to as the maximum
snapshot capacity. LVM provisions the maximum snapshot capacity to be equivalent to the maximum
volume group capacity specified when creating the volume group.
For example, to create a Version 2.2 volume group with the unshare unit as 512 KB, extent size
8 MB, and maximum snapshot capacity of 128 TB, enter the following command:
# vgcreate –V 2.2 –S 128t –s 8 –U 512 vg01 /dev/disk/disk40
LVM stores the information related to sharing relationship of the unshare units of each snapshot
logical volume in its metadata. The size of the metadata for a Version 2.2 volume group depends on
the size of unshare unit chosen at the volume group creation time. If the unshare unit is small

7
(for example, 512 KB), more unshare units are required to represent the data in one extent. If the
unshare unit is large (for example, 4 MB), the number of unshare units required is less. The increase
in metadata size from Version 2.1 to Version 2.2 volume groups (with the same volume group
capacity) depends on the size of the unshare unit. You must choose this value carefully based on the
size and the pattern of I/Os issued by the application using the volume group. LVM recommends you
use the following guidelines when choosing the size of unshare unit:
• If the write I/Os to the original logical volume or the snapshots are random and as small as one of
the unshare units, choose the unshare unit to which the typical I/O size is closest. If the write I/O is
larger than the largest unshare unit, choose the largest unshare unit. This applies to both raw and
block write I/Os.
• If the write I/Os to the original logical volume or the snapshots are sequential, choose an unshare
unit such that the total size of the group of sequential I/Os is closest to the unshare unit. This applies
to both raw and block write I/Os.
• If the application is read intensive (if the number of read I/Os are significantly more than the
number of write I/Os to the original logical volume or the snapshots) and the read I/Os are
random, choose an unshare unit that is closest to the size of the read I/O. This applies to both raw
and block read I/Os.
• If the application is read intensive (if the number of read I/Os are significantly more than the
number of write I/Os to the original logical volume or the snapshots) and the read I/Os are
sequential in nature, consider the following:
– For raw read I/Os, choose an unshare unit that is closest to the size of the read I/O.
– For block read I/Os, choose the largest unshare unit (for example, 4096 K).
For more information, see vgcreate(1M).

Creating snapshots
To create a snapshot of a logical volume, use the lvcreate –S option. By default, the name of the
snapshot is a string consisting of the original logical volume name, the tag _S, and the minor number
of the snapshot logical volume. The snapshot logical volume is treated as just another logical volume
in the volume group and contributes to the limit of maximum number of logical volumes in a volume
group. The maximum number of snapshots you can create for a particular logical volume is 255.
By default, a snapshot is created as a read-only logical volume. You cannot create a snapshot when
the volume group is quiesced.
The following rules apply to all snapshot logical volumes:
• The allocation policies of the snapshot are inherited from the original logical volume unless
specified explicitly; with the exception that contiguous allocation policy is not supported for
space-efficient snapshots. The allocation policy of a space-efficient snapshot is set to default
allocation when the original logical volume is configured for contiguous allocation.
• After the snapshot is created, you cannot change its configuration parameters, except for the access
permissions, availability, IO timeout, and consistency recovery attributes.
• You can stripe the snapshot only if the original logical volume is striped. You cannot create a
striped snapshot of a non-striped original logical volume, or vice versa.
• The scheduling policy is inherited from the original logical volume and cannot be changed.
• You cannot create snapshots off swap and dump logical volumes.
• You can create only fully-allocated snapshots off root and boot logical volumes. You cannot create
space-efficient snapshot of these logical volumes.
• You cannot create a snapshot of a snapshot logical volume.
• You cannot create a snapshot of a logical volume whose size is 0.

8
You can use the following options when creating a snapshot:
• The –S option takes only one value s to indicate that the logical volume being created is a
snapshot logical volume.
• To create a fully-allocated snapshot, do not use the –l or –L options.
• To create a space-efficient snapshot, use the -l option to specify the number of extents in the
pre-allocated pool or the -L option to specify the size of pre-allocated pool.
• Use the –m option to create a mirrored snapshot. If you do not specify the -m option, the snapshot
is created with no mirrors, even if the original logical volume is mirrored. It is possible to create a
mirrored snapshot of a non-mirrored original logical volume.
• Use the –n option to explicitly set the name of the snapshot logical volume.
• Use the -t option to append a timestamp of the snapshot creation to the snapshot logical volume
name. The timestamp is of the form YYYYMMDD_HH.MM.SS.
• Use the -p option to set the access permission at the time of snapshot creation. Because the
snapshot is read-only by default, use this option to create a read-write snapshot logical volume
if required.
• Use the –e option (HP-UX 11i v3 September 2010 release and later) to enable or disable the
automatic increase of pre-allocated extents. By default, the automatic increase of pre-allocated extents is
enabled. The lvmpud daemon must be running for this feature to be enabled. If not, it is disabled.
• Use the –P option (HP-UX 11i v3 September 2010 release and later) to set the threshold value at
which increment messages are logged in syslog or at which the automatic increase of pre-allocated
extents is triggered.
• You can use all other options, for example -c. -C, -D, -M, and –s, as for a normal logical volume.

Examples
• To create a read-only mirrored space-efficient snapshot of the logical volume /dev/vg01/lvol1
with default naming and 200 pre-allocated extents, enter the following command:
#lvcreate -S s -l 200 -m 1 /dev/vg01/lvol1
Logical volume "/dev/vg01/lvol1_S2" has been successfully created with
character device "/dev/vg01/rlvol1_S2".
Logical volume "/dev/vg01/lvol1_S2" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in
/etc/lvmconf/vg01.conf

• To create a read-only space-efficient snapshot of the logical volume /dev/vg01/lvol1 with


default naming and 200 pre-allocated extents, threshold value set to 50%, and the automatic
increase of pre-allocated extents enabled without lvmpud running, enter the following command:
#lvcreate -S s -l 200 –e y –P 50 /dev/vg01/lvol1
The automatic increase of pre-allocated extents has been disabled
since lvmpud is not running. Please start the lvmpud daemon and
enable the feature using lvchange command
Logical volume "/dev/vg01/lvol1_S2" has been successfully created wit
character device "/dev/vg01/rlvol1_S2"
Logical volume "/dev/vg01/lvol1_S2" has been successfully extended
Volume Group configuration for /dev/vg01 has been saved in
/etc/lvmconf/vg01.conf

• To create a read-only space-efficient snapshot of the logical volume /dev/vg01/lvol1 with


default naming and 200 pre-allocated extents, threshold value set to 30%, and the automatic
increase of pre-allocated extents enabled with lvmpud running, enter the following command:
#lvcreate -S s -l 200 –e y –P 30 /dev/vg01/lvol1
Logical volume "/dev/vg01/lvol1_S2" has been successfully created with

9
character device "/dev/vg01/rlvol1_S2".
Logical volume "/dev/vg01/lvol1_S2" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in
/etc/lvmconf/vg01.conf

• To create a fully-allocated writeable snapshot of the logical volume /dev/vg01/lvol1, with the
name snap1 and the timestamp appended to this name, enter the following command:
#lvcreate -S s -n snap1 -t y –p w /dev/vg01/lvol1
Logical volume "/dev/vg01/snap1_20100122_00.36.18" has been successfully
created with character device "/dev/vg01/rsnap1_20100122_00.36.18".
Logical volume "/dev/vg01/snap1_20100122_00.36.18" has been successfully
extended.
Volume Group configuration for /dev/vg01 has been saved in
/etc/lvmconf/vg01.conf

Note
When a logical volume snapshot is created, the logical volume is first
quiesced. After all I/Os that are in progress have completed, the I/Os on
the logical volume are paused for the duration of the snapshot creation.
There is no guarantee that the status of the snapshot will be the same as
that of the original logical volume when the lvcreate command was
initiated to create the snapshot. To ensure correctness of the snapshot
logical volume, HP recommends that the applications using the logical
volume be quiesced prior to initiating the snapshot creation.

Choosing the size of the pre-allocated pool


The optimum size of pre-allocated pool depends on the purpose of the snapshot and the duration for
which the snapshot is kept. You must choose this value carefully based on the I/O activity on the
original logical volume.
If you intend to create a snapshot to retain for a long time, create a fully-allocated snapshot. This
ensures that the snapshot does not become over-committed due to writes on the original logical
volume over a period of time.
If the snapshot is taken for backup purposes and the backup is typically done when the I/O activity is
minimal, the size of pre-allocated pool must be slightly more than the total size of data written during
the backup activity. For example, if you determine that during the backup activity, maximum of 30%
of the logical volume can be written to, provision the pre-allocated pool to have slightly more than this
value to prevent the snapshot from becoming over-committed.
For more information, see lvcreate(1M).

Extending the pre-allocated extent pool


This section applies to space-efficient snapshots only. To increase the number of extents in the
pre-allocated pool, use the lvextend command. Use the -l option to specify the new value for the
number of extents in the pre-allocated pool or the -L option to specify the new total size of the
pre-allocated pool. The value specified with the -L option is rounded to the nearest multiple of the
logical extent size. In both the cases, the number of extents in the pre-allocated pool cannot exceed
the number of extents in the original logical volume.
You cannot specify physical volume paths or physical volume groups when increasing the number of
number of extents in the pre-allocated pool. The lvextend command can fail in the following cases:
• Not enough extents are available to satisfy the allocation policy of the space efficient snapshot
logical volume.

10
• The number of extents or size of pre-allocated pool specified in the command is not greater than the
existing value.
• The snapshot logical volume is inoperative.

For example, you have a Version 2.2 volume group vg01 with logical volume /dev/vg01/lvol1
having a space-efficient snapshot /dev/vg01/lvol1_S2. When write I/Os are issued to the
original logical volume, some extents on the space-efficient snapshot get unshared.
# lvdisplay /dev/vg01/lvol1_S2
--- Logical volumes ---
LV Name /dev/vg01/lvol1_S2
VG Name /dev/vg01
LV Permission read-only
LV Status available/syncd, snapshot,space efficient
Snapshot Status operative
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 40
Current LE 10
Allocated PE 3
Stripes 0
Stripe Size (Kbytes) 0
Bad block NONE
Allocation strict
IO Timeout (Seconds) default
Pre-allocated LE 5
Current pre-allocated LE 2
Unshared LE 3
Current pre-allocated PE 2
Original LV /dev/vg01/lvol1
Timestamp Tue Jan 26 16:17:42 2010
At this point, the threshold has not been reached. When more extents get unshared and the threshold
is reached, the following warning is displayed in the syslog:
LVM: WARNING: Snapshot LV (VG 128 0x000000, LV Number: 2) threshold value
reached. Please increase the number of pre-allocated extents for this
snapshot LV
The lvdisplay output shows the number of extents in the pre-allocated pool that were not picked for
any unshare operation in Current pre-allocated LE and the total number of extents that were
pre-allocated to the space-efficient snapshot in Pre-allocated LE. Increase the Pre-allocated
LE value to add more extents in the pre-allocated pool using lvextend.
In this example, when the threshold is reached, lvdisplay shows the following values:
Pre-allocated LE 5
Current pre-allocated LE 1
Unshared LE 4
Use lvextend to add more extents in the pre-allocated pool as follows:
# lvextend -l 8 /dev/vg01/lvol1_S2
Now, lvdisplay shows the following values:
Pre-allocated LE 8
Current pre-allocated LE 4
Unshared LE 4
For more information, see lvextend(1M).

11
Beginning with the HP-UX 11i v3 September 2010 Update release, LVM provides a feature to
automatically increase the pre-allocated extents when the threshold value is reached. For more
information, see Enabling the automatic increase of pre-allocated extents.

Enabling the automatic increase of pre-allocated extents


Prior to HP-UX 11i v3 September 2010 Update release, when the number of pre-allocated extents in
the pre-allocated pool falls below the internally maintained threshold value, a message is logged in
syslog and an event is published to the listening subsystems for the user to take action.
Beginning with the HP-UX 11i v3 September 2010 Update release, LVM enables you to automatically
increase the pre-allocated extents when the threshold value is reached and to set the threshold value.
You can enable the automatic increase of pre-allocated extents with the –e option to the lvcreate
or lvchange commands. By default, the automatic increase of pre-allocated extents is enabled.
The lvmpud daemon must be running to enable the automatic increase of pre-allocated extents. For
more information, see lvmpud(1M).
You can change the threshold value using the –P option to lvcreate or lvchange commands.
By default, the threshold is set to the internally maintained threshold value as explained in Data
Unsharing on Snapshot Logical Volumes. The number of extents that will be incremented automatically
after threshold value is reached is equal to the threshold value.

Note
The lvmpud daemon must be running for this feature to be enabled. Also,
ensure that a sufficient number of extents are present in the volume group
for the automatic increase of pre-allocated extents to succeed.

If the automatic increase of pre-allocated extents is not enabled and the threshold value is set, when
the number of free extents in the pre-allocated extent pool falls below the threshold value, a message
is logged in syslog and an event is published to the listening subsystems for the user to take action.
If neither the -e or -P options are specified, by default, the automatic increase of pre-allocated
extents is enabled and the threshold value is set to the default value.
After the task to automatically increase the pre-allocated extents is posted and it succeeds, LVM prints
the following messages in syslog:
lvmpud->lvextend -l 16 /dev/vg01/lvol1_S2
LVM: The task posted for increasing the pre-allocated extents succeeded
for the snapshot LV (VG 128 0x001000, LV Number: 2).
The lvmpud->lvextend in the preceding message indicates that lvextend was initiated by
lvmpud as a part of automatic increase of pre-allocated extents.
If the task posted to automatically increase the pre-allocated extents fails, the following message is
logged in syslog with appropriate error messages:
LVM: ERROR: The task posted for increasing the pre-allocated extents
failed for the snapshot LV (VG 128 0x001000, LV Number: 2)
If the number of pre-allocated extents incremented automatically is equal to the original logical volume
settings, the following message is logged and no further tasks are posted to lvmpud for further
increase:
LVM: The number of pre-allocated extents for snapshot LV(VG 128
0x001000,LV Number: 2) is equal to the original logical volume's setting.
The number of pre-allocated extents cannot be increased further.

12
Enabling the automatic increase of pre-allocated extents does not ensure that the snapshot logical
volume does not get marked as over-commit. You must select a proper threshold value based on the
purpose of snapshot, the duration for which the snapshot is kept, and the I/O activity on the original
logical volume.
If the I/O activity on the original logical volume is greater, choose a higher threshold value so the
threshold is reached faster and more pre-allocated extents are allocated at a time.

Example
An original logical volume /dev/vg01/lvol1 has 200 extents. For snapshot logical volume
/dev/vg01/lvol1_S2 with 100 extents and threshold value 70%, the lvdisplay output is
as follows:
# lvdisplay /dev/vg01/lvol1_S2
--- Logical volumes ---
LV Name /dev/vg01/lvol1_S2
VG Name /dev/vg01
LV Permission read-only
LV Status available/syncd, snapshot,space efficient
Snapshot Status operative
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 400
Current LE 200
Allocated PE 0
Stripes 0
Stripe Size (Kbytes) 0
Bad block NONE
Allocation strict
IO Timeout (Seconds) default
Pre-allocated LE 100
Current pre-allocated LE 100
Unshared LE 0
Current pre-allocated PE 100
Original LV /dev/vg01/lvol1
Timestamp Wed Apr 28 14:01:14 2010
Auto Pre-allocation Enabled
Threshold Percent 70

When a write operation comes to an original logical volume, data unsharing is initiated on the
snapshot logical volume. If the number of extents in the pre-allocated pool size is less than or equal to
the threshold value, automatic increase of pre-allocated extents is initiated and the number of pre-
allocated extents increases by the threshold value.
In the previous example, if the number of extents remaining in the pre-allocated pool reaches the
threshold value (70% of number of pre-allocated extents), the number of pre-allocated extents is
automatically incremented by the threshold value (70 extents). Now, the number of pre-allocated
extents is 170.
The following is the output of lvdisplay of a snapshot logical volume /dev/vg01/lvol1_S2
after automatic increase of pre-allocated extents:
# lvdisplay /dev/vg01/lvol1_S2
--- Logical volumes ---
LV Name /dev/vg01/lvol1_S2
VG Name /dev/vg01
LV Permission read-only
LV Status available/syncd, snapshot,space efficient
Snapshot Status operative

13
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 400
Current LE 200
Allocated PE 30
Stripes 0
Stripe Size (Kbytes) 0
Bad block NONE
Allocation strict
IO Timeout (Seconds) default
Pre-allocated LE 170
Current pre-allocated LE 140
Unshared LE 30
Current pre-allocated PE 140
Original LV /dev/vg01/lvol1
Timestamp Wed Apr 28 14:01:14 2010
Auto Pre-allocation Enabled
Threshold Percent 70

The next time, the threshold value is calculated as 70% of 170 extents. By increasing the
pre-allocated pool size by 70%, the size of the snapshot crosses the original logical volume size.
Therefore, it is increased to maximum size of original logical volume.
For more information on using this feature, see lvmpud(1M), lvcreate(1M), lvchange(1M),
and lvm(7).

Changing the Attributes of a Snapshot Logical Volume


You can change only some attributes of a snapshot logical volume. Use the following lvchange
options to change attributes of the snapshot logical volume. The options and their values remain the
same as they are for normal logical volumes. For more information, see lvchange(1M).
• -p — Sets the access permission of the snapshot logical volume. By default, the snapshot is read-
only. Use this option to make the snapshot writable.
• -M and –c — Sets the mirror consistency recovery policy.
• -a — Changes the availability of the snapshot logical volume. If the snapshot logical volume is
made unavailable using this option, I/Os are not allowed to succeed. However, you can still
unshare data on this snapshot logical volume because of write I/Os on its successor. In case of
space efficient snapshot logical volumes, if enough extents are not available for unsharing, it might
become over-committed and inoperative. If the space-efficient snapshot was made temporarily
unavailable but its data is still useful, HP recommends that you monitor the space efficient snapshot
for the threshold value of number of extents in its pre-allocated pool. When the threshold is
reached, increase the number of extents in the pre-allocated pool using lvextend or enable the
feature to automatically increase the pre-allocated extents. For more information, see Extending the
pre-allocated extent pool and Enabling the automatic increase of pre-allocated extents, respectively.
• -t — Changes the I/O timeout value for the snapshot logical volume. An I/O issued on any
logical volume on the snapshot tree might result in one or more CBW I/Os as a part of data
unsharing process. The timeout value for each CBW I/O is inherited from the original I/O that
induced it. However, the time budget for completion of the whole I/O (including the original I/O
and its CBW I/Os) is still equal to the I/O timeout value of the original I/O and not the sum of the
original I/O timeout and CBW I/O timeout values. Also, LVM I/O retry policy based on the I/O
timeout value in case of I/O failure still remains the same for the I/O on a logical volume on the
snapshot tree, as with any I/O on a logical volume not on a snapshot tree.

14
For example, an I/O is issued on the original logical volume of a snapshot tree. The timeout value
for the original I/O is equal to 60 seconds, which means that the I/O is completed (either success
or failure) within 60 seconds. In this case, if the original I/O requires a CBW I/O, the CBW I/O is
also given a timeout value of 60 seconds; the I/O is still completed (either success or failure) within
60 seconds.
If the timeout value set for the original I/O is not enough for the completion of the original I/O and
CBW I/Os induced by it, the original I/O fails with an error indicating that the I/O time budget is
exhausted. Therefore, HP recommends you choose the I/O timeout value of logical volumes on a
snapshot tree that it is comparatively larger (keeping in mind that the original I/O might result in
one or more CBW I/Os) than the I/O timeout value chosen for a logical volume that is not on a
snapshot tree.

• -e — Enables or disables the automatic increase of pre-allocated extents. The default behavior is
to enable the feature. The lvmpud daemon must be running for this feature to be enabled. If not, it
is disabled.
• -P — Sets the percentage threshold value at which increment messages are logged in syslog, or
the automatic increase of preallocated extents is triggered. The value ranges from 1 to 100.

Note
Although the behavior of I/O timeout for logical volumes on snapshot
tree has changed, the behavior and interaction with the I/O timeout for
physical volumes has not changed.

For more information, see lvchange(1M).

Examples
• The output of lvdisplay for space-efficient snapshot /dev/vg01/lvol1_S2 is as follows:
Timestamp Tue Apr 27 13:21:20 2010
Auto Pre-allocation Enabled
Threshold Percent 30
To change the threshold value for /dev/vg01/lvol1_S2 from 30% to 60%, enter the following
command:
# lvchange -P 60 /dev/vg01/lvol1_S2
Logical volume "/dev/vg01/lvol1_S2" has been successfully changed.
Volume Group configuration for /dev/vg01 has been saved in
/etc/lvmconf/vg01.conf
The following output of lvdisplay reflects the change in threshold percent:
Timestamp Tue Apr 27 13:21:20 2010
Auto Pre-allocation Enabled
Threshold Percent 60

• The output of lvdisplay for space-efficient snapshot /dev/vg01/lvol1_S2 is as follows:


Timestamp Tue Apr 27 13:21:20 2010
Auto Pre-allocation Enabled
Threshold Percent 60
To disable the automatic increase of pre-allocated extents and change the threshold percent from
60% to 70%, enter the following command:
# lvchange -e n -P 70 /dev/vg01/lvol1_S2
Logical volume "/dev/vg01/lvol1_S2" has been successfully changed.
Volume Group configuration for /dev/vg01 has been saved in
/etc/lvmconf/vg01.conf

15
The following output of lvdisplay reflects the changes:
Timestamp Tue Apr 27 13:21:20 2010
Auto Pre-allocation Disabled
Threshold Percent 70

• To enable the automatic increase of pre-allocated extents when lvmpud is not running, enter the
following command:
# lvchange -e y /dev/vgpj/lvol1_S2
The automatic increase of pre-allocated extents has been disabled
since lvmpud is not running. Please start the lvmpud daemon and
enable the feature using lvchange command.
Logical volume "/dev/vgpj/lvol1_S2" has been successfully changed.
Volume Group configuration for /dev/vgpj has been saved in
/etc/lvmconf/vgpj.conf
The automatic increase of pre-allocated extents is enabled only if lvmpud is running.

Changing the attributes of a logical volume having snapshots


You cannot change some attributes of an original logical volume using lvchange if the logical
volume has some snapshot associated with it. The following lvchange options are disabled for this
type of logical volume:
• -s — Sets the strictness policy of the mirrored logical volume.
• -D — Sets the distributed allocation policy.
• -d — Sets the scheduling policy.
• -C — Sets the contiguous allocation policy.

For more information, see lvchange(1M).


HP recommends that the I/O timeout value of a logical volume having snapshots be set to a larger
value to accommodate the CBW I/Os induced by a write I/O to this logical volume. For more
information, see Changing the attributes of a snapshot logical volume.

Deleting logical volumes on a snapshot tree


To delete snapshot logical volumes from a volume group, use the lvremove command. You can
delete either a single snapshot or a snapshot and all its predecessors using lvremove. Before
removing a logical volume that has snapshots associated with it, you must remove all its snapshot
logical volumes. Ensure that all the snapshots being deleted are closed before issuing the
lvremove command.
When a single snapshot logical volume is deleted, if the snapshot has a predecessor that is not
marked over-committed or inoperative, for all unshare units of the predecessor that share data with
this snapshot, the unshared data of the snapshot is copied to the predecessor. If the predecessor is a
space-efficient snapshot, ensure that sufficient number of extents are pre-allocated to prevent it from
being marked over-committed because of the unshare data copy during snapshot deletion.
For example, you want to delete snapshot S1, and S0 shares data A, C, and D with S1. Of these, S1
shares data A with LV, but has its own copy of C and D, which are referred to as unshared data on
S1. When S1 is deleted, unshare units that contain C and D are copied over to S0, and S0 no longer
shares these units with its new successor LV.

16
Figure 4: Deleting logical volumes on a snapshot tree

A A A

B X B

Y C C

Z D D

LV S1 S0

Deletion of a single snapshot can be a lengthy operation because of the unshare data copy. In
addition, the amount of data that is copied to the predecessor depends on the size of the logical
volume and the amount of data unshared on the logical volume being deleted.
To delete a snapshot and all its predecessors, use the lvremove -F option. Because the snapshot
and all its predecessors are deleted at the end of this operation, the shared data is not copied to the
snapshot predecessor. If the snapshot predecessors do not contain any valuable data or if all the
predecessors have been marked inoperative, HP recommends you use the -F option to delete all the
predecessors. The –F option is ignored if it is specified with the last predecessor on a snapshot tree.
For more information, see lvremove(1M).

Example
To delete all the snapshots of the original logical volume /dev/vg01/lvol1, follow these steps:
1. Identify the predecessor of the original logical volume using the Associated snapshots field of
lvdisplay output of the original logical volume as follows:

# lvdisplay /dev/vg01/lvol1
--- Logical volumes ---
LV Name /dev/vg01/lvol1
VG Name /dev/vg01
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 40
Current LE 10
Allocated PE 10
Stripes 0
Stripe Size (Kbytes) 0
Bad block NONE
Allocation strict
IO Timeout (Seconds) default
Number of Snapshots 3
Associated snapshots /dev/vg01/lvol1_S4
/dev/vg01/lvol1_S3
/dev/vg01/lvol1_S2
In this example, /dev/vg01/lvol1_S4 is the immediate predecessor of the original
logical volume.

17
2. Use the lvremove –F option to delete snapshot /dev/vg01/lvol1_S4 and all its
predecessors as follows:

# lvremove -F /dev/vg01/lvol1_S4
Do you really want to delete the logical volume "/dev/vg01/lvol1_S4"
and all its predecessors (y/n) : y
Logical volume "/dev/vg01/lvol1_S4" and all its predecessors have been
successfully removed.
Volume Group configuration for /dev/vg01 has been saved in
/etc/lvmconf/vg01.conf
If you do not use the –f option, you are asked to confirm the deletion.

Displaying Snapshot Information


The vgdisplay, lvdisplay, pvdisplay, and lvmadm commands are enhanced to display
information about the snapshots. This section lists the new fields that were added to each of these
command outputs. For more information, see vgdisplay(1M), lvdisplay(1M),
pvdisplay(1M), and lvmadm(1M).

lvmadm command
Use the lvmadm -V option to view the new fields (the last three) added for snapshot logical volumes
in Version 2.2 volume groups as follows:
# lvmadm -t -V 2.2
--- LVM Limits ---
VG Version 2.2
Max VG Size (Tbytes) 2048
Max LV Size (Tbytes) 256
Max PV Size (Tbytes) 16
Max VGs 2048
Max LVs 2047
Max PVs 2048
Max Mirrors 5
Max Stripes 511
Max Stripe Size (Kbytes) 262144
Max LXs per LV 33554432
Max PXs per PV 16777216
Max Extent Size (Mbytes) 256
Min Unshare unit(Kbytes) 512
Max Unshare unit(Kbytes) 4096
Max Snapshots per LV 255
vgdisplay command
The following new fields are added to vgdisplay command output for snapshot logical volumes:
• Cur Snapshot LV
Displays the total number of snapshot logical volumes configured in the volume group. Because a
snapshot logical volume is treated as another logical volume, the Cur LV and Open LV fields are
also incremented or decremented when a new snapshot is created or deleted, respectively.

• Unshare unit size (Kbytes)


Displays the size of unshare unit (in kilobytes) configured at the time of volume group creation or
volume group version migration to Version 2.2 or higher.

18
• Current pre-allocated PE
Displays the total number of extents currently pre-allocated to all space-efficient snapshot logical
volumes in the volume group. When extents are picked from the pre-allocated pool of a particular
snapshot to cater to data unsharing or when a space-efficient snapshot is deleted, this value is
decremented. When you use lvextend to increase the pre-allocated pool size of a snapshot
logical volume, this value is incremented.

• Cur Snapshot Capacity


Displays the total capacity of all the snapshots configured in the volume group. Regardless of the
type of snapshot, the capacity of the snapshot is equal to that of original logical volume.

• Max Snapshot Capacity


Displays the maximum snapshot capacity that is allowed in a volume group. This value is equal to
the VG Max Size specified during volume group creation.

In the vgdisplay verbose output, the following new fields are added for snapshot logical volumes:
• Snapshot Status
Indicates the snapshot as operative, inoperative, or over-commit.

• Pre-allocated LE
Displays the total number of extents that have been pre-allocated for a space-efficient snapshot. This
value is incremented when the number of extents in the pre-allocated pool is increased using
lvextend. This field is not displayed for a fully-allocated snapshot.

• Current pre-allocated LE
Displays the number of logical extents currently present in the pre-allocated extents pool. This value
excludes those extents that have already been picked for unsharing. This field is not displayed for a
fully-allocated snapshot.

• Current pre-allocated PE
Displays the number of physical extents corresponding to Current pre-allocated LE and
the number of mirror copies of the space-efficient snapshot. This field is not displayed for a
fully-allocated snapshot.

• Unshared LE
Displays the number of extents of the snapshot logical volume that have been unshared.

In the vgdisplay verbose output, the following new field is added for physical volumes:
• Current pre-allocated PE
Displays the total number of physical extents of the physical volume that are present in the
pre-allocated pool of all the snapshot logical volumes of the volume group. This value represents
those extents that have not yet been picked for unshare.

The following is the vgdisplay output of a Version 2.2 volume group vg01, which has two
snapshot logical volumes. The unshare unit of the volume group is 2 MB and the maximum volume
group capacity is 128 t. Both snapshots are created off an original logical volume of 1 GB size,
therefore the current snapshot capacity in the volume group is shown as 2 GB. The Current
pre-allocated PE shows the total pre-allocated extents of all the snapshot logical volumes in the
volume group.

19
The status of the logical volume specifies the type of snapshot logical volume (space-efficient or fully-
allocated). In this example, both the snapshots are operative. For the space-efficient snapshot, the
pre-allocated LE shows the total number of extents set aside for unsharing (50) and Unshared LE
shows the number of unshared extents (2). The difference between these two values is the number of
extents currently available for unsharing in the pre-allocated pool. This value is shown in
Current pre-allocated LE as 48. The space-efficient snapshot has one mirror copy, so the
Current pre-allocated PE shows the number of physical extents in the pre-allocated pool for all
mirror copies of the snapshot logical volume. For the fully-allocated snapshot, the Unshared LE is 0,
implying that it shares all its data with its successor.
# vgdisplay -v vg01
--- Volume groups ---
VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 2047
Cur LV 3
Open LV 3
Cur Snapshot LV 2
Max PV 2048
Cur PV 2
Act PV 2
Max PE per PV 2097152
VGDA 4
PE Size (Mbytes) 8
Unshare unit size (Kbytes) 2048
Total PE 5048
Alloc PE 356
Current pre-allocated PE 96
Free PE 4692
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 2.2
VG Max Size 128t
VG Max Extents 16777216
Cur Snapshot Capacity 2g
Max Snapshot Capacity 128t

--- Logical volumes ---


LV Name /dev/vg01/lvol1
LV Status available/syncd
LV Size (Mbytes) 1024
Current LE 128
Allocated PE 128
Used PV 1

--- Snapshot logical volumes ---


LV Name /dev/vg01/lvol1_S2
LV Status available/syncd, snapshot,space efficient
Snapshot Status operative
LV Size (Mbytes) 1024
Current LE 128
Allocated PE 4
Pre-allocated LE 50
Current pre-allocated LE 48
Unshared LE 2
Current pre-allocated PE 96
Used PV 2

20
LV Name /dev/vg01/lvol1_S3
LV Status available/syncd, snapshot,fully allocated
Snapshot Status operative
LV Size (Mbytes) 1024
Current LE 128
Allocated PE 128
Unshared LE 0
Used PV 1

--- Physical volumes ---


PV Name /dev/disk/disk15476
PV Status available
Total PE 2524
Free PE 2218
Current pre-allocated PE 48
Autoswitch On
Proactive Polling On

PV Name /dev/disk/disk15820
PV Status available
Total PE 2524
Free PE 2474
Current pre-allocated PE 48
Autoswitch On
Proactive Polling On

pvdisplay command
The following new fields are added in the pvdisplay output for snapshot logical volumes:
• Current pre-allocated PE
Displays the total number of physical extents of the physical volume that are present in the
pre-allocated pool of any of the snapshot logical volumes of the volume group.
• Unshared LE on LV
Represents the number of logical extents of each snapshot logical volume in the volume group that
have been unshared to an extent on this physical volume. This field is displayed in pvdisplay
verbose output in the distribution of physical volumes section.
• pre-allocated status
A new status in the Physical Extents section. Indicates those extents of the physical volume that
are currently present in the pre-allocated pool, but have not been unshared. The snapshot logical
volume to which these extents are mapped is also displayed for each such extent. The logical extent
number is set to NO_LXINDEX to indicate that these extents are not yet mapped to a logical extent,
but have been set aside for a future unshare operation.

The following pvdisplay verbose output shows a physical volume with a total of 48 pre-allocated
extents. The physical volume has its extents mapped to the logical extents of the original logical
volume and both its snapshots. Two physical extents of this physical volume are mapped to unshared
extents of the space-efficient snapshot /dev/vg01/lvol1_S2. No physical extent of the physical
volume is mapped to any unshared extent of the fully-allocated snapshot /dev/vg01/lvol1_S3.
The partial output of the physical extent to logical extent map shows that physical extents 128 and
129 are mapped to unshared logical extents 0 and 1 of the space-efficient snapshot
/dev/vg01/lvol1_S2 and the remaining physical extents from 132 to 177 are pre-allocated.
Because pre-allocated extents are not mapped to any logical extents, the logical extent number is
shown as NO_LXINDEX. Physical extents from 178 to 305 are mapped to the fully-allocated
snapshot; the physical extents that follow are free.

21
# pvdisplay -v /dev/disk/disk15476
--- Physical volumes ---
PV Name /dev/disk/disk15476
VG Name /dev/vg01
PV Status available
Allocatable yes
VGDA 2
Cur LV 3
PE Size (Mbytes) 8
Total PE 2524
Free PE 2218
Current pre-allocated PE 48
Allocated PE 306
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On

--- Distribution of physical volume ---


LV Name LE of LV PE for LV Unshared LE on LV
/dev/vg01/lvol1 128 128 0
/dev/vg01/lvol1_S2 128 128 2
/dev/vg01/lvol1_S3 128 128 0

--- Physical extents ---


PE Status LV LE
00000000 current /dev/vg01/lvol1 00000000
00000001 current /dev/vg01/lvol1 00000001
00000002 current /dev/vg01/lvol1 00000002
.
.
.
00000126 current /dev/vg01/lvol1 00000126
00000127 current /dev/vg01/lvol1 00000127
00000128 current /dev/vg01/lvol1_S2 00000000
00000129 current /dev/vg01/lvol1_S2 00000001
00000130 pre-allocated /dev/vg01/lvol1_S2 NO_LXINDEX
00000131 pre-allocated /dev/vg01/lvol1_S2 NO_LXINDEX
00000132 pre-allocated /dev/vg01/lvol1_S2 NO_LXINDEX
.
.
.
00000176 pre-allocated /dev/vg01/lvol1_S2 NO_LXINDEX
00000177 pre-allocated /dev/vg01/lvol1_S2 NO_LXINDEX
00000178 current /dev/vg01/lvol1_S3 00000000
00000179 current /dev/vg01/lvol1_S3 00000001
.
.
.
00000304 current /dev/vg01/lvol1_S3 00000126
00000305 current /dev/vg01/lvol1_S3 00000127
00000306 free 00000000

22
lvdisplay command
The following new fields are added to the lvdisplay output of a logical volume with snapshots:
• Number of snapshots
Displays the number of snapshots associated with the logical volume. If the logical volume has no
snapshots configured, this value is 0.
• Associated snapshots
Displays a list of all the snapshots associated with this logical volume. The snapshots are listed in
the reverse order of snapshot creation; the oldest snapshot is displayed last in the list and the most
recent snapshot is displayed first in the list.

The following new or modified fields are added to the lvdisplay output of a snapshot
logical volume:
• LV Status
Indicates the type of snapshot logical volume. This is a modified field.
• Snapshot Status
Indicates whether a snapshot is operative, inoperative, or over-commit.
• Pre-allocated LE
Represents the total number of extents that have been pre-allocated for a space-efficient snapshot.
This field is not displayed for a fully-allocated snapshot.
• Current pre-allocated LE
Displays the number of logical extents currently present in the pre-allocated extents pool. This value
excludes those extents that have already been picked for unsharing. This field is not displayed for a
fully-allocated snapshot.
• Current pre-allocated PE
Represents the number of physical extents corresponding to Current pre-allocated LE and the
number of mirror copies of the space-efficient snapshot. This field is not displayed for a fully-
allocated snapshot.
• Unshared LE
Displays the number of extents of the snapshot logical volume that have been unshared.
• Original LV
Displays the name of the original logical volume of which this logical volume is a snapshot.
• Timestamp
Displays the time at which the snapshot was created.
• Unshared LE and unshared PE
In the distribution of logical volumes section, displays the number of unshared logical and physical
extents for each physical volume on which extents of the logical volume are mapped.
• Unshared Logical extents
Displays the mapping of all unshared logical extents to the corresponding physical extents. This
section is not displayed for a fully-allocated snapshot and if a space-efficient snapshot does not
have any unshared extents.
• Pre-allocated extents
Displays the extents that are currently present in the pre-allocated pool of the space-efficient
snapshot. This section is not displayed for a fully-allocated snapshot.
• Shared status
A new status in the Logical Extents section. Indicates the extent shares its data with its successor.
This status is displayed only for fully-allocated snapshots.

23
• Auto pre-allocation
Indicates whether the automatic increase of pre-allocated extents is enabled or not. This is displayed
only for space efficient snapshots beginning with the HP-UX 11i v3 September 2010 Update
release.
• Threshold Percent
Displays the threshold percentage at which increment messages are logged in syslog and the
automatic increase of pre-allocated is triggered. This is displayed only for space efficient snapshots
beginning with the HP-UX 11i v3 September 2010 Update release.

Beginning with the HP-UX 11iv 3 September 2010 Update release, the Distribution of logical
volume section has the following changes:
• It displays only the Unshared LE and Unshared PE fields for space efficient snapshots. In the
HP-UX 11i v3 March 2010 Update release, the LE on PV, PE on PV, Unshared LE, and
Unshared PE fields were displayed for space-efficient and fully-allocated snapshots.
• It is not displayed for a space-efficient snapshot if it does not have any unshared extents.

Example 1: Space-efficient snapshot logical volume


The following lvdisplay verbose output shows a space-efficient snapshot of logical volume
/dev/vg01/lvol1. The snapshot status is operative and it is a mirrored snapshot. It has 50
pre-allocated logical extents, of which two logical extents have been unshared and the rest are
represented by Current pre-allocated LE. The corresponding number of physical extents is
represented by Current pre-allocated PE.
Because the snapshot is mirrored, its unshared extents are mapped to two physical volumes (shown in
the Distribution of logical volume section). The logical extent to physical extent mapping for the
unshared extents is shown in the Unshared Logical extents section. The extents that are pre-
allocated are shown in Pre-allocated extents. For each pre-allocated logical extent of the
snapshot, there are two physical extents because the space-efficient snapshot is mirrored.
# lvdisplay -v /dev/vg01/lvol1_S2
--- Logical volumes ---
LV Name /dev/vg01/lvol1_S2
VG Name /dev/vg01
LV Permission read/write
LV Status available/syncd, snapshot,space efficient
Snapshot Status operative
Mirror copies 1
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 1024
Current LE 128
Allocated PE 4
Stripes 0
Stripe Size (Kbytes) 0
Bad block NONE
Allocation strict
IO Timeout (Seconds) default
Pre-allocated LE 50
Current pre-allocated LE 48
Unshared LE 2
Current pre-allocated PE 96
Original LV /dev/vg01/lvol1
Timestamp Tue Jan 26 17:57:43 2010
Auto Pre-allocation Enabled
Threshold Percent 50

24
--- Distribution of logical volume ---
PV Name Unshared LE Unshared PE
/dev/disk/disk15476 2 2
/dev/disk/disk15820 2 2

--- Unshared Logical extents ---


LE PV1 PE1 Status 1 PV2
PE2 Status 2
00000000 /dev/disk/disk15476 00000128
current /dev/disk/disk15820
00000000 current
00000001 /dev/disk/disk15476 00000129
current /dev/disk/disk15820
00000001 current

--- Pre-allocated extents ---


PV Name1 PE1 PV Name2 PE2
/dev/disk/disk15476 00000130 /dev/disk/disk15820 00000002
/dev/disk/disk15476 00000131 /dev/disk/disk15820 00000003
/dev/disk/disk15476 00000132 /dev/disk/disk15820 00000004
.
.
.

Example 2: Fully allocated snapshot logical volume


The following lvdisplay verbose output shows a fully-allocated snapshot of logical volume
/dev/vg01/lvol1. The logical volume status shows that it is a fully-allocated snapshot that is
operative. There are no unshared extents yet in the logical volume. Because all extents of the snapshot
are shared, the extent status is shown as shared. For an unshared extent, the status displayed
is current.
# lvdisplay -v /dev/vg01/lvol1_S3
--- Logical volumes ---
LV Name /dev/vg01/lvol1_S3
VG Name /dev/vg01
LV Permission read-only
LV Status available/syncd, snapshot,fully allocated
Snapshot Status operative
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 1024
Current LE 128
Allocated PE 128
Stripes 0
Stripe Size (Kbytes) 0
Bad block NONE
Allocation strict
IO Timeout (Seconds) default
Unshared LE 0
Original LV /dev/vg01/lvol1
Timestamp Tue Jan 26 17:57:51 2010

--- Distribution of logical volume ---


PV Name LE on PV PE on PV Unshared LE Unshared PE
/dev/disk/disk15476 128 128 0 0

25
--- Logical extents ---
LE PV1 PE1 Status 1
00000000 /dev/disk/disk15476 00000178 shared
00000001 /dev/disk/disk15476 00000179 shared
00000002 /dev/disk/disk15476 00000180 shared
.
.
.

Importing volume groups with snapshots


A snapshot logical volume in a volume group can have the default name or a user-defined name. The
name of a logical volume in a Version 2.x volume group is stored along with the LVM configuration
information on disk. When a volume group with snapshots is exported and imported without using the
map file containing logical volume names, the snapshot logical volume is created with the default
naming convention. In this case, the list of associated snapshots of the original logical volume is still
displayed using the user-defined snapshot name. This causes inconsistency in the representation of
snapshots because a subsequent lvdisplay of the snapshot using user-defined name will fail. To
retain the user-defined name of the snapshot and ensure proper representation of the snapshots,
HP recommends you use a map file during the vgexport and vgimport operation.
The following example shows a volume group with an original logical volume /dev/vg01/lvol1
and three snapshots. One snapshot has the default name /dev/vg01/lvol1_S4 and the others are
created using user-defined names /dev/vg01/snap1 and /dev/vg01/snap2. This volume group
is exported and imported without using a map file. After the vgimport operation, the snapshots with
the user-defined names are now recreated with the DSF /dev/vg01/lvol1_S2 and
/dev/vg01/lvol1_S3. The list of associated snapshots of original logical volume
/dev/vg01/lvol1 is as follows:
Associated snapshots /dev/vg01/lvol1_S4
/dev/vg01/snap2
/dev/vg01/snap1
Although the first snapshot /dev/vg01/snap1 is recreated as /dev/vg01/lvol1_S2 and the
second snapshot /dev/vg01/snap2 is recreated as /dev/vg01/lvol1_S3, in the previous
output the user-defined names are displayed. If you try to display the logical volume properties of the
snapshot using the user-defined snapshot name, the command fails with the following output:
# lvdisplay /dev/vg01/snap1
lvdisplay: Error: Couldn't stat(2) logical volume "/dev/vg01/snap1".
[Error: No such file or directory]
Usage: lvdisplay
[-F]
[-v [-k]]
LogicalVolumePath ...
The default name of a snapshot has the minor number of the snapshot logical volume. Before
exporting the volume group, if snapshot /dev/vg01/snap1 of the logical volume
/dev/vg01/lvol1 had the minor number 2, after importing the volume group without the map file,
the snapshot device special file is created as /dev/vg01/lvol1_S2. From this new device special
file name, you can interpret that its minor number is 2 and the original logical volume of the snapshot
is /dev/vg01/lvol1. Using this information and the corresponding user-defined name of the
snapshot prior to exporting the volume group, you can recreate the device special file of the snapshot
with the original user-defined name /dev/vg01/snap1.
If you did not store this information before exporting the volume group and if the volume group had
more than one snapshot with a user-defined name before exporting the volume group, you cannot
map the names of snapshot device special files to their original user-defined names. In the previous

26
example, /dev/vg01/snap1 might correspond to /dev/vg01/lvol1_S3 and
/dev/vg01/snap2 might correspond to /dev/vg01/lvol1_S2 or vice-versa. If the original
logical volume also had a user-defined name before exporting the volume group, it is more difficult to
map the new device special files of the snapshot logical volumes with their user-defined names.
To avoid this, generate the map file containing logical volume names during vgexport operation
and use the same map file during the vgimport operation.

Reconfiguring a volume group using vgmodify


Dynamic LUN Expansion (DLE), Dynamic LUN Contraction (DLC), and reprovisioning using
vgmodify is supported for Version 2.2 volume groups even if snapshot logical volumes are a part of
the volume group. However, you cannot change the unshare unit of the volume group using this
command in the HP-UX 11i v3 March 2010 Update release.

Migration of volume group version using vgversion


The vgversion command is enhanced to support migration from Version 1.0, 2.0, and 2.1 volume
groups to Version 2.2 volume groups and migration from Version 2.2 to Version 2.0 and 2.1 volume
groups. A new option -U is introduced to choose the unshare unit while migrating to a Version 2.2
volume group. The supported values are 512 KB, 1024 KB, 2048 KB, and 4096 KB. If you do not
use the –U option when migrating the volume group to Version 2.2, the unshare unit is set to the
default value of 1024 KB. After this value is set, you cannot change it. The unshare unit cannot be
greater than the size of the physical extent of the volume group.
Because the size of metadata required for a Version 2.2 volume group is greater than that of a
Version 2.0 and 2.1 volume groups, more space from each physical volume is used during migration
to Version 2.2 volume groups. A Version 2.2 volume group migration to a previous 2.x version might
free up some extents. To utilize these extents, run vgmodify.
A Version 2.2 volume group supports root, boot, swap, and dump logical volumes. However, the
HP-UX 11i v3 March 2010 Update release, vgversion does not allow the migration of Version 1.0
volume group to Version 2.2 if the volume group contains root, boot, swap, or dump logical volumes.
Migration from a Version 2.2 volume group to a previous 2.x version fails if the volume group has
snapshot logical volumes configured. To migrate to a previous 2.x version, remove the snapshots and
retry the version migration operation.

Examples
• To migrate a Version 1.0 volume group vg01 with some physical volumes and some logical
volumes to a Version 2.2 volume group with an unshare unit 2048 KB, enter the following command:
# vgversion -V 2.2 -U 2048 -v vg01
• If you try to migrate a Version 2.2 volume group vg01 with some snapshot logical volumes to a
previous 2.x version (for example, Version 2.1), the vgversion command fails as follows:
# vgversion -V 2.1 vg01
Performing "vgchange -a y -l -p -s vg01" to collect data
Activated volume group.
Volume group "vg01" has been successfully activated.
vgversion: Error: The specified volume group contains snapshot
logical volumes.
Please delete the snapshot logical volumes for vgversion to proceed.

vgversion: Error: Failed to change the Volume Group version to 2.1


Deactivating Volume Group "vg01"
Volume group "vg01" has been successfully deactivated.
To recover, delete all the snapshot logical volumes and retry version migration.

27
pvmove , vgmove, and lvmove commands
If a physical volume of a Version 2.2 volume group has pre-allocated extents of a space efficient
snapshot mapped to it, you cannot use the pvmove automatic rebalance feature on this physical volume. In
this case, use the pvmove legacy functionality that does not perform the automatic rebalance of extents.
The vgmove operation succeeds even if the physical volumes involved in migration have pre-allocated
extents of a space-efficient snapshot mapped to it.
You cannot use lvmove to migrate extents of a logical volume from one set of physical volumes to
another set of physical volumes belonging to a Version 2.2 volume group if the logical volume is a
space-efficient snapshot and the migration involves moving one or more of its pre-allocated extents.

vgreduce command
You cannot remove a physical volume that has pre-allocated extents from a volume group using the
vgreduce command. For vgreduce to succeed, free up the pre-allocated extents using lvremove
and then run vgreduce.
If you run vgreduce with the -f option on a volume group that has missing physical volumes, and if
any of these physical volumes have pre-allocated extents, vgreduce reports information about these
extents. In this case, free up the pre-allocated extents using lvremove and then re-run vgreduce.

lvsplit and lvmerge commands


You cannot split a mirrored snapshot logical volume, but can split a mirrored original logical volume
with snapshots using lvsplit.
You cannot merge a snapshot logical volume using lvmerge. If either of the logical volume paths
specified to lvmerge is a snapshot logical volume or a logical volume with snapshots, the merge
operation fails.
Although you can split a mirrored original logical volume having snapshots, the split logical volume
cannot be merged back to the original logical volume as long as one of the logical volumes has
snapshots associated with it. To merge the split logical volume back to the original logical volume,
delete the snapshots associated with both the logical volumes (if any) before proceeding with the
merge operation. For more information, see lvsplit(1M) and lvmerge(1M).

vgchange command
Each time the configuration of a volume group changes (with a LVM configuration command), the
configuration backup file is updated automatically, unless disabled by the user explicitly. For a
Version 2.2 volume group with snapshots configured, information related to the data sharing between
a logical volume and its successor and predecessor is also maintained on disk. This information changes
when a write I/O requires data unsharing. However, this change is not updated in the configuration
file of the volume group for each write I/O. When you use this configuration file to restore to a set of
physical volumes, the data sharing information is stale and can cause data corruption.
To prevent this, vgchange is enhanced to automatically take a backup of the configuration file when
a Version 2.2 volume group is deactivated. If you choose to skip the automatic backup of the
configuration file using the –A n option and use this configuration file to restore all the physical
volumes of the volume group, the correctness of data in the snapshot logical volumes cannot be
guaranteed for the reason mentioned previously. Therefore, HP recommends you not bypass the
update to the configuration file during a volume group deactivation to ensure that the latest data
sharing details are saved in the configuration file.
For more information, see vgchange(1M).

28
Configurable location for the volume group configuration file
Because of the increased on-disk metadata size for a Version 2.2 volume group, the configuration file
size can also increase each time a snapshot is created. For more information on the size of
configuration file when snapshots are configured, see Configuration file size
The default location where the configuration file is stored is /etc/lvmconf. The space in the /etc
file system might not be sufficient to store the configuration file of too many Version 2.2 volume
groups with large snapshot capacity and several snapshots configured. To overcome this problem,
you can configure the location of the configuration file with the LVMCONFPATH_NON_BOOT variable
defined in file /etc/lvmrc. To configure the default location for backing up a volume group
configuration for Version 2.2 and above, edit the /etc/lvmrc file and set the variable to the
appropriate location to be used to store the configuration files. After you make this change, all future
configuration backups and restores use this location for Version 2.2 and higher volume groups. This
configuration is applicable only for non-bootable volume groups with Version 2.2 or higher.
For more information, see vgcfgbackup(1M) and vgcfgrestore(1M).

Limitations when using snapshots


When snapshot logical volumes are configured in a volume group, the following limitations to the
normal usage of the logical volumes and the volume group are in the HP-UX 11i v3 March 2010
Update release:
• Activation of a Version 2.2 volume group in shared mode fails if the volume group has snapshot
logical volumes configured.
• You cannot create snapshot logical volumes when the volume group is activated in shared mode.
• You cannot create snapshots off swap and dump logical volumes. You also cannot configure a
logical volume as a swap or dump logical volume if it has snapshots associated.
• You can create only fully allocated snapshots off root and boot logical volumes. You cannot create
space-efficient snapshot of such logical volumes. Also, you cannot configure a logical volume as a
root or boot logical volume if it has space-efficient snapshots associated.
• You cannot configure a snapshot logical volume as a root, boot, swap, or dump logical volume.
• You cannot create a snapshot of a snapshot logical volume.
• You can stripe a snapshot only if the original logical volume is striped. You cannot create a striped
snapshot of a non-striped logical volume, nor can you create a non-striped snapshot of a striped
logical volume.
• The scheduling policy is inherited from the original logical volume; you cannot change it.
• You cannot split a mirrored snapshot logical volume using lvsplit.
• You cannot specify a snapshot logical volume or an original logical volume with snapshots
associated in lvmerge.
• If a physical volume of a Version 2.2 volume group has pre-allocated extents on it, you cannot use
the automatic rebalance feature of pvmove on the physical volume.
• Beginning with the HP-UX 11iv3 September 2010 Update release, you can change the size and
number of mirrors of a logical volume if it has snapshots associated. However, you cannot reduce
the size of such a logical volume if it has at least one space efficient snapshot logical volume
associated with it. In the HP-UX 11iv3 March 2010 Update release, you cannot change the size
and number of mirrors of a logical volume if it has snapshots associated.
• You cannot change the number of mirrors of a snapshot logical volume after the snapshot is created.
• You cannot change the unshare unit of the volume group after it is configured during the volume
group creation.

29
Common use examples
The following examples are based on a Version 2.2 volume group vg01 with an 8 MB extent size
and maximum snapshot capacity of 128 TB and an unshare unit of 4 MB. The volume group has a
logical volume /dev/vg01/lvol1 of size 10 GB, with a file system created on it that has the
following files:
# ll /mnt_lvol1/
total 1070408
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file1
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file2
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file3
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file4
drwxr-xr-x 2 root root 96 Jan 26 16:45 lost+found
1. Create a space efficient snapshot of the logical volume /dev/vg01/lvol1 with 50 pre-allocated
extents as follows:
# lvcreate -S s -l 50 –p w /dev/vg01/lvol1

2. Mount this snapshot logical volume on a file system as follows:


# fsck /dev/vg01/lvol1_S2
# mount /dev/vg01/lvol1_S2 /mnt_S2/
# ll /mnt_S2/
total 1070408
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file1
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file2
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file3
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file4
drwxr-xr-x 2 root root 96 Jan 26 16:45 lost+found
# cmp /mnt_lvol1/file1 /mnt_S2/file1
# cmp /mnt_lvol1/file2 /mnt_S2/file2
# cmp /mnt_lvol1/file3 /mnt_S2/file3
# cmp /mnt_lvol1/file4 /mnt_S2/file4

Note
The contents are the same as that of the original logical volume.

3. Perform a write operation on the original logical volume.


# cp /mnt_lvol1/file1 /mnt_lvol1/file5
# ll /mnt_S2
total 1070408
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file1
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file2
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file3
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file4
drwxr-xr-x 2 root root 96 Jan 26 16:45 lost+found
# ll /mnt_lvol1/
total 1338010
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file1
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file2
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file3
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file4
-rwxrwxrwx 1 root sys 137011480 Jan 26 17:02 file5
drwxr-xr-x 2 root root 96 Jan 26 16:45 lost+found

30
Note
The changes are not reflected in its snapshot. (/mnt_S2 does not
have file5)

4. During the write operation to the original logical volume, ensure that the threshold is not reached
on its space-efficient snapshot. If the threshold is reached, increase the number of extents in the
pre-allocated pool as explained in Extending the pre-allocated extent pool or enable the automatic
increase of pre-allocated extents as explained in Enabling the automatic increase of pre-allocated
extents. Failing to do so can make the space-efficient snapshot over-commit and inoperative.
# lvdisplay /dev/vg01/lvol1_S2
--- Logical volumes ---
LV Name /dev/vg01/lvol1_S2
VG Name /dev/vg01
LV Permission read-only
LV Status available/syncd, snapshot,space efficient
Snapshot Status inoperative/over-commit
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 10240
Current LE 1280
Allocated PE 50
Stripes 0
Stripe Size (Kbytes) 0
Bad block NONE
Allocation strict
IO Timeout (Seconds) default
Pre-allocated LE 50
Current pre-allocated LE 0
Unshared LE 50
Current pre-allocated PE 0
Original LV /dev/vg01/lvol1
Timestamp Tue Jan 26 16:56:37 2010
5. You can neither read from nor write to an inoperative snapshot. You must delete it. Before deleting
a snapshot, unmount the file system (if mounted) as follows:
# umount /mnt_S2/
# lvremove -f /dev/vg01/lvol1_S2
Logical volume "/dev/vg01/lvol1_S2" has been successfully removed.
Volume Group configuration for /dev/vg01 has been saved in
/etc/lvmconf/vg01.conf

Note
When a snapshot becomes inoperative, all its predecessors are
also marked inoperative, if they share data with the snapshot.
In these cases, you can delete all the predecessors using the
lvremove -F option).

31
Recommended practices
The following practices are recommended when Version 2.2 volume groups are configured
with snapshots:
• The size of the configuration file is bigger for Version 2.2 volume groups. Set the location of the
configuration file in the variable LVMCONFPATH_NON_BOOT in the /etc/lvmrc file and ensure
that sufficient space is allocated to this location to hold the large configuration files.
• Based on the type of application, choose the unshare unit based on the guidelines mentioned in
Creating a version 2.2 (or higher) volume group
• Do not override the automatic backup of configuration file done by vgchange.
• When you back up the configuration file of a volume group with snapshots, ensure that there are no
I/Os in progress so that the configuration file has latest sharing information.
• When you use the configuration file of a Version 2.2 volume group with snapshots to restore the
configuration on all available physical volumes of a volume group, ensure that the configuration file
is updated with the data sharing information of the snapshots to prevent data corruption on
the snapshots.
• To ensure correctness of the data in a snapshot logical volume, HP recommends that applications
using the logical volume be quiesced prior to initiating the snapshot creation.
• For logical volumes on a snapshot tree, set the timeout to a larger value to accommodate the CBW
I/Os induced by a write I/O on any logical volume on the snapshot tree. For more information, see
Changing the attributes of a snapshot logical volume
• When you import a volume group with snapshots, to retain the user-defined names of the snapshot
logical volumes, use a map file generated by a corresponding vgexport operation. For more
information, see Importing volume groups with snapshots
• In very low system memory conditions, deletion of a single snapshot can hang indefinitely for
memory to become available. Ensure that sufficient memory is available during deletion of a single
snapshot that requires data to be copied to its predecessor. If the lvremove command hangs in these
cases, increase the system memory or free some existing system memory to proceed with the snapshot
deletion.
• To restore data on the original logical volume, if you copy the entire contents of its space-efficient
snapshot, the shared data on the space-efficient snapshot is unshared. Before performing the data
restore, ensure that enough extents are pre-allocated to the space efficient snapshot or selectively
copy only the unshared data of the snapshot to its original logical volume. Alternatively, if you want
to restore the entire contents of the snapshot to its original logical volume, use a fully-
allocated snapshot.

Error messages
When snapshots are configured, under certain conditions, you might see the following
error messages:
• Error: Exceeds the maximum supported snapshot capacity (4194304 MB)
for the specified volume group /dev/vg01.
During snapshot creation, lvcreate reports that the creation of a new snapshot for the specified
original logical volume cannot be performed as the resulting current snapshot capacity will exceed
the maximum supported snapshot capacity for this volume group. This can occur when the size of
the logical volume for which the snapshot creation is requested is more than the total snapshot
capacity remaining in the volume group. Use vgmodify to increase the maximum volume group

32
size, which increases the maximum snapshot capacity to an equivalent value, or delete any of the
snapshots that are not needed or in use.

• Warning: The pre-allocated extents could not be allocated for


space efficient snapshot "/dev/vg01/lvol1_S2".
Any future writes to successor of this snapshot logical
volume will mark this snapshot and all its predecessor
as inoperative.
During the volume group activation, vgchange reports that the pre-allocated extents cannot be
allocated for a space efficient snapshot because of the lack of free extents in the volume group
satisfying the snapshot allocation policy. This results in marking this snapshot and all its
predecessors as inoperative if any new writes are performed to its successor. This can occur when a
few of the physical volumes belonging to this volume group are unavailable during volume group
activation or when enough free physical extents are not available in the volume group. Add
physical volumes to the volume group using vgextend; make the unavailable physical volumes
available; or for mirrored space-efficient snapshots, if this error occurred because of the strictness
policy of mirroring, you might consider choosing a lesser strictness policy for the snapshot. Then,
deactivate and activate the volume group before using the space efficient snapshot or its successor.

• Warning: The space efficient snapshot "/dev/vg01/lvol1_S2"


has been marked as read-only.
During the volume group activation, vgchange reports that the space-efficient snapshot has been
marked as read-only. This can happen when the pre-allocated extents cannot be allocated for the
space efficient snapshot during volume group activation. This warning is displayed after the
previous warning message. After the previous warning is handled, you will no longer see
this warning.

• Warning: Deletion of a snapshot can result in its unshared data being


copied to its predecessor. If the predecessor is a space-efficient
snapshot, ensure that it has sufficient number of pre-allocated extents
so that the data unsharing doesn't result in the predecessor being
marked as inoperative.
When a single snapshot logical volume is deleted, if the snapshot has a predecessor that is not
marked over-commit or inoperative, for all unshare units of the predecessor that share data with this
snapshot, only the unshared data of the snapshot is copied to the predecessor. If the predecessor is
a space-efficient snapshot that contains useful information, ensure that sufficient number of extents
are pre-allocated to prevent it from being marked over-commit due the unshare data copy during
snapshot deletion. Using the lvdisplay on the snapshot being deleted, you can determine the
maximum number of extents that are required on the predecessor.

• LVM: WARNING: Snapshot LV (VG 128 0x000000, LV Number: 6) threshold


value reached. Please increase the number of pre-allocated extents for
this snapshot LV
This message in the syslog reports that the particular space efficient snapshot has reached its
threshold number of pre-allocated extents. This can occur when writes happening on either the
space-efficient snapshot or its successor logical volume on the snapshot tree has used up most of the
extents in the pre-allocated extent pool. Increase the number of pre-allocated extents for this space-
efficient snapshot to prevent it from becoming in-operative.

• Error: The specified logical volume "/dev/vg01/lvol1_S2" is


inoperative.
pvmove cannot be performed on logical volumes that are inoperative.

33
The pvmove operation fails if the logical volumes specified are inoperative or if the physical
volumes specified contain logical volumes that are inoperative. Delete all such inoperative snapshot
logical volumes that have caused the pvmove operation to fail and retry.

• Error: The specified logical volume "/dev/vg01/lvol1_S2" is


inoperative.
lvextend cannot be performed on logical volumes that are
inoperative.
Increasing the number of pre-allocated extents of an inoperative space-efficient snapshot logical
volume using lvextend failed. A snapshot logical volume is of no use because read and write
I/Os to the snapshot fail and it is no longer a point-in-time image of the original LV. Delete all such
inoperative snapshot logical volumes.
• Cannot find a free physical extent for pre-allocated extent
of logical volume "/dev/vg01/lvol1_S2".
If no free physical extent is found for a pre-allocated extent of a space-efficient snapshot logical
volume, pvmove fails. Add a physical volume to the volume group or free up extents to create free
user extents that pvmove can use, based on the allocation policy of the snapshot logical volume.
• Space worth 5 extents will be freed from the Physical Volume
"/dev/disk/disk4" during the conversion. Please run vgmodify(1M) to
utilize the freed up space.
The on-disk metadata space required for a volume group with Version 2.2 is greater than that
required for a volume group with Version 2.0 or 2.1. During conversion from a Version 2.2 volume
group to a Version 2.1 or 2.0 volume group (using vgversion), some metadata space is freed
up, which you can use by running vgmodify.
• The size of the volume group has been increased to 4194304m during
conversion in order to include the unused space on the physical volumes
present in the volume group.
During conversion from a Version 1.0 volume group to a Version 2.x volume group (using
vgversion), the maximum size of the volume group is increased, taking into account all the
unused space on the physical volumes present in the volume group.

• Error: The Logical Volume "/dev/vg01/lvol1_S2" has pre-allocated


extents associated with it. Automatic re-balance operation is not
supported for the logical volumes having pre-allocated extents.
If a logical volume has pre-allocated extents associated, the automatic rebalance operation using
pvmove is not supported. Use pvmove without the rebalance option to move extents of the
logical volume.

• Error: The Physical Volume "/dev/disk/disk4" has pre-allocated


extents associated with it. Automatic re-balance operation is not
supported on physical volumes having pre-allocated extents.
If a physical volume has pre-allocated extents associated, the automatic rebalance operation using
pvmove is not supported. Use pvmove without the rebalance option to move extents of the
physical volume.

• Warning: The volume group configuration for volume group "/dev/vg01" has
not been backed up. If the existing configuration backup file is
restored on to all the physical volumes, then, the data contained in the
logical volumes may be corrupt after the next activation. It is
recommended that the volume group be deactivated only after the volume
group configuration is backed up successfully.

34
If a Version 2.2 volume group is deactivated using the vgchange –A n option to skip the
automatic backup of configuration file, this warning is displayed. If the Version 2.2 volume group
contains snapshots, HP recommends that you deactivate the volume group after backing the
configuration file. Do not use the vgchange –A n option if you want to back up the configuration
file before deactivating the volume group.

• The automatic increase of pre-allocated extents has been disabled since


lvmpud is not running. Please start the lvmpud daemon and enable the
feature using lvchange command.
The automatic increase of pre-allocated extents feature cannot be enabled if lvmpud is not running
on the system. Start the lvmpud daemon and then enable the feature.

Performance numbers
With the HP-UX 11i v3 March 2010 Update release, there is no performance degradation for read
and write I/Os on a logical volume that has no snapshots associated with it. Also, when a snapshot is
created, the read I/O performance on the original logical volume does not show any degradation.

Read performance
When snapshots are involved, the performance of read I/Os on the snapshot logical volume has the
following performance degradation:
• Raw random read I/Os on snapshot logical volumes have an average performance degradation of
5%. When the original logical volume and the snapshot are striped, expect up to a 5 to 6%
performance degradation.
• Raw sequential read I/Os on snapshot logical volumes have an average performance degradation
of 15%. When the original logical volume and the snapshot are striped, expect up to a 25%
performance degradation.
• Block random read I/Os on snapshot logical volumes have an average performance degradation
of 1%. When the original logical volume and the snapshot are striped, expect up to a 6%
performance degradation.
• Block sequential read I/Os on snapshot logical volumes have an average performance degradation
of 1%. When the original logical volume and the snapshot are striped, expect up to an 8%
performance degradation.

Note
Over time, as more and more data is unshared between the original logical
volume and its snapshots, the performance degradation of read I/Os
gradually reduces.

35
Write performance
Performance of the first write I/O on a shared region of a logical volume with a snapshot is low
compared to that of a logical volume without snapshots or a logical volume with a single mirror copy.
This is because the write I/O requires data to be unshared on the predecessor of the original logical
volume. Over a period of time, as the snapshot data is unshared, write I/O performance on the
logical volume with a snapshot reaches that of a logical volume with one mirror and finally nears that
of a logical volume with no mirrors or snapshots.

Note
A logical volume with no mirror copies has better write performance when
compared to that of a logical volume with one or more mirror copies.

The following table shows the results of a performance test of write I/Os on a 1000 GB logical
volume when it has no mirrors, when it has one mirror copy, and when it has a snapshot associated.

Raw random write Raw sequential Block random Block sequential


I/O response time write I/O response write I/O response write I/O response
Scenario (msec) time (msec) time (msec) time (msec)

LV with no mirror 0.207 0.192 0.012 0.166

LV with 1 mirror 0.834 0.228 0.012 0.171

LV with snapshot: write attempt 1 63.752 0.249 0.012 0.167

LV with snapshot: write attempt 2 31.79 0.2 0.012 0.166

LV with snapshot: write attempt 3 21.115 0.203 0.012 0.164

LV with snapshot: write attempt 4 15.832 0.205 0.012 0.162

LV with snapshot: write attempt 5 2.715 0.204 0.012 0.165

LV with snapshot: write attempt 6 0.215 0.204 0.012 0.166

Note
The tests were run on a volume group with a maximum volume
group capacity of 128 TB, 4 MB extent size, 1 MB unshare unit,
and 8 KB chunks of write I/Os were issued.

In case of raw random and raw sequential write I/O, the write performance on the first attempt is low
compared to that of a non-mirrored or mirrored logical volume with no snapshots. As more data is
unshared over a period of time, the response time of the write I/O on the logical volume with
snapshot associated with it improves and nears the performance on the mirrored logical volume and
then equals the performance on the non-mirrored logical volume. In case of block random and
sequential write I/O, the performance degradation is very low and almost negligible.
The following graphs show the performance (in terms of response time) of 8 KB and 2048 KB random
raw write I/Os on a logical volume with no mirrors, with a single mirror, and with a single snapshot.
The volume group has a 4 MB extent size and 1 MB unshare unit.

36
Figure 5: Raw random 8 KB Write I/Os

Figure 6: Raw random 2 MB Write I/Os

37
The first instance of a write to the logical volume with snapshot takes more time and over a period of
time, the time taken equals to that of a mirrored logical volume with no snapshots, and then reduces
to that of a non-mirrored logical volume with no snapshots.

Configuration file size


Because of the increased metadata size for a Version 2.2 volume group, the configuration file size
increases each time a snapshot is created. When the volume has no snapshot logical volumes, the
size of the configuration file is comparable to that of a Version 2.0 or 2.1 volume group of the same
configuration. When a snapshot is created, information related to the snapshot and its data sharing
relationship is stored in the configuration file, which increases the size of the configuration file.
The increase in size is different for a space-efficient snapshot and a fully allocated snapshot for the
same snapshot capacity. For a space-efficient snapshot, this increase in size depends on the snapshot
capacity. For a fully-allocated snapshot, this increase in size depends on the snapshot capacity and
the extent size.
The following table summarizes the average increase in the size of the configuration file for
each1000 GB of snapshot capacity (for a fully allocated snapshot, the increase is given for two
different extent sizes).

Avg. increase in Avg. increase in Avg. increase in


configuration file size for a configuration file size for a configuration file size for a
space efficient snapshot fully allocated snapshot with fully allocated snapshot with
Unshare unit (in KB) (in KB) 8 MB extent size(in KB) 32 MB extent size(in KB)

512 252.9 1253.5 503.2

1024 126.3 1125.5 375.2

2048 64.4 1065.5 315.2

4096 32.7 1033.5 283.2

The increase in size of the configuration file is less for a space-efficient snapshot creation because at
the point of snapshot creation, entire data is shared with the original logical volume and no physical
extents are set aside on disk for the snapshot. Over time, as unsharing of a space efficient snapshot
progresses, the snapshot gets its own copy of data and the extent mapping on disk is updated to
include the new physical extents. When the entire space-efficient snapshot is unshared, the increase in
size of configuration file is equivalent to the size of a fully-allocated snapshot of similar configuration.
The configuration file does not get updated automatically after each data unshare operation. So the
increase is the file size is seen only when the configuration file is backed up explicitly using
vgcfgbackup or during a configuration change that takes automatic backup of the file. If you
choose to compress the configuration file to reduce the file size, a subsequent configuration operation
that performs automatic backup of the configuration file recreates the file (uncompressed file).

Note
When you back up the configuration file of a volume group with snapshots,
ensure that there are no I/Os in progress so that the configuration file has
the latest sharing information.

38
For more information
To learn more about LVM and HP-UX system administration, see the following documents on the
HP Business Support Center at: http://www.hp.com/go/hpux-LVM-VxVM-docs
• HP-UX System Administrator's Guide: Logical Volume Management
• HP-UX Logical Volume Manager and MirrorDisk/UX Release Notes
• LVM White Papers (the Release Notes lists all white papers)

Feedback
Please give your comments about this white paper, or suggestions for LVM or related documentation,
through our technical documentation feedback portal:
http://www.hp.com/bizsupport/feedback/ww/webfeedback.html

Share with colleagues

© Copyright 2010 Hewlett-Packard Development Company, L.P. The information contained herein is subject to
change without notice. The only warranties for HP products and services are set forth in the express warranty
statements accompanying such products and services. Nothing herein should be construed as constituting an
additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.

5900-1056, September 2010

You might also like