HP-UX: Importing SAN VG from a failed server

Assign the same EMC LUNs to the new server. Recognize all the LUNs in newserver from ioscan.

#ioscan -fnKC disk

Create a script with the following contents to get the VG info. Here created the script in filename /usr/bin/vgid.
# vi /usr/bin/vgid
echo ” Disk Name CPU ID PV ID CPU ID VG ID”
echo ” ———————————————————“
for i in `ioscan -FnkCdisk | grep dsk`
echo $i
done | grep rdsk |while read DSKNAME
echo “Disk : $DSKNAME `xd -An -j8200 -N16 -tx $DSKNAME 2> /dev/null || echo — Failed to read. Please check`”
echo ” “
done | sort -k 7 | grep Disk | sed ‘s/rdsk/dsk/’

Change the permission to this script file using below command.
# chmod a+x /usr/bin/vgid (this command will add execute permission for all users)

Execute the script
# vgid

From the output of above, number of VG and associated LUNs (PV) can be identified by VGID. VGID is unique for each Volume Group. So now the VG configuration can be collected and conclude that which LUN (PV) belong to which VG.

Then go for vgimport for each volume group with the associated LUNs (PV).

# mkdir /dev/vgnn
# mknod /dev/vgnn/group c 64 0xhh0000
vgimport -v /dev/vgnn pvanmes assosiated with vgnn

Here all LVs under this vgnn are getting created in default names like LV1 and LV2… etc.
Warning: A backup of this volume group may not exist on this machine.
Please remember to take a backup using the vgcfgbackup command after activating the volume group

#fstyp LVname
#mkdir DIR
#mount LVname DIR

Add the entries in /etc/fstab.

Repeat the each steps to all VGs.
#fstyp /dev/vg01/lvol1

How do I migrate existings LUNs from one HP-UX host to another?

In order to successfully move LUNs to a new host, these general steps must be taken.
All physical volumes (which relate to a physical LUN) within a volume group must be moved as a group.
First backup your /etc/lvmtab and the /etc/fstab files.

Under HP-UX on the server where the LUNs currently reside, run the following:
      1. unmount (To unmount the associated file systems)
      2. vgchange -a n <volume group name> (To deactivate the volume group)
      3. vgexport -p -m mapfile.map <volume group name> (This actually creates  the mapfile without exporting the volume group. If you prefer to export the volume group at this time  exclude the -p option)

On new host run the following:
       5. ioscan –fnC disk                                                         (To find new disk entries)
       6. insf –e C disk                        (To install the special device files)
       7.ll /dev/*/group                                                            (To see what minor numbers have already been used)
       8. mkdir /dev/vgxx                                                            (To create the directory)
       9. mknod /dev/vgx/group c 64 0x0<x>0000    (To create the device file)
     10. vgexport <volume group name> On original host if not already exported. See step 3. 
     11. vgimport -m <mapfile.map> <volume group name> /dev/dsk/cxtxdx /dev/dsk/cxtxdx (To import the volume group)
     12. vgchange -a y <volume group name> (to activate the volume group)

The volume group should now be useable by the new server attached to the array.