HP-UX LVM Supported Limits (September 2008)
Calculating an Optimal Extent Size for a Version 1.0 Volume Group
Sometimes when creating a Version 1.0 volume group (VG), the vgcreate command might abort with a
message indicating that the extent size is too small (too big error or a more informative error (with newer
patches) explaining that the VGRA is too big). In this situation, you must manually increase the extent size
and re-issue the vgcreate command.
Increasing the extent size increases the data area marked stale when a write to a mirrored logical volume
(LV) fails, and can increase the time required for resynchronizing the stale data. Also, more space than
intended might be allocated to the LV because the space is allocated in units of extent size. Therefore, the
optimal extent size is the smallest value that can be used to successfully create the volume group with the
given configuration parameters.
The minimum extent size for a VG is calculated using the maximum number of logical volumes (MAXLVs)
and physical volumes (MAXPVs) in the VG and the maximum number of physical extents (MAXPXs) per
each physical volume (PV).
For a VG with bootable PVs, the metadata must fit within 768 kilobytes. Therefore, a vgcreate command
with a set of values for MAXLVs, MAXPVs, and MAXPXs that succeedson a VG without bootable PVs might
fail on a VG with bootable PVs. In this situation, if you must add a bootable PV to a VG, recreate the VG
by giving smaller values for these arguments. By far the biggest factor in the size of the metadata is the
values for MAXPVs and MAXPXs. Alternatively, convert the bootable PV to a normal PV by rerunning
pvcreate on that PV without the ‘–B’ option and then add it to the VG. For a PV that is included in a VG,
you can use vgmodify to change a PV from bootable to a normal PV.
Sample shell script
The following shell script creates and compiles a small program that gives the minimum extent size for a
given VG:
#!/usr/bin/sh
cat << EOF > vgrasize.c
#include <stdio.h>
#define BS 1024 /* Device block Size */
#define roundup(val, rnd) (((val + rnd - 1) / rnd) * rnd)
main(int argc, char *argv[])
{
int i, length, lvs, pvs, pxs;
if (argc != 4) {
/* Usage example:
* Maximum LVs in the VG = 255,
* Maximum PVs in the VG = 16
* Maximum extents per PV = 2500 :
*
* $ vgrasize 255 16 2500
*/
printf("USAGE: %s <MAXLVs> <MAXPVs> <MAXPXs>\n", argv[0]);
exit(1);
}
lvs = atoi(argv[1]); pvs = atoi(argv[2]); pxs = atoi(argv[3]);
4