Volume group creation, done right need only be done once to last a long time. A few simple steps can make it a process you do once and then enjoy the long term benefits.
Step one is a little homework. Take a reasonable estimate at how many physical volumes the volume group is going to contain. Why is this important? Because by default lvm allocates resources as if there will be 255 physical volumes. Most volume groups don’t see that many disks, and the overall capacity is impacted by the default. For this example, we will pick a small volume group that is never anticipated to exceed 10 physical volumes. We will set the maximum volumes to 25 to have a fair amount of additional capacity but to more efficiently allocate scarce resources.
Now th fun begins. We will create a volume group called vg03
Discover the new disks, important if LUNS have been presented to the system.
insf -C disk (may not be needed on HP-UX 11.31)
ioscan -fnC disk
ioscan shows three disks for this example.
/dev/rdsk/c10t0d1 /dev/rdsk/c10t0d2 /dev/rdsk/c10t0d3
mknod /dev/vg03/group c 64 0×030000
# We have created a device file for the volume group.
We need to pvcreate the disks, which lablels the disk for use by LVM
vgcreate -p25 /dev/vg03 /dev/dsk/c10t0d1 /dev/dsk/c12t0d1 /dev/dsk/c10t0d3
# alternative vgcreate -e 65535 -s 16 /dev/vg10 /dev/dsk/c10t0d1 /dev/dsk/c12t0d1 /dev/dsk/c16t0d1 /dev/dsk/c17t0d1
The option -s lets us set a larger PE size which can also increase capacity.
Now inevitably someone is going to decide to add another disk to this volume group. It may be immediately or it may be down the road. We are prepared.
The SAN admin and project manager want to create a scratch area within the volume group for oracle backups to disk.
They present a new lun disk /dev/rdsk/c16t0d5
We respond like lightning.
insf -C disk
ioscan -fnC disk
vgextend vg03 /dev/dsk/c16t0d5
The disk is ready for use.
Different article for how we set up logical volumes and a file system.