Setting a tape device online or offline
Set a tape device online or offline with the chccwdev command
or through the online
sysfs attribute of the device.
About this task
- 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
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.
# 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:
This setting persists across re-boots. For more details, see Persistent device configuration.# chzdev -e tape 015f
To apply this setting to the running system only, use the chzdev command with the -a option or one of the following commands:
or# chccwdev -e 0.0.015f
To find the index number that the tape device driver assigned to the device, issue:# echo 1 > /sys/bus/ccw/devices/0.0.015f/online
In the example, the assigned index number is# 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
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:
This setting persists across re-boots. For more details, see Persistent device configuration.# chzdev -d tape 015f
To apply this setting to the running system only, use the chzdev command with the -a option or one of the following commands:
or# chccwdev -d 0.0.015f
# echo 0 > /sys/bus/ccw/devices/0.0.015f/online