mt(1) mt(1)
NAME
mt - tape control utility
SYNOPSIS
mt [-f tapename] command [count]
DESCRIPTION
You can use mt to send commands to the tape drives, in order, for
example, to
- retain a streamer tape,
- rewind a tape/streamer tape to the beginning,
- wind forward to a specific position,
- write an end-of-archive mark,
- extend the reservation of a tape drive, so that it remains reserved
for the initiator when the job has been completed,
- abort the job on a tape drive,
- print status information about the tape unit.
OPTIONS
-f tapename
Addresses the driver of the named unit. mt interprets the next
argument as the name of a special file.
tapename
Here you specify the special file for the device you wish to
address. The special file must be a file for a raw device;
it must on no account be a block special file [see
stape(7)].
The name of the special file determines, for example,
whether or not the tape is to be wound back automatically to
the start following access.
To transport a tape to a specific position with mt you have
to select the special file which does not cause the tape to
be rewound.
-f tapename not specified:
mt reads the TAPE environment variable.
This enables you to use a predefined special file. If you assign
the name of your chosen special file to the environment variable
TAPE, you can then call mt without using the -f option and mt
will access the predefined special file automatically.
Page 1 Reliant UNIX 5.44 Printed 11/98
mt(1) mt(1)
command
command which the designated driver is to execute. Some commands
have two different forms, and in these cases both versions of the
command are shown before the description of the function.
The available commands are as follows:
fsf Wind on to the start of the next archive.
An archive consists of all files between:
- the start-of-tape mark and the first end-of-archive mark
or
- two end-of-archive marks.
The last archive on the tape is bounded by two end-of-
archive marks.
Commands such as cpio and tar automatically write an end-
of-archive mark on the tape when they close the special file
after completing the write operation. Hence an archive
always contains the files which you have written to tape or
tape cartridge in a single write operation.
You should use fsf only with special files which do not
automatically wind the tape back to the start following
access (see the -f option).
bsf bsf winds the tape back to the previous end-of-archive mark.
You should only use bsf with special files which do not
automatically wind the tape back to the start following
access (see the -f option).
append
Moves forwards until after the last archive. This command
must be used for some tape devices if data is to be added
after the last archive.
fsr fsr winds the tape on to the start of the next record. mt
does this by looking for the next record gap.
You can use write(2) to write data directly to tape. You
write a record each time you call write(2), the end of which
is marked automatically with a record gap. Records for mag-
netic tape units can be between 1 byte and 128 Kbytes long.
You should only use fsr with special files which do not
automatically wind the tape back to the start following
access (see the -f option) and only with tapes of variable
record length.
Page 2 Reliant UNIX 5.44 Printed 11/98
mt(1) mt(1)
bsr bsr winds the tape back to the start of the previous record.
mt does this by looking for the next record gap. For more
information on records, refer to the description of fsr.
You should only use bsr with special files which do not
automatically wind the tape back to the start following
access (see the -f option) and only for tapes that have been
written with variable record length.
eof
weof Write an end-of-archive mark at the current tape position.
This can be used to create an "empty" archive. A shell
script could then read files from the tape until it finds an
empty archive.
rewind
Wind back to start of tape/streamer tape. The count argu-
ment, if specified, is ignored.
You should only use rewind with special files which do not
automatically wind the tape back to the start following
access (see the -f option).
offline
rewoffl
This command only works with MTUs.
offline and rewoffl wind the tape back to the start and
place the tape unit off-line. The count argument, if speci-
fied, is ignored.
Warning:
If the drive cover of a tape cartridge drive is located
behind a tape loading door, as on the 8mm magnetic tape car-
tridge drive of a RM600-xx, the system's tape loading door
must be opened before the command is executed. If the door
is closed, the drive may well be damaged when opened.
ret
reten
This command only works with streamers.
ret and retension retension the tape. The count argument, if
specified, is ignored.
You should retension the tape in the following instances:
- when you insert a cartridge in the drive;
- after a full tape read or write operation.
Page 3 Reliant UNIX 5.44 Printed 11/98
mt(1) mt(1)
erase
Erase the tape from the current position to the end of the
tape. The count argument, if specified, is ignored. On
streamers: erase all archives from the tape.
insert
Open the drive door. The count argument, if specified, is
ignored. This is useful for a 8mm drive within an auto-
changer with no tape inserted and drive door closed. The
offline command will not work in this case.
status
Display status information about the tape unit. The informa-
tion displayed depends on the type of tape and the type of
drive.
The count argument, if specified, is ignored.
The output always includes the name of the device type used.
In addition, the current setting of the buffer size is
displayed.
The output for a streamer on an RM600 e.g. would be:
IOS tape drive, residual=8192
ds=4000<>
er=0
In the top byte, ds contains the "Sense Key" and in the lower
byte the "Additional Sense Key" from the "Extended Sense Bytes"
of the device. residual and er should not be evaluated.
reserve
Extend the reservation of tape devices. High-performance
tape drives often have two independent SCSI ports that can
be connected to two systems. Up to now, the tape driver
reserved the drive at the start of a job and freed it again
when the job was completed. However, if a drive is being
used by two systems simultaneously, it can happen that the
second system will access the tape before the first system
has, for example, finished its data backup. The reserve com-
mand allows a system to reserve the drive until it frees it
again explicitly with a release command. If the second sys-
tem attempts to access the drive while it is still reserved,
the device rejects the job with an I/O error and sends a
"Reservation Conflict" message to the console. A reservation
is only possible if a cassette is inserted in the device. A
reinitdev command cancels the reservation if it was issued
by the previous initiator. A reinitdev command from a second
system that hadn't reserved it before, is unsuccessful. If
the initiator (system) fails for some reason, the reserva-
tion can only be canceled by booting the failed system or
Page 4 Reliant UNIX 5.44 Printed 11/98
mt(1) mt(1)
setting the port on the tape device to "offline"!
For technical reasons, this cannot be done any other way at
present, because the corresponding SCSI commands have not
yet been implemented by the manufacturers of the tape
devices.
release
Release a tape device that had previously been reserved
explicitly with a reserve command. This command cancels the
extended reservation of a tape device again. The drive can
also be freed if no cassette is inserted in it.
If a release or reserve command is executed for a tape
device, which has already been reserved by another system,
the mt command issues the following error messages:
/dev/iosX/rstapeXXX Command: command causes reservation con-
flict !
command, in this case, represents the command reserve or
release.
A "Reservation Conflict" message is also output on the con-
sole by the tape driver.
relstat
Determine the reservation status of a tape drive. If no
reservation is effective, the following message is issued:
/dev/iosX/rstape0XX is not reserved.
If a drive was reserved with the reserve command by the
current system, the following message is issued:
/dev/iosX/rstape0XX is reserved.
If the drive was reserved by another system, the following
message is issued:
/dev/iosX/rstape0XX is reserved by other initiator or sys-
tem.
The reservation messages are also issued, if there is no
cassette in the drive, provided one of the ports is
reserved. If the reservation is canceled, the following mes-
sage is issued when the status is queried:
Unable to get reservation status of: /dev/iosX/rstape0XX
Device not ready.
Page 5 Reliant UNIX 5.44 Printed 11/98
mt(1) mt(1)
If this message is issued, it generally means that there is
no cassette in the drive. Once a cassette is inserted, the
reservation status can be determined again. A different
error has occurred if the following message is issued:
Unable to get reservation status of: /dev/iosX/rstape0XX
Information regarding the problem that has occurred is out-
put on the system console in this case.
reset
The job processed on the tape drive is aborted. This command
can only be executed by the system administrator. It can be
particularly useful if a tape device requires an unusually
long period of time for a command, which would otherwise be
completed very quickly, or if a command has been entered
inadvertently.
Note:
This command generally results in the tape contents, i.e.
the previously saved data, being lost.
count
An integer: command is to be executed count times. The count
argument is ignored for the following commands:
erase, offline, ret, reten, rewind, rewoffl, status
count not specified:
The specified command is executed once.
EXIT STATUS
0 The driver executed the mt command successfully.
1 The driver did not recognize the command specified in the mt call.
2 There was an error during execution of the mt command.
ENVIRONMENT VARIABLES
TAPE This variable can be set to the name of the special file which
the mt command is to access if the -f option is not specified.
EXAMPLES
The file dates/critical is to be read from the fifth archive on a tape
cartridge. The cartridge is in the drive and is currently positioned
at the start of the tape:
a) Go to the start of the fifth archive:
$ mt -f /dev/ios0/rstape025n fsf 4
Page 6 Reliant UNIX 5.44 Printed 11/98
mt(1) mt(1)
b) Read the file you want:
$ tar xvf /dev/ios0/rstape025 dates/critical
x dates/critical
When tar finishes executing, the tape is automatically wound back
to the start, since the special file /dev/ios0/rstape025 was speci-
fied.
NOTES
When working with mt and cpio, it is important to ensure that the tape
is positioned behind an EOF (end of file) mark after mt, before
proceeding to work with cpio. This behavior complies with MIPS ABI.
FILES
/dev/rmt/ctape*
/dev/rmt/vtape*
/dev/ios?/[r]stape*
SEE ALSO
cp(1), cpio(1), dd(1), env(1), set(1), tar(1), ioctl(2), write(2),
mtio(7), stape(7).
Page 7 Reliant UNIX 5.44 Printed 11/98