Tuesday, 21 April 2015

cluster cleanup script

#!/bin/ksh
# This script removes the cluster and cluster setup
# we use the entries in /etc/cluster/rhosts to determine the nodename, which
# should be the same as the hostname.
# in AN61, the hostname = PHA_nodename = CAA_nodename = node1 / node2
# The script should also work if the nodenames are different than node1 / node2
# (although not tested)
# but it does require that hostname = nodename.
function restart_clcomd {
  let CLCOMDOK=0
  let TRIES=0
  stopsrc -s clcomd
  sleep 5
  startsrc -s clcomd
  sleep 20
# MODIFIED 2013.04.02, karlmi: Now we restart clcomd again after clearing
# /etc/cluster/rhosts. clrsh will not work, so don't test it.
#  while [[ $CLCOMDOK -eq 0 ]]
#  do
#    typeset OUTPUT
#    OUTPUT=$(clrsh $NODE1 hostname 2>/dev/null)
#    print "clrsh $NODE1 hostname is $OUTPUT" >> $LOG
#    if [[ $OUTPUT = $NODE1 ]]; then
#      typeset OUTPUT
#      OUTPUT=$(clrsh $NODE2 hostname 2>/dev/null)
#      print "clrsh $NODE2 hostname is $OUTPUT" >> $LOG
#      if [[ $OUTPUT = $NODE2 ]]; then
#         let CLCOMDOK=1
#      fi
#    fi
#    let TRIES=TRIES+1
#    if [[ $TRIES -gt 6 ]]; then
#      return 1
#    fi
#    if [[ $CLCOMDOK -eq 0 ]]; then
#      sleep 10
#    fi
#  done
  return 0
}

# MODIFIED 2013.03.12, karlmi: stop_cluster no longer used
function stop_cluster {
   print "Bringing nodes offline" | tee -a $LOG
   print "clmgr offline cl" | tee -a $LOG
   OUTPUT=$(clmgr offline cl WHEN=now MANAGE=offline)
   rc=$?
   print $OUTPUT >> $LOG
   if [[ $rc -gt 2 ]]; then
     print "Failed to cleanly stop cluster services. Make sure cluster services are stopped on both nodes then execute this script again.  Ask your instructor for help if you need it." | tee -a $LOG
   exit 1
   fi
}
function remove_cluster {
   # Restore the original httpd.conf back to /usr/IBMIHS/conf
   #sed "s/^ServerName .*/ServerName node1/" /usr/IBMIHS/conf/httpd.conf > /classfiles/httpd.conf
   #mv /classfiles/httpd.conf /usr/IBMIHS/conf/.
   #clrsh $NODE2 'sed "s/^ServerName .*/ServerName node2/" /usr/IBMIHS/conf/httpd.conf > /classfiles/httpd.conf'
   #clrsh $NODE2 cp /classfiles/httpd.conf /usr/IBMIHS/conf/.
   print "Deleting the cluster" | tee -a $LOG
   print "clmgr -f delete cluster ALL 2>&1" | tee -a $LOG
   clmgr -f delete cluster ALL 2>&1 >> $LOG
#   # Restart clcomd
   restart_clcomd
   # Verify the cluster is removed
   print "Verify cluster is removed from $NODE2" | tee -a $LOG
   print "clrsh $NODE2 /usr/es/sbin/cluster/utilities/cltopinfo 2>&1" | tee -a $LOG
   OUTPUT=$(clrsh $NODE2 /usr/es/sbin/cluster/utilities/cltopinfo 2>&1)
   rc=$?
   print $OUTPUT | tee -a $LOG
   if [[ $rc -eq 255 ]]; then
     # The PHA cluster is removed from $NODE2
     print "PHA cluster is removed from $NODE2" | tee -a $LOG
   else
     # Try to remove it
     print "Trying to remove the PHA cluster from $NODE2" | tee -a $LOG
     print "/usr/es/sbin/cluster/utilities/clrmclstr 2>&1" | tee -a $LOG
     /usr/es/sbin/cluster/utilities/clrmclstr 2>&1 | tee -a $LOG
   fi
   print "Verify cluster is removed from $NODE1" | tee -a $LOG
   print "/usr/es/sbin/cluster/utilities/cltopinfo 2>&1" | tee -a $LOG
   OUTPUT=$(/usr/es/sbin/cluster/utilities/cltopinfo 2>&1)
   rc=$?
   print $OUTPUT | tee -a $LOG
   if [[ $rc -eq 255 ]]; then
     # The PHA cluster is removed from node1
     print "PHA cluster is removed from $NODE1" | tee -a $LOG
   else
     # Try to remove it
     print "Trying to remove the PHA cluster from $NODE1" | tee -a $LOG
     print "/usr/es/sbin/cluster/utilities/clrmclstr 2>&1" | tee -a $LOG
     /usr/es/sbin/cluster/utilities/clrmclstr 2>&1 | tee -a $LOG
   fi
   print "Verify CAA cluster is removed" | tee -a $LOG
   print "/usr/sbin/lscluster -c 2>&1" | tee -a $LOG
   OUTPUT=$(/usr/sbin/lscluster -c 2>&1)
   rc=$?
   print $OUTPUT | tee -a $LOG
   if [[ $rc -eq 255 ]] || [[ $OUTPUT = "Cluster services are not active." ]]; then
     # The CAA cluster is removed from node1
     print "The CAA cluster is removed from $NODE1" | tee -a $LOG
   else
     # Try to remove it
     print "Trying to remove the CAA cluster" | tee -a $LOG
     print "/usr/sbin/rmcluster -fn $CLUSTER 2>&1" | tee -a $LOG
     CAA_FORCE_ENABLED=1 /usr/sbin/rmcluster -fn $CLUSTER 2>&1 | tee -a $LOG
     print "Verify CAA cluster is removed" | tee -a $LOG
     print "/usr/sbin/lscluster -c 2>&1" | tee -a $LOG
     OUTPUT=
     OUTPUT=$(/usr/sbin/lscluster -c 2>&1)
     rc=$?
     print $OUTPUT | tee -a $LOG
     if [[ $rc -eq 255 ]] || [[ $OUTPUT = "Cluster services are not active." ]]; then
       # The CAA cluster is removed from node1
       print "The CAA cluster is removed from $NODE1" | tee -a $LOG
     else
       print "There are problems removing the CAA cluster. Ask the instructor for assistance" | tee -a $LOG
       let RC=RC+1
     fi
   fi
   # Make sure the CAA cluster is removed from node2
   print "Verify the CAA cluster is removed from $NODE2" | tee -a $LOG
   print "clrsh $NODE2 /usr/sbin/lscluster -c 2>&1" | tee -a $LOG
   OUTPUT=
   OUTPUT=$(clrsh $NODE2 '/usr/sbin/lscluster -c 2>&1')
   rc=$?
   print $OUTPUT | tee -a $LOG
   if [[ $rc -eq 255 ]] || [[ $OUTPUT = "Cluster services are not active." ]]; then
     # The CAA cluster is removed from node2
        print "The CAA cluster is removed from $NODE2" | tee -a $LOG
   else
     # Try to remove it
     print "Trying to remove the CAA cluster" | tee -a $LOG
     print "clrsh $NODE2 /usr/sbin/rmcluster -fn $CLUSTER 2>&1" | tee -a $LOG
     clrsh $NODE2 'CAA_FORCE_ENABLED=1 /usr/sbin/rmcluster -fn $CLUSTER 2>&1' | tee -a $LOG
     print "Verify CAA cluster is removed" | tee -a $LOG
     print "clrsh $NODE2 /usr/sbin/lscluster -c 2>&1" | tee -a $LOG
     OUTPUT=
     OUTPUT=$(clrsh $NODE2 '/usr/sbin/lscluster -c 2>&1')
     rc=$?
     print $OUTPUT | tee -a $LOG
     if [[ $rc -eq 255 ]] || [[ $OUTPUT = "Cluster services are not active." ]]; then
       # The CAA cluster is removed from node2
       print "The CAA cluster is removed from $NODE2" | tee -a $LOG
     else
       print "There are problems removing the CAA cluster. Ask the instructor for assistance" | tee -a $LOG
       let RC=RC+1
     fi
   fi
   # Make sure the repository disk definition is removed on node1
   print "Make sure the repository disk definition is removed on $NODE1" | tee -a $LOG
   print "/usr/sbin/lspv | grep caa 2>&1" | tee -a $LOG
   OUTPUT=$(/usr/sbin/lspv | grep caa 2>&1)
   rc=$?
   print $OUTPUT | tee -a $LOG
   if [[ $rc -ne 0 ]]; then
     # The repository definition is removed from node1
     print "The repository disk definition is removed from $NODE1" | tee -a $LOG
   else
     print "Attempting to cleanup the repository disk on $NODE1" | tee -a $LOG
     print "/usr/sbin/clusterconf -fu 2>&1" | tee -a $LOG
     /usr/sbin/clusterconf -fu 2>&1 | tee -a $LOG
     print "Make sure the repository disk definition is removed on $NODE1" | tee -a $LOG
     print "/usr/sbin/lspv | grep caa 2>&1" | tee -a $LOG
     OUTPUT=$(/usr/sbin/lspv | grep caa 2>&1)
     rc=$?
     print $OUTPUT | tee -a $LOG
     if [[ $rc -eq 0 ]]; then
       print "There are problems removing the CAA cluster. Ask the instructor for assistance" | tee -a $LOG
       let RC=RC+1
     fi
   fi
   # Make sure the repository disk definition is removed on node2
   print "Make sure the repository disk definition is removed on $NODE2" | tee -a $LOG
   print "clrsh $NODE2 /usr/sbin/lspv | grep caa 2>&1" | tee -a $LOG
   OUTPUT=$(clrsh $NODE2 /usr/sbin/lspv | grep caa 2>&1)
   rc=$?
   print $OUTPUT | tee -a $LOG
   if [[ $rc -ne 0 ]]; then
     # The repository definition is removed from node2
     print "The repository disk definition is removed from $NODE2" | tee -a $LOG
   else
     print "Attempting to cleanup the repository disk on $NODE2" | tee -a $LOG
     print "clrsh $NODE2 /usr/sbin/clusterconf -fu 2>&1" | tee -a $LOG
     clrsh $NODE2 /usr/sbin/clusterconf -fu 2>&1 | tee -a $LOG
     print "Make sure the repository disk definition is removed on $NODE2" | tee -a $LOG
     print "clrsh $NODE2 /usr/sbin/lspv | grep caa 2>&1" | tee -a $LOG
     OUTPUT=$(clrsh $NODE2 /usr/sbin/lspv | grep caa 2>&1)
     rc=$?
     print $OUTPUT | tee -a $LOG
     if [[ $rc -eq 0 ]]; then
       print "There are problems removing the CAA cluster. Ask the instructor for assistance" | tee -a $LOG
       let RC=RC+1
     fi
   fi
} # end of remove_cluster
function cleanup_storage {
   # Remove the httpvg volume group
   # a. varyoff on node1
   # b. exportvg on node1
   # c. varyoff on node2
   # d. exportvg on node2
   VGS=$(/usr/sbin/lsvg -o)
   OUTPUT=$(print $VGS | grep "httpvg")
   rc=$?
   if [[ $rc -eq 0 ]]; then
     print "Varying off httpvg on $NODE1" | tee -a $LOG
     umount /usr/HTTPServer/htdocs/en_US 2>&1 | tee -a $LOG
     varyoffvg httpvg
   fi
   print "Exporting httpvg on $NODE1" | tee -a $LOG
   OUTPUT=$(exportvg httpvg)
   rc=$?
   if [[ $rc -ne 0 ]]; then
     print "Problem exporting httpvg on $NODE1. Verify httpvg is no longer defined in lspv output. If it is, alert your instructor" | tee -a $LOG
   fi
   VGS=
   VGS=$(clrsh $NODE2 /usr/sbin/lsvg -o)
   OUTPUT=$(print $VGS | grep "httpvg")
   rc=$?
   if [[ $rc -eq 0 ]]; then
     print "Varying off httpvg on $NODE2" | tee -a $LOG
     OUTPUT=$(clrsh $NODE2 "/usr/sbin/umount /usr/HTTPServer/htdocs/en_US 2>&1")
     rc=$?
     print $OUTPUT | tee -a $LOG
     OUTPUT=$(clrsh $NODE2 "/usr/sbin/varyoffvg httpvg 2>&1")
     rc=$?
     print $OUTPUT | tee -a $LOG
   fi
   print "Exporting httpvg on $NODE2" | tee -a $LOG
   OUTPUT=$(clrsh $NODE2 "/usr/sbin/exportvg httpvg 2>&1")
   rc=$?
   print $OUTPUT | tee -a $LOG
   if [[ $rc -ne 0 ]]; then
     print "Problem exporting httpvg on $NODE2. Verify httpvg is no longer defined in lspv output.  If it is, alert your instructor" | tee -a $LOG
   fi
rmdev -dl hdisk2
cfgmgr
clrsh $NODE2 rmdev -dl hdisk2
clrsh $NODE2 cfgmgr
} # end cleanup_storage
function cleanup_network {
   # Make sure the persistent alias is gone
   OUTPUT=$(clrsh $NODE2 netstat -i | grep node2admin | awk '{print $1}')
   if [[ $OUTPUT = "en"* ]]; then
      IF=$OUTPUT
      OUTPUT=$(clrsh $NODE2 ifconfig $IF -alias node2admin)
   fi
   typeset OUTPUT
   typeset IF
   OUTPUT=$(netstat -i | grep node1admin | awk '{print $1}')
   if [[ $OUTPUT = "en"* ]]; then
      IF=$OUTPUT
      OUTPUT=$(ifconfig $IF -alias node1admin)
   fi
   #
   # Remove configuration on en1 and en2 on node1 and node2
   #
   print "Removing configuration on en1 and en2 on $NODE2" | tee -a $LOG
   clrsh $NODE2 'chdev -l en1 -a state="detach"'
   clrsh $NODE2 'chdev -l en2 -a state="detach"'
   print "Removing configuration on en1 and en2 on $NODE1" | tee -a $LOG
   chdev -l en1 -a state='detach'
   chdev -l en2 -a state='detach'
   #
   # Remove IP entries from /etc/hosts on Node2
   #
   print "Removing IP entries from /etc/hosts on $NODE2" | tee -a $LOG
   clrsh $NODE2 "cat /etc/hosts | grep -v ^1[79]2 >/tmp/hosts"
   clrsh $NODE2 'print "172.16.3.3 node3admin" >>/tmp/hosts'
   clrsh $NODE2 "cp /tmp/hosts /etc/hosts 2>&1" | tee -a $LOG
   #
   # Remove IP entries from /etc/hosts on Node1
   #
   print "Removing IP entries from /etc/hosts on $NODE1" | tee -a $LOG
   cat /etc/hosts | grep -v ^1[79]2 >/tmp/hosts
   print "172.16.3.3 node3admin" >>/tmp/hosts
   cp /tmp/hosts /etc/hosts 2>&1 | tee -a $LOG
   rm /tmp/hosts
   clrsh $NODE2 rm /tmp/hosts
   # Empty /etc/cluster/rhosts
   print "Emptying /etc/cluster/rhosts" | tee -a $LOG
   >/etc/cluster/rhosts
   clrsh node2 ">/etc/cluster/rhosts"
}
# MAIN
NODE1=node1
NODE2=node2
CLUSTER=pha_cluster
LOG=/tmp/EX2_prescript.log
RC=0
date=`date`
print "Executing EX2_prescript on $date" >$LOG
# Make sure we're executing on node1
HOSTNAME=$(hostname | grep node1)
if [[ $HOSTNAME = "" ]]; then
print "Execute this script on $NODE1. Exiting." | tee -a $LOG
exit 1
fi
# Stop cluster services on all nodes
# MODIFIED 2013.03.12, karlmi: no longer needed for 712
# stop_cluster
# Remove the cluster
remove_cluster
# Clean up storage
cleanup_storage
# Clean up network
cleanup_network
# restart clcomd after clearing network
# Restart clcomd
restart_clcomd
if [[ $RC -gt 0 ]]; then
  print "There may have been problems removing the cluster completely. Continue with the lab exercise and complete the verification steps.  Ask for the instructor's help if needed." | tee -a $LOG
else
  print "The prescript for Exercise2 has completed successfully."
fi
 

Wednesday, 15 April 2015

How to configure a VIOS Media Repository/Virtual Media Library (ex. AIX Install/Restore)

How to configure a VIOS Media Repository/Virtual Media Library (ex. AIX Install/Restore)


Technote (FAQ)


Question

What's the procedure to install an AIX base ISO to an AIX parition using a VIOS media repository?

What's the procedure to create/use/remove a virtual media repository?

Can a mksysb ISO be restored through the virtual media repository?

Cause

     This document provides a step by step command line procedure for using a virtual media repository or Virtual Media Library (VML) to install/restore an AIX partition.
This applies to VIOS version 2.2.x.

Answer



PART I. REQUIREMENTS BEFORE PROCEEDING

PART II. PERFORMING NEW AIX INSTALL WITH VML

PART III. PERFORMING MKSYSB RESTORE WITH MKSYSB ISO AND VML



PART I. REQUIREMENTS BEFORE PROCEEDING :

     Please ensure the following requirements are met before proceeding:
     A.) There should be an existing pair of virtual scsi adapters paired between the VIO server (vhost) and the VIO client (vscsi). Since the client may not have an OS, the adapter pairing can be verified through the partition properties/profile on the HMC or IVM.
     B.) A basic understanding of managing VIO virtual optical devices.
     C.) A basic understanding of the AIX Installation Menu and how to install AIX.

Back to top


PART II. PERFORMING NEW AIX INSTALL WITH VML:


Step 1: Obtain AIX base ISO image from ESS and store on the VIO server.

     AIX base ISO images can be obtained by contacting Entitled Software Support (ESS) at 1-800-879-2755 option 2, option 2. The representatives should be able to verify entitlement and guide customers on how to download the ISO image.

     After the AIX ISO image had been downloaded, the image can be stored in the /home/padmin directory of the VIO server.

$ ls -al /home/padmin/AIX_iso

total 8687952
drwxr-xr-x 2 padmin staff 256 Apr 13 17:07 .
drwxr-x--- 9 padmin system 4096 Apr 13 17:10 ..
-rw-r--r-- 1 root staff 4448223232 Apr 13 17:08 AIX_6.1_Base_Operating_System_TL_6100-07-00_DVD_1_of_2_102011.iso

Step 2: Create/Modify the media repository

     A.) Creating the repository in rootvg:
$ mkrep -sp rootvg -size 6G
Virtual Media Repository Created
Repository created within "VMLibrary" logical volume

     B.) Creating the repository in a new VG:
$ mkvg -vg <new volume group name> hdisk#
$ mkrep -sp <repository name> -size 6G

     C.) Increasing the size of the media repository:

$ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
6118    6118    rootvg     139776     26624

$ chrep -size 4G ==> Adds an additional 4GB to the repository

$ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
10198    10198    rootvg     139776     22528
NOTE: Increasing the size is currently the only option, to reduce the size of the repository it will need to be removed and recreated.

Step 3: Create the virtual media disk
$ mkvopt -name <new media disk name> -file <ISO filename> -ro

Example:
$ mkvopt -name base_61_TL7 -file /home/padmin/AIX_iso/AIX_6.1_Base_Operating_System_TL_6100-07-00_DVD_1_of_2_102011.iso -ro
NOTE: This command may take a few minutes to complete.

Step 4: Verify the virtual media disk is part of the repository

$ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
10198     5955    rootvg    139776     22528

Name File Size Optical Access
base_61_TL7 4243 None ro

Step 5: Create the file backed optical device and map it to a vhost:
~ Shown without the vtopt device ~

$ lsmap -vadapter vhost0
SVSA Physloc Client Partition ID
--------------- -------------------------------------------- ------------------
vhost0 U9117.MMA.10708D0-V1-C11 0x00000002

VTD L1_rootvg
Status Available
LUN 0x8100000000000000
Backing device lpar1_lv
Physloc
Mirrored N/A

     Create the vtopt device.
$ mkvdev -fbo -vadapter vhost0
vtopt0 Available

~ Shown with the vtopt device ~

$ lsmap -vadapter vhost0
SVSA Physloc Client Partition ID
--------------- -------------------------------------------- ------------------
vhost0 U9117.MMA.10708D0-V1-C11 0x00000002

VTD L1_rootvg
Status Available
LUN 0x8100000000000000
Backing device lpar1_lv
Physloc
Mirrored N/A

VTD vtopt0
Status Available
LUN 0x8200000000000000
Backing device
Physloc
Mirrored N/A

NOTE: Additional vtopt devices can be created and mapped to other vhosts. Consequently, each vtopt device will appear as a cd-rom device on the VIO client(s).

Step 6: Load the virtual media disk on the vtopt device:

$ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
10198     5955     rootvg      139776      22528

Name File Size Optical Access
base_61_TL7 4243 None ro

$ loadopt -vtd vtopt0 -disk base_61_TL7

$ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
10198     5955     rootvg     139776      22528

Name File Size Optical Access
base_61_TL7 4243 vtopt0 ro


     Verify that the vtopt# backing device is the virtual media disk location .

$lsmap -vadapter vhost0

...
...

VTD vtopt0
Status Available
LUN 0x8200000000000000
Backing device /var/vio/VMLibrary/base_61_TL7
Physloc
Mirrored N/A

Step 7: Boot the client partition from the virtual optical device:

     A.) Activate the AIX Partition to the SMS Menu

     B.) Select the virtual optical device (CD-ROM)

SMS 1.7 (c) Copyright IBM Corp. 2000,2008 All rights reserved.
-------------------------------------------------------------------------------
Main Menu
1. Select Language
2. Setup Remote IPL (Initial Program Load)
3. Change SCSI Settings
4. Select Console
5. Select Boot Options <<<

Multiboot
1. Select Install/Boot Device <<<
2. Configure Boot Device Order
3. Multiboot Startup <OFF>

Select Device Type
1. Diskette
2. Tape
3. CD/DVD
4. IDE
5. Hard Drive
6. Network
7. List all Devices <<<

Select Device
Device Current Device
Number Position Name
1. - Interpartition Logical LAN
( loc=U9117.MMA.10708D0-V2-C3-T1 )
2. - SCSI CD-ROM
( loc=U9117.MMA.10708D0-V2-C2-T1-L8200000000000000 ) <<<

NOTE: The location code lun ID L8200000000000000 should match the LUN ID of the vtopt mapped to the vhost:

$lsmap -vadapter vhost0

...
...

VTD vtopt0
Status Available
LUN 0x8200000000000000
Backing device /var/vio/VMLibrary/base_61_TL7
Physloc
Mirrored N/A

SCSI CD-ROM
( loc=U9117.MMA.10708D0-V2-C2-T1-L8200000000000000 )

1. Information
2. Normal Mode Boot <<<
3. Service Mode Boot

Are you sure you want to exit System Management Services?
1. Yes <<<
2. No


     Upon exiting SMS, the AIX partition will boot up from the virtual optical device to the AIX Installation Menus.

Step 8: Install the AIX operating system.


Step 9: Unloading the virtual media disk:

$ unloadopt -vtd vtopt0


Step 10: Removing the VM Library

     A.) Unmap the vtopt# VTDs from the vhost(s)

$ rmvdev -vtd <VTDname>

     B.) Remove the virtual media disk(s) from the Virtual Media Repository:

$ rmvopt -name <name of virtual optical disk>

     C.) Remove the repository:

$ rmrep [-f]


Back to top


PART III: PERFORMING MKSYSB RESTORE WITH MKSYSB ISO AND VML :

Step 1: Check the remaining space of the repository and the size of the mksysb ISO file:

$ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
10198      5955     rootvg      139776      22528

Name File Size Optical Access
base_61_TL7 4243 None ro

# ls -al
total 38609016
drwxr-xr-x 3 root system 4096 Apr 25 19:02 .
drwxr-x--- 9 padmin system 4096 Apr 25 21:59 ..
-rw-r----- 1 padmin staff 4448223232 Apr 02 15:59 AIX_6.1_Base_Operating_System_TL_6100-07-00_DVD_1_of_2_102011.iso
-rw-r----- 1 padmin staff 4032843776 Apr 09 22:12 Virtual_IO_Server_V2.2.1_DVD_1_of_2_102011.iso
-rw-r--r-- 1 root system 3120545792 Apr 25 19:01 cd_image_6357164
drwxr-xr-x 2 root system 256 Apr 12 10:16 lost+found
-rw-r--r-- 1 root staff 2542 Apr 02 12:08 mybackup.tar.gz
-rw-r--r-- 1 root staff 183 Apr 02 12:12 mybackup_DEPLOYED
-rw-r--r-- 1 root staff 102 Apr 02 12:12 mybackup_NONDEPLOYED
-rw-r--r-- 1 root staff 1476 Apr 02 12:12 mybackup_VALID
-rw-r----- 1 root system 8163543040 Apr 13 11:48 nim_resources.tar


Step 2: Create the virtual media disk out of the mksysb ISO and add to the repository

$ mkvopt -name lpar1_sysb -file /home/padmin/mount/cd_image_6357164 -ro
Step 3: Verify the new virtual media disk in the repository:

$ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
10198    2979    rootvg     139776     22528

Name File Size Optical Access
base_61_TL7 4243 None ro
lpar1_sysb 2976 None ro

Step 4: As it was done in Part II Step 6, load the new mksysb virtual media disk to the available virtual optical device mapped to the vhost:

$ lsmap -vadapter vhost0
SVSA Physloc Client Partition ID
--------------- -------------------------------------------- ------------------
vhost0 U9117.MMA.10708D0-V1-C11 0x00000002

VTD L1_rootvg
Status Available
LUN 0x8100000000000000
Backing device lpar1_lv
Physloc
Mirrored N/A

VTD vtopt0
Status Available
LUN 0x8200000000000000
Backing device <== Available to add backing device
Physloc
Mirrored N/A

     Load the virtual media disk:

$ loadopt -vtd vtopt0 -disk lpar1_sysb

     Verify that the virtual media disk is assigned as the backing device:
$ lsmap -vadapter vhost0
SVSA Physloc Client Partition ID
--------------- -------------------------------------------- ------------------
vhost0 U9117.MMA.10708D0-V1-C11 0x00000002

VTD L1_rootvg
Status Available
LUN 0x8100000000000000
Backing device lpar1_lv
Physloc
Mirrored N/A

VTD vtopt0
Status Available
LUN 0x8200000000000000
Backing device /var/vio/VMLibrary/lpar1_sysb
Physloc
Mirrored N/A

     Follow Step 6 and Step 7 to boot the client LPAR and restore from the virtual media disk.

Step 5: Restoring a mksysb with multiple volumes

     Locate the directory with your multiple ISO images.

NOTE: Ensure that the volume order (vol1,vol2, etc.) are identifiable to reduce the probability of corrupting the restore.

$ ls -al /home/padmin/mount/*lpar2*
total 6139912
drwxr-xr-x 2 root system 256 Apr 26 07:21 .
drwxr-xr-x 5 root system 4096 Apr 25 22:28 ..
-rw-r--r-- 1 root system 674078720 Apr 26 00:24 cd_image_3014874.vol1
-rw-r--r-- 1 root system 676304896 Apr 26 02:20 cd_image_3014874.vol2
-rw-r--r-- 1 root system 676304896 Apr 26 04:10 cd_image_3014874.vol3
-rw-r--r-- 1 root system 676304896 Apr 26 05:56 cd_image_3014874.vol4
-rw-r--r-- 1 root system 440211456 Apr 26 07:21 cd_image_3014874.vol5

(Total Sum of ISO file sizes = 3143204864 or 3.143 G)

     Ensure that the repository has enough space:

$ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
10198    2979     rootvg     139776      22528

Name File Size Optical Access
base_61_TL7 4243 None ro
lpar1_sysb 2976 vtopt0 ro

     The repository needs more space. Increase the size of the repository.

$ chrep -size 2G

     Check the space available.

$ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
12238    5019     rootvg     139776     20480

Name File Size Optical Access
base_61_TL7 4243 None ro
lpar1_sysb 2976 vtopt0 ro

     Now, create the virtual media disks out of each volume.

Volume1
$ mkvopt -name lpar2_sysb_vol1 -file /home/padmin/mount/vioc_lpar2_backup/cd_image_3014874.vol1

Volume2
$ mkvopt -name lpar2_sysb_vol2 -file /home/padmin/mount/vioc_lpar2_backup/cd_image_3014874.vol2

Volume3
$ mkvopt -name lpar2_sysb_vol3 -file /home/padmin/mount/vioc_lpar2_backup/cd_image_3014874.vol3

Volum4
$ mkvopt -name lpar2_sysb_vol4 -file /home/padmin/mount/vioc_lpar2_backup/cd_image_3014874.vol4

Volume5
$ mkvopt -name lpar2_sysb_vol5 -file /home/padmin/mount/vioc_lpar2_backup/cd_image_3014874.vol5

     Verify that all of the volumes have been made into a virtual disk:

$ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
12239    2022     rootvg     139776     20480

Name File Size Optical Access
base_61_TL7 4243 None ro
lpar1_sysb 2976 vtopt0 ro
lpar2_sysb_vol1 643 None rw
lpar2_sysb_vol2 645 None rw
lpar2_sysb_vol3 645 None rw
lpar2_sysb_vol4 645 None rw
lpar2_sysb_vol5 420 None rw

     Check that a vtopt has been mapped to the appropriate vhost serving the client and that the backing device is available:

$ lsmap -vadapter vhost1
SVSA Physloc Client Partition ID
--------------- -------------------------------------------- ------------------
vhost1 U9117.MMA.10708D0-V1-C12 0x00000003

VTD L2_rootvg
Status Available
LUN 0x8100000000000000
Backing device lpar2_lv
Physloc
Mirrored N/A

VTD vtopt1
Status Available
LUN 0x8200000000000000
Backing device <== Available for a virtual media disk from repository
Physloc
Mirrored N/A


     Load volume 1 of the virtual media disks to the virtual optical device:

$ loadopt -vtd vtopt1 -disk lpar2_sysb_vol1

     Verify it's been assigned as the backing device:

$ lsmap -vadapter vhost1
...

VTD vtopt1
Status Available
LUN 0x8200000000000000
Backing device /var/vio/VMLibrary/lpar2_sysb_vol1
Physloc
Mirrored N/A


     Boot the client from the virtual optical device and begin the install with virtual media disk volume 1 (Follow Part II Steps 7 and 8)

     When prompted for volume 2 (and every additional volume) "Please remove volume 1, insert volume 2, and press the ENTER key.", on the VIOS we'll need to unload the current volume and load the next volume:

Example:

$ unloadopt -vtd vtopt1
$ set -o vi
$ loadopt -vtd vtopt1 -disk lpar2_sysb_vol2

     Back on the client getting installed, strike ENTER/RETURN to begin reading from the second volume and continue the install.

     Continue the process of unloading and loading the virtual media disk volumes in order as the client asks for them until the restore has completed.

Thursday, 9 April 2015

0516-021 /usr/sbin/varyonvg: The varyonvg failed because the volume group's major number was already used by another device.



We have an issue with one of our customer getting the problem unable to create the volume group and it triggers the major number was already used.

It trigger the below error
$ alt_root_vg -target hdisk2   << hdisk2 is the Hitachi  san disk.

Calling mkszfile to create new /image.data file.
Checking disk sizes.
Creating cloned rootvg volume group and associated logical volumes.
0505-102 alt_disk_install: mkvg has returned an error.
0516-021 /usr/sbin/varyonvg: The varyonvg failed because the volume group's
major number was already used by another device.
0516-862 /usr/sbin/mkvg: Unable to create volume group.


Solution from IBM as

I believe what is going on here is the following:
The main detailed issue we are having here is that, sometimes, device
drivers or kernel extensions will use a Major Number but fail to update
the ODM, so AIX thinks the value is available when it is actually in use
in the kernel.

Hence, what we will do here is that we will try to get rid of the
problematic Major Number, as follows:

- We will run "lvlstmajor" to list the next available major number
# lvlstmajor

> it should display a number, Example: XX

- Then, we will use this displayed major number with a dummy VG
# lvgenmajor dummyXX

> this should create an entry in ODM class CuDvDr for "dummyXX"

- Now, we will make sure that the new major number is ready:
# lvlstmajor

> it should display an incremented number, i.e. XX+1

- And now, we can try creating a Test Volume Group to make sure that the
"mkvg" command will work fine:
# mkvg -y testvg hdisk2

> where hdisk2 is the disk you wanted to create the Alt-Disk-Copy on

- If that works, then Remove the newly created "testvg":
# varyoffvg testvg
# exportvg testvg

** So far, we made sure that the "mkvg" command is working perfectly

- Now, we can retry the original command...the alt_root_vg -target hdisk#
** After the original command, "alt_root_vg", finishes successfully,
you can remove the "dummyXX" entry from ODM class CuDvDr, as follows:

# odmdelete -o CuDvDr -q "value1=dummyXX"
0518-307 odmdelete: 1 objects deleted.

Hope this helps!

 

VMWARE SAN Configuration


Cluster Configuration Procedure

For HACMP additional file sets are required in addition to the BOS installation file sets.
From the BOS Installation media select all “ rsct” file sets except rsct.vsd.* file sets( use smitty installp command). Then install the following file sets from HACMP Media. The file sets to be selected are

  1. cluster.adt.es
  2. cluster.es
  3. cluster.es.cfs
  4. cluster.es.cspoc
      5.   cluster.license

The HACMP Configuration can be done via SMIT. To start the configuration run the command # smitty hacmp and the steps are shown below in screen shots. But before starting the configuration ensure to add the boot and service IP entries in the /etc/hosts file in both the nodes that are participating in the HACMP cluster. Also configure the network in both nodes with the Boot IP and ensure the connectivity via the boot IP in both the nodes (do a ping test).



First ensure that you have HACMP software/DUMP and all the required patches published on the net for the HACMP S/W

First check  following settings:

HIGH Watermark for pending write I/Os per File (maxpout)


#       lsattr –El sys0 | grep maxpout          for cluster it should be 32

             LOW Watermark for pending write I/Os per File (minpout)


#       lsattr –El sys0 |grep  minpout           for cluster it should be 24

To change the above settings:

#       smitty system
Change/Show Characteristics of Operating System
and change the below parameters:

Ensure that all the File Systems in the cluster are not getting mounted automatically.
#       chfs –a mount=no /filesystem
For All the FS  “mount=no”

Also the VGs are not varied on automatically.
#       chvg  -a n –Q n vgname
#       ls –l /dev/*vg
#       chdev –l <LUN No.> –a pv=yes
§  For all the VGs  autovaryon=no
§  After changing the VG characteristics in node1 unmount the file systems and varyoff the VGs from node1 and import them  in the node2
#       importvg –y <VG name>  -V <major number>  <the LUN used for the VG>

Ø  MAKE SURE THAT MAJOR NO OF THE VGS IS SAME IN BOTH THE NODES.

Ø  Also make sure that the file systems are not auto mounted and VGs are not auto varyon.

#       chfs –a mount=no <file system name>
#       chvg –a n –Q n  < VG name>

Try mounting of the File Systems.
Then varyoff the VGs
To configure Ether-channel do the following:
#       ifconfig en0 down
#       ifconfig en0 detach
#       rmdev –dl en0
#       rmdev dl et0
#       rmdev –dl ent0
#       cfgmgr
#       smitty etherchannel

Then check and remove the odm-entry  as follows:

#       odmget CuAt |grep <gate way>

if it shows any value like

value = “ net, -hopcount,0,,0,<gateway>”

then delete the above entry using the below command

#       odmdelete –o CuAt –q value=” net, -hopcount,0,,0,<gateway>”

Again check the for the above false entry in ODM.


















Configure en4 with the boot IP ADDRESS and make sure that /etc/hosts is updated with the following entries in both the nodes.

o   <boot ip address1>     hostname1_boot
o   <cluster ip Address1> hostname1_svc                        hostname1
o   <boot ip address2>     hostname2_boot
o   <cluster ip Address2> hostname2_svc                        hostname2



Add scripts to the /usr/es/sbin/cluster/
#       mkdir scripts

o   For HOST1(We can add  scripts to below mentioned files)
#       vi <hostname1>.start
route add 0.0.0.0 <gate way>
#       touch <hostname1>.stop
#       touch <hostname2>.start
#       touch <hostname2>.stop

o   For HOST2
#       vi <hostname2>.start
route add 0.0.0.0 <gate way>
#       touch <hostname2>.stop
#       touch <hostname1>.start
#       touch <hostname1>.stop
o   On both the nodes
#       chmod 755 *.start
#       chmod 755 *.stop


Configure Etherchannel. Make sure that both the ports are showing the link as UP reboot the System to make sure that the old IPs are removed completely , otherwise make the port down/detach and remove it.

#       ifconfig en0 down
#       ifconfig en0 detach
#       rmdev –dl en0
#       rmdev –dl et0
#       rmdev –dl ent0
#       cfgmgr
and configure etherchannel

Install the HACMP software through either HACMP CD or DUMP. Also ensure that you have all the patched required for the HACMP with you. Once the HACMP S/W is installed apply all the PATCHES.

#       installp –agxc <path where the dump/patches are copied> all

OR
o   Use smitty installp menus

Take a reboot

#       shutdown –Fr

After reboot confirm all the things are done perfectly. Now the actual cluster configuration starts

smitty hacmp

o   Extended Configuration
o   Extended Topology Configuration
o   Configure an HACMP cluster
o   Add/Change/Show an HACMP Cluster

Enter the cluster name
example


smitty hacmp
o   Extended Configuration
o   Extended Topology Configuration
o   Configure HACMP Nodes
o   Add a Node to the HACMP Cluster

For Node 1

example


Enter  the nodename1 (hostname) and the communication path to node( above mentioned name --hostname1_boot )

For Node 2

Example



Enter  the nodename2 (hostname) and the communication path to node( above mentioned name –hostname2_boot )

smitty hacmp
o   Extended Configuration
o   Discover HACMP-related Information from configured Nodes



Configuring Heart Beat on Non IBM Storage..

smitty hacmp
o   Extended Configuration
o   Extended Topology Configuration
o   Configure HACMP Communication Interface devices
o   Add Communication Interface/Devices
o   Add Discovered Communication interface and Devices
o   Communication Interfaces

Example

Select the two discovered communication path to node


smitty hacmp
o   Extended Configuration
o   Extended Resource Configuration
o   HACMP Extended Resources Configuration
o   Configure HACMP Service IP Labels/Addresses
o   Add a Service IP Label/Address
o   Configurable on Multiple Nodes.

Example

smitty hacmp
o   Extended Configuration
o   Extended Resource Configuration
o   HACMP Extended Resource Configuration
o   Configure HACMP Application
o   Configure HACMP Application Servers
o   Add An Application Server

Node1
Add Server name and path of the scripts


(You have to mention the path for the scripts for the hostname1.start/stop for both nodes)
                       Node2
                       Server name and path of the scripts



(You have to mention the path for the scripts for the hostname1.start/stop for both nodes)

smitty hacmp
o   Extended configuration
o   Extended Resource Configuration
o   HACMP Extended Resource Group Configuration
o   Add a Resource Group
§  (Here for the host2 to host1 failover type the host2 host1 sequence manually in the Participating Nodes(Default Node Priority)
§  option )








For node2(Enter the group name2 ,the priority and the failover policies)
example



For node2(Enter the group name2 ,the priority and the failover policies)



For concurrent volume groups




smitty hacmp
o   Extended Configuration
o   Extended Resource Configuration
o   HACMP Extended Resource Group Configuration
o   Change /Show resources and Attributes for a Recovery Group
            Here three options have to be filled :
a. Service IP labels/Addresses
b. Application  Server
c. Volume Groups





For node1

















For Node2



For concurrent Volume group



smitty hacmp
o   Extended Configuration
o   Extended Verification and Synchronization




For disk heart beats
smitty hacmp
o   Extended Configuration
o   Extended Topology Configuration
o   Configure HACMP Communication Interface devices
o   Add Communication Interface/Devices
o   Add Discovered Communication interface and Devices
Select Communication Devices





smitty hacmp
o   Extended Configuration
o   Extended Verification and Synchronization




If the cluster sync fails then do as follows:
Go to /usr/es/sbin/cluster/diag
Cp ver_get_diskhb_info ver_get_diskhb_info_org
Vi ver_get_diskhb_info
search for mode and change the below entry

Original entry              :           mode=`/usr/sbin/lqueryvg –p $line –X >/dev/null 2>&1`

Modified entry            :           mode=`/usr/sbin/lqueryvg –p $line –X 2>/dev/null`

Then sync the cluster.

Start the cluster.





If hacmpvg is not showing concurrent in lspv then create new resource group and add resource vg in resource group and do the necessary changes shown below…..