tape

format for SCSI tape device names 

File Format


SYNOPSIS

/dev/ [n] [r] mt [h#] [l#] [t#] [#] [s...] [bblocksize] [ddensity]


DESCRIPTION

The SCSI tape device naming described in this reference page applies only to the cpio, dd, mt, pax, and tar commands.

A valid MKS SCSI tape device name uses the following format:

n 

specify that the tape should not be rewound after the operation (the default is to rewind after the operation). Note that commands which implicitly rewind the tape (such as erase, offline, or retension) and those which position the tape (such as fsf or bsf) ignore the no-rewind indicator.

r 

accesses the tape in an unbuffered (raw) manner. The r option turns off any internal buffering in the tape drive. All buffering supported by the tape drive is used unless r is present in the tape device name.

Using buffered tape access allows the drive to cache reads and writes, resulting in better performance. However, note that errors in writing to the tape might occur after the write operation to the tape drive has already succeeded (since the drive was just caching the information up to that point).

It's worth experimenting with this parameter if you are having performance problems. Try the raw device (/dev/rmt0) until you have successfully read the tape (determined the appropriate block size, etc.), and then try the buffered device (/dev/mt0) if you are experiencing performance problems.

h# 

specifies the SCSI host adapter. # can be 0 through 7.

t# 

specifies the SCSI device target ID. # can be 0 through 7.

l# 

specifies the SCSI logical unit (LUN). # can be 0 through 7.

# 

specifies which of the tape drives on the system to use (meeting any of the criteria specified by any h#, t# or l#). Typically h#, t# or l# are not specified, and this digit indicates which of the tape drives on the system to use. Thus, /dev/mt0 (or simply /dev/mt) is the first drive found on the system; /dev/mt1 is the second, and so on. /dev/mth21 is the second (1) tape drive found on host adapter #2 (h2).

s 

requests a modified speed for the selected density.

Currently accepted by the Archive Viper 2525's QIC-525 format with a modified speed of 90 ips (as opposed to the standard 120 ips for QIC-525 when the s isn't included), and the Tandberg Data TDC 4100 QIC-1000 format with a modified speed of 80 ips (vs. the standard 53 ips for the QIC-1000 when the ss isn't included). For QIC-1000 at 80 ips, s must be specified twice.

You can specify s multiple times to select among multiple modified speeds, should your drive support them.

bblocksize 

attempts to force the drive into fixed block mode, with the block size set to a specific value. An error occurs if the tape drive does not support fixed block mode.

For example, if you wanted to write a tar archive to tape with 512 byte blocks, but you wanted to write 10 blocks per tape operation to improve tape streaming performance, you could use the command

tar -c -f /dev/rmt0b512 -b 10 *

This sets the drive to fixed block mode, with a block size of 512 bytes. The tar utility then writes 10 blocks in each tape operation. The tape itself contains the same block sizes and information as if the tape were written one block at a time, but performance could be substantially better.

ddensity 

specifies the density (tape format). ddensity can take one of the forms shown in Table 1:

Density # Common Name Size Speed Tracks BPI Case Style
01 1/2" 9 800 Reel-to-reel
02 1/2" 9 1,600 Reel-to-reel
03 1/2" 9 6,250 Reel-to-reel
04/84 QIC-11 1/4" 4/9 8,000 Cartridge
05 QIC-24 1/4" 90 ips 9 8,000 Cartridge
06 1/2" 9 3,200 Reel-to-reel
07 1/4" 4 6,400 Cartridge
08 .15" 4 8,000 Cassette
09 1/2" 18 Cartridge
0A 1/2" 22 6,667 Cartridge
0B 1/4" 4 1,600 Cartridge
0C 1/2" 24 12,690 Cartridge
0D 1/2" 24 25,380 Cartridge
0F QIC-120 1/4" 90 ips 15 10,000 Cartridge
10 QIC-150 1/4" 90 ips 18 10,000 Cartridge
11 QIC-525 1/4" 120 ips 26 16,000 Cartridge
12 QIC-1350 1/4" 30 51,677 Cartridge
15 QIC-1000 1/4" 53 ips 30 36,000 Cartridge

Table 1: Forms of the ddensity Option

ddensity accepts input with the QIC- prefix in uppercase, lowercase or omitted; it also accepts the prefix QIC with the - omitted. Thus, QIC-150, QIC150, qic150, or 150 are all valid ways to specify the QIC-150 format.

Note:

QIC-11 specifies the 9 track QIC-11 format; for the 4 track QIC-11 format, use the alternate format: d#4; or d#xx, where xx is a hex number indicating the code for the requested density. This alternate format allows selection of densities beyond the QIC formats defined in Table 1. Use the d#xx format carefully; consult your tape drive's technical documentation for the proper density code (usually documented under the MODE SELECT command).

If you do not specify the density in write mode, the tape drive chooses one of the formats as a default (consult your tape drive's documentation). If you do not specify the density in read mode, most tapes try to sense the format.

SCSI tape drives with a single format (such as the Archive Python DAT) do not require density specification.

Not all densities are supported for all drives (many drives read some formats but not write them). Table 2 lists some of the 1/4" SCSI drives and the formats they support:

11(9) 24 120 150 525 1000 1350
Archive
Viper 60S R R/W
Viper 125S R R R/W
Viper 150S R R R/W R/W
Viper 2525 R R/W R/W R/W
Anaconda 2750 R R/W R/W R/W R/W R/W
Anaconda 2800 R/W R/W R/W R/W R/W R/W
Tandberg
Data TDC 3620 R/W R/W
Data TDC 3640 R/W
Data TDC 3660 R/W R/W
Data TDC 4100 R/W R/W R/W R/W R/W
Wangtek
5099ES R/W
5125ES R R/W
5150ES R R/W R/W

Table 2: 1/4" SCSI Drives and Formats

Block Sizes

When writing to a tape device, the blocking factor specified by the utility (or the default if none is specified) determines the block size to be used. Note that you may not use 8.1/2012R2/10/2016/2019/11/2022 device names (that is, \\.\tape0) to set block sizes; you can only set block sizes when using MKS device names, such as /dev/rmt0.

When reading from a tape device, the specified blocking factor is used to read the first block from the tape. If the first block is smaller than the specified block size, the tape drive reports the difference to standard error then uses the actual block size on the tape. If the tape block size is larger than the one specified, an error is reported to standard output. Thus, if you don't know the block size on a given tape, specifying a large block size (63K, for example) gives you the best chance of adapting to the proper block size and reading your tape.

Block sizes are specified as follows:

Utility Option Unit Default
dd ibs=/obs=/bs= Various 512 bytes
cpio -C bytes 512 (5120 if -B specified)
pax -b 512-byte-blocks automatically determined on read
10240 on write

Table 3: Block Size Specifications

tar defaults to a large block size of 63.5K, pax defaults to 10K, and cpio defaults to 512 bytes. For example, if you are reading a cpio archive on a tape with an unknown block size, a command such as

cpio -it -C 63000 -I /dev/rmt0

has the best chance at reading the tape (that is, if your tape drive supports true block size detection). Note that the typical block size for cpio archives on tape is either 512 bytes, or 5120 bytes as specified by the -B option.

Variable vs. Fixed Mode Support

SCSI tape drives can support variable block mode, fixed block mode, or both. Older drives typically support only fixed block mode. Newer drives often either support variable block mode only, or both variable block and fixed block modes. To allow auto-sensing for block sizes, MKS utilities use variable block mode when they can determine that the drive supports it.

Variable block mode allows reading and writing each block on the tape with a different block size. No block size has to be indicated to the drive before reading or writing--the read or write itself specifies how many bytes go in a given block. When writing, this allows every block in a file to have a potentially different block size (for compatibility, however, MKS utilities all write consistent block sizes). When reading in variable block mode, the utility is informed of the difference between the attempted size of the read and the actual size of the block on the tape. This allows the MKS utilities to automatically adjust (downwards only) to the block size on the tape.

Fixed block mode allows reading and writing to the tape in units of a given block size, which can be specified to the drive prior to the read or write operation. Such tape drives may support more than one potential fixed block size, others support only one. If your drive supports only fixed block mode, no automatic sensing of the block size is possible. However, on such drives the possible block size values are typically limited to a few common values, such as 512, 1024, 2048, or 4096. For cpio archives, a block size of 5120 bytes is often used.

Because reads and writes are done on a set block size in fixed mode, several blocks can be read or written in a single operation. This improves performance on some older drives, as opposed to the variable mode which must determine the block size for each individual operation. However, with newer drives, variable block mode often delivers better performance than writing with multiple blocks per write in fixed block mode because the new drives that support variable block mode usually have built-in buffering to improve performance.

EOF Markers

The ASPI device driver or 8.1/2012R2/10/2016/2019/11/2022 provides an interface to the SCSI devices, but the majority of the tape support is implemented by the application program (such as the MKS tape and archive utilities). This means that the MKS tape and archive utilities cannot control of the tape drive between invocations. Once the program terminates, it has no way of knowing whether or not it's going to be run again to operate on the tape drive.

The main problem with this behavior occurs when writing multiple files to a single tape. Tape standards require that two filemarks be written after the last file on a tape to indicate the end of useful data. MKS utilities write two such filemarks after they have completed writing a file to tape; however, they have no way of knowing whether or not the user intends to write another file on the tape immediately after the one currently being written.

Since MKS utilities must run to completion and have no way of controlling the tape drive between invocations, the two terminating filemarks are written after every file. Thus, if you write to consecutive files with an MKS utility (using a no-rewind device such as /dev/nrmt0), two filemarks occur between each file on the tape. When reading the tape, these filemarks appear as an empty file between each file written.

Some tape drives allow you to overwrite trailing files on a tape. After you have written a file with a no-rewind device on such drives, you can backspace the tape to before the second filemark with an mt bsf 1 command, and then write your second file. This eliminates the second filemark that was between your two files. By doing an mt bsf 1 after every file written to the tape, you can separate the files with a single filemark, as is done on UNIX.

Other tape drives, however, only allow you to append to a tape after all data has been transferred, including the two terminating filemarks. A write error occurs if you attempt to write to one of these drives after doing an mt bsf 1. On such tape drives, you can do an mt eom to force the tape to the end of the recorded medium (that is, past all data, including the two terminating filemarks) before writing your next file. In this case, you will have two filemarks between each file on your tape.


EXAMPLES

The following command performs a buffered tape operation on the first tape drive found, rewinding after the operation:

/dev/mt

The following command performs the unbuffered tape operation on the tape drive of SCSI host adapter 0, SCSI target 1, LUN 2, in QIC-525 format with a block size of 1024, without rewinding the tape afterwards:

/dev/nrmth0t1l2b1024dqic525

The following command dumps all of drive c: to a potentially muti-volume backup using tar. While creating an archive, this command writes 10 512-byte tape blocks at a time (5120 bytes per tape request) in QIC-150 format, and prints the file names to standard error. The volume name (argument to the V flag) is /dev/mtd150. Since no # is used, the command drives to the same device name for each volume.

tar cvbV 10 /dev/mtd150 c:/

The following command finds all files on drive c:, and gives them to the standard input of cpio. cpio creates an archive (the -o option), writing 10 blocks at a time (the -B option). It creates the potentially multi-volume archive on the first tape drive in QIC-150 format, and writes the file names to standard error as they are processed (the -v option).

Similar to the -f option to tar, which lets you specify a file rather than a volume pattern, the -O option to cpio prompts you for a device or file name whenever it fills a tape. Note that specifying the -V flag without # input removes the need to enter a device name with every tape, as required with the tar -f option and the cpio -O option.

find c:/ -type f -print | cpio -OBvV /dev/mtd150

The following command writes all of drive c: to the potentially multi-volume backup /dev/mtd150 at 5120 bytes per tape write, and writes the file names to standard error as they are processed (the -v option).

pax -wvb 5120 -V /dev/mtd150 c:/

EXTENDED SCSI TAPE ERRORS

There is a chance that the vendor-specific error messages which follow the standard SCSI error message are not valid for your drive. A set of vendor-specific error flags may be returned by your tape drive; these are often common between vendors, but are not guaranteed to be so.

A typical SCSI error message might appear as:

dd: SCSICMD: 8: Read Data, ERROR (70 0 0 0): unit
needs attention, SCSI bus parity

This message can be broken down as follows:

dd: 

the command name

SCSICMD: 8: Read Data, 

the SCSI command name/number that resulted in the error

ERROR (70 0 0 0): unit needs attention, 

the four hex bytes reported in parenthesis are the raw version of the error messages that follow. The first two bytes indicate the standard SCSI error message, which is reported immediately after the ERROR (x x x x): .

The last two bytes are the vendor-specific flags which result in the comma separated secondary messages being printed (see below for the list of possible secondary messages).

Any error text after the initial standard SCSI error (that is, after the comma) is an attempt to report the vender-specific error messages. These may include:

beginning of media
block not located
cartridge not in place
end of data
end of media
rror counter overflow
filemark detected
no data detected
SCSI bus parity
tape drive not ready
unit needs attention
unrecoverable data error
write data error
write protect

If you see any of the above errors and it is not consistent with other error messages, the status of the tape drive, the tape, or the command you are using, your tape drive may use the vendor-specific flags in a manner different from the commonly method. In such a case, the extended portion of the error message should be ignored.


NOTES

The r, h#, t#, l#, s, bblocksize, and ddensity options are available on 8.1/2012R2/10/2016/2019/11/2022 systems where an ASPI layer is installed. The n and # options are available on all 8.1/2012R2/10/2016/2019/11/2022 systems.

SCSI hard drives should be set at a higher priority than the tape drives to avoid problems (for example, with smartdrv).

When writing multi-volume backups, you should write each volume from the start of each tape. tar, pax and cpio do not explicitly rewind the tape before each volume; however, inserting a tape into most drives causes the tape to automatically rewind. If you find that secondary volumes are not being written at the start of the tapes, your drive probably isn't rewinding the tapes, and you should do so manually for each tape with the mt rewind command before reading or writing a multi-volume archive.


AVAILABILITY

PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
cpio, dd, mt, pax, tar


PTC MKS Toolkit 10.4 Documentation Build 39.