VIOS clone

There may be a time whereby one wants to clone the VIOS. This can be done on the same system (to an alternate disk), or perhaps for a remote system. This is explained in detail at:

https://www.ibm.com/support/pages/how-clone-powervm-vios-rootvg

When I attempted this, I ran into a little bit of a snag. I was attempting to use scenario 3, putting vios on an Alternate disk, then booting from that. This is so the VIOS would boot from a SAN lun, instead of the local disk.

Typically this is accomplished in the restricted shell by running:

$ alt_root_vg -target <new_hdisk>

However, in my specific case, I had renamed this device to be a bit more friendly of a name (so I knew exactly what it was). This was initially done with: rendev -l hdisk1 -n osbootlun

However, when running alt_root_vg -target osbootlun I encountered the following:

Building boot image on cloned disk.
0301-168 bosboot: The current boot logical volume, /dev/hd5, does not exist on /dev/hdisk94.
0505-120 alt_disk_install: Error running bosboot in the cloned volume group.

hdisk94 is the “current” rootvg disk, and it does in fact have the hd5 LV.

Work-around:

Rename device back to a hdiskXXX name, then run the VIOS clone:

# rendev -l osbootlun -n hdisk911
# exit
$ alt_root_vg -target hdisk911
Building boot image on cloned disk.
forced unmount of /alt_install/var/vio/VMLibrary/
...
Bootlist is set to the boot disk: hdisk911 blv=hd5

At this point you now have the VIOS installed (additionally) on the alternate disk. The clone steps above changed the default boot device to hdisk911. If at some point in the future, you wanted to change it back, simply re-point it.

Note: Once you perform the VIOS clone steps above and reboot the server, it’ll come up on the new boot device. AIX will name disks as hdiskxxx in the order that it sees them. The old disk is typically a member of the VG: old_rootvg OR alt_rootvg or similar.

If everything is working fine from the reboot and you no longer wish to keep the old VIOS installation, you can remove it. To determine what the physical volume names are:

# lspv
hdisk0     00c609e0a5ec1460         rootvg     active
hdisk1     00c609e037478aad         old_rootvg     active
hdisk4     00c03c8a14fa936b         abc_vg     active
hdisk2     00c03b1a32e50767         None
hdisk3     00c03b1a32ee4222         None
hdisk5     00c03b1a35cdcdf0         None

Typically an alternate rootvg operation will (after the reboot) rename the old vios installation as: old_rootvg or alt_inst. So to remove it, and to clean things up:

# alt_rootvg_op -X old_rootvg #remove the old vios installation
# chdev -l hdisk1 -a pv=clear # wipe out the PVID
# chpv -c hdisk1 #remove boot record
# dd if=/dev/zero of=/dev/hdisk1 bs=4092 count=12800 #erase hdisk1