LVM Volume Group Dynamic LUN Expansion (DLE) and Contraction (DLC) (September 2009)

54
1. Use the vgmodify review mode to verify there is enough free space on all of the physical
volumes to reconfigure them to the desired maximum VG size. The vgmodify command
checks for free extents at the ends of the PVs that it can utilize, and also checks for free space
resulting from prior LUN expansions. You must provide the –E option and the –S option for
review mode to check for LUN expansions. It might be necessary to use the pvmove
command to relocate the portions of logical volumes residing at the ends of the PVs.
# vgmodify –r –a –E –S 64t vg1 # Review mode (-r)
2. If review mode reports that the maximum VG size can be increased, perform the actual
reprovisioning reconfiguration. This operation reconfigures every PV in the VG to the new
(larger) maximum VG size. The maximum VG size as reported by the vgdisplay command
is not changed until every PV is reconfigured. This operation also automatically adds new
extents to PVs where the new extents were not added previously because the volume group
was at its maximum number of extents.
# vgmodify –a –E -S 64t vg1 # Change mode (-r removed)
3. Verify the result of the reprovisioning reconfiguration by running the vgdisplay –v
command to check the new maximum VG size, the new maximum number of extents for the
VG, and additional extents that might have been added to some of the PVs.
4. If any vgextend commands were previously unable to add PVs to the volume group, rerun
those commands now. The vgextend commands must succeed in adding more PVs to the VG.
Run vgdisplay –v to verify that more free extents are available.
5. Expand logical volumes using lvextend –l as necessary to allow them to accommodate
more user data. You can also create additional logical volumes using lvcreate. You can
also add additional mirrors using lvextend –m.
Online reprovisioning to decrease the ma
ximum volume group size
You can set the maximum VG size value for a volume group to a lower value as long as the volume
group has not already reached that size. Use the vgdisplay command to see the current maximum
VG size, the total number of extents, and the number of free extents. The current size of the VG is the
total number of extents times the extent size.
To decrease the maximum VG size for the volume group, follow these steps:
1. Use the review mode of vgmodify to verify that the volume group maximum VG size can be
decreased to the desired new (lower) value.
# vgmodify –r –a –S 32t vg1 # Review mode (-r)
2. If review mode reports that the maximum VG size can be decreased, perform the actual
reprovisioning reconfiguration. The maximum VG size as reported by vgdisplay is reduced
immediately, then vgmodify reconfigures every PV in the VG to reduce the amount of space
being used for LVM configuration data. The unused space is made available as new extents
for user data.
# vgmodify –a -S 32t vg1 # Change mode (-r removed)
3. Verify the result of the reprovisioning reconfiguration by running the vgdisplay –v
command to check the new maximum VG size, the new maximum number of extents for the
VG, the new total number of extents for the VG, and the new number of free extents for the
VG.
Common Version 2.x examples
This section provides detailed examples for using the vgmodify command to perform online dynamic
LUN expansion (DLE), online dynamic LUN contraction (DLC), and online volume group reprovisioning
(changing maximum VG size) for version 2.x volume groups.
The volume group is active in all of the examples unless otherwise noted.
Display values that have changed following reconfigurations are shown in bold.