Skip to content

Instantly share code, notes, and snippets.

@hrchu
Last active May 30, 2018 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrchu/a1b7dad0aa64e34fe0c40b45ef9dc821 to your computer and use it in GitHub Desktop.
Save hrchu/a1b7dad0aa64e34fe0c40b45ef9dc821 to your computer and use it in GitHub Desktop.
documents extracted from cygwin.com/packages/x86_64/mt/mt-2.5.2-1
*mt 2.5*
------
- system
- All x86 and x64 Windows versions supported by Cygwin 1.7 and later.
- notes
- The default device name is "/dev/tape". Since that doesn't
exist in Cygwin by default, just create a convenient symlink.
It's done the same way on Linux.
- If you don't want to create a symlink you can also just set the
environment variable "TAPE" to a convenient value if you like.
This, too, avoids that you'll have to use the -f option all the
time.
- Supports setting blocksize to 0 to enable variable blocksizes.
- `mt' supports nearly all commands of GNU-mt, except for `stwrthreshold'.
`mt' also supports the `mkpartition', `partseek' and `setpartition'
commands of the most recent mt from Fedora Linux , as well as
`datcompression' and `compression' both, to be compatible with both mt
versions used on Linux these days.
- The output of `mt status' is now compatible to mt as used on Red Hat
Linux in the first place. If you want to switch to the former GNU-mt
compatibel output, you can do so by setting the environment variable
MT_STATUS_GNU.
In contrast to any mt on Linux, the command `status' reports more
detailed information with `mt status 2' or `mt status 3'. This also
allows printing the Windows-specific bits in the generic status register.
- Supports settings of capabilities using the `drvbuffer' and `stoptions'
commands. To ease input, it allows to enter the value to these commands
using hexadecimal notation. In case of `mt drvbuffer', the value is
used unchanged, in case of `stoptions' it's or'd with MT_ST_BOOLEANS
(see include/cygwin/mtio.h)
How does that work? Please compare the below examples with the
MT_ST_xxx codes in include/cygwin/mtio.h.
Per the standard, buffer writes can be switched on and off by
simply giving 1 or 0 as value:
- mt drvbuffer 0 switches "BUFFER_WRITES" off.
- mt drvbuffer 1 switches "BUFFER_WRITES" on.
Now the serious examples:
- mt drvbuffer 0x3000001 switches "BUFFER_WRITES" on.
- mt drvbuffer 0x4020010 switches "PADDING" and "TWO_FM" off.
- mt drvbuffer 0x1000041 sets the exact bits as given in the argument,
so the example switches "AUTO_LOCK" and
"BUFFER_WRITES" on, everything else off.
- mt stoptions 0x41 does exactly the same.
Basically, `mt stoptions 0xnnnnnnn' is equivalent to
`mt drvbuffer 0x1nnnnnnn'.
- mt drvbuffer 0xf0001000 sets the EOT warning zone size to 4096 bytes.
The meaning of the supported settings:
- BUFFER_WRITES: If BUFFER_WRITES is switched on, the underlying OS
buffers all data written to the tape. If switched off, data is
immediately written to the tape. The default is buffered writes.
- ASYNC_WRITES: When this option is turned on, write calls return
immediately and the actual write operation is executed asynchronously.
This only applies to variable block size writing.
- TWO_FM: When closing the file descriptor immediately after writing
to tape, the close command writes a tape filemark. If TWO_FM is
switched on, two filemarks are written and the tape is positioned
right between these two filemarks. The default is to write only one
filemark.
- FAST_MTEOM: By default the MTEOM command positions the tape to the
end-of-data position by spacing over 32767 filemarks. This keeps
the file numbering in sync. With FAST_MTEOM switched on, the
tape is positioned using direct spacing to EOD (if the tape drive
supports this operation). This invalidates the file number.
- AUTO_LOCK: By default, the tape drive eject mechanism keeps unlocked,
unless the explicit command to lock the drive is given, using the
MTLOCK ioctl command. If AUTO_LOCK is switched on, the door is
locked, as soon as a read or write command is performed. The drive
then gets automatically unlocked after the file descriptor is closed.
- SYSV: Switches on System V semantics. On System V, if a file being
read is closed, the tape drive is positioned right after the
following filemark, unless the filemark has just been crossed.
The default is BSD semantics, which means, the tape drive is left
where it is on close after read.
- NOWAIT: By default, the tape code waits for finishing tape commands.
If NOWAIT is on, Cygwin won't wait for some commands to succeed.
These are rewinding, retension, erase, load/unload and direct
(absolute or logical) seeking.
- ECC: Switches hardware correction on and off.
- PADDING: Switches data padding on and off. Data padding means,
adding filler blocks automatically on write to keep the tape
streaming at constant speed. This might reduce the capacitity.
- REPORT_SM: Switches reporting of setmarks on and off.
Most of the above settings also depend on the drive resp. driver
capabilities. See `mt status 3'.
- Since this `mt' uses the Cygwin device driver (well, it's not
exactly a driver, but you get the idea), please note that
using a rewind device name (e.g. /dev/st0) will rewind the tape
after the operation! This is equivalent to Linux. If you e.g.
want to move to block 3, don't be surprised that
mt -f /dev/st0 seek 3
ends up on block 0. In these cases, use the appropriate no-rewind
device instead:
mt -f /dev/nst0 seek 3
Caution: Even using the `status' command will rewind when used
on a rewind tape device!
- Send bug reports to cygwin@cygwin.com
MT(1L) MT(1L)
NAME
mt - control magnetic tape drive operation
SYNOPSIS
mt [-V] [-f device] [--file=device] [--version] operation [count]
DESCRIPTION
This manual page documents the GNU version of mt. mt performs the given operation, which must be one of the tape operations listed below,
on a tape drive.
The default tape device to operate on is taken from the file /usr/include/sys/mtio.h when mt is compiled. It can be overridden by giving
a device file name in the environment variable TAPE or by a command line option (see below), which also overrides the environment vari‐
able.
The device must be either a character special file or a remote tape drive. To use a tape drive on another machine as the archive, use a
filename that starts with `HOSTNAME:'. The hostname can be preceded by a username and an `@' to access the remote tape drive as that
user, if you have permission to do so (typically an entry in that user's `~/.rhosts' file).
The available operations are listed below. Unique abbreviations are accepted. Not all operations are available on all systems, or work
on all types of tape drives. Some operations optionally take a repeat count, which can be given after the operation name and defaults to
1.
eof, weof
Write count EOF marks at current position.
fsf Forward space count files. The tape is positioned on the first block of the next file.
bsf Backward space count files. The tape is positioned on the first block of the next file.
fsr Forward space count records.
bsr Backward space count records.
bsfm Backward space count file marks. The tape is positioned on the beginning-of-the-tape side of the file mark.
fsfm Forward space count file marks. The tape is positioned on the beginning-of-the-tape side of the file mark.
asf Absolute space to file number count. Equivalent to rewind followed by fsf count.
eom Space to the end of the recorded media on the tape (for appending files onto tapes).
rewind Rewind the tape.
offline, rewoffl
Rewind the tape and, if applicable, unload the tape.
status Print status information about the tape unit. `status 2' and `status 3' print more information.
retension
Rewind the tape, then wind it to the end of the reel, then rewind it again.
erase Erase the tape.
fss (SCSI tapes) Forward space count setmarks.
bss (SCSI tapes) Backward space count setmarks.
wset (SCSI tapes) Write count setmarks at current position (only SCSI tape).
eod, seod
Space to end of valid data. Used on streamer tape drives to append data to the logical and of tape.
setblk (SCSI tapes) Set the block size of the drive to count bytes per record.
setdensity
(SCSI tapes) Set the tape density code to count. The proper codes to use with each drive should be looked up from the drive docu‐
mentation.
drvbuffer
(SCSI tapes) Set the tape drive buffer code to number. The proper value for unbuffered operation is zero and "normal" buffered
operation one. The meanings of other values can be found in the drive documentation or, in case of a SCSI-2 drive, from the SCSI-2
standard.
stoptions
(SCSI tapes) Set the driver options bits to count for the device. The bits can be set by oring the following values: 1 to enable
write buffering, 2 to enable asynchronous writes, 4 to enable read ahead, 8 to enable debugging output (if it has been compiled to
the driver).
stwrthreshold
(SCSI tapes) The write threshold for the tape device is set to count kilobytes. The value must be smaller than or equal to the
driver buffer size.
seek (SCSI tapes) Seek to the count block on the tape. This operation is available on some Tandberg and Wangtek streamers and some
SCSI-2 tape drives.
tell (SCSI tapes) Tell the current block on tape. This operation is available on some Tandberg and Wangtek streamers and some SCSI-2
tape drives.
densities
(SCSI tapes) Write explanation of some common density codes to standard output.
compression, datcompression
(some SCSI-2 DAT tapes) Inquire or set the compression status (on/off). If the count is one the compression status is printed. If
the count is zero, compression is disabled. Otherwise, compression is enabled. The command uses the SCSI ioctl to read and write
the Data Compression Characteristics mode page (15). ONLY ROOT CAN USE THIS COMMAND.
setpart, setpartition
Change active partition on tape drives supporting them. A count of 0 means to position the tape in the default partition.
partseek
The tape position is set to block count in the partition given by the argument after count. The default partition is 0.
mkpart, mkpartition
Creates tape partitions on tape drives supporting them. Creates one partition if count is 0, two partitions otherwise. For drives
supporting initiator partitions, count is the size of the second partition in megabytes. For drives only supporting select or
fixed partitions, count just specifies if one (count = 0) or two (count > 0) partitions are created.
mt exits with a status of 0 if the operation succeeded, 1 if the operation or device name given was invalid, or 2 if the operation failed.
OPTIONS
-f, --file=device
Use device as the file name of the tape drive to operate on. To use a tape drive on another machine, use a filename that starts
with `HOSTNAME:'. The hostname can be preceded by a username and an `@' to access the remote tape drive as that user, if you have
permission to do so (typically an entry in that user's `~/.rhosts' file).
-V, --version
Print the version number of mt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment