Sample Header Ad - 728x90

Tape readable with scsitape but not dd or tar, why?

7 votes
1 answer
1043 views
I just installed an Exabyte tape drive:
$ lsscsi -g
[11:0:0:0]   process Marvell  91xx Config      1.01  -          /dev/sg0 
[12:0:1:0]   cd/dvd  TOSHIBA  CD-ROM XM-3401TA 0283  /dev/sr0   /dev/sg1 
[12:0:5:0]   tape    EXABYTE  EXB-8500-85Qanx0 046G  /dev/st0   /dev/sg2 
[N:1:4:1]    disk    Samsung SSD 970 EVO 250GB__1               /dev/nvme1n1
[N:0:4:1]    disk    Samsung SSD 970 EVO 250GB__1               /dev/nvme0n1
$   /usr/sbin/tapeinfo -f /dev/sg2  
Product Type: Tape Drive
Vendor ID: 'EXABYTE '
Product ID: 'EXB-8500-85Qanx0'
Revision: '046G'
Attached Changer API: No
SerialNumber: '02541381  '
MinBlock: 1
MaxBlock: 245760
SCSI ID: 5
SCSI LUN: 0
Ready: yes
WriteProtect: yes
BufferedMode: yes
Medium Type: 0x85
Density Code: 0x0
BlockSize: 1024
DataCompEnabled: no
DataCompCapable: no
DataDeCompEnabled: no
CompType: 0x0
DeCompType: 0x0
Block Position: 15750
ActivePartition: 0
EarlyWarningSize: 0
I can read from a tape like this:
$ mt -f /dev/nst0 rewind
$ /usr/sbin/scsitape -f /dev/sg2 read 0  > outfile.bin
$ tar tf outfile.bin
[ a list of files in the tar archive ]
However, I cannot read from the tape with tar in the normal way:
$ mt -f /dev/nst0 rewind
$ tar tf /dev/nst0 
tar: /dev/nst0: Cannot read: Input/output error
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now
In /var/log/messages we see:
Jun 29 13:11:00 horizon kernel: [ 9362.244683] Errata on LSI53C1030 occurredsc->req_bufflen=0x2800, xfer_cnt=0x400,difftransfer=0x0a
Jun 29 13:11:00 horizon kernel: [ 9362.244773] st 12:0:5:0: [st0] Sense Key : Medium Error [current] 
Jun 29 13:11:00 horizon kernel: [ 9362.244790] st 12:0:5:0: [st0] >ASC=0xff >ASCQ=0xff
Reducing the read size (for example with tar -f /dev/nst0 -b 1 --record-size=512 -t) doesn't seem to make a difference. The mechanisms are quite different; scsitape read uses ioctl against /dev/sg2 to read from the tape device, while tar uses read syscalls against /dev/nst0 or /dev/st0 to read. But I don't know why access via /dev/sg2 works while access via /dev/nst0 does not. Can anybody explain this? In case it matters, the mt-st package is not installed and so there is no /etc/stinit.def file. I'm using the mt binary that comes with the cpio package.
Asked by James Youngman (1142 rep)
Jun 29, 2021, 12:29 PM
Last activity: Jun 29, 2021, 01:54 PM