Sometimes it’s necessary to mount an ISO to an LPAR virtually via a VIOS.

In this example, our ISO image file, ITM-only.iso, is copied to the /tmp directory, and the virtual media library has already been created at /var/vio/VMLibrary (see mkrep command for further details on this). See here for how to convert files to an ISO.

We will need to know the vhost devices used for the LPAR we want to mount the ISO to (or create them if they do not exist), and the LPAR #.

In this case the LPAR ID is 1 and is configured with vhost0. We are using the padmin user on the VIO server and root user on the target LPAR. If the LPAR is new, you will need to ensure you’ve created all the relevant virtual adapters on both the new LPAR and each VIO server, for the latter using a DLPAR operation and a cfgdev command as padmin to bring the vhost into existence.

First let’s load the ISO into the virtual media library..

mkvopt -name ITM -file /tmp/ITM-only.iso -ro

We should now be able to see our media by running: –

$ lsrep
Size(mb) Free(mb) Parent Pool         Parent Size      Parent Free
   20403     3398 rootvg                   279552           140288
 
Name                                    File Size Optical         Access
IPMBaseServer43                               453 None            rw
IPMHIghSpeed43                                  4 None            rw
IPMMedSpeed                                     4 None            rw
IPMPTF                                        678 vtopt0          rw
ITM                                          2711 None            ro   <-----
PowerHA-R610-Base                             313 None            rw
PowerHA-R610-SP03                              49 None            rw
aix_61_01                                    4040 None            rw
aix_61_02                                    1312 None            rw
db2                                           302 None            rw
goldbuild                                    1629 None            ro
hispeedprinter                                  4 None            rw
ipm_410                                       374 None            rw
medspeedprinters                                4 None            rw
mksysb                                       5120 None            rw
sddpcm.iso                                      4 None            rw
sddpcm61                                        4 None            rw

If you decide your didn’t name your VML disk right, or would just like to change it, you can use the command:

chvopt -name <old_name> -mv <new_name>

You can now delete the original ISO file in /tmp.

Now create a virtual optical adapter on the vadapter associated with our target LPAR (if one does not already exist, do lsmap to see this).

mkvdev -fbo -vadapter vhost0
vtopt0

And we can then load that virtual device with our media with

loadopt -disk ITM -vtd vtopt0

lsvopt will show you it’s mounted…

$ lsvopt
VTD             Media                                   Size(mb)
vtopt0          ITM                                         2711

Running cfgmgr on the target LPAR as root will now show a cd0 device which we can mount.

lsdev -Cccdrom
cd0 Available  Virtual SCSI Optical Served by VIO Server
 
mount -o ro /dev/cd0 /cdrom

Change to the /cdrom directory and you have your ISO all mounted and ready to go.

When you’re finished, change directory so you’re not in /cdrom and do…

umount /cdrom
rmdev -dl cd0

You may decide you want to keep the cdrom device for future use, in which case don’t run that last rmdev command.

Back on the VIOS as padmin do:

unloadopt -vtd vtopt0

Use a rmvdev command if you want to remove the virtual optical device from the VIOS, but it doesn’t consume any resource when not in use, so you may as well leave it.