Virtual SCSI-attached tape devices

6.10 KVM guest

The representation of virtual SCSI-attached tape and medium changer devices on Linux® as a KVM guest on IBM® Z depends on your device driver.

st
The st device driver for SCSI tape drives is included in the Linux kernel source from kernel.org. Depending on your distribution, it might be compiled into your kernel or supplied as a separate module.
For each device, st provides device nodes of the form /dev/st<i><x> and /dev/nst<i><x> where the latter is for non-rewinding devices, where
<x>
is an alphabetic character that specifies a tape property, for example, compression or encryption.
<i>
identifies an individual device.
The identifier, <i>, is assigned when Linux is booted or when a device is set online. As a result, there is no fixed mapping between a physical tape device and the tape device nodes. For details, see the st man page.
ch
The ch device driver for SCSI medium changers is included in the Linux kernel source from kernel.org. Depending on your distribution, it might be compiled into your kernel or supplied as a separate module.

For each device, ch provides device nodes of the form /dev/sch<i> where <i> identifies an individual device.

The identifier, <i>, is assigned when Linux is booted or when a device is set online. As a result, there is no fixed mapping between physical media changer devices and the media changer device nodes. For details, see Documentation/scsi/scsi-changer.txt in the Linux source code.

lin_tape
The lin_tape device driver is available from the IBM Fix Central site at www.ibm.com/support/fixcentral. For details about downloading the device driver, see Technote 1428656.

The device nodes that it provides include characteristics of the physical tape drive or medium changer and are persistent across reboots and after setting a tape device offline and back online. For details, see IBM Tape Device Drivers Installation and User's Guide, GC27-2130.

Listing your tape devices

Use the lsscsi command with the -v option to list all your SCSI-attached devices, including SCSI-attached tape and medium changer devices. You can also use the lstape command to list tape and medium changer devices.
Example:
# lsscsi -v
[0:0:0:0]   tape       IBM      ULT3580-TD6     H990  /dev/st0
  dir: /sys/bus/scsi/devices/0:0:0:0 \
 [/sys/devices/css0/0.0.0000/0.0.0003/virtio2/host0/target0:0:0/0:0:0:0]
[0:0:0:1]   mediumx    IBM      3573-TL         E.80  /dev/sch0
  dir: /sys/bus/scsi/devices/0:0:0:1 \
 [/sys/devices/css0/0.0.0000/0.0.0003/virtio2/host0/target0:0:0/0:0:0:1]
[0:0:1:0]   tape       IBM      ULT3580-TD6     H990  /dev/st1
  dir: /sys/bus/scsi/devices/0:0:1:0 \
 [/sys/devices/css0/0.0.0000/0.0.0003/virtio2/host0/target0:0:1/0:0:1:0]
[0:0:1:1]   mediumx    IBM      3573-TL         E.80  /dev/sch1
  dir: /sys/bus/scsi/devices/0:0:1:1 \
 [/sys/devices/css0/0.0.0000/0.0.0003/virtio2/host0/target0:0:1/0:0:1:1]
[1:0:0:0]   tape       IBM      ULT3580-TD6     H990  /dev/st3
  dir: /sys/bus/scsi/devices/1:0:0:0 \
 [/sys/devices/css0/0.0.0001/0.0.0004/virtio5/host1/target1:0:0/1:0:0:0]
[1:0:0:1]   mediumx    IBM      3573-TL         E.80  /dev/sch3
  dir: /sys/bus/scsi/devices/1:0:0:1 \
 [/sys/devices/css0/0.0.0001/0.0.0004/virtio5/host1/target1:0:0/1:0:0:1]
[1:0:1:0]   tape       IBM      ULT3580-TD6     H990  /dev/st2
  dir: /sys/bus/scsi/devices/1:0:1:0 \
 [/sys/devices/css0/0.0.0001/0.0.0004/virtio5/host1/target1:0:1/1:0:1:0]
[1:0:1:1]   mediumx    IBM      3573-TL         E.80  /dev/sch2  
  dir: /sys/bus/scsi/devices/1:0:1:1 \
 [/sys/devices/css0/0.0.0001/0.0.0004/virtio5/host1/target1:0:1/1:0:1:1]

The output includes the device node as used by the st or ch device driver and the SCSI device name of the form <scsi_host_no>:0:<scsi_id>:<scsi_lun>, 0:0:0:0 for /dev/st0 in the example.

If the devices are handled by lin_tape instead of st or ch, lsscsi cannot determine the device node name and displays - instead.

The sysfs path in the output includes two bus IDs:
  • The first bus ID, from left to right, applies to the subchannel
  • The second bus ID applies to the virtual SCSI host bus adapter (HBA)
The two bus IDs can but do not need to be the same. In the example, the HBA device bus-ID for /dev/st0 is 0.0.0003.

The following lstape output for the same device setup assumes that the devices are managed by the lin_tape device driver instead of st and ch. The lstape output also shows the generic device name, sg<x>, that is assigned by the SCSI generic device driver, sg.

# lstape --verbose
FICON/ESCON tapes  (found 0):
TapeNo  BusID       CuType/Model  DevType/Model    BlkSize State    Op      MedState
SCSI tape devices (found 8):
Generic Device        Target         Vendor   Model            Type       State
        HBA           WWPN                    Serial
sg0     IBMtape0      0:0:0:0        IBM      ULT3580-TD6      tapedrv    running
        0.0.0003      N/A                     10WT037733
sg1     IBMchanger0   0:0:0:1        IBM      3573-TL          changer    running
        0.0.0003      N/A                     00L4U78W6497_LL0
sg3     IBMtape1      0:0:1:0        IBM      ULT3580-TD6      tapedrv    running
        0.0.0003      N/A                     10WT037701
sg2     IBMchanger1   0:0:1:1        IBM      3573-TL          changer    running
        0.0.0003      N/A                     00L4U78W6497_LL0
sg6     IBMtape3      1:0:0:0        IBM      ULT3580-TD6      tapedrv    running
        0.0.0004      N/A                     10WT037733
sg7     IBMchanger3   1:0:0:1        IBM      3573-TL          changer    running
        0.0.0004      N/A                     00L4U78W6497_LL0
sg4     IBMtape2      1:0:1:0        IBM      ULT3580-TD6      tapedrv    running
        0.0.0004      N/A                     10WT037701
sg5     IBMchanger2   1:0:1:1        IBM      3573-TL          changer    running
        0.0.0004      N/A                     00L4U78W6497_LL0
Use the SCSI device name and the device bus-ID to communicate about the devices with the hypervisor administrator.