Online LUN Vgmodify WP Modified Final
Online LUN Vgmodify WP Modified Final
vgmodify
Abstract.............................................................................................................................................. 3
Introduction......................................................................................................................................... 4
Overview............................................................................................................................................ 4
What can vgmodify do for me? ......................................................................................................... 4
When would I want to use vgmodify?................................................................................................. 4
Section I: Offline vgmodify.................................................................................................................... 4
Prerequisites .................................................................................................................................... 5
Increasing the range of values vgmodify provides ................................................................................ 5
Details ............................................................................................................................................ 5
Changing disk type (boot/non-boot) and impact of boot disks ........................................................... 6
Dynamic LUN expansion (DLE) and LUN contraction......................................................................... 6
Physical extent renumbering (-n option) and pvmove enhancement ..................................................... 7
How the volume group parameter settings affect the metadata size .................................................... 7
Configuration backup files, restore script and vgcfgrestore changes ................................................... 7
Making better use of the alternate bad block pool space................................................................... 8
Optimization of max_pv and max_pe values ................................................................................... 8
Guidance on choosing the max_pv and max_pe values .................................................................... 9
Typical procedure for using vgmodify ................................................................................................. 9
Common usage examples ............................................................................................................... 10
Increasing max number of physical volumes and accommodating larger disks – without PE renumbering11
Increasing max number of physical volumes and accommodating larger disks – with PE renumbering .. 14
Changing a bootable disk to non-bootable.................................................................................... 18
Optimizing the metadata space ................................................................................................... 22
Handling dynamic LUN expansion and configurations where not all the disk space can be allocated... 24
Section II : Online vgmodify ................................................................................................................ 29
Prerequisites .................................................................................................................................. 29
Details .......................................................................................................................................... 29
Typical procedure for using online DLE ............................................................................................. 30
Common usage examples ............................................................................................................... 32
Determining the right size to which a physical volume should be expanded ...................................... 32
Determining candidate physical volumes for online dynamic LUN expansion ..................................... 35
Handling online dynamic LUN expansion where all of the additional disk space can be allocated....... 36
Handling online dynamic LUN expansion where some of the additional disk space can be allocated... 38
Handling online dynamic LUN expansion where none of the additional disk space can be allocated ... 40
LVM vgmodify Messages .................................................................................................................... 41
vgmodify(1M)................................................................................................................................ 41
For More Information ......................................................................................................................... 43
Call to action .................................................................................................................................... 43
Abstract
The Logical Volume Manager (LVM) vgmodify command enables you to change attributes that
previously were fixed at creation time (for example, increasing the maximum number of physical
volumes or the maximum number of extents). It also enables you to resize disks (Dynamic LUN
Expansion or DLE), a feature commonly provided by disk arrays. This paper explains the benefits of
vgmodify and how to use it.
The vgmodify command interface is available on HP-UX 11i v2 with the PHCO_35524 patch and
11i v3.
Introduction
LVM and MirrorDisk/UX now support more than one version of volume groups. Version 1.0 is the
version supported on all current and previous versions of HP-UX 11i. Versions 2.x (currently 2.0 and
2.1) volume groups are supported starting with the March 2008 update to HP-UX 11i v3 release.
The vgmodify command is currently supported only on Version 1.0 volume groups.
For further details on the newly supported volume group versions, see the “LVM Version 2.0 Volume
Groups in HP-UX 11i v3” whitepaper.
Overview
What can vgmodify do for me?
The new vgmodify command enables you to alter some characteristics of an existing Volume Group
(VG) or Physical Volume (PV) that were set with vgcreate or pvcreate. These modifiable
attributes are the maximum number of PVs, the maximum number of Logical Volumes (LVs), the
maximum number of extents per PV allowed in the VG, and whether a PV is to be bootable or not.
The vgmodify command handles the expansion (DLE) and contraction of a LUN.
Before the introduction of vgmodify, all these operations required the data in the volume group to
be backed up and the volume group destroyed, or physical volume removed, before rebuilding and
reloading the data.
You can use the vgmodify command in two modes: online vgmodify (when the volume group is
active and offline vgmodify (when the volume group is deactivated.
Offline vgmodify enables you to change the characteristics of a volume group and handles expansion
of a LUN. Currently, online vgmodify only handles LUN expansion. Sections I and II discuss offline
and online vgmodify, respectively.
Example: VG has LVs 1, 2, and 3 on PVs 0 and 1. LVs 4, 5, and 6 on PVs 2, 3, 4, and 5.
# vgchange -a n VG
# vgexport -m MAP VG
# vgchgid PV2 PV3 PV4 PV5
# mkdir /dev/VG; mknod /dev/VG/group c 64 0xnn0000
# Where nn is the original volume group number.
# mkdir /dev/new_VG; mknod /dev/new_VG/group c 64 0xmm0000
# Where mm is the new volume group number.
# vgimport -m MAP /dev/VG PV0 PV1
# vgimport -m MAP /dev/new_VG PV2 PV3 PV4 PV5
# vgchange -a y -q n VG; vgchange -a y new_VG
# lvremove -f VG/LV4 VG/LV5 VG/LV6 new_VG/LV1 new_VG/LV2 new_VG/LV3
# vgreduce -f VG; vgreduce -f new_VG
# vgcfgbackup VG; vgcfgbackup new_VG
On completion, VG holds three LVs (1, 2, and 3) with PVs 0 and 1. While new_VG holds three LVs
(4, 5, and 6) across PVs 2, 3, 4, and 5.
Remember to change any name references to the new volume group (for example, if the old LV4 is
recorded in /etc/fstab it must be changed to /dev/new_VG/LV4).
Details
The vgmodify command is invoked in one of three modes: table, review, or change:
• Table mode. A table (-t) of possible settings are displayed.
• Review mode. A review (-r) is performed that the new settings, based upon the other
arguments, can be successfully applied.
• Change mode. New settings are applied to the volume group.
Changing the volume group parameters affects the size of the LVM metadata. An area at the front of
each physical volume is reserved to hold the LVM metadata. The vgmodify command can expand the
LVM metadata if space before the first physical extent is available. It is also possible for vgmodify to
utilize (where the -n option is used) the first physical extent, if free, for LVM metadata.
Where the options require it (change mode and changes are required), vgmodify builds a new
configuration backup file based upon the new layout. The vgmodify command then invokes
vgcfgrestore to apply this configuration to all of the physical volumes.
LUN contraction is supported only on 11i v2, not on11i v3. In 11i v3, if a LUN contraction event is
received, LVM makes the physical volume unavailable.
• Every time vgmodify is run it automatically obtains the current disk size and compares this
with the size known to LVM. No additional options are required to handle a DLE event.
• If pvcreate was originally run with –s and a lower disk size value, vgmodify adjusts the
setting to match its actual size.
• DLE might require that the max_pe value is increased so that all the space can be allocated to
physical extents. This can be achieved by including the –e option and an increased max_pe
setting.
• Before contracting a physical volume make certain the space being reduced is not associated
with allocated extents. Note: LUN contraction is not supported on 11i v3.
• The vgmodify command performs a physical volume size reduction only if the space being
removed is held in extents that are free. If the extents are in use vgmodify reports this
condition and exits without making changes. To overcome this problem, increase the physical
volume back to its original size (where possible) and then the extents in use made free before
again reducing the size of the disk. Where it is not possible to increase the size of the
physical volume, the extents associated with the device must be made free via lvreduce –k
or lvremove. Note: LUN contraction is not supported on 11i v3.
An enhancement to the pvmove command enables you to move the contents of physical extent zero
thereby making it free.
A subsequent vgmodify command can reallocate an unused physical extent zero for metadata use.
A consequence of this is that physical extents are renumbered lower (the old physical extent one
becoming new physical extent zero). Logical extent numbering remains unchanged.
If the specified volume group parameters are sufficiently smaller than the existing settings, it is
possible that the new VGRA is small enough to allow metadata space to be returned to physical
extent space. When this occurs, physical extents are renumbered higher (space that was partially
metadata now holding the new physical extent zero (automatically marked free) and the old physical
extent zero becoming new physical extent one). Logical extent numbering remains unchanged.
Where a configuration permits both higher and lower renumbering (for example all physical extents
free on all physical volumes in the volume group), vgmodify favors renumbering higher.
How the volume group parameter settings affect the metadata size
The choice of volume group settings is affected by the LVM metadata size. While the max_lv setting
has only a small impact on the VGRA size (by default vgcreate has already set max_lv to the
maximum possible value), the max_pv and max_pe settings are a major factor. As a general rule, if
you reduce either the max_pe or max_pv values, you can increase the other (max_pe or max_pv). As
a helpful approximation, halving one (max_pe or max_pv) allows the doubling of the other. For
example, if you halve max_pe, you can approximately double max_pv.
• Each time vgmodify is used a new set of configuration backup file are created. This is done
each time to ensure it is using the most up-to-date configuration details.
• Unless being run in review (-r) or table (-t) mode, vgmodify uses vgcfgrestore to
apply the configuration to all the physical volumes. If the operation does not fully complete
(for example, it is interrupted by a system crash), you can perform a manual restoration. To
simplify a recovery, vgmodify creates a <vg_name>_restore script under /etc/lvmconf.
The vgmodify command does not use this shell script. It is only provided for manual
restoration to all physical volumes, taking into account any alternate paths.
With the introduction of vgmodify, the configuration files for a specific volume group might have
different parameters. The vgcfgrestore command is enhanced and now offers a –v option, which
is only applicable with –l, to additionally report from the configuration backup file:
After vgmodify has performed a modification, you must remove all old configuration backup files.
However, if some remain and a restore is to be performed, use extreme care in using older
configuration files. Issue a vgcfgrestore –vl on the file and verify the values match the current
configuration. Compare the output of vgcfgrestore –vl on the two files. If the max_pv, max_pe,
or max_lv values differ, use the output of vgdisplay to validate which set is current. If the size of a
PV is different, use diskinfo on the raw device to check the current size. Manually remove old
lvmconf files that hold out of date information.
Example output:
• With -v
# vgcfgrestore -vl -n vg01
Volume Group Configuration information in "/etc/lvmconf/vg01.conf"
VG Name /dev/vg01
---- Physical volumes : 2 ----
PV Type Size (kb) Start (kb) PVkey
c3t1d0 Non-Boot 1000000 1024 0
c2t1d0 Non-Boot 1000000 1024 0
• Without -v
# vgcfgrestore -l -n vg01
Volume Group Configuration information in "/etc/lvmconf/vg01.conf"
VG Name /dev/vg01
---- Physical volumes : 2 ----
/dev/rdsk/c3t1d0 (Non-bootable)
/dev/rdsk/c2t1d0 (Non-bootable)
The values displayed in the –t output are not a complete set of all possible choices but instead are
the optimal ones. For instance if the output shows two adjacent lines:
You can apply a max_pv of 36, 37, or 38 to the volume group, but the highest max_pe for all of
these is the same as for 39 (2300). Similarly, you can use a max_pe between 2557 and 2299, but
the highest max_pv is 39. In reality, with a max_pv of 39, the max_pe can range from the highest
physical extent in use on any physical volume in the volume group to 2300. With a max_pe of 2300,
the max_pv can range from the number of physical volumes currently part of the volume group to 39.
Therefore, –t output shows the optimal values, not the complete list. Or to put it another way the most
sensible set of values to use.
The –o option instructs vgmodify to use the highest optimal max_pv and max_pe values. This option
is most commonly used on volume groups that have not been modified by vgmodify and where the
user has no specific need to change any value. It is asking vgmodify to make best use of the
metadata space.
When adjusting sizes of an existing or creating a new volume group, picking max_pv and max_pe
has some side effects on the overall volume group configuration. It is best to provision for growth as
best as possible. In general, the larger the extent size (this is the one parameter vgmodify cannot
alter) the larger the volume group can grow. The following are some guidelines.
• From the table mode (the –t option), you can see how max_pv, max_pe, and disk size can
be tuned for your specific needs or growth plans.
• If you have plans to increase the number of physical volumes in the volume group, use the
disk size and max_pv columns from the ‘-t’ table to determine the max_pv setting. You must
review the Logical Volume Management “Configuring for performance section” in the HP-UX
Administrator's Guide for guidance on the number of volume groups. In general, try to keep
the number of physical volumes to a minimum to improve performance.
• If you have plans to increase the largest size of disk in the volume group, use the max_pv and
max_pe columns from the ‘–t’ table to determine the size that best meets your needs.
• Choose a setting from the ‘-t’ table that gives an adequate number of physical volumes of
the largest size required.
• Physical extent renumbering enables more flexibility for picking max_pv and max_pe. If the
‘-t’ table does not provide suitable values, check the ‘-tn’ table.
4. During a maintenance window, deactivate the volume group (for the root VG boot the volume
group into maintenance mode), make it cluster unaware (if necessary), and run vgmodify to
apply the new settings.
1. In this example we want to place a disk that is 20 GB in size and increase the number of
physical volumes to at least 20.
Table mode displays the current settings, including the current VGRA size. The –v argument
shows the amount of space for the VGRA on each of the physical volumes. The summary
shows that you can increase the VGRA to 896 KB without using the –n argument or 4096 KB
(the PE size) with –n. The list of settings is based upon a VGRA no greater than 896 KB in
size.
2. There are two optimal settings that allow an 20 GB disk to be part of the volume group with
at least 20 physical volumes. The following example uses a max_pv of 21.
The review mode (-r) displays the current and new settings for comparison. The program
completes before making any changes.
4. Apply the changes using the same vgmodify arguments but without –r.
# vgmodify -v -p 21 -e 5116 vg02
Performing "vgchange -a y -l -p -s vg02" to collect data
Activated volume group
Volume group "vg02" has been successfully activated.
Volume Group configuration for /dev/vg02 has been saved in
/etc/lvmconf/vg02.conf
Deactivating Volume Group "vg02"
Volume group "vg02" has been successfully deactivated.
Almost all the initial output is identical to that for –r. The underlined text is only applicable
when a change is being made. Note the program reports whether the VG.conf or
VG.conf.old contains the new or old layout at various stages (useful if it is interrupted).
# vgchange –a y -s vg02
Volume group "vg02" has been successfully changed.
# vgdisplay vg02
--- Volume groups ---
VG Name /dev/vg02
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 1
Max PV 21
Cur PV 2
Act PV 2
Max PE per PV 5116
VGDA 4
PE Size (Mbytes) 4
Total PE 2046
Alloc PE 1800
Free PE 246
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 429744m
VG Max Extents 107436
Note the Max PE per PV and Max PV settings match the requested setting.
Increasing max number of physical volumes and accommodating larger disks – with
PE renumbering
Using vgmodify -t, select the entry from the tables that meets the requirement for the maximum disk
size with an adequate number of physical volumes. If you cannot achieve the number of physical
volumes you require, use the ‘-tn’ option on vgmodify. If you are using a setting from the –tn table
and this requires physical extent renumbering lower, run vgmodify –tnv and check that no disks
need the first physical extent to be made free. If they do, free up this extent on each disk using
pvmove, lvreduce, or lvremove. Run vgmodify –r –e max_pe –p max_pv <vgname>,
where max_pe and max_pv are the chosen values. Finally, when a maintenance window is available,
deactivate the volume group and run vgmodify with the same options as before but without –r.
1. In this example we want to place a disk that is 80 GB in size and increase the number of
physical volumes to at least 20.
Note without –n that we can only place 13 disks of the required size or greater into the
volume group. Also that the summary shows that with –n you can handle a larger VGRA so
using –n is beneficial.
# vgmodify -tnv vg01
Volume Group configuration for /dev/vg01 has been saved in
/etc/lvmconf/vg01.conf
With –n we can place up to 24 disks of 81 GB in size, but we must free up the first extent on
four disks. The need was for at least 20 disks so any entries between the 20 and 24 range
will suffice. The example uses 24.
2. Free up the first extent on all four disks – note: keeping the extent on the same disk.
Note that all four disks that the first extent will be moved on are reported as having PEs
renumbered lower.
# vgchange -a n vg01
Volume group "vg01" has been successfully changed.
5. Change mode.
# vgchange –a y -s vg01
Activated volume group
Volume group "vg01" has been successfully changed.
# vgdisplay vg01
--- Volume groups ---
VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 1
Max PV 24
Cur PV 4
Act PV 4
Max PE per PV 20988
VGDA 8
PE Size (Mbytes) 4
Total PE 69456
Alloc PE 16
Free PE 69440
Total PVG 1
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 2014848m
VG Max Extents 503712
Changing a bootable disk to non-bootable
Table mode
Run the following three commands:
vgmodify –B n –n –t <vgname> <PV to convert> (with–n).
vgmodify –B n –t <vgname> <PV to convert> (without –n).
vgmodify –B n –o –r <vgname> <PV to convert>.
Select the entry from the output of the three commands that meets the requirements. If using a setting
from the –tn table and this requires physical extent renumbering lower, run vgmodify –B n –tnv
<vgname> <PV to convert> and check that no disks need the first physical extent to be made
free. If they do, free-up this extent on each disk using pvmove, lvreduce, or lvremove.
Review mode
Run vgmodify –B n –r –e max_pe –p max_pv <vgname> <PV to convert>, where
max_pe and max_pv are the chosen values.
Change mode
Finally, when a maintenance window is available, deactivate the volume group and run vgmodify
with the same options as before but without –r or, if using the –o settings, -B n –o <vg name>
<PV to convert>.
1. First run table mode and note whether there are any bootable disks reported.
Note that the space for the VGRA on c1t0d0 is 768 KB regardless of whether –n is used or
not. This is expected for a bootable disk. Note how this affects the summary and is limiting
both –n and non –n sizes.
2. Table mode with the bootable disk now made non-boot.
5. Change mode.
# vgchange -a y -s vg02
Activated volume group
Volume group "vg02" has been successfully changed.
7. Verify settings.
# vgdisplay vg02
--- Volume groups ---
VG Name /dev/vg02
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 1
Max PV 42
Cur PV 2
Act PV 2
Max PE per PV 2556
VGDA 4
PE Size (Mbytes) 4
Total PE 2046
Alloc PE 1
Free PE 2045
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 429408m
VG Max Extents 107352
# vgcfgrestore -l -n vg02
Volume Group Configuration information in "/etc/lvmconf/vg02.conf"
VG Name /dev/vg02
---- Physical volumes : 2 ----
/dev/rdsk/c0t0d0 (Non-bootable)
/dev/rdsk/c1t0d0 (Non-bootable)
Optimizing the metadata space
Run vgmodify –r –o <vgname>. If the command reports an update to the volume group is required,
during a maintenance window, deactivate it and run vgmodify –o <vgname>.
1. Run vgmodify.
# vgmodify -r -o vg05
Current Volume Group settings:
Max LV 255
Max PV 16
Max PE per PV 1023
PE Size (Mbytes) 4
VGRA Size (Kbytes) 208
New configuration requires "max_pes" are increased from 1023 to
6652
The current and new Volume Group parameters differ.
An update to the Volume Group IS required
Using –o increases the max_pes from 1023 to 6652 as the VGRA size is increased from
208 to 896 KB.
# vgchange -a n vg05
Volume group "vg05" has been successfully changed.
# vgchange -a y -s vg05
Activated volume group
Volume group "vg05" has been successfully changed.
# vgdisplay vg05
--- Volume groups ---
VG Name /dev/vg05
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 0
Open LV 1
Max PV 16
Cur PV 2
Act PV 2
Max PE per PV 6652
VGDA 4
PE Size (Mbytes) 4
Total PE 2046
Alloc PE 0
Free PE 2046
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 425728m
VG Max Extents 106432
Handling dynamic LUN expansion and configurations where not all the disk space
can be allocated
Run vgmodify –v –r <vgname>. Any disks that have been resized since pvcreate was run on
them are reported as follows:
/dev/rdsk/c0t0d0" size changed from 16777216 to 100000000kb
Also note if there messages telling you there is insufficient space to allocate all the disk space on any
device. For example:
/dev/rdsk/c0t4d2 Warning: Max_PE_per_PV for the volume group (4348) too
small for this PV (24413).
Using only 4348 PEs from this physical volume.
If you wish to change the volume group parameters, follow the guidance given in the previous
sections. Otherwise, during a maintenance window, deactivate the volume group and run vgmodify
–v <vgname>.
1. Review mode.
# vgmodify -r -v vg04
Volume Group configuration for /dev/vg04 has been saved in
/etc/lvmconf/vg04.conf
c5t0d0 increased in size since it was initialized with pvcreate. c6t0d0 has its correct size
recorded by LVM so has not changed size since pvcreate. Both disks are unable to allocate
all their space as the maximum number of PEs per PV setting is too low. A setting of 1464
can accommodate the largest disk currently in the volume group (c5t0d0). Now display the
table mode and see what configurations are suitable.
# vgmodify -t -v vg04
Volume Group configuration for /dev/vg04 has been saved in
/etc/lvmconf/vg04.conf
2. Max_pv values up to 70 provide for a sufficient number of max_pes for the current largest
disk. The following example selects the entry for max_pv of 20.
# vgchange -a n vg04
Volume group "vg04" has been successfully changed.
4. Change mode.
# vgdisplay vg04
--- Volume groups ---
VG Name /dev/vg04
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 0
Open LV 11
Max PV 20
Cur PV 3
Act PV 3
Max PE per PV 5372
VGDA 6
PE Size (Mbytes) 4
Total PE 3707
Alloc PE 0
Free PE 3707
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 429760m
VG Max Extents 107440
# pvdisplay /dev/dsk/c5t0d0
--- Physical volumes ---
PV Name /dev/dsk/c5t0d0
VG Name /dev/vg04
PV Status available
Allocatable yes
VGDA 2
Cur LV 0
PE Size (Mbytes) 4
Total PE 1464
Free PE 1464
Allocated PE 0
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
Note the Total PE is now at 1464, which is greater than the previous max_pe setting of
1023.
# pvdisplay /dev/dsk/c6t0d0
--- Physical volumes ---
PV Name /dev/dsk/c6t0d0
VG Name /dev/vg04
PV Status available
Allocatable yes
VGDA 2
Cur LV 0
PE Size (Mbytes) 4
Total PE 1220
Free PE 1220
Allocated PE 0
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
Using offline vgmodify, the user can change the characteristics of a volume group and handle the
increase in the disk size of the physical volumes belonging to the volume group. Unlike offline mode,
you cannot currently use online vgmodify to change the characteristics of a volume group. To achieve
this, you must deactivate the volume group and use the offline vgmodify functionality.
Online vgmodify allows the user to handle a LUN expansion while the volume group is online. Most
of the high end devices (like HP’s Enterprise Virtual Array) enable you to increase the capacity of a
LUN without affecting the availability of the LUN. This is referred to as Dynamic LUN expansion or
DLE. The online vgmodify command enables the user to take advantage of this feature.
Following a DLE using the device’s utilities, you can use online vgmodify to allow LVM to access this
new space. After the volume group has been adjusted by vgmodify, you can allocate the new space
using the normal LVM method by lvextend or lvcreate. Handling LUN expansion using online
vgmodify is referred to as online DLE.
To use vgmodify for online DLE, you must explicitly specify the –a option (to indicate this is an online
operation) and the –E option (to indicate that the user desires to handle a DLE operation). You can
either choose to handle DLE on all the disks belonging to the volume group or can explicitly list out the
physical volumes for which DLE needs to be handled. When you specify a set of physical volumes in
conjunction with the –E option, the change in disk size of a physical volume not belonging to the
specified set is ignored by online DLE.
Prerequisites
• The volume group must be active.
• The volume group must not be activated in shared mode or read-only mode.
• The volume group must not be in the quiesced state.
• All physical volumes belonging to volume group must be accessible.
• There cannot be any entries in the bad block directory of any physical volume in the volume
group. The vgmodify command reports any disks containing bad blocks and exits without
making any changes. Use pvdisplay –d to display the count of bad blocks and verify this
is the cause of the failure. To overcome this problem, replace the disk and restore the
configuration with vgcfgrestore.
• The volume group must not have a cluster lock physical volume. The cmviewcl –v
command displays the device path name of the disk configured as a cluster lock LUN.
• The increase in disk size must be greater than the size of a physical extent on the physical
volume.
• The number of extents allocated on the physical volume in question must not already be equal
to the max_PE / PV for the volume group.
Details
The online vgmodify command is invoked in one of three modes: table, review, or change:
• Table mode. A table (-t) of possible settings are displayed.
• Review mode. A review (-r) is performed that the new settings, based upon the other
arguments, can be successfully applied.
• Change mode. New settings are applied to the volume group.
• An online DLE operation does not cause any change in the size of the volume group
metadata.
• Unlike in the case of offline vgmodify, in the online case, you must explicitly use the –a and
the –E options to indicate that a DLE at the device end needs to be handled by LVM.
• The online DLE operation can be performed while the user I/Os to the physical volumes
belonging to the volume group in question are in progress.
• After the on-disk metadata reflects the changed configuration, the online DLE process updates
the configuration backup file for the volume group in question to reflect the changed
configuration.
• During online DLE, you can either choose to include the additional disk space on all of the
disks belonging to the volume group or specify the particular disks belonging to the volume
group on which you want the additional space to be used.
• If pvcreate was originally run with –s and a lower disk size value, online DLE adjusts the
setting to match its actual size.
• Unlike the offline vgmodify operation, the online DLE does not require any recovery steps if
interrupted during its operation.
• After the online DLE operation completes successfully, vgmodify takes a backup of the new
volume group configuration and places it in the /etc/lvmconf directory.
• After online DLE is complete, use extreme care in using older configuration files. You must
use a vgcfgrestore –vl on the files to verify that the disk size values match the current
configuration. You must manually remove the old configuration files that hold out of date
information.
• If you restored an older volume group configuration onto a physical volume on which a
successful online DLE operation has been completed, the PV is attached during re-activation.
In this situation, accessing user data that was placed beyond the original physical volume
size (size of the physical volume prior to expanding it) will have undesirable affects and
might corrupt user data.
•
#vgmodify -t –v vg1 #the table output should be used to determine the right size
for expansion. (See the section on usage examples for
details)
3. After deciding the correct size to which to expand the disk, you must do the DLE operation
using the relevant disk utilities.
4. You must use the review mode to ensure that a DLE on the disk now would yield the desired
results.
5. Now, you can perform the actual DLE operation in the change mode.
Consider a volume group with a 300 GB disk on which you have used up all the extents. Now, the
user feels the need for an additional disk space of at least 150 GB on this disk. That is, a new size of
450 GB (460800 MB) or more.
# vgdisplay vg1
--- Volume groups ---
VG Name /dev/vg1
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 0
Max PV 50
Cur PV 1
Act PV 1
Max PE per PV 30000
VGDA 2
PE Size (Mbytes) 16
Total PE 19199
Alloc PE 19199
Free PE 0
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 24000000m
VG Max Extents 1500000
# pvdisplay /dev/disk/disk4154
--- Physical volumes ---
PV Name /dev/disk/disk4154
VG Name /dev/vg1
PV Status available
Allocatable yes
VGDA 2
Cur LV 1
PE Size (Mbytes) 16
Total PE 19199
Free PE 0
Allocated PE 19199
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
# diskinfo /dev/rdisk/disk4154
SCSI describe of /dev/rdisk/disk4154:
vendor: HP
product id: OPEN-V
type: direct access
size: 314572800 Kbytes
bytes per sector: 512
Note, the max_PE per PV for this volume group is 30000. You now run vgmodify in the table mode:
#vgmodify -t vg1
# diskinfo /dev/rdisk/disk4154
SCSI describe of /dev/rdisk/disk4154:
vendor: HP
product id: OPEN-V
type: direct access
size: 492830720 Kbytes
bytes per sector: 512
Now, use online vgmodify in review mode to review the effect of the change in disk size.
#vgmodify -v –r –a –E vg1
Volume Group configuration for /dev/vg1 has been saved in
/etc/lvmconf/vg1.conf
"/dev/rdisk/disk4154" size changed from 314572800 to 492830720kb
"/dev/rdisk/disk4154" size is limited by the maximum extents per PV
to 491520000.
Now, you can perform the actual DLE operation in change mode.
#vgmodify –a –E vg1
"/dev/rdisk/disk4154" size changed from 314572800 to 492830720kb
"/dev/rdisk/disk4154" size is limited by the maximum extents per PV
to 491520000.
# vgdisplay vg1
--- Volume groups ---
VG Name /dev/vg1
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 0
Max PV 50
Cur PV 1
Act PV 1
Max PE per PV 30000
VGDA 2
PE Size (Mbytes) 16
Total PE 30000
Alloc PE 19199
Free PE 10801
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 24000000m
VG Max Extents 1500000
Note the total number of extents on the disk has increased to 30000, which is also the max_PE per
PV configured for the volume group.
Determining candidate physical volumes for online dynamic LUN expansion
Run vgmodify –v –r –a -E <vgname>. Any disks that have been resized since pvcreate was
run on them are reported as follows:
/dev/rdsk/c0t0d0" size changed from 16777216 to 100000000kb
Also note if there are messages telling you there is insufficient space to allocate all the disk space on
any device. For example,
"/dev/rdsk/c0t4d2" size is limited by the maximum extents per PV to
56934400.
If you want to change the volume group configuration parameters, follow the guidance given in
section I. Otherwise, you can still go ahead with the online DLE operation and get LVM to use as
much additional disk space as can be accommodated by the current max_PE value.
Review mode.
# vgmodify –v -r –a -E vg04
/dev/rdisk/disk43 has been increased in size since it was initialized via pvcreate.
/dev/rdisk/disk46 has its correct size recorded by LVM so has not changed size since
pvcreate. Both are unable to allocate all their space as the maximum number of PEs per PV
setting is too low. /dev/rdisk/disk47 has also increased in size and all its new space
can be used by LVM.
Following this, you can either do an online DLE to use what additional space can be
accommodated using the current max_PE value, or, you can use offline vgmodify to achieve
DLE and change the max_PE value appropriately to be able to use all the additional disk
space added (For this, see the examples listed in Section I)
Handling online dynamic LUN expansion where all of the additional disk space can
be allocated
Consider a 50 GB disk belonging to a volume group vg1 that has its max_PE per PV value set to
25535. The disk size was increased to 68 GB using the relevant disk utilities.
# vgdisplay vg1
--- Volume groups ---
VG Name /dev/vg1
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 0
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 25535
VGDA 2
PE Size (Mbytes) 4
Total PE 12799
Alloc PE 12799
Free PE 0
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 1634240m
VG Max Extents 408560
Note, currently there are 12799 extents allocated on this PV. Now, use online vgmodify in review
mode to review the effect of the change in disk size.
# vgmodify –r -a -E vg1
"/dev/rdisk/disk43" size changed from 52428800 to 71687369kb
# vgmodify -a -E vg1
"/dev/rdisk/disk43" size changed from 52428800 to 71687369kb
# vgdisplay vg1
--- Volume groups ---
VG Name /dev/vg1
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 0
Open LV 0
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 25535
VGDA 2
PE Size (Mbytes) 4
Total PE 17500
Alloc PE 12799
Free PE 4701
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 1634240m
VG Max Extents 408560
Note that the amount of disk space increased by the number of physical extents allocated on the disk
from 12799 to 17500.
Handling online dynamic LUN expansion where some of the additional disk space
can be allocated
Consider a 50 GB disk belonging to a volume group vg1 that has its max_PE per PV value set to
13900. The disk size was increased to 68 GB using the relevant disk utilities.
# vgdisplay vg1
--- Volume groups ---
VG Name /dev/vg1
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 0
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 13900
VGDA 2
PE Size (Mbytes) 4
Total PE 12799
Alloc PE 12799
Free PE 0
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 889600m
VG Max Extents 222400
Note, currently there are 12799 extents allocated on this PV. Now, use online vgmodify to review
the effect of the change in disk size.
# vgmodify –r -a -E vg1
"/dev/rdisk/disk43" size changed from 52428800 to 71687369kb
"/dev/rdisk/disk43" size is limited by the maximum extents per PV
to 56934400.
# vgmodify -a -E vg1
"/dev/rdisk/disk43" size changed from 52428800 to 71687369kb
"/dev/rdisk/disk43" size is limited by the maximum extents per PV
to 56934400.
# vgdisplay vg1
--- Volume groups ---
VG Name /dev/vg1
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 0
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 13900
VGDA 2
PE Size (Mbytes) 4
Total PE 13900
Alloc PE 12799
Free PE 1101
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 889600m
VG Max Extents 222400
Note that the entire increase in disk space is not made available for use by LVM. This is because of
the max_PE value, which is set to 13900. Only part of the disk space (54 GB out of 68 GB) was used
to increase the number of physical extents allocated on the disk from 12799 to 13900. To fully utilize
the 68 GB disk space, you must use offline vgmodify and modify the volume group configuration
parameters.
Handling online dynamic LUN expansion where none of the additional disk space
can be allocated
Consider a 50 GB disk added to a volume group vg1 which has its max_PE per PV value set to
12799. The disk size was increased to 63 GB using the relevant disk utilities.
# vgdisplay vg1
--- Volume groups ---
VG Name /dev/vg1
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 0
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 12799
VGDA 2
PE Size (Mbytes) 4
Total PE 12799
Alloc PE 12799
Free PE 0
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 819136m
VG Max Extents 204784
Note, currently there are 12799 extents allocated on this PV. Now, use online vgmodify to review
the change in disk size.
# vgmodify –r -a -E vg1
An update to the Volume Group is NOT required
Review complete. Volume group not modified
Note the command indicates that the volume group does not require an update. This is because the
number of extents allocated on the PV is already at the max_PE value of 12799. Now, you cannot
add more extents to this PV without changing the max_PE value. For changing the max_PE value, you
must use offline vgmodify (For this, see the examples listed in Section I)
LVM vgmodify Messages
vgmodify(1M)
When vgmodify makes any changes to the volume group, a new physical volume identifier
(PVID) is created for each physical volume. This can take one second per physical volume in
the volume group. A new PVID ensures that a partial restoration from a configuration backup
file created before this modification does not lead to a mixed configuration.
vgmodify detected that the size of c2t3d0 has changed. When the physical volume was
created (see pvcreate(1M)), it was 768,000 kb it is now 8,700,000 kb. This detail is
reported when using the –v argument.
The volume group has five physical volume,s but vgmodify can only locate four. Verify that
all five physical volumes are accessible. vgmodify cannot continue until it can access all
five.
This is the amount of space available for the VGRA when physical extent renumbering is left
unchanged.
This is the amount of space available for the VGRA when physical extents are renumbered
lower so that the first physical extent can be used for metadata. All physical extent numbers
are reduced by one.
This is the amount of space available for the VGRA when physical extents are renumbered
higher so that metadata space can be returned to user space. All physical extent numbers are
increased by one.
Before making any modifications, a test write is performed to each physical volume. The test
write failed to this device. vgmodify stopped before making any changes applicable to the
new configuration. Check the device before repeating the command.
• Physical Volume "/dev/rdsk/c2t3d0" is already the type requested
The -B option was used with c2t3d0 in the list of physical volumes, but this physical volume
is already the type requested. It is already bootable if –B y, or non-bootable if –B n.
• Installing the new configuration was partially successful. Examine vgcfgrestore(1M) messages
to understand which disks may require manual restoration from the
"/etc/lvmconf/vg01.conf" file. The Volume Group should activate in its current state without
quorum override but not all disks may attach.
vgmodify was partially successfully in placing the new configuration onto the physical
volumes but some failed. You will see error messages from vgcfgrestore prior to this
message. Check the disks associated with the failures and then manually restore to these
disks.
• The space available for the configuration data will be limited by having bootable disks. If
this is not a boot VG then consider changing the type, using -B n, of the following bootable
disks:
/dev/rdsk/c2t3d0
/dev/rdsk/c3t4d0
Bootable disks (that is disks that were created using pvcreate –B or changed type using
vgmodify –B y) limit the space available for the VGRA. If this is not a boot volume group,
use –B n to change all the disks in the list to non-boot.
• Physical Extent zero is not free on all PVs. You will not achieve these values until the first
extent is made free (see pvmove(1M)) on all the following disks:
/dev/rdsk/c2t4d0
vgmodify was run with –n and it wants to lower the physical extent numbers on c2t4d0, but
to do this the first extent must be free so that its space can be given over to metadata.
• VGRA for the disk is too big for the specified parameters. Decrease max_PVs and/or
max_PEs.
The selected max_pv and max_pe values create a VGRA that is too large for the space
available on all physical volumes. The VGRA cannot be greater than the physical extent size.
The disk /dev/rdsk/c2t4d0 was resized to a size greater than 56934400, but because of
the limitation of the current value of max_PE, LVM can only use 56934400 of the disk space.
• The LVM White Papers listed below are available at the HP documentation website:
http://www.docs.hp.com/en/oshpux11iv3#LVM%20Volume%20Manager
o LVM Limits
o LVM Migration from Legacy to Agile Naming Model
o LVM New Features in HP-UX 11i v3
o LVM Online Disk Replacement (LVM OLR)
o LVM Version 2.0 Volume Groups in HP-UX 11i v3
o LVM Volume Group Quiesce/Resume
o SLVM Single-Node Online Reconfiguration (SLVM SNOR)
Call to action
HP welcomes your input. Please give us comments about this white paper, or suggestions for LVM or
related documentation, through our technical documentation feedback website:
http://docs.hp.com/en/feedback.html