Deleting a Virtual Media Repository

If a Virtual Media Repository is no longer required, it can be deleted with the “vios rmrep” command. However, no virtual media may then be in use on client LPARs!

Before we attempt to delete the Virtual Media Repository, let’s first look at the size:

$ vios lsrep ms12-vio1
                                 PARENT
SIZE       FREE       POOL    SIZE       FREE
39.84 GB   24.72 GB  rootvg  528.00 GB  430.00 GB
$

The Virtual Media Repository is obviously not empty, only 24.72 GB of the total 39.84 GB are free.

The virtual media contained are:

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

Two of the virtual media are loaded in virtual optical devices. The first medium (AIX_720500_DVD_1.iso) is mounted on the LPAR aix04. The second medium (AIX_720500_DVD_2.iso) is only loaded, but not used. Of course, this cannot be seen from the output above, but can be checked on the LPARs.

The first step should be to ensure that none of the virtual media is in use on a client LPAR. The verification can be done by trying to eject the virtual media.

We try to unload the first medium from the virtual device aix04_cd:

$ 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
$

That was unsuccessful, so the media is in use on the client and we need to umount the CD filesystem on the client. The client is the LPAR aix04:

aix04 # umount /cdrom
aix04 #

A new attempt to unload the medium is now successful:

$ vios unloadopt ms12-vio1 aix04_cd
$

Next we try to unload the second medium from the vtopt0 device:

$ vios unloadopt ms12-vio1 vtopt0
$

This was immediately successful, which means that the medium on the associated LPAR (aix01) was not in use.

Listing all virtual media again shows that none of the virtual media is in use any more:

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

We therefore now try to delete the Virtual Media Repository. The command is “vios rmrep“:

$ vios rmrep ms12-vio1
hmc01: viosvrcmd -m ms12 -p ms12-vio1 -c \"rmrep \"
ERROR: remote HMC command returned an error (1)
StdErr: HSCL2970 The IOServer command has failed because of the following reason:
StdErr: DVD repository contains file backed DVD media. Use -f to remove
StdErr:
StdErr: rc=4
$

By default, the command only deletes an empty Virtual Media Repository. But we don’t have to delete all virtual media individually with “vios rmmedia“, because “vios rmrep” can also do this if the option “-f” (force) is specified:

$ vios rmrep -f ms12-vio1
$

The command is successful, the Virtual Media Repository has been deleted. The command “vios lsrep” shows that there is no longer a Virtual Media Repository:

$ vios lsrep ms12-vio1
                 PARENT
SIZE  FREE  POOL  SIZE  FREE
-     -     -     -     -
$