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, 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.
# 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:
Then issue:# modprobe tape_3590
Alternatively, issue:# chzdev -e -a tape 015f
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:
or# chzdev -d -a tape 015f
or# chccwdev -d 0.0.015f
# echo 0 > /sys/bus/ccw/devices/0.0.015f/online