HP-UX ServiceGuard - Logical Volume Manager How to Add a Disk-Volume Group-Logical Volume...

来源:互联网 发布:python3 json 编辑:程序博客网 时间:2024/05/02 00:41

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

  1. Attach the new LUN, or on smart arrays, zone the new LUN for use on each cluster node. Then insure the operating system can see the devices.


     # ioscan       # cause HPUX to discover the new LUN
     # insf -e      # create special files 
     # diskinfo /dev/rdsk/c-t-d-     # verify correct size

  1. On the node where the target VG is active, load the LVM metadata structure on a new disk. Be careful in SAN environments not to select a disk already in use on another server outside of the cluster. SMH (System Management Homepage) or legacy SAM cannot insure this!

# pvcreate <options> /dev/rdsk/c-t-d-

Or, if using agile/persistent device files, identify them and pvcreatethem.


     # ioscan -m dsf
     # pvcreate <options> /dev/rdisk/disk---- 

Repeat step 2 for each new LUN.

To create a new VG, skip to PROCEDURE 2.

  1. Extend the disk into an existing VG:


     # 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.

  1. Identify used minor numbers:


     # 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

  1. Select an unused minor number for the new VG
  2. Create the new VG.

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<options>/dev/vgNEW /dev/dsk/c-t-d-
     or
     # vgcreate<options>/dev/vgNEW/dev/disk/disk113

  1. Add the new VG reference to the cluster configuration ASCII file.

The file was created by root and usually resides in /etc/cmcluster on onenode. The file can be reconstituted using:


    # cmgetconf<outfile>

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 <cluster ASCII config file>

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.

  1. Add a reference for the new VG to the right package file.

Modular package format

Locate the package configuration file on one of the nodes in the cluster.


/etc/cmcluster/<package_dir>/<pkg_config>

To reconstitute it:

    
# cmgetconf-p <pkg_name> <outfile>

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 <package ASCII config file>

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

  1. The VG must be activated before proceding. If the VG is already clustered (PROCEDURE 2), locate the node where it is active. If not active, activate it using:

    
# vgchange -a e vgnew

  1. On the node where the VG is active, use vgdisplay to display the available number and size of extents. Determine the number of extents to use on the new logical volume, then create a new logical volume.

Example:


     # lvcreate -L <size> [-n newLvolname] /dev/vgNEW

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.

  1. Create a file system on the new logical volume.

Example:


     # newfs -F vxfs -o largefiles /dev/vgNEW/lvol2

  1. Create a mount point for the new file system ON EACH NODE.
  2. Verify the file system will mount, umount:


     # mount /dev/vgNEW/lvol2 /app/mnt2
     # umount /app/mnt2

  1. Add the new logical volume reference to the package.

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 <package_config>

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.

  1. Perform PROCEDURE 6 to update /dev/vgNEW/lvolx name on the other node(s).

PROCEDURE 4 -Growing an existing logical volume

  1. On the node where the VG is active, determine the available extents using vgdisplay.
  2. Grow the logical volume. This could involve a single LUN or include LVM mirrors or extent striping options.

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.

  1. Perform procedure 1 and 3 if not already done.
  2. After growing a logical volume, grow the file system within the logical volume to fill the extended space.


     # 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

  1. On the node where a disk was added to a VG or a new VG was created, create an LVM map file and copy it to the other node(s):


     # 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

  1. Copy the map file to the other node(s) in the cluster.

Example:


 # rcp vgNEW.map othernode:/etc/lvmconf

  1. Login to the other node(s), and identify the minor number used by this VG.

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.