3

The Wikipedia LTO article says that every LTO drive can read out the memory chip of a tape via 13.56 MHz NFC.

I expect here to find serial numbers, tape properties and usage data. How can I read this data with free and open-source software on a Linux system?

Jonas Stein
  • 3,898
  • 4
  • 34
  • 55

2 Answers2

2

Method.1 LTO DRIVE

LTO drive has a RFID reader inside to read data from the chip. The client can access this via SCSI command. Specifically, READ ATTRIBUTE command (Operation Code: 8C).

READ ATTRIBUTE command shall be invoked along with Attribute Identifier that specifies the data field to be transferred. For example, according to IBM SCSI Reference, MEDIUM SERIAL NUMBER can be read with 0401h of Attribute Identifier and LOAD COUNT is 0003h.

This is an open-source Linux software sending READ ATTRIBUTE command to the drive. Serial numbers, tape properties such as medium length, width and usage data such as load count, total MB written etc... are supported.

Method.2 Generic RFID Reader

Currently, Proxmark3 and ACR122U supports LTO cartridge memory.

Step.1 Dump all data from the chip with these readers. Install Proxmark3 software or nfc-ltocm depending on your hardware, place LTO cartridge onto the reader, and then send dump command. Binary data of the chip will be stored on your storage device.

Step.2 Make this binary data human-readable with this script. Here is YouTube video for demonstration.

Kevin Nakamoto
  • 136
  • 1
  • 6
  • 1
    This is currently a link-only answer. Could you explain how the OP would obtain, configure, install, and use the code behind this link to read their data? – Jeff Schaller Jul 31 '20 at 01:03
2

If you have the sg3_utils / sg3-utils installed (the name depends on your distro), you can use sg_read_attr to do that. With -e it'll enumerate all the attributes it knows about.

$ sg_read_attr -e
Attribute ID    Length  Format  Name
------------------------------------------
  0x0000:       8       binary  Remaining capacity in partition [MiB]
  0x0001:       8       binary  Maximum capacity in partition [MiB]
  0x0002:       8       binary  TapeAlert flags
  0x0003:       8       binary  Load count
  0x0004:       8       binary  MAM space remaining [B]
  0x0005:       8       ascii   Assigning organization
  0x0006:       1       binary  Format density code
  0x0007:       2       binary  Initialization count
  0x0008:       32      ascii   Volume identifier
  0x0009:       -1      binary  Volume change reference
  0x020a:       40      ascii   Density vendor/serial number at last load
  0x020b:       40      ascii   Density vendor/serial number at load-1
  0x020c:       40      ascii   Density vendor/serial number at load-2
  0x020d:       40      ascii   Density vendor/serial number at load-3
  0x0220:       8       binary  Total MiB written in medium life
  0x0221:       8       binary  Total MiB read in medium life
  0x0222:       8       binary  Total MiB written in current/last load
  0x0223:       8       binary  Total MiB read in current/last load
  0x0224:       8       binary  Logical position of first encrypted block
  0x0225:       8       binary  Logical position of first unencrypted block
                                after first encrypted block
  0x0340:       90      binary  Medium usage history
  0x0341:       60      binary  Partition usage history
  0x0400:       8       ascii   Medium manufacturer
  0x0401:       32      ascii   Medium serial number
  0x0402:       4       binary  Medium length [m]
  0x0403:       4       binary  Medium width [0.1 mm]
  0x0404:       8       ascii   Assigning organization
  0x0405:       1       binary  Medium density code
  0x0406:       8       ascii   Medium manufacture date
  0x0407:       8       binary  MAM capacity [B]
  0x0408:       1       binary  Medium type
  0x0409:       2       binary  Medium type information
  0x040a:       -1      unknown Numeric medium serial number
  0x0800:       8       ascii   Application vendor
  0x0801:       32      ascii   Application name
  0x0802:       8       ascii   Application version
  0x0803:       160     text    User medium text label
  0x0804:       12      ascii   Date and time last written
  0x0805:       1       binary  Text localization identifier
  0x0806:       32      ascii   Barcode
  0x0807:       80      text    Owning host textual name
  0x0808:       160     text    Media pool
  0x0809:       16      ascii   Partition user text label
  0x080a:       1       binary  Load/unload at partition
  0x080a:       16      ascii   Application format version
  0x080c:       -1      binary  Volume coherency information
  0x0820:       36      binary  Medium globally unique identifier
  0x0821:       36      binary  Media pool globally unique identifier

SA_value        Acronym Description
------------------------------------------
  0:            av      attribute values
  1:            al      attribute list
  2:            lvl     logical volume list
  3:            pl      partition list
  4:            smc     SMC-2 should define this
  5:            sa      supported attributes

So then you can read 0x0401 or 0x003 (/dev/sg0 being my tape device):

$ sudo sg_read_attr -f 0x401 /dev/sg0
  Medium serial number: SOMESERIAL                      
$ sudo sg_read_attr -f 0x3 /dev/sg0
  Load count: 14

Or to read them all with -f all

Mathieu
  • 951
  • 5
  • 6