Question & Answer
Question
How can I use the Unix 'dd' command to verify a tape volume label?
Answer
The first step that may be necessary to verify a tape volume label is to find out the block size in use on that tape volume. This parameter is typically set on the physical tape library console interface and will vary between manufacturers so the ideal place to search is on the manufacturer website.
There is a method to manually find out the block size as follows:
On most Unix systems, the 'dd' command will output a message indicating a read failed from a tape drive (and corresponding tape volume) along with insufficient memory message. For example on AIX:
- bash$ dd if=/dev/rmt1 of=/tmp/test.file ibs=32 count=1
dd: 0511-051 The read failed.
: There is not enough memory available now.
0+0 records in.
0+0 records out.
The 'if' parameter must reference a valid path to a drive that contains the volume you are seeking information about. This volume may be loaded using a utility such as tapeutil or directly from the physical library's console management. The drive should not be in use by Tivoli Storage Manager at the time the command is run and it is recommended to take the drive offline to Tivoli Storage Manager.
The 'ibs' parameter indicates the block size to use in bytes unless a 'k' is specific, in which case the parameter is read as kilobytes. A value of 32 bytes, as in the example above, is a good starting value. If this command returns a memory related error message then the value can be doubled.
- bash$ dd if=/dev/rmt1 of=/tmp/test.file ibs=64 count=1
dd: 0511-051 The read failed.
: There is not enough memory available now.
0+0 records in.
0+0 records out.
- bash$ dd if=/dev/rmt1 of=/tmp/test.file ibs=128 count=1
0+1 records in.
0+1 records out.
Once the correct block size has been discovered, the 'dd' command should not generate a memory error when reading from the volume.
Now that the block size is known, the data on the first block of the tape can be dumped to a file:
- dd bs=<your block size found above> conv=ascii if=<your tape drive path> of=/tmp/<blockname>.out
For example:
- bash$ dd bs=128 conv=ascii skip=0 count=1 if=/dev/rmt1 of=/tmp/block1.out
0+1 records in.
0+1 records out.
Once the file is file '/tmp/block1.out' is written, the file may be viewed in any text editor or the cat command can be used:
- bash$ cat /tmp/block1.out
VOL1200312
Product Synonym
TSM
Was this topic helpful?
Document Information
Modified date:
17 June 2018
UID
swg21398709