Tape naming scheme

Red Hat Enterprise Linux 9.2 LPAR mode z/VM guest

The tape device driver assigns minor numbers along with an index number when a physical tape device comes online.

The naming scheme for tape devices is summarized in Table 1:
Table 1. Tape device names and minor numbers
Device Names Minor numbers
Non-rewinding character devices ntibm<n> <n>
Rewinding character devices rtibm<n> <n>+1
where <n> is the index number that is assigned by the device driver. The index starts from 0 for the first physical tape device, 1 for the second, and so on. The name space is restricted to 128 physical tape devices, so the maximum index number is 127 for the 128th physical tape device.

The index number and corresponding minor numbers and device names are not permanently associated with a specific physical tape device. When a tape device goes offline, it surrenders its index number. The device driver assigns the lowest free index number when a physical tape device comes online. An index number with its corresponding device names and minor numbers can be reassigned to different physical tape devices as devices go offline and come online.

Tip: Use the lstape command to determine the current mapping of index numbers to physical tape devices.

When the tape device driver is loaded, it dynamically allocates a major number to channel-attached character tape devices. A different major number might be used when the device driver is reloaded, for example when Linux® is rebooted.

For online tape devices directories provide information about the major/minor assignments. The directories have the form:
  • /sys/class/tape390/ntibm<n>
  • /sys/class/tape390/rtibm<n>
Each of these directories has a dev attribute. The value of the dev attribute has the form <major>:<minor>, where <major> is the major number of the device and <minor> is the minor number specific to the logical device.

Example

In this example, four physical tape devices are present, with three of them online. The TapeNo column shows the index number and the BusID indicates the associated physical tape device. In the example, no index number is allocated to the tape device in the first row. The device is offline and, currently, no names and minor numbers are assigned to it.

# lstape --ccw-only
TapeNo  BusID      CuType/Model DevType/DevMod  BlkSize State   Op      MedState
0       0.0.01a1   3490/10      3490/40         auto    UNUSED  ---     UNLOADED
1       0.0.01a0   3480/01      3480/04         auto    UNUSED  ---     UNLOADED
2       0.0.0172   3590/50      3590/11         auto    IN_USE  ---     LOADED
N/A     0.0.01ac   3490/10      3490/40         N/A     OFFLINE ---     N/A
Table 2 summarizes the resulting names and minor numbers.
Table 2. Example names and minor numbers
Bus ID Index (TapeNo) Device Device name Minor number
0.0.01a1 0 non-rewind ntibm0 0
rewind rtibm0 1
0.0.01a0 1 non-rewind ntibm1 2
rewind rtibm1 3
0.0.0172 2 non-rewind ntibm2 4
rewind rtibm2 5
0.0.01ac not assigned n/a n/a not assigned
For the online character devices, the major/minor assignments can be read from their respective representations in /sys/class:
# cat /sys/class/tape390/ntibm0/dev
254:0
# cat /sys/class/tape390/rtibm0/dev
254:1
# cat /sys/class/tape390/ntibm1/dev
254:2
# cat /sys/class/tape390/rtibm1/dev
254:3
# cat /sys/class/tape390/ntibm2/dev
254:4
# cat /sys/class/tape390/rtibm2/dev
254:5
In the example, the major number that is used for character devices is 254. The minor numbers are as expected for the respective device names.