HP-UX LVM change VG Max Size

In HP-UX if you need to adjust an existing LVM Volume Group Max Size to accommodate a new physical disk, here is an example which use the vgmodify command.

Change VG Max Size

In HP-UX since LVM version 2.x, you can increase the maximum size of the VG (vgmodify -a -S) which then increases the maximum number of extents per PV. If you are using LVM version 1.0, this will also work but the volume group and LVs in it should be unmounted.
The max default is 65535 but using vgmodify -a -S ### vg_name can increase this limit way beyond the 65k limit to as much as 33554432 extents per PV. This will allow much larger PVs to be added.

That said, using vgcreate without -s pe_size is not good sysadmin practice. It is much better to specify -s 32 or even -s 128 if you think the VG will have larger disks in the future. This applies to all VG versions.

Example:
Adding a new Disk to the VG vg01 causes a “too small error” message.

# pvcreate /dev/rdisk/disk7
Physical volume "/dev/rdisk/disk7" has been successfully created.

# vgextend /dev/vg01 /dev/disk/disk7
vgextend: Warning: Max_PE_per_PV for the volume group (10495) too small for this PV (18431).
Using only 10495 PEs from this physical volume.
Volume group "/dev/vg01" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

You will need to adjust the VG Max Size to accommodate the new disk, for instance set VG max size from 600G to 1000G

# vgdisplay -v 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 16
Cur PV 2
Act PV 2
Max PE per PV 10495
VGDA 4
PE Size (Mbytes) 4
Total PE 20990
Alloc PE 10495
Free PE 10495
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 2.0
VG Max Size 600g
VG Max Extents 167920

/# vgmodify -a -S 1000G /dev/vg01

/# vgdisplay -v 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 16
Cur PV 2
Act PV 2
Max PE per PV 10495
VGDA 4
PE Size (Mbytes) 4
Total PE 20990
Alloc PE 10495
Free PE 10495
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 2.0
VG Max Size 1000g
VG Max Extents 167920

Now you should be able add the physical disk again using the vgextend command successfully

If for some reason you got another error from vgextend like the one below:

vgmodify: Error: Cannot reconfigure physical volume "/dev/rdisk/disk7" to the
requested maximum volume group size 307200 MB without moving
extent(s). The last 1 extent(s) have to be made free
(see pvmove(1M)) to be able to reconfigure the physical volume.
The physical volume "/dev/rdisk/disk7" can be reconfigured to the new
maximum volume group size 264096 MB without removing free
extents from the end of the physical volume.
Physical volume "/dev/rdisk/disk7" was not changed.

You will need to move PEs from one physical volume to another PV in order to solve this error. This can happen when the volume if currently 100% allocated on all LVs. You can try doing one of the following:

– Relocate PE number 0 to any free extent with in the same physical volume.

pvmove /dev/dsk/c1t0d0:0 /dev/dsk/c1t0d0

– Relocate PE number 0 from /dev/dsk/c1t0d0 to any free extent in the volume group.

pvmove /dev/dsk/c1t0d0:0

Now you can try the vgextend command again and you should be successful.


– masterkenneth

Leave a Reply

Your email address will not be published. Required fields are marked *