mt - Magnetic tape manipulating program
mt [-f tape_device] command [count]
mt [-f tape_device] reserve [-f | -l | -t | -r]
This option specifies the tape device to be manipulated.
This option specifies the number of times that the operation
is to be repeated.
The mt command enables you to manage magnetic tape drives
and also to coordinate shared access to tape devices,
including devices that are part of a storage area network
(SAN).
Note
Unless enhanced security is enforced on the local system,
the mt command is not privileged and all devices are
accessible to users, except in the case of the force
options that function only with the reserve option.
If you do not specify a tape name with the -f option, the
TAPE environment variable is used; if TAPE does not exist,
mt uses the /dev/ntape/tape0_d0 device. Note that
tape_device must refer to a raw (not block) tape device.
By default, mt performs the requested operation once. You
can perform operations more than once using the count
option.
The following commands are available: Backspaces count
files. Backspaces count records. Writes count End-ofFile
marks at the current position on the tape. Forward
spaces count files. Forward spaces count records. This
option prepares a SCSI tape for loading into the device.
Not all SCSI tape drives support this command. Rewinds
the tape and places the tape unit offline (count is
ignored). Bring a SCSI tape to the ready state if a tape
is in the tape path. Currently, this command is only supported
in the SCSI/CAM tape driver. Not all SCSI tape
drives support this functionality. Enables you to free a
tape device that is part of a storage area network (SAN).
Use this command option if you previously obtained exclusive
access to the tape device by using the reserve
option. Enables you to exclusively reserve shared tape
devices, including devices that are part of a storage area
network (SAN). Before initiating a reservation, use the
tur option to ensure that no other process is using the
target device.
Use the reserve option before launching any application
that is not shared tape aware. That is, any
application (such as a backup program) that is
unable to dynamically determine that it is writing
to a shared tape device. This includes the command
line utilities, tar, dump, dd, vdump, restore, and
vrestore. Consult the application's documentation
or contact the application vendor to determine
whether an application is shared tape aware. After
the application completes its task, use the release
option to free the tape device for use by other
processes.
The following force options are available for use
only when you specify the reserve option with the
mt command:
Caution
These options require root privileges. You must use
the force options only when you are certain that
the device is not being used by another user. For
example, use the force option if a user has finished
using the tape device, but neglected to
release the device. Any other use of the force
options might cause data corruption by allowing
simultaneous access to the device by different processes.
There is no way to determine whether a shared
device is reserved erroneously other than by physically
examining the device and verifying its status
with authorized users. In general, you must assume
that if a device is reserved, then another user is
accessing it, and you should not force a reservation.
Forces a lun reset on a tape device in a SAN only
on the active path before the reserve. This option
is useful if no path failures have occurred.
Forces a target reset on all available paths before
the reserve This option works on devices located in
a SAN and local shared SCSI tape devices. This
option is useful when path failures have occurred.
Forces a target reset only on the active path
before the reserve. This option works on devices
located in a SAN and local shared SCSI tape
devices. This option is useful if no path failures
have occurred. Force a lun reset on a tape device
in a SAN on all available paths before the reserve.
This option is useful when path failures have
occurred.
Use the hwmgr show scsi -full command to determine
the active paths (bus/target/lun) to a tape device.
See hwmgr_show(8) for more information. Rewinds
the tape (count is ignored). Sets the tape at the
specified read position coordinates. The data
obtained when using the rdpos option can be used as
an argument to the seek or seekds commands.
Use the following options with the rdpos command:
The read position short format. This option
requires a tape coordinate argument in the following
syntax: # mt -f /dev/ntape/tape1 rdpos s
READ POSITION short format
First block: 3 (0x3)
Last block: 0 (0x0)
Number of blocks: 0 (0x0)
Number of bytes: 0 (0x0)
The preceding example provides the following
information: The block address associated with the
current logical position. The block address associated
with the next block to be transferred from
the buffer to the medium. The number of data
blocks that have not been written to the medium.
The number of data bytes that have not been written
to the medium.
In addition to the information provided by the preceding
example, the rdpos s option may display
additional messages. Availability of these additional
messages depends on the capabilities of the
tape drive device. You will only see such error
messages if the tape device is configured to detect
the error state and to display the appropriate message:
An error has occurred and the tape position
cannot be returned. An error has occurred as the
device is incapable of reporting block locations.
Number of bytes in the buffer field does not represent
the actual number of bytes in the buffer.
Number of blocks in the buffer field does not represent
the actual number of blocks in the buffer.
The logical unit is positioned between early-warning
and the end of media (EOM). The logical unit
is at the beginning of media (BOM). The read position
long format. This option requires an argument
in the following syntax: # mt -f /dev/ntape/tape1
rdpos l READ POSITION long format
File number: 0 (0x0)
Block number: 3 (0x3)
The following information is returned: The number
of file marks between BOM and current logical position.
The number of logical blocks between BOM and
the current logical position.
In addition to the information provided by the preceding
example, the rdpos l option may display
additional messages. Availability of these additional
messages depends on the capabilities of the
tape drive device. You will only see such error
messages if the tape device is configured to detect
the error state and to display the appropriate message:
An error has occurred as the device is incapable
of reporting block locations. File Number
and Set Number are unknown The logical unit is
positioned between early-warning and the end of
media (EOM). The logical unit is at the beginning
of media (BOM). The read position short format,
with device-specific addresses. This option only
works on certain devices and requires a tape coordinate
argument as for the s option.
The output will be the same format as for the s
option, although the device-specific data bytes may
differ if the device supports its own format. Not
all devices support their own format. If the d
option is not supported by the device, the following
error message will be displayed: MTIOCRDPOS
(dev_specific): I/O error
Space to end of recorded data. Currently, this command
is only supported in the SCSI/CAM tape driver.
Not all SCSI tape drives support this functionality.
Positions a tape at the specified coordinates.
The output of the rdpos command may be used
as an argument to this command. You can specify the
value from the First block field when using the s
option. Positions a tape at the specified coordinates.
You can use the output from the rdpos command
as an argument, and the syntax is as for the
seek command.
Unlike the general seek command, the seekds command
is device-specific. Some tape devices provide a
device-specific format for accessing the media
position, which differs from the SCSI logical block
format defined by the SCSI standard. The devicespecific
format may provide a faster way of seeking
to a particular position on the tape. Prints status
information about the tape unit. Enables you
to determine if another application has already
reserved a tape device that is part of a storage
area network (SAN), otherwise known as a shared
tape device. Use this option before you use the
reserve option. Prepares a SCSI tape for removal
from the device. Not all SCSI tape drives support
this functionality.
Only as many characters as are required to uniquely identify
a command need to be specified.
The mt command returns the following exit status: Success.
Command was unrecognized. Operation failed.
Raw magnetic tape interface with no rewind when closed.
Raw magnetic tape interface with rewind when closed.
Commands: dd(1), hwmgr(8)
Functions: ioctl(2)
mt(1)
[ Back ] |