Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MKSYSB's on new LPAR'd systems

Status
Not open for further replies.
Aug 5, 2003
35
0
0
US
Forgive me as I'm new to the LPAR thing, but I wanted to see if you guys could give me some guidance here. I have a new system that we've partitioned into 2 servers. This system has one DVD that we could move between the two, but I am not the scripting expert either! :) How can I get a mksysb of these servers? I don't have a NIM server, but wouldn't be opposed to setting one up if I need to. I may get external tapes drives to attach as an option if I can't come up with something.

Thoughts?

Dave
 
The simplest method would be to setup a nim server.
You can then NFS mount a filesystem from the NIM server and just use the mksysb command.
 
This is another way of doing it:

Code:
#!/usr/bin/ksh

PROGNAME=${0##*/}

HMCUSER="hscroot"       # User on HMC with super admin privilege
HMC="p5hmc"             # TCP/IP host name of HMC

DEV="$1"                # Device to move
DHOST="$2"              # Destination host

function Die
{
  print -u2 "$PROGNAME: $*"
  exit 1
}

function GetManagedSystem
{
  typeset LPAR="$*" TESTLPAR= TSYSTEM=
  integer i
  ssh $HMCUSER@$HMC lssyscfg -r sys -F name |
  while read TSYSTEM
  do
    SYSTEM[${#SYSTEM[*]}]="$TSYSTEM"
  done
  (( i = 0 ))
  while (( i < ${#SYSTEM[*]} )); do
    ssh $HMCUSER@$HMC lssyscfg -r lpar -m \"${SYSTEM[i]}\" -F "lpar_id name" |
    while read TESTLPAR
    do
      if [[ $TESTLPAR = $LPAR ]]
      then
        echo "${SYSTEM[i]}"
        return
      fi
    done
    (( i += 1 ))
  done
  echo ""
}

LPAR=$(uname -L)        # ID and name of this partition
LPAR_ID=${LPAR% *}      # Extract LPAR ID

# Test ssh connectivity to HMC
[[ $(ssh $HMCUSER@$HMC whoami 2>/dev/null) = $HMCUSER ]] || Die "ssh to HMC $HMC not functional"

# Test ssh connectivity to destination host
[[ $(ssh $DHOST id -un 2>/dev/null) = $(id -un) ]] || Die "ssh to $DHOST not functional"

# Test ssh connectivity to destination host
[[ $(ssh $DHOST id -un 2>/dev/null) = $(id -un) ]] || Die "ssh to $DHOST not functional"

# Get name of managed system to which this LPAR belongs
SYSTEM="$(GetManagedSystem "$LPAR")"
[[ $SYSTEM != "" ]] || Die "not able to determine managed system"

# Get LPAR ID and name of destination host
DLPAR=$(ssh $DHOST uname -L)
[[ $DLPAR != "" ]] || Die "$DHOST not an LPAR"

# Extract LPAR ID of destination
DLPAR_ID=${DLPAR%\ *}

# Verify that destination DLPAR is on the same managed system
[[ $(GetManagedSystem "$DLPAR") = "$SYSTEM" ]] || Die "$DHOST not in the same managed system"

# Find the PCI bus device to which this device connects.
while [[ $DEV != pci* ]]; do
  SLOT=$(lscfg -l $DEV | awk '{print $2}')
  DEV=$(lsdev -C -F parent -l $DEV)
done
set -x

# Get the drc_index for the slot we want to move
DRC_INDEX=$(ssh $HMCUSER@$HMC lshwres -r io --rsubtype slot -m \"$SYSTEM\" -F drc_name:drc_index | awk -F: '$1 == "'$SLOT'" {p
rint $2}')

if /usr/sbin/rmdev -R -l $DEV
then
  if ssh $HMCUSER@$HMC chhwres -r io -m \"$SYSTEM\" -o m --id $LPAR_ID --tid $DLPAR_ID -l $DRC_INDEX
  then
    ssh $DHOST /usr/sbin/cfgmgr -s
  fi
fi

Save this to for example moveHD.sh

then you can run this as follows:

(Assuming that your DVD is /dev/cd0)

moveHD.sh cd0 Name_of_destination_host

and there you go, you can schedule this in crontab and add to the command above your mksysb command in another file.

But before you be able to do the above you need to set up the ssh between your HMC and the LPARs.

Refer to this link for ssh setting:


I hope this is what in your mind!

Regards,
Khalid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top