The tape command sends commands to, and receives status
from, the tape subsystem. tape
can communicate with QIC-02 cartridge, SCSI
(including HP DAT) tape drives, and QIC-40,
QIC-80, and Irwin mini-cartridge tape drives.
(The Irwin specific program
mcart(C)
is invoked automatically by tape when options specific to
the Irwin driver are used.)
The tape command reads /etc/default/tape to find
the default device name for sending commands and receiving status.
For example, the following line in /etc/default/tape will
cause tape to communicate with the QIC-02
cartridge tape device:
device = /dev/xct0
If a device name is specified on the command line, it overrides the
default device. tape queries the device to determine its
device type. If the device does not respond to the query,
tape will print a warning message and assume the device is
a QIC-02 cartridge tape.
The tape drive type may be specified using the following flags:
-8
QIC-80 mini-cartridge tape
-c
QIC-02 cartridge tape
-f
QIC-40 mini-cartridge tape
-i
Irwin mini-cartridge tape
-s
SCSI tape (including HP DAT)
See the
tape(HW)
manual page and the Getting Started Guide for a list of supported tape drives.
Commands
The following commands can be used with the various tape drivers
supported under UNIX. The letters following each command indicate
which drivers support the command:
A
All drivers
C
QIC-02 cartridge tape driver
F
QIC-40 and QIC-80 mini-cartridge tape drivers
I
Irwin mini-cartridge tape driver
S
SCSI tape driver (including HP DAT)
The amount and reset commands can be used while
the tape is busy with other operations. All other commands
(including status) wait until the currently executing
command has been completed before proceeding.
When you are using the non-rewinding tape device or the
tape commands rfm and wfm, the tape
drive light remains on after the command has been completed.
Use the command tape rewind to clear this condition.
The -a option allows an argument arg to be
passed to the commands: format, partition,
rfm, rsm, setcomp, setblk,
setpart, wfm, and wsm.
amount (C,S,F)
Report amount of data (kilobytes) in current or last transfer.
The counter resets after 4 GB (4194304 kilobytes),
so this must be taken into account for transfers larger than
this limit.
drive (I)
Display information about the Irwin driver and the tape drive.
See the
mcart(C)
manual page for more details.
eod (S)
Position the tape to the EOD, the end of written data.
See the
dat(HW)
manual page for more information.
erase (C,S,F)
Erase and retension the tape cartridge.
format (F,I)
Format the tape cartridge. Floppy controller-based tapes must be
formatted before they can be used. This command takes approximately
one minute per megabyte of tape capacity.
For QIC-40 and QIC-80 tape drives only, the
argument to the -a flag can be used to specify the number
of tracks to be formatted. Only even numbers less than or equal to
the number of tracks on the tape are allowed. See the
tape(HW)
manual page for more information. If no argument is given, the
entire tape will be formatted.
Preformatted tapes are available which are more reliable than
user-formatted tapes. Before reformatting a used tape, you must
erase it with a bulk eraser. Proper use of a bulk eraser is not
trivial; refer to the documentation for your bulk eraser.
getbb (F)
Print a list of bad tape blocks detected during the last tape
operation. This listing can be saved in a file for use by the
putbb command.
getblk (S)
Report the tape block size. A size of 0 (zero) implies variable
block size.
getcomp (S)
Report the drive compression and decompression settings. These are
either enabled or disabled.
getdensity (S)
Report the density setting of the tape drive as one of the following
values:
Value
Description
0
Default
1
800bpi (NRZI) (½ inch)
2
1600bpi (PE) (½ inch)
3
6250bpi (GCR) (½ inch)
4
8000bpi (GCR) (¼ inch) QIC-11
5
8000bpi (GCR) (¼ inch) QIC-24
6
3200bpi (PE) (½ inch)
7
6400bpi (IMFM) (¼ inch)
8
8000bpi (GCR) (0.15 inch)
9
37871bpi (GCR) (½ inch)
0xa
6667bpi (MFM) (½ inch)
0xb
1600bpi (PE) (¼ inch)
0xc
12690bpi (GCR) (½ inch)
0xd
25380bpi (GCR) (½ inch)
0xe
Reserved forECMA
0xf
10000bpi (GCR) QIC-120
0x10
10000bpi (GCR) QIC-150
0x11
16000bpi (GCR) QIC-320/QIC-525
0x12
51667bpi (RLL) QIC-1350
0x13
61000bpi (DDS) 4mm X3B5/88-185A
0x14
54000bpi 8mm X3B5/88-036 (EXB-8200)
0x15
QIC-1000
0x22
QIC-2GB
0x7f
No change
Unknown density settings result in the message Unknown Density
type XX.
getpart (S)
Report the active partition number of the tape drive. See the
dat(HW)
manual page for additional information.
getspeed (S)
Report the speed setting of the tape drive. The value returned is
specific to the type of drive.
setspeed (S)
Set the speed of the tape drive. The value must be supported by
the drive.
getvar (S)
Report the current setting
of the Stp_read_variable_blocks switch
in the device driver.
setvar (S)
Set the Stp_read_variable_blocks switch
in the device driver.
For example, turn the switch on
by setting Stp_read_variable_blocks to 1 (one)
with the -a option:
tape -a 1 setvar
To turn it off,
use the -a option
with an argument of 0 (zero).
When Stp_read_variable_blocks is set to 1,
a read in variable mode (block size=0)
returns the actual physical block read.
With Stp_read_variable_blocks set to 0,
a read returns as much data as the buffer will hold.
info (I)
Display Irwin cartridge information. See the
mcart(C)
manual page for more details.
kapacity (I)
Report Irwin cartridge capacity in 1024-byte blocks. See the
mcart(C)
manual page for more details.
load (S)
Load the tape cartridge.
map (F)
Print out a map of the bad blocks on the tape. The format is a
series of lines of the format:
track n: -------------X------...
Each ``-'' represents a good block on the track; an
``X'' represents a block marked as bad.
obeyeom (S)
Instruct the tape driver to obey the EOM (end-of-media) return code.
When turned off (the default for backward compatibility),
the driver returns STP_MEDIUM instead of STP_EOM when an actual
EOM error is detected. When turned on, it returns STP_EOM correctly.
For example, turn the option on
by setting obeyeom to 1 (one)
with the -a option:
tape -a 1 obeyeom
To turn it off,
use the -a option
with an argument of 0 (zero).
partition (S)
Partition an SCSI tape into logical partitions 0 and
1. The size (in megabytes) of partition 1 is specified on the
command line. The size of partition 0 is the remainder of the
tape. For example, tape -a 200 partition creates a
200MB partition (in partition 1); partition 0 comprises
the rest of the tape. For a 1300MB unformatted
DAT tape, partition 0 could hold approximately
1100MB of data. (See the
dat(HW)
manual page for additional information.)
putbb (F)
Read a list of bad tape blocks from the standard input and add them
to the bad block table on the tape. The format expected by
putbb is the same as generated by the getbb
command.
reset (C,S,F)
Reset tape controller and tape drive. Clears error conditions and
returns tape subsystem to power-up state.
reten (A)
Retension tape cartridge. Should be used periodically to remedy
slack tape problems. Tape slack can cause an unusually large number
of tape errors.
rewind (A)
Rewind to beginning of tape
(BOT). (If a SCSI tape is partitioned, the
logical partition is rewound to the logical BOT. See the
dat(HW)
manual page for details.)
rfm (C,S)
Wind the tape forward a specified number of filemarks (using
-aarg). Position the tape at the next filemark
if no number is specified. A negative number moves the tape
backwards that number of filemarks. Note that cartridge tapes (C)
are able to wind forward only one filemark at a time.
rsm (S)
Wind the tape forward a specified number of setmarks (using
-aarg). Position the tape at the next setmark
if no number is specified. A negative number moves the tape
backwards that number of setmarks. (See the
dat(HW)
manual page for more information.)
setansi (S)
Set ANSI style tape handling.
setblk (S)
Set the tape block size to a specified byte size. For example, the
following command sets the tape block size to 512 bytes:
tape -a 512 setblk
Select variable block size by specifying a block size of 0 (zero).
setcomp (S)
Enable or disable tape drive compression and decompression. The
values of the argument arg to the -a option
select the capabilities required (depending on the drive type):
Value of arg
Compression
Decompression
0
disabled
disabled
1
enabled
disabled
2
disabled
enabled
3
enabled
enabled
setdensity (S)
Set the tape density to the value specified by the argument
arg to the -a option. The possible values of
arg are listed in the table for the getdensity
command. For example, tape -a 2 setdensity selects a
density of 1600bpi for a nine-track tape.
setpart (S)
Select a partition on a pre-partitioned tape. The argument
arg to the -a option specifies the
partition. For example, tape -a 1 setpart selects
partition 1 on a tape with two partitions. (Most partitioned drives
default to partition 0 on power-on or reset.) See the
dat(HW)
manual page for additional information.
status (C,S,F)
The status output looks like this:
status: status message
soft errors: n
underruns: m
Status is a report of the current status of the drive;
``no cartridge'', ``write protected'', or ``beginning of tape'' are
typical status messages.
Soft errors is the number of recoverable errors that
occurred during the last tape operation. A recoverable error is one
which is correctable by the drive or controller. An example of a
non-recoverable ``hard'' error is an attempt to write to a
write-protected cartridge. Note that if the number of soft errors
greatly exceeds the manufacturer's specifications, the drive may
require service or replacement, or you may be using a defective
tape.
Underruns is the number of times the tape drive had to
stop and restart due to tape buffer underflows. Underruns are not an
error condition; they mean that the data transfer did not occur at
the drive's maximum
data transfer rate. The number of underruns can be affected by
system load.
If you use the status command while the tape drive is
busy, no message is displayed until the drive is free.
unload (S)
Unload the tape cartridge.
wfm (C,S)
Write arg filemarks at the current tape position. If
arg is not specified, write one filemark. Note that
cartridge tapes (C) are able to write only one filemark.
wsm (S)
Write arg setmarks at the current tape position. If
arg is not specified, write one setmark. (See the
dat(HW)
manual page for more information.)
xstatus (S)
This command provides more information than the status
command. The information maintained and reported is specific to the
drive type; it may include number of retries, ECC
corrections, and data transferred. The following is a list of all
the information that may be reported:
errors corrected without substantial delay:
errors corrected with possible delay:
Total errors:
Total errors corrected:
Total ECC errors:
Total bytes transferred:
Total unrecovered errors:
Underruns:
Overruns:
The term Underruns is described for the status
command.
The term Overruns is the number of times the tape drive
had to stop and restart due to the tape buffer overflowing. Overruns
are not an error condition; they mean that the processor could not
transfer data from the tape drive fast enough to keep the drive in
streaming mode. The number of overruns can be affected by system
load.
Exit values
The following exit values may be returned by tape (for
Irwin drives, refer to the exit codes listed on the
mcart(C)
manual page):
0
Normal exit with no error.
1
Faulty cables, or no cartridge in drive.
2
Incorrect command syntax, unknown or bad tape format, unknown drive
type, or device special file not found.
3
Cartridge write protected, or no data on cartridge.
4
Device in use by another process.
Examples
Display the commands available with SCSI tape drives:
tape -s
Display the commands available with Irwin tape drives:
tape -i
To obtain the status of the current (default) tape drive:
tape status
(Note: this is only applicable to QIC-02,
QIC-40, QIC-80 and SCSI tape drivers.)
To retension the tape in the default drive:
tape reten
To rewind an SCSI tape (on a system where the default tape
drive is some other type):
tape -s rewind
Wind an SCSI tape forward three filemarks:
tape -s -a 3 rfm
Wind an SCSI tape backward two filemarks:
tape -s -a -2 rfm
Format an Irwin tape:
tape -i format /dev/rctmini
Format a QIC-40/80 tape:
tape -f format /dev/rctmini
Files
Device special files:
/dev/rStp0
/dev/rct0
/dev/erct0
/dev/rmc1
/dev/nrStp0
/dev/nrct0
/dev/xct0
/dev/xStp0
/dev/rct2
/dev/rctmini
/dev/rft0
/dev/nrct2
/dev/xctmini
/dev/xft0
/dev/xct0
/dev/rmc0
Device special files for SCSI tapes (first tape drive):
/dev/rmt/Sc0s0
linked to /dev/rStp0
/dev/rmt/Sc0s0n
linked to /dev/nrStp0
/dev/rmt/Sc0s0x
linked to /dev/xStp0
/dev/rmt/Sc0s0r
Note that if you have not installed a cartridge tape on your system,
SCSI tapes device are linked to
/dev/ct0. For more information on device files, see
the
tape(HW)
manual page.