Deleting Virtual Media

If virtual media are no longer required, e.g. ISO images from old AIX versions, these can be deleted to reclaim space in the Virtual Media Repository. We show the removal with the help of “vios rmmedia” with some examples.

We currently have the following virtual media in our virtual media repository on the virtual I/O server ms12-vio1:

$ vios lsmedia ms12-vio1
NAME                  FILE SIZE  OPTICAL   ACCESS
AIX_720500_DVD_1.iso    3.56 GB  vtopt0    ro
AIX_720500_DVD_2.iso    4.00 GB  None      ro
AIX_720501_flash.iso    7.56 GB  None      rw
mksysb_aix01.iso        4.00 GB  aix04_cd  rw
$

Two of the media (AIX_720500_DVD_1.iso and mksysb_aix01.iso) are currently loaded in virtual optical devices and are therefore potentially in use.

We first delete the virtual medium AIX_720501_flash.iso, which is currently not in use:

$ vios rmmedia ms12-vio1 AIX_720501_flash.iso
$

A check shows that the medium was removed successfully:

$ vios lsmedia ms12-vio1
NAME                  FILE SIZE  OPTICAL   ACCESS
AIX_720500_DVD_1.iso    3.56 GB  vtopt0    ro
AIX_720500_DVD_2.iso    4.00 GB  None      ro
mksysb_aix01.iso        4.00 GB  aix04_cd  rw
$

Next we delete the virtual medium mksysb_aix01.iso. The medium is currently loaded in the virtual optical device aix04_cd and could potentially be in use by the client (aix04). This can be checked by trying to unload the medium. This is only successful if the client is not using the medium:

$ vios unloadopt ms12-vio1 aix04_cd
hmc01: viosvrcmd -m ms12 -p ms12-vio1 -c \"unloadopt -vtd aix04_cd\"
ERROR: remote HMC command returned an error (1)
StdErr: HSCL2970 The IOServer command has failed because of the following reason:
StdErr: Unable to perform the requested operation.
StdErr: 'aix04_cd' is currently reserved by the client.
StdErr:
StdErr: Use the -release flag to remove the reserve
StdErr:
StdErr: rc=41
$

The medium is currently in use on the client! We log into the client and unmount the mounted file system:

aix04 # umount /cdrom
aix04 #

Then we try again to unload the medium from the drive again:

$ vios unloadopt ms12-vio1 aix04_cd
$

This time it was successful. This means that the virtual medium to be deleted is no longer in use and is no longer inserted in any drive. Therefore we can now delete the medium with the command “vios rmmedia“:

$ vios rmmedia ms12-vio1 mksysb_aix01.iso
$

The deletion was now successful:

$ vios lsmedia ms12-vio1
NAME                  FILE SIZE  OPTICAL  ACCESS
AIX_720500_DVD_1.iso    3.56 GB  vtopt0   ro
AIX_720500_DVD_2.iso    4.00 GB  None     ro
$

Note: With read-only virtual media, the virtual media can easily be inserted into multiple virtual optical devices and used by multiple client LPARs.

If you try to delete a virtual medium that is inserted in a drive and is in use by the client, you will get the following error message:

$ vios rmmedia ms12-vio1 AIX_720500_DVD_1.iso
hmc01: viosvrcmd -m ms12 -p ms12-vio1 -c \"rmvopt -name AIX_720500_DVD_1.iso\"
ERROR: remote HMC command returned an error (1)
StdErr: HSCL2970 The IOServer command has failed because of the following reason:
StdErr: Unable to perform operation while the virtual DVD is loaded.
StdErr:
StdErr: rc=4
$

You can try to force a deletion with the “-f” (force) option, but this is not successful if the medium is in use by the client:

$ vios rmmedia -f ms12-vio1 AIX_720500_DVD_1.iso
hmc01: viosvrcmd -m ms12 -p ms12-vio1 -c \"rmvopt -f -name AIX_720500_DVD_1.iso\"
ERROR: remote HMC command returned an error (1)
StdErr: HSCL2970 The IOServer command has failed because of the following reason:
StdErr: Unable to perform the requested operation.
StdErr: 'vtopt0' is currently reserved by the client.
StdErr:
StdErr: rc=41
$

Before a virtual medium can be deleted, a mounted CD file system must first be unmounted on the client before the virtual medium can be successfully deleted.