Setting a tape device online or offline

6.10 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, use the chccwdev command, or you can write 1 to the online attribute of the device to set it online; or write 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.

Your distribution might use udev to create alternative device nodes that distinguish devices by the physical device's bus ID instead of the index number. If you are using such device nodes, you do not need to know the index number.

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, issue:
    # chzdev -e tape 015f
    This setting persists across re-boots. For more details, see Persistent device configuration.
    To apply this setting to the running system only, use the chzdev command with the -a option or one of the following commands:
    # 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 tape 015f
    This setting persists across re-boots. For more details, see Persistent device configuration.
    To apply this setting to the running system only, use the chzdev command with the -a option or one of the following commands:
    # chccwdev -d 0.0.015f
    or
    # echo 0 > /sys/bus/ccw/devices/0.0.015f/online