Howto: Clone AIX via virtual DVD DLPAR

Today I created a few LPARs and I used a mksysb image as the installation source. Because the LPARs would have only one Ethernet adapter, I used the Virtual I/O Server virtual DVD feature for booting the install images.

Note: The process should work simultaneously if you create individual virtual SCSI adapters for each LPAR, but this document demonstrates the command line method of passing a single SCSI adapter and DVD around.

Principles

LPAR: VM in the IBM PowerVM terminology.

VIO Server: Virtual I/O Server, an AIX LPAR with virtual I/O management capabilities. Some tasks require the VIO Server which is commandline only and uses a restricted KSH user with a modified set of AIX commands.

HMC: The actual control interface to the Power system's hypervisor, managing LPARs and I/O assignment. The primary Web interface has a fully equivalent command line alternative, accessible via ssh and running in restricted Bash. It can issue VIO Server commands via the "viosvrcmd" command, as seen below.

Profile: A predefined set of LPAR resources on the HMC. It is read during cold boot of the LPAR but the CPU/RAM maximum limits are in effect while the OS is running.

DLPAR: dynamic runtime operation (add or remove CPU, memory, physical or virtual adapters)

HMC chsyscfg command = profile change

HMC chhwres command = DLPAR operation

Here we are using a fully virtualized I/O setup with SAN disks via virtual Fibre Channel adapters. The serial terminals providing the console are also virtual devices.

The virtual DVD is loaded with a simulated device on the Virtual I/O server which is really a file, usually an ISO image or a mksysb (AIX bootable LVM image). These files can be used in multiple virtual DVD drives at the same time.

Prerequisites

  • LPAR profiles complete with CPU, RAM, vFC adapters and disks
  • One virtual SCSI adapter created and assigned to the first LPAR (here I used slot ID 404)
  • mksysb image available in the VIO repository
  • First LPAR successfully installed from this image (to see if the image is bootable etc)
  • The VIO Server providing the virtual DVD is LPAR id=1
  • "EscapeChar none" set in .ssh/config if you use an OpenSSH client for accessing the HMC
  • N is an example LPAR ID

Procedure

Add vSCSI adapter 404 to next LPAR by changing the existing profile - N represents the ID of the next LPAR we will be working on.

chsyscfg -r prof -m <machine> -i "lpar_id=N,name=normal,virtual_scsi_adapters=404/client/1/vioserver1/404/0"
lssyscfg -r prof -m <machine> -F lpar_name,name,virtual_scsi_adapters | grep -w 404

Delete vSCSI DVD from the VIO Server

viosvrcmd -m <machine> --id 1 -c "unloadopt -vtd dlpar-DVD -release"
viosvrcmd -m <machine> --id 1 -c "rmdev -dev vhost3 -recursive"

Add vSCSI adapter 404 to next LPAR on VIO Server profile via DLPAR. First command removes, second command reassigns it. You could use a "move" operation as well.

chhwres -r virtualio --rsubtype scsi -m <machine> --id 1 -o r -s 404
chhwres -r virtualio --rsubtype scsi -m <machine> --id 1 -o a -s 404 -a "adapter_type=server,remote_lpar_id=N,remote_slot_num=404"

Check for slot 404 to appear on the VIOS (note that DLPAR has run cfgmgr to detect the device) and identify matching vSCSI adapter. It should be the same device name each time.

viosvrcmd -m <machine> --id 1 -c "lsdev -vpd" | grep vhost
...
  vhost3           U8204.E8A.0000000-V1-C404           Virtual SCSI Server Adapter
...

Create and populate new vDVD (fbo is for "File-based Optical Device")

viosvrcmd -m <machine> --id 1 -c "mkvdev -vadapter vhost3 -fbo -dev dlpar-DVD"
viosvrcmd -m <machine> --id 1 -c "loadopt -disk src_lpar2_vol1 -vtd dlpar-DVD"

Boot LPAR into SMS and initiate mksysb restore

chsysstate -r lpar -m <machine> --id N -f normal -o on -b sms
mkvterm -m <machine> --id N

The key sequences for your convenience (may vary on different systems):

Enter Enter

5 1 3 1 1 1 2 1 (get to the Normal Mode Boot)

1 Enter

Enter (English)

Enter ("An invalid boot disk" warning)

2 (Settings)

3 (Toggle "Import user volume groups")

Enter (Install)

When you have multiple DVD volumes: At the "Please remove volume 1, insert volume 2, and press the ENTER key." prompt, escape to HMC (~.)

viosvrcmd -m <machine> --id 1 -c "unloadopt -vtd dlpar-DVD -release"
viosvrcmd -m <machine> --id 1 -c "loadopt -disk src_lpar2_vol2 -vtd dlpar-DVD -release"

Then go to the vterm console again.

mkvterm -m <machine> --id N

You don't get any input, but the vterm opens. Bravely hit Enter and the install goes on. Repeat as necessary for further image volumes.

The installer will reboot the LPAR. After you get to the AIX login prompt, login as root and halt the LPAR.

root@localhost # shutdown -Fh

Alternative hard shutdown from HMC

chsysstate -r lpar -m <machine> --id N -o shutdown --immed

Check state

lssyscfg -r lpar -m <machine> -F lpar_id,state

Remove vSCSI adapter from LPAR profile

chsyscfg -r prof -m <machine> -i "lpar_id=N,name=normal,virtual_scsi_adapters=none"

Cycle complete!!! The adapter 404 is now free and you can allocate it to the next LPAR.

Todo: On each finished AIX LPAR, clean up Defined devices (typically, vscsi0 and cd0). You can do it right after install as well.

Cleanup

After the last LPAR is installed, run these again:

Remove server DVD and adapter with DLPAR

viosvrcmd -m <machine> --id 1 -c "unloadopt -vtd dlpar-DVD -release"
viosvrcmd -m <machine> --id 1 -c "rmdev -dev vhost3 -recursive"
chhwres -r virtualio --rsubtype scsi -m <machine> --id 1 -o r -s 404

If necessary, revert VIO Server profile(s) to a state without adapter 404 assigned to any of the LPARs. We don't need the moving adapter in the VIO Server profile anymore.

Check:

lssyscfg -r prof -m <machine> -F lpar_name,name,virtual_scsi_adapters | grep -w 404

Modify the value of virtual_scsi_adapters to include remaining vSCSI adapters only. Note the escape characters around nested quotes.

chsyscfg -r prof -m <machine> -i "lpar_id=1,name=normal,\"virtual_scsi_adapters=407/server/7/src_lpar2/407/0,406/server/6/src_lpar1/406/0,11/server/any//any/0\""

Here's a summary of the time spent on testing and documenting the procedure. Times include all the steps described above: VIO configuration, a complete installation and poweroff.

Second LPAR: 1:48

Third LPAR: 0:18

Fourth LPAR: 0:15

I didn't even bother scripting it, just used Bash history search to call up and edit each line.

Mass add a virtual Ethernet adapter to LPAR profiles (takes about a minute to completeÖ

for lpar in 10 11 12 13; do chsyscfg -r prof -m <machine> -i "lpar_id=$lpar,name=normal,\"virtual_eth_adapters=302/0/302//0/0/ETHERNET0\""; done