HP-UX ServiceGuard - Logical Volume Manager How to Add a Disk-Volume Group-Logical Volume or Grow a File System
Issue
Occasionally,there is a need to manipulate volume groups, logical volumes or grow filesystems governed by a Serviceguard package. How is this accomplished?
Solution
If this is aServiceguard Extension for RAC (SGeRAC) environment, read the note at thebottom before proceeding.
Examples below usea sample VG named vgNEW. Substitute as needed.
PROCEDURE 1 -Adding a disk to an existing Serviceguard-managed volume group
# ioscan # cause HPUX to discover the new LUN
# insf -e # create special files
# diskinfo /dev/rdsk/c-t-d- # verify correct size
# pvcreate
Or, if using agile/persistent device files, identify them and pvcreatethem.
# ioscan -m dsf
# pvcreate
Repeat step 2 for each new LUN.
To create a new VG, skip to PROCEDURE 2.
# vgextend/dev/vgNEW/dev/dsk/c-t-d-/dev/dsk/(pvlink)
or for agile addressing:
# vgextend/dev/vgNEW/dev/disk/disk113 /dev/disk/(pvlink)
The vgextend will update the /etc/lvmtab file on this node only. For othernodes to successfully activate all LUNs in this VG, the lvmtab file on adoptivenodes must also be updated. If no logical volume will be created, performPROCEDURE 6!
PROCEDURE 2 -Create a new cluster-managed volume group
Use this procedureif a new VG will be created for a Serviceguard package. The following may beperformed while the target package is active.
# ll /dev/*/group
Example:
crw-r----- 1 root sys 64 0x000000 Nov 28 2006 /dev/vg00/group
crw-rw-rw- 1 root sys 64 0x010000 Nov 28 2006 /dev/vg04-HPVM/group
crw-rw-rw- 1 root sys 64 0x050000 Sep 3 15:29 /dev/vg05-HPVM/group
crw-rw-rw- 1 root sys 64 0x020000 Sep 11 19:04 /dev/vgSG/group
Example:
# mkdir /dev/vgNEW
# mknod /dev/vgNEW/group c 64 0x030000
NOTE: Read the man page for vgcreate before proceeding. This may be thelast chance to determine the LVM version and non-modifiable VG configurationsettings such as max_pe and pe_size, once the VG has been created.
# vgcreate
or
# vgcreate
The file was created by root and usually resides in /etc/cmcluster on onenode. The file can be reconstituted using:
# cmgetconf
At the bottom of the file add the VOLUME_GROUP reference.
Eg:
VOLUME_GROUP/dev/vgNEW
Apply the modification (no need to cmcheckconf - cmapplyconf does it):
# cmapplyconf -f -C
If cmapplyconf cannot be performed successfully in step 4, use thefollowing method on a node running Serviceguard. Remedy the cmapplyconf problemat the earliest convenience!
Install cluster identification on the VG.
Deactivate the VG:
# vgchange -a n vgNEW
Cluster the VG:
# vgchange -c y vgNEW
If the package that will operate the VG is already running, activate theVG. Also activate the VG if a logical volume will be created.
# vgchange -a e vgNEW
If the package is not running, deactivate the VG before starting thepackage.
Modular package format
Locate the package configuration file on one of the nodes in the cluster.
/etc/cmcluster/
To reconstitute it:
# cmgetconf-p
Edit the file, adding a new 'vg' reference. Example:
vg vgNEW
Write the update to the file and apply it to the cluster.
# cmapplyconf -f -P
Legacy package format
Locate and appropriate package control script:
# cmviewconf | grep script
Edit the control script file, adding a new VG[x] reference.
NOTE: The index value within the brackets must be the next availablevalue.
Example:
---snipped from package control script ---
VG[3]="vg07" (Note the index value of this original VG is 3)
VG[4]="vgNEW" (Increment the index value)
Copy the modified file to the other nodes package directory if no logicalvolumes will be created at this time.
PROCEDURE 3 -Creating a new logical volume
# vgchange -a e vgnew
Example:
# lvcreate -L
Another example: create a more complex logical volume, such as one stripedacross multiple LUNs and requiring PVG mapping for LVM mirroring:
# lvcreate -i 4 -s g /dev/vgNEW
Such a command may take some time to complete.
The new logical volume metadata is installed on disk and a reference tothe disk will be added in /dev/vgNEW on this node.
Example:
# newfs -F vxfs -o largefiles /dev/vgNEW/lvol2
# mount /dev/vgNEW/lvol2 /app/mnt2
# umount /app/mnt2
Locate and edit the package configuration file.
Modular package format
Edit the package configuration file and locate previous VG/lvolreferences.
Example:
--- snipped from file ---
fs_mount_opt "-o rw,largefiles"
fs_umount_opt ""
fs_fsck_opt "" (orig references)
Add new references:
fs_name /dev/vgNEW/lvol2
fs_directory /app/mnt2
fs_type "vxfs"
fs_mount_opt "-o rw,largefiles"
fs_umount_opt ""
fs_fsck_opt ""
Apply the package modifications;
# cmapplyconf -P
Legacy package format
Edit the package control script, loading it with references to the new
logical volume.
Example:
LV[4]="/dev/vgNEW/lvol2"; FS[4]="/app/mnt2";
FS_TYPE[4]="vxfs";FS_MOUNT_OPT[4]="-o largefiles"
FS_UMOUNT_OPT[4]="";FS_FSCK_OPT[4]=""
Copy the updated package control script to the other node(s) packagedirectory.
PROCEDURE 4 -Growing an existing logical volume
Example:
# lvextend -L 100000M /dev/vgNEW/lvol2
(final size = 100GB)
Proceed to the next procedure.
PROCEDURE 5 -Growing an existing file system
Can be done whilethe package managing the volume group and logical volume is running if OnlineJFS is installed. Determine whether it is by running this command:
# vxlicrep | grep HP_OnlineJFS
HP_OnlineJFS = Enabled
If this feature ismarked DEMO and non-functional, re-install swinstall the B3929CA product tomake it permanent. If the feature is not installed, the file system must beunmounted before proceding.
# fsadm -F vxfs -b 10000M /dev/vgNEW/lvol02
- where -b = size of logical volume.
If only growing an existing logical volume, file system and not adding adisk to the VG, you may stop here, since the size of the file system is derivedfrom the VxFS metadata in the file system structure.
PROCEDURE 6 -Updating /etc/lvmtab on other nodes
# cd /etc/lvmconf
# vgexport -pvs -m map.vgNEW /dev/vgNEW
(Ignore any message that the VG is still activated)
The result will be a file: /etc/lvmconf/vgNEW.map
The file contain 2 types of information; the unique VGID of the volumegroup, and the (custom) names of the logical volumes in the volume group.
VGID 0a09507147c84038
1 lvol1
2 lvol2
Example:
# rcp vgNEW.map othernode:/etc/lvmconf
Example:
# ll /dev/*/group
crw-rw-rw- 1 root sys 64 0x020000 Sep 11 19:04 /dev/vgNEW/group
\______/ (minor number)
If the VG is new, identify an unused minor number using
# ll /dev/*/group and use it in the next steps
Now export and reimport the VG
# vgexportvgNEW (If a previously existing VG)
# mkdir/dev/vgNEW
# mknod /dev/vgNEW/group c 64 0x020000
# vgimport -vs -m /etc/lvmconf/vgNEW.map /dev/vgNEW
Or, to use agile/persistent addressing, use this command:
# vgimport -vs -N -m /etc/lvmconf/vgNEW.map /dev/vgNEW
Use the command "strings /etc/lvmtab" to review the updated content
of the file. The updated /etc/lvmtab should show the new PV andit's
PVlinks.
NOTE: SGeRAC clusters use a 'shared' form of VG activation that restrictsLVM manipulation of said volume groups. If you determine (using vgdisplay) thatthe VG is activated in shared mode, LVM modification commands will not workuntil the VG is declustered or at least changed to activate in exclusive mode.
Newer versions of LVM permit"vgchange -x" to transform the VG from shared mode to exclusive modewhile active on one node. If needed, a whitepaper titled 'SLVM Online VolumeRe-configuration' at docs.hp.com discusses this method.