How to use the t_reader utility

Summary: This article describes the use of t_reader and t_writer utilities on various operating systems, and where to download it.

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Symptoms

  • Must determine the actual block sizes on a tape
  • Must verify NetWorker label structure
  • Must verify the physical integrity of tape media
  • Must confirm NetWorker block header metadata
  • Must dump the raw first 512 bytes of each block

The t_reader utility is for diagnosing and troubleshooting tape drive-related issues. It is a NetWorker Support too which provides several tape functions which make it a useful troubleshooting tool. Use it to:

  • Test the actual size of blocks written to tape
  • Determine if there are variations of sizes of blocks written to tape
  • Test reading of physical media for I/O errors or physical damage
  • Determine if the elements below the application layer (driver, OS, transport, device itself) can read blocks of a specific size
  • Expose low-level information in Windows not possible with any other current utility

 

Cause

Issues with tape media are often caused by external factors such as:

  • OS/HBA/driver blocking factor problems
  • Undetected I/O hardware or transport errors during write
  • Media degradation due to age, use, drive hygiene or improper storage

 

Resolution

Download t_reader from here: NetWorker Tools

Extract the bundle and use the t_reader for your host's architecture.

  • t_reader will not automatically rewind the volume on UNIX (it offers to on Windows) - this allows you to position to and begin from any spot on the tape.
  • On most operating systems t_reader reports the block sizes that it finds from this point; some requires you a block size to attempt to read.
  • t_reader begins its enumeration of file and record at 0 - meaning if you were to space forward to file 5, record 500 deliberately and then run t_reader - t_reader outputs would appear to begin at F0 R0, despite actually starting at a much later address.
  • On Operating Systems that can determine actual block size, a block size limitation in the driver or OS results in an error indicating the buffer is too small to hold the block data, such as cannot allocate memory or more data is available.
  • t_reader does not need to read actual data but can recognize and read NetWorker labels if present
  • On Windows, it can also read and report block header information, if available; it can also dump the first 512 raw bytes of data (see variables below)
  • Always - block sizes must be consistent after the first pair of 32 KB label blocks, and must match the block size written into the label as returned by scanner

UNIX
To prepare a volume by rewinding it first:

mt -f /dev/nst0 rewind

To run t_reader, supply the OS device file handle of the drive with the tape cartridge loaded, for example:

./t_reader_linux /dev/nst0

The output of a standard NetWorker volume after rewinding looks like this:

About to read FileNo-BlockNo: 0-0  Found block size: 32768
About to read FileNo-BlockNo: 0-1 EOF encountered
About to read FileNo-BlockNo: 1-0  Found block size: 32768
About to read FileNo-BlockNo: 1-1 EOF encountered
About to read FileNo-BlockNo: 2-0  Found block size: 98304
About to read FileNo-BlockNo: 2-1  Found block size: 98304
...
About to read FileNo-BlockNo: 19-0  Found this record at block size= 98304
About to read FileNo-BlockNo: 19-1 File Mark encountered
About to read FileNo-BlockNo: 20-0 File Mark encountered
No more data is on Tape

This example demonstrates a healthy volume with two 32K blocks on the first two files indicating the label, followed by 96K blocks punctuated periodically by filemarks until the End of Data (EOD) encountered after file 18.

WINDOWS
For Windows you must also supply the size of block you want to read:

t_reader \\.\tape0 131072

The effect of this is that Windows attempts to read whatever block size is provided it, and not complain (despite being potentially larger than the actual block size written) - though it will error if either the block size provided as the argument is smaller than the actual block, or there is an OS or driver limitation which makes a block of that size unusable.

Since Windows cannot automatically determine and report the block size, it must be supplied as the second argument. If the block size is too large, it misreports as it is simply reading multiple blocks and presenting them as the argument-supplied size. If the block size supplied, e.g.131072, is smaller than the actual block size, for example 262144, you receive an error:

>>>>>File Mark Encountered. Total Records Estimated In File 1 Are 1
Read Record does not align on Assigned Buffer

In order therefore to correctly determine an unknown block size, start at 32768, and double until the utility succeeds. However, you can generally determine the expected block size from the label.

Windows also has two variables which can be set for deeper debugging:

set EXPLODE_LEVEL=1

Causes t_reader to report the block header for any NetWorker blocks found:

Read 262144 bytes: HW Fn-Rn:2-81 Media Fn-Rn:2-81 Cummulative Bytes Read 21561344

mr_version 6
mr_size 262144
Volid 4222551389 (0xFBAF055D)
Media Fn 2-Media Rn 81
mr_len 444
mr_chunk_len 1

To cause t_reader to dump the first 512 B of every block read:

set DUMP_BUFFER=1

Expect output like:

Read 262144 bytes: HW Fn-Rn: 2-47 Cummulative Bytes Read 12648448

Dumping 512 Bytes Starting At Address: 0x  850048
0x0000: 56 4F 4C 31 51 30 57 30 50 53 20 20 20 20 20 20
0x0010: 20 20 20 20 20 4E 45 54 57 4F 52 4B 45 52 20 20
0x0020: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0x0030: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0x0040: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33
0x0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
...

This may allow for deeper debugging or proving non-NetWorker, damaged or encrypted volumes, but is obviously for uncommon usages.

 

Additional Information

t_reader also comes bundled with a companion utility, t_writer.exe. This is a Windows-only utility which takes the place of UNIX utilities like tar and dd and allows test writes to be performed to tapes at custom block sizes. It requires the accompanying file, seeding.image, or any binary file of the same name.

To use the utility, run it with using a media-loaded device as the first argument and the wanted block size in bytes as the second, for example:

win_t_writer.exe \\.\Tape2147483639 131072

The utility runs until the user interrupts the process. It may be run successively on the same volume with different block sizes to simulate variant block sizes, or repeatedly until failure if random I/O errors or SCSI resets are suspected. It may also be used to demonstrate if a condition is truncating block sizes below the application layer.

As an example of the output:

C:\Users\Administrator\t_reader>win_t_writer.exe \\.\Tape2147483639 131072

CAUTION: This Is An Un-Supported Tool. To Be Used By Tech. Support Personnel Only
For Comments or Change Requests, email: abid.yazdanie@emc.com

******WARNING Tape Write operations will occur on the device******
******Data Destruction Will Occur******
******You are using this tool at your own risk******


usage: win_t_writer \\.\tapeX 131072
Where tapeX is \\.\tapeX and 131072 (128X1024) is the desired block size, in this case 128K
The Block Size Used Above Is Only An Example.
Run mt -f \\.\tapeX status To Find The Max. Block Size For Your Tape Drive

Enter y to proceed or n to abort: y
Proceeding to write....
About to allocate write buffer
Opening Seeding File seeding.image
Copying Contents Of Seeding File: seeding.image To Write Buffer
WRITE access to device \\.\\\.\Tape2147483639
Successfully opened device: \\.\\\.\Tape2147483639

Calling WriteFile in a perennial loop...

 

Affected Products

NetWorker
Article Properties
Article Number: 000094976
Article Type: Solution
Last Modified: 19 Nov 2024
Version:  3
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.