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

5
Change a disk type (boot to non-boot or vice versa).
Change the maximum number of logical volumes in the volume group.
For Version 2.x volume groups, use vgmodify to do the following tasks:
Make full use of the space available on a disk that is larger than the current configuration.
Contract a physical volume to a size smaller than the current configuration.
Change the maximum size.
vgmodify for Version 1.0 volume groups
Increasing the range of values vgmodify provides
The following method describes how to move one or more of the physical volumes into another
volume group. After completing this task, you can add new disks or use
vgmodify to increase the
maximum number of physical extents per physical volume. This is only possible where the volume
group (VG) has one group of logical volumes (LVs) using one set of physical volumes (PVs) and the
remaining logical volumes using a different set of physical volumes (you can use
pvmove to re-
organize the layout if it does not already conform).
For 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).
Command usage
To run vgmodify on an activated volume group (online mode), invoke it with the –a option. To run
vgmodify on a deactivated volume group (offline mode), invoke it without the –a option.
For online and offline modes, you can invoke the
vgmodify command one of the following additional
modes:
Table mode. A table (-t option) of possible settings are displayed.
Review mode. A review (-r option) 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.