TAPE(HW) UNIX System V
Name
tape - magnetic tape device
Description
The tape device implements the UNIX interface with a tape
drive. QIC-02 cartridge tape drives are supported by the ct
device driver, QIC-40 and QIC-80 tape drives connected to
the floppy disk controller are supported with the ft device
driver, and Irwin tape drives connected to the floppy disk
controller are supported with the ir device driver.
Typically, the tar(C), cpio(C), dd(C), backup(ADM),
xbackup(ADM), xrestore(ADM), or restore(ADM) commands are
used to access a tape drive.
A single tape drive with a raw (character, non-blocking)
interface is supported, except for the SCSI tape driver
which supports up to four devices. There are four standard
tape device types. Devices beginning with the ``r'' prefix,
(for ``raw device''), should be used for most normal tape
work, while devices with the ``n'' prefix, (``for no rewind
on hold''), should be used for storing and restoring
multiple files. Devices beginning with the ``x'' prefix are
control devices, which are used for sending ioctl(S)
commands to the tape subsystem.
Devices beginning with the ``e'' prefix (for ECC device)
support a 2/64 error recovery scheme. Thus two 512-byte
blocks out of every 64 blocks can be bad and the driver will
correct the errors. This software ECC support provides a
high degree of error recovery.
The ft and ir floppy tape drivers do not support the ``n''
or ``e'' device types. ECC encoding and decoding is
automatically used with the standard ``r'' device. On the
QIC-40, QIC-80 and Irwin 80MB drives, for every 29K written
to the tape, 3K of ECC data is written with it to provide
error recovery. On the Irwin 10, 20, 40 and 60MB drives,
for every 16K written to the tape, 2K of ECC data is
written.
QIC-40 and QIC-80 tapes must be formatted with the tape(C)
command before use, unless you use pre-formatted tapes.
Similarly, Irwin tapes must be first servo-written and then
formatted with tape(C) before use, unless you use pre-
formatted tapes. The ir driver can read tapes formatted and
written under UNIX but cannot write to them.
The following table summarizes the base naming conventions
for the tape drives supported:
ct0,1 QIC24 unit 0,1
ct2,3 QIC11 unit 0,1
Stp0,1,2,3 SCSI tape unit 0,1,2,3
ft0 QIC-40 or QIC-80 floppy tape unit
ir0 Irwin floppy tape unit
ctmini default mini-cartridge device
mt0,1 reel to reel unit 0,1 1600 bpi
mt2,3 reel to reel unit 0,1 800 bpi
mt4,5 reel to reel unit 0,1 6250 bpi
The default tape device is stored in the file
/etc/default/tape, which is also used by tape(C).
/etc/default/tape should always contain the "x" (control)
device name of the default device, and is normally updated
by mkdev(ADM) tape. If the default device is an QIC-40,
QIC-80 or Irwin tape drive, the appropriate device from the
table above will be linked to the ctmini device node. QIC-
02 tape drives will always be accessed by the ct0,1 device
nodes as shown in the table. If a SCSI tape drive is
installed as the default device and there is no QIC-02 drive
installed, it will be linked to the ct0 device node. If
both SCSI and QIC-02 drives are installed, the SCSI device
node cannot be linked to the ct0 device node.
tape(C) describes the commands used to access tape drives.
Definition of ioctl commands
The following ioctl commands can be used with the various
tape device drivers supported under UNIX. The letters
following each description indicate which drivers support
each ioctl command:
A All drivers
C QIC-02 cartridge tape driver
S SCSI tape driver
F QIC-40 and QIC-80 mini-cartridge tape drivers
I Irwin mini-cartridge tape driver
MTSTATUS
Returns a device-independent structure holding the status of
the drive. The tape_info structure is defined in
/usr/include/sys/tape.h. (A) MT_DSTATUS Returns a device-
dependent structure holding status information of the drive.
(A)
MTRESET
Resets the driver software and the tape drive. Interrupts
tape commands in progress. (A)
MTREPORT
Returns an integer code which determines the type of device
which the driver controls. The type numbers are defined in
/usr/include/sys/tape.h. (A)
MTRETEN
Winds the tape forward to EOT and then backward to BOT. (A)
MTREWIND
Rewinds the tape to BOT. (A)
MTERASE
Erases the data on the tape and retensions the cartridge.
(C,S,F)
MTAMOUNT
Returns an integer count of the amount of the last data
transfer. (A)
MTFORMAT
Formats the tape. Expects as an argument the number of
tracks to format, which must be an even number. If no
argument is provided, the default is 20 tracks for QIC-40
drives, 28 tracks for QIC-80 drives, and from 8 to 32 tracks
for Irwin drives, depending on the capacity of the tape. On
Irwin drives, the tape must previously have been servo-
written before formatting, either by the manufacturer or
with the MT_SERVO command. (F,I)
MTGETHDR
Expects as an argument a pointer to a struct ft_header or
struct ir_header and copies the header of the current tape
into it. (F,I)
MTPUTHDR
Takes a pointer to a struct ft_header or struct ir_header
and writes it onto the tape. This command should be used
with caution. (F,I)
MTGETNEWBB
Takes a pointer to a struct ft_newbbt or struct ir_newbbt
and copies in a list of bad blocks detected on the last
write operation. (F,I)
MTPUTNEWBB
Takes a pointer to a struct ft_newbbt or struct ir_newbbt,
reads in the header from the tape, then writes a new bad
block onto the tape with the new bad blocks from the
provided bad block table. (F,I)
MTGETVTBL
Takes a pointer to a struct ft_vtbl and copies in the volume
table from the tape. (F)
MTPUTVTBL
Takes a pointer to a struct ft_vtbl and writes the volume
table onto the tape. This command should be used with
caution. (F)
MTSERVO
Writes servo marks on a blank tape in preparation for
formatting with MT_FORMAT. If the tape has previously been
servo-written, this command may fail unless the tape is
first bulk-erased with a commercial tape eraser. Normally,
a tape should only be servo-written once in its lifetime,
although it can be formatted many times. (I)
MTRFM
Winds the tape forward to the next file mark. (C,S)
MTWFM
Writes a file mark at the current location on the tape.
(C,S)
MTLOAD
On devices which are capable of doing so, loads the tape
into the drive. (S)
MTUNLOAD
On devices which are capable of doing so, unloads the tape
from the drive. (S)
Files
/dev/rStp0 /dev/xft0 /dev/nrct0 /dev/erct0
/dev/nrStp0 /dev/rir0 /dev/rct2 /dev/xct0
/dev/xStp0 /dev/xir0 /dev/nrct2 /dev/rctmini
/dev/rft0 /dev/rct0 /dev/xct0 /dev/xctmini
Include files:
/usr/include/sys/tape.h
/usr/include/sys/ct.h
/usr/include/sys/ft.h
/usr/include/sys/ir.h
Notes
After certain tape operations are executed, the system
returns a prompt before the tape controller has finished its
operation. If the user enters another tape command too
quickly, a ``device busy'' error is returned until the tape
device is finished with its previous operation.
Periodic tape cartridge retensioning and tape head cleaning
are necessary for continued error-free operation of the tape
subsystem. Use tape(C) to retension the tape.
See Also
backup(ADM), xbackup(ADM), cpio(C), dd(C), format(C),
tape(C), tar(C), restore(ADM), xrestore(ADM)
(printed 8/30/89) TAPE(HW)