tape(7) —
NAME
tape − SCSI tape storage driver
DESCRIPTION
Small Computer System Interface (SCSI) tape devices and disks are supported by the High Performance Device Driver (see hpdd(7)). The following HPDD drivers control the SCSI bus:
Adaptec 1520/1522
Adaptec 1540/1542/1640
Adaptec 1740
Bustek 742
DPT 2001/2012
Future Domain 1660/700/8x0
IBM SCSI Adapter
Western Digital 7000ASC
Western Digital 7000EX
Magnetic tape devices provide for backup and exchange of data normally stored on fixed disks. These tape devices can be classified as 1/4-inch magnetic tape cartridges and DAT devices.
The tape driver supports the Archive Viper series of SCSI tape drives, such as models 2125S and 2150S. These drives must be equipped with firmware EPROMs of at least revision 6 level (for the 2125S) or revision 4 level (for the 2150S). The firmware revision number is located on a sticker on the EPROM, on the component side of the tape drive main printed circuit board. The drive should be configured for an otherwise unused SCSI ID number and should be jumpered for a “Disconnect Size” of no more than 16 KB. See the Archive Viper Product Manual for more information.
The tape driver has been tested with the Archive 60-MB, 120-MB, and 150-MB tape drives. The 60-MB drive reads and writes 60 MB. The 120-MB drive reads 60 and 120 and writes 120. The 150-MB drive reads all three and writes 150 on a 150-MB tape, and 120 on a 120-MB tape.
NOTE: If a DC-600A cartridge is used in a 150-MB tape drive, the driver writes in 120-MB format, the highest possible writable density, by default. If the user then takes the tape to a 60-MB drive, it will be unable to read it. A kernel message that states:
"Tape written in 120 meg format"
has been added to warn the user of this possibility.
The tape driver also supports SCSI DAT tape devices, although the driver does not take advantage of the newer random access DAT tapes. All DAT tapes are treated as though they are sequential access devices. Devices that have been successfully tested are the Archive DAT model 4520 and the Exabyte model EXB-8200.
The tape driver also supports the Wangtek SCSI 60-MB and 150-MB tape drives, as well as the new 525-MB tape drive.
The tape driver can read 60-MB QIC-24 tapes, and read or write 125-MB QIC-120 or 150-MB QIC-150 (2150S drive only) tapes. Note that only DC600XTD tapes are certified for 150-MB recording and that DC600A tapes are certified for 125-MB recording.
Cartridge tapes are treated as character devices. Tape drives can be categorized as fixed or variable record length. Fixed block drives include the Archive Viper 2150S, for example. Variable length drives include the DAT drives, such as the 8mm Exabyte 8200, the 4mm Wangtek 6130HS, and the Wangtek 525-MB cartridge tape. The tape driver reads and writes to fixed-length tape drives using 512-byte blocks. Variable-length drives are set to use 1024-byte blocks. A read or write call with a length that is not a multiple of either 512 or 1024 bytes (i.e., a native block size) will result in an error message being issued. The tape driver running with the Future Domain host bus adapter supports only tape drives with 512-byte block sizes. No attempt is made by the driver to allocate large blocks of memory to insure efficient streaming operation of the drive, although the drives themselves contain 64KB buffers. The dd(1M) command can be used as a filter to provide buffering between a command and the driver, or the −C option of the cpio(1) command can be used to allocate very large tape buffers.
Support for the 9-track SCSI HP_Cipher tape drive and the Tandberg Data Corporation (TDC) 3800 1/4-inch SCSI cartridge tape drive has been provided by the following drivers:
Adaptec 1520/1522
Adaptec 1540/1542/1640
Adaptec 1740
Bustek 742
DPT 20xx
Western Digital 7000ASC
Western Digital 7000EX
Since the TDC 3800 series of 1/4-inch SCSI cartridge tape drives, the Archive 2525-s, and the Wangtek 5525es can read or write variable block-length records, the above drivers will automatically determine the blocksize of a previously written 525MB tape and set the driver tape blocksize to that value in both read and write operations. If the user wants to write in 512 bytes/block and the determined tape blocksize is 1024 bytes/block, or if the user wants to write in 1024 bytes/block and the determined tape blocksize is 512 bytes/block, the tape blocksize can be changed appropriately (to 512 or 1024 bytes/block, respectively) with the mt command. To find the current blocksize, use
mt −v
To set a new tape blocksize, use
mt −b
See mt(1) for more information.
The HPDD has limited support for 9-track tape drives that can interface with a SCSI controller. These models have been tested and are supported by SunSoft:
Cipher 9-track reel tape
F88OES 3200/1600 BPI
M990110-00-0100U 6250/3200/1600 BPI
C800-ES 1600/3200 BPI
M995 1600/6250 BPI
9-track tape is not recommended for use with the Adaptec 152x or the Future Domain tmc8x0 controllers.
Device Names and Numbers
All devices handled by the tape driver have a major number assigned by kconfig(1). Each tape drive has a span of 16 minor numbers associated with it. The interpretation of the minor numbers for tape devices is described in the file /usr/include/sys/gentape.h. On a given SCSI controller, the minor number is calculated as (16 x scsi_id) + 8 for rewind. Thus, a tape with a SCSI ID of 3 that is to rewind on close is:
(16 x 3) + 8 = 56
For each drive, bit 3 should be set if the tape should be rewound when it is closed. This is set for the /dev/tape device and is the normal usage. This type of device allows a single file to be written on a tape. If bit 3 is not set, the tape will not be rewound when closed. (See below for a complete description of tape behavior on closing the device.) This is reset for the /dev/ntape device and allows multiple files, separated by file marks (described below) to exist on a single tape. Bit 2 of the minor number should be set if positioning operations (rewinding, seeking a file mark) should return immediately after the requests initiating them have been sent to the drive. If this bit is not set, the driver will wait for such operations to be completed before returning control to user programs. Note that the open system call always waits for any long-term operation that may be in progress to complete before it attempts to open the drive. The driver uses the default capacity of the tape for the density value.
After kconfig is run, /dev/tape and /dev/ntape nodes will be created for the first tape. If a user has more than one tape device on a system, device node aliases can be created with the command:
ln /dev/rmt[0-9]t[0-9] /dev/username
where /dev/username is a user-supplied name such as /dev/tape2, and a name such as rmt0t2 is the kconfig name for the tape device.
File Marks and End-of-Medium
A special marker, known as a file mark or End of File (EOF), is normally written at the end of each data file written to the tape. If a file mark is detected in the middle of a multi-block read operation, a short block count will be returned. Subsequent read operations (or any read that encounters a file mark prior to any data blocks) will return EOF. The driver will return the appropriate error message at “End of Medium.”
Tape Position on Close
When the tape device is closed, its position depends on several factors: whether it is to be rewound (bit 3 in minor device number), whether it was opened for a read or a write, whether it is currently positioned at a file mark or the End of Medium, and whether the last operation performed was an ioctl (described below).
If the last operation performed on the drive was a standard read or write (or simply open), the type of open done to the drive is checked. If it was opened for write, a file mark is written. If it was opened for read and a file mark was not the last thing read, and the tape is not to be rewound on closing, a Seek to End-of-File is initiated. If the last operation performed on the drive was an ioctl call, no further positioning or file mark writing is performed. Finally, the tape is rewound if bit 3 of the minor device number is set.
Ioctl Calls Supported
The following ioctl calls are defined in the file /usr/include/sys/gentape.h. Unless stated otherwise, the arg value of the ioctl call is ignored.
TC_SEOF
This call takes a count as an argument and seeks to the argth file mark on the tape.
TC_SEOD
This call causes the tape to space to the end of data. Some tape devices, such as the Archive Viper 2150S, permit writing at only two locations: beginning of tape and end of data. End of data corresponds to a point on the tape just past where the last data (or file mark) was written.
TC_REWIND
This call causes the tape to be rewound to the beginning of tape point.
TC_WFM
This call takes a count as an argument and writes count file marks onto the tape. This command also causes any unwritten data in the drive’s cache to be written to the tape. An arg of 0 is valid and simply causes the drive to flush its cache to tape.
TC_ERASE
This call causes the entire tape to be erased. This command is only valid when the tape is at the “beginning of tape” point.
TC_RETENSION
This call causes the tape to be shuttled from beginning to end and back again, causing clean packing of the tape against the hubs. New tapes should be retensioned prior to use, as should tapes that have small portions of their length used extensively.
TC_WAIT
This call will not return until a previously issued long-term command (TC_SEOF, TC_REWIND, TC_ERASE, or TC_RETENSION) has completed. This command only makes sense when used on a tape device with bit 2 of the minor device number (for immediate return on long-term operations) set.
TC_GETPARMS
This call requires a pointer at struct tc_parms (see the file /usr/include/sys/gentape.h) as an argument. It will return with information about the drive and the currently loaded tape. Note that tape density information will not be meaningful until the drive has actually attempted read or write operations to the tape, i.e., a read or a write must precede this ioctl.
Multiple Volume Backup
The TC_SEOF and TC_SEOD ioctls may be used to back up and restore multiple files on one tape volume. The mt(1) utility takes parameters sfm and enddata for convenience, corresponding to these ioctls.
For example, to back up the project1 directory:
$ mt −vf /dev/tape rewind(make sure tape is rewound)
$ cd /project1
$ cpio −ocvC 102400 > /dev/tape
Later, write the /project2 directory as a second file on the same tape:
$ cd /project2
$ mt −vf /dev/tape rewind(make sure tape is rewound)
$ mt −vf /dev/ntape sfm(seek to end of project1 cpio
file marker)
$ mt −vf /dev/ntape enddata(necessary only on drives like
Archive 2150)
$ find . −print | cpio −ocvC 102400 > /dev/tape
Restore the project2 directory:
$ cd /project2
$ mt −vf /dev/tape rewind(make sure tape is rewound)
$ mt −vf /dev/ntape sfm(seek to end of project1 cpio
file marker)
$ cpio −icvumC 102400 </dev/ntape (restore the directory)
It is necessary to seek to the end of data on tape drives like the Archive Viper 2150S because writing is permitted at only two positions: the beginning of the tape and the end of data.
Configuration
In order to use the tape device, it must be configured into the kernel. To do this, the High Performance Device Driver configuration file (/etc/conf/pack.d/gendev/space.c) must contain an external definition such as the following:
extern int tape_init();
and the line:
tape_init,
must appear in the initialization of the gdev_init_routines table defined near the end of that file. The entry for tape_init must appear prior to the NULL line in the initialization. This instructs the High Performance Device Driver to invoke the initialization routine for tapes when the system boots.
In addition, the file /etc/conf/pack.d/tape/space.c contains a configuration definition for each tape-supporting host bus adapter permitted.
Note that a driver module for a tape-supporting host bus adapter must also be enabled if it is to be included in the kernel. (When kconfig is run, all of these files will be updated as necessary.)
FILES
/usr/include/sys/gentape.h
/etc/conf/pack.d/gendev/space.c
/etc/conf/pack.d/tape/space.c
/etc/conf/cf.d/mdevice
/dev/tape
/dev/ntape
SEE ALSO
cpio(1), dd(1M), kconfig(1), mt(1), aha1520(7), aha1540(7), aha1740(7), athd(7), bt742(7), dpt20xx(7), hpdd(7), mcis(7), tmc8x0(7).
ADDED VALUE
This entry, supplied by SunSoft, Inc., is an extension of UNIX System V.
\*U — Version 1.0