Displaying tape information

Red Hat Enterprise Linux 9.2 LPAR mode z/VM guest

Use the lstape command to display summary information about your tape devices, or read tape information from sysfs.

Alternatively, you can read tape information from sysfs. Each physical tape device is represented in a sysfs directory of the form

/sys/bus/ccw/devices/<device_bus_id>

where <device_bus_id> is the device bus-ID that corresponds to the physical tape device. This directory contains a number of attributes with information about the physical device. The attributes: blocksize, state, operation, and medium_state, might not show the current values if the device is offline.

Table 1. Tape device attributes
Attribute Explanation
online 1 if the device is online or 0 if it is offline (see Setting a tape device online or offline)
cmb_enable 1 if channel measurement block is enabled for the physical device or 0 if it is not enabled (see Channel measurement facility)
cutype Type and model of the control unit
devtype Type and model of the physical tape device
blocksize Currently used block size in bytes or 0 for auto
state State of the physical tape device, either of:
UNUSED
Device is not in use and is available to any operating system image in a shared environment
IN_USE
Device is being used as a character device by a process on this Linux® image
OFFLINE
The device is offline.
NOT_OP
Device is not operational
operation The current tape operation, for example:
---
No operation
WRI
Write operation
RFO
Read operation
MSN
Medium sense
Several other operation codes exist, for example, for rewind and seek.
medium_state The current state of the tape cartridge:
1
Cartridge is loaded into the tape device
2
No cartridge is loaded
0
The tape device driver does not have information about the current cartridge state

Procedure

Issue a command of this form to read an attribute:
# cat /sys/bus/ccw/devices/<device_bus_id>/<attribute>
where <attribute> is one of the attributes of Table 1.

Example

The following lstape command displays information about a tape device with bus ID 0.0.015f:
# 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
This sequence of commands reads the same information from sysfs:
# cat /sys/bus/ccw/devices/0.0.015f/online
1
# cat /sys/bus/ccw/devices/0.0.015f/cmb_enable
0
# cat /sys/bus/ccw/devices/0.0.015f/cutype
3480/01
# cat /sys/bus/ccw/devices/0.0.015f/devtype
3480/04
# cat /sys/bus/ccw/devices/0.0.015f/blocksize
0
# cat /sys/bus/ccw/devices/0.0.015f/state
UNUSED
# cat /sys/bus/ccw/devices/0.0.015f/operation
---
# cat /sys/bus/ccw/devices/0.0.015f/medium_state
1