Setting a tape device online or offline

Red Hat Enterprise Linux 8.6 LPAR mode z/VM guest

Set a tape device online or offline with the chccwdev command or through the online sysfs attribute of the device.

About this task

Setting a physical tape device online makes both corresponding logical devices accessible:
  • The non-rewind character device
  • The rewind character device

At any time, the device can be online to a single Linux® instance only. You must set the tape device offline to make it accessible to other Linux instances in a shared environment.

Procedure

Use the chzdev command to set a tape online or offline.

Alternatively, you can write 1 to the device's online attribute to set it online or 0 to set it offline.

Results

When a physical tape device is set online, the device driver assigns an index number to it. This index number is used in the standard device nodes to identify the corresponding logical devices. The index number is in the range 0 - 127. A maximum of 128 physical tape devices can be online concurrently.

If you are using the standard device nodes, you must find out which index number the tape device driver has assigned to your tape device. This index number, and consequently the associated standard device node, can change after a tape device was set offline and back online.

If you need to know the index number, issue a command of this form:
# lstape --ccw-only <device_bus_id>
where <device_bus_id> is the device bus-ID that corresponds to the physical tape device. The index number is the value in the TapeNo column of the command output.

Examples

  • To set a physical tape device with device bus-ID 0.0.015f online, first load the module if you have not already done so:
    # modprobe tape_3590
    Then issue:
    # chzdev -e -a tape 015f
    Alternatively, issue:
    # chccwdev -e 0.0.015f
    or
    # echo 1 > /sys/bus/ccw/devices/0.0.015f/online
    To find the index number that the tape device driver assigned to the device, issue:
    # lstape 0.0.015f --ccw-only
    TapeNo  BusID      CuType/Model DevType/Model   BlkSize State   Op      MedState
    2       0.0.015f   3480/01      3480/04         auto    UNUSED  ---     LOADED
    In the example, the assigned index number is 2. The standard device nodes for working with the device until it is set offline are then:
    • /dev/ntibm2 for the non-rewinding device
    • /dev/rtibm2 for the rewinding device
  • To set a physical tape device with device bus-ID 0.0.015f offline, issue:
    # chzdev -d -a tape 015f
    or
    # chccwdev -d 0.0.015f
    or
    # echo 0 > /sys/bus/ccw/devices/0.0.015f/online