Can not find tape drive ID using using 'mtx -f /dev/sg4 status' command
Environment
- Red Hat Enterprise Linux 5, 6, 7
- Tape devices, medium changer
Issue
-
Can not find tape drive ID using using
mtx -f /dev/sg4 statuscommand. -
mtx -f /dev/sg4 statuscommand shows errorIllegal Request$ mtx -f /dev/sg4 status mtx: Request Sense: Long Report=yes mtx: Request Sense: Valid Residual=no mtx: Request Sense: Error Code=70 (Current) mtx: Request Sense: Sense Key=Illegal Request mtx: Request Sense: FileMark=no mtx: Request Sense: EOM=no mtx: Request Sense: ILI=no mtx: Request Sense: Additional Sense Code = 20 mtx: Request Sense: Additional Sense Qualifier = 00 mtx: Request Sense: BPV=no mtx: Request Sense: Error in CDB=no mtx: Request Sense: SKSV=no READ ELEMENT STATUS Command Failed
Resolution
-
Please use the
mtx -f /dev/sgX <arg.>command with tape changer, autoloader, tape library or medium changer only. It would not work as expected for tape devices. -
To check the status of tape device, you could use following command instead of
mtx -f /dev/sgX <arg.>:o First verify if the
stmodule is successfully loaded:$ lsmod |grep -i sto If above module is not loaded, then please load the same manually using following command:
$ modprobe sto Execute following command to check the status of tape device.
$ mt -f /dev/st0 status
Root Cause
-
The
mtxcommand would not work as expected for the tape devices, since it is suppose to be used with tape changer, autoloader or tape library devices only. Below is the snip from man page ofmtxcommand (man 1 mtx):NAME mtx - control SCSI media changer devices SYNOPSIS mtx [-f <scsi-generic-device>] [nobarcode] [invert] [noattach] command [ command ... ] DESCRIPTION The mtx command controls single or multi-drive SCSI media changers such as tape changers, autoloaders, tape libraries, or optical media jukeboxes. It can also be used with media changers that use the ’ATTACHED’ API, presuming that they properly report the MChanger bit as required by the SCSI T-10 SMC specification. OPTIONS The first argument, given following -f , is the SCSI generic device corresponding to your media changer. [...] -
The information in
/proc/scsi/scsiandlsscsicommand output shows that/dev/sg4device corresponds to HP Ultrium 6-SCSI tape device and not the tape changer, autoloader or tape library, due to whichmtx -f /dev/sg4 statuscommand showed an errorSense Key=Illegal Request.$ lsscsi --generic [6:0:0:0] disk FUJITSU ETERNUS_DXL 1032 /dev/sda /dev/sg0 [6:0:0:1] disk FUJITSU ETERNUS_DXL 1032 /dev/sdb /dev/sg1 [7:0:1:0] disk FUJITSU ETERNUS_DXL 1032 /dev/sdc /dev/sg2 [7:0:1:1] disk FUJITSU ETERNUS_DXL 1032 /dev/sdd /dev/sg3 [7:0:2:0] tape HP Ultrium 6-SCSI 251B /dev/st0 /dev/sg4 <--- Host: scsi7 Channel: 00 Id: 02 Lun: 00 Vendor: HP Model: Ultrium 6-SCSI Rev: 251B Type: Sequential-Access ANSI SCSI revision: 06
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.