8.3.4. Removing Devices

Devices that are no longer required, are also typically removed automatically from a virtual I/O server. If devices are to be removed manually, the “vios rmdev” (remove device) command can be used. In addition to the virtual I/O server, the device to be removed must be specified:

$ vios rmdev ms13-vio1 hdisk3

The definition for the device remains in the ODM of the virtual I/O server:

$ vios lsdev ms13-vio1 hdisk3
NAME    STATUS   PHYSLOC                                          PARENT  DESCRIPTION
hdisk3  Defined  U78D3.001.VYR0AL4-P1-C7-T1-W500507680130A1C4-L0  fscsi4  MPIO IBM 2145 FC Disk

If the device is also to be removed from the ODM, the ‘-d‘ option must be used!

Of course, if a device is in use, it cannot be removed. If you try to remove the device, an error message is shown, typically with information on how the device is currently in use:

$ vios rmdev ms13-vio1 hdisk4
hmc01: viosvrcmd -m ms13 -p ms13-vio1 -c \"rmdev -dev hdisk4 -ucfg\"
ERROR: remote HMC command returned an error (1)
StdErr: HSCL2970 The IOServer command has failed because of the following reason:
StdErr: Device "hdisk4" is in use as an AMS backing device.
StdErr: rc=71

In this case the device (hdisk4) is configured as a paging device for a shared memory pool.

Occasionally, an adapter and child devices should be removed. In principle, all child devices must first be removed before the parent device itself can be removed. With the option ‘-R‘ (recursive) devices can be removed recursively. For example, to remove the FC adapter fcs4 including all child devices (fscsi4, sfwcomm4 and hdisks), the option ‘-R‘ can be used on the device fcs4:

$ vios rmdev -R ms13-vio1 fcs4

If the definitions are also to be deleted from the ODM at the same time, the ‘-d‘ option must also be used.