Sie sind hier : Homepage →  Linux (2) Tape-Backup→  Die (tar) Kommandos→  mt / mtx

Also hier die Befehle für die Newcomer, sonst ist es wirklich mühsam:

Für den DAU erklärt : der "mt" und "mtx" Befehl

Mit "mt" kann man ganz einfach alle möglichen Geräte Optionen an einem Tape (SCSI) Laufwerk ein und ausschalten. Mit "mtx" wird der Roboter bzw. der Loader gesteuert.


Hiermit fragt man zuerst den Status des Gerätes (in diessm Falle st0) ab:

# mt -f /dev/st0 status


Wenn das Laufwerk nicht streamt. ist es wichtig, die Kompression des Laufwerkes abzuschalten: (hier die Suse Kommandozeile)


  • das Prüfen geht so: # mt -f /dev/st0 datcompression 1
  • das Abschalten so: # mt -f /dev/st0 datcompression 0
  • das Einschalten so: # mt -f /dev/st0 datcompression 2


Die Optionen 0 und 2 spulen auch das DLT Band immer wieder auf Anfang. Damit lassen sich also die nonstreaming Problemchen aufspüren, eingrenzen und meist auch lösen.


Auf der Knoppix CD geht das ein klein bißchen anders :

  • das Abschalten so: # mt -f /dev/st0 compression 0
  • das Einschalten so: # mt -f /dev/st0 compression 1

Hier fast die komplette Befehlssyntax des "mt" Befehls :

(die Formattierung ist weg ??? - das müssen wir noch suchen)



mt - control magnetic tape drive operation



mt [-V] [-f device] [--file=device] [--rsh-command=command] [--version] operation [count]




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



status Print status information about the tape unit.



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 posi-

tion (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.



(SCSI tapes) Set the tape density code to count. The proper codes to use with each drive should be looked up from the drive documentation.



(SCSI tapes) Set the tape drive buffer code to num-ber. 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.



(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).



(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.



(SCSI tapes) Write explanation of some common den-

sity codes to standard output.



(some SCSI-2 DAT tapes) Inquire or set the compres-

sion status (on/off). If the count is one the

compression status is printed. If the count is

zero, compression is disabled. Otherwise, compres-

sion is enabled. The command uses the SCSI ioctl to

read and write the Data Compression Characteristics



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.



-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 `HOST-

NAME:'. 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).



Notifies mt that it should use command to communi-

cate with remote devices instead of /usr/bin/ssh or



-V, --version

Print the version number of mt.



mtx - control SCSI media changer devices



mtx [-f ] [nobarcode] [invert] [noat-

tach] command [ command ... ]



The mtx command controls single or multi-drive SCSI media

changers such as tape changers, autoloaders, tape

libraries, or optical media jukeboxes. It can also be

used with media changers that use the 'ATTACHED' API, pre-

suming that they properly report the MChanger bit as

required by the SCSI T-10 SMC specification.



The first argument, given following -f , is the SCSI

generic device corresponding to your media changer. Con-

sult your operating system's documentation for more infor-

mation (for example, under Linux these are generally

/dev/sg0 through /dev/sg15, under FreeBSD these are

/dev/pass0 through /dev/passX, under SunOS it may be a

file under /dev/rdsk).


The 'invert' option will invert (flip) the media (for

optical jukeboxes that allow such) before inserting it

into the drive or returning it to the storage slot.


The 'noattach' option forces the regular media changer API

even if the media changer incorrectly reported that it

uses the 'ATTACHED' API.


The 'nobarcode' option forces the loader to not request

barcodes even if the loader is capable of reporting them.


Following these options there may follow one or more

robotics control commands. Note that the 'invert' and

'noattach' options apply to ALL of robotics control com-





--version Report the mtx version number (e.g. mtx 1.2.8)

and exit.



inquiry Report the product type (Medium Changer, Tape

Drive, etc.), Vendor ID, Product ID, Revision,

and whether this uses the Attached Changer API

(some tape drives use this rather than reporting

a Medium Changer on a separate LUN or SCSI



noattach Make further commands use the regular media

changer API rather than the _ATTACHED API, no

matter what the "Attached" bit said in the

Inquiry info. Needed with some brain-dead

changers that report Attached bit but don't

respond to _ATTACHED API.


inventory Makes the robot arm go and check what elements

are in the slots. This is needed for a few

libraries like the Breece Hill ones that do not

automatically check the tape inventory at system



status Reports how many drives and storage elements are

contained in the device. For each drive, reports

whether it has media loaded in it, and if so,

from which storage slot the media originated.

For each storage slot, reports whether it is

empty or full, and if the media changer has a

bar code, MIC reader, or some other way of

uniquely identifying media without loading it

into a drive, this reports the volume tag and/or

alternate volume tag for each piece of media.

For historical reasons drives are numbered from

0 and storage slots are numbered from 1.


load [ ]

Load media from slot into drive

. Drive 0 is assumed if the drive num-

ber is omitted.


unload [] [ ]

Unloads media from drive into slot

. If is omitted, defaults to

drive 0 (as do all commands). If is

omitted, defaults to the slot that the drive was

loaded from. Note that there's currently no way

to say 'unload drive 1's media to the slot it

came from', other than to explicitly use that

slot number as the destination.


[eepos ] transfer

Transfers media from one slot to another, assum-

ing that your mechanism is capable of doing so.

Usually used to move media to/from an

import/export port. 'eepos' is used to

extend/retract the import/export tray on certain

mid-range to high end tape libraries (if, e.g.,

the tray was slot 32, you might say say 'eepos 1

transfer 32 32' to extend the tray). Valid val-

ues for eepos are 0 (do nothing to

the import/export tray), 1, and 2 (what 1 and 2

do varies depending upon the library, consult

your library's SCSI-level documentation).


first []

Loads drive from the first slot in

the media changer. Unloads the drive if there is

already media in it. Note that this command may

not be what you want on large tape libraries --

e.g. on Exabyte 220, the first slot is usually a

cleaning tape. If is omitted,

defaults to first drive.



last []

Loads drive from the last slot in the

media changer. Unloads the drive if there is

already a tape in it.


next []

Unloads the drive and loads the next tape in

sequence. If the drive was empty, loads the

first tape into the drive.




The original 'mtx' program was written by Leonard Zubkoff

and extensively revised for large multi-drive libraries

with bar code readers by Eric Lee Green ,

to whom all problems should be reported for this revision.

See 'mtx.c' for other contributors.



You may need to do a 'mt offline' on the tape drive to

eject the tape before you can issue the 'mtx unload' com-

mand. The Exabyte EZ-17 and 220 in particular will happily

sit there snapping the robot arm's claws around thin air

trying to grab a tape that's not there.


For some Linux distributions, you may need to re-compile

the kernel to scan SCSI LUN's in order to detect the media

changer. Check /proc/scsi/scsi to see what's going on.


If you try to unload a tape to its 'source' slot, and said

slot is full, it will instead put the tape into the first

empty slot. Unfortunately the list of empty slots is not

updated between commands on the command line, so if you

try to unload another drive to a full 'source' slot during

the same invocation of 'mtx', it will try to unload to the

same (no longer empty) slot and will urp with a SCSI




This program reads the Mode Sense Element Address Assign-

ment Page (SCSI) and requests data on all available ele-

ments. For larger libraries (more than a couple dozen ele-

ments) this sets a big Allocation_Size in the SCSI command

block for the REQUEST_ELEMENT_STATUS command in order to

be able to read the entire result of a big tape library.

Some operating systems may not be able to handle this.

Versions of Linux earlier than 2.2.6, in particular, may

fail this request due to inability to find contiguous

pages of memory for the SCSI transfer (later versions of

Linux 'sg' device do scatter-gather so that this should no

longer be a problem).


The eepos command remains in effect for all further com-

mands on a command line. Thus you might want to follow

eepos 1 transfer 32 32 with eepos 0 as the next command

(which clears the eepos bits).


Need a better name for 'eepos' command! ('eepos' is the

name of the bit field in the actual low-level SCSI com-

mand, and has nothing to do with what it does).



This program has only been tested on Linux with a limited

number of tape loaders (a dual-drive Exabyte 220 tape

library, with bar-code reader and 21 slots, an Exabyte

EZ-17 7-slot autoloader, and a Seagate DDS-4 autochanger

with 6 slots). It may not work on other operating systems

with larger libraries, due to the big SCSI request size.

Report problems to Eric Lee Green .



Under Linux, cat /proc/scsi/scsi will tell you what SCSI

devices you have. You can then refer to them as /dev/sga,

/dev/sgb, etc. by the order they are reported.


Under FreeBSD, camcontrol devlist will tell you what SCSI

devices you have, along with which pass device controls



Under Solaris, set up your 'sgen' driver so that it'll

look for tape changers (see /kernel/drv/sgen.conf and the

sgen man page), type touch /reconfigure then reboot. You

can find your changer in /devices by typing

/usr/sbin/devfsadm -C to clean out no-longer-extant

entries in your /devices directory, then find /devices

-name hanger -print to find the device name. Set the sym-

bolic link /dev/changer to point to that device name (if

it is not doing so already).


With BRU, set your mount and unmount commands as described

on the EST web site at to move to

the next tape when backing up or restoring. With GNU tar,

see mtx.doc for an example of how to use tar and mtx to

make multi-tape backups.




This version of mtx is currently being maintained by Eric

Lee Green formerly of Enhanced Software

Technologies Inc. The 'mtx' home page is and the actual code is cur-

rently available there and via CVS from source- .







Mit mtx sollen sich Loader- bzw. Band-Roboter- Funktionen ansteuern und ausführen lassen. Das probieren wir noch.

Zurück zur Startseite ----- © 2009 / 2016 - Copyright by Dipl. Ing. Gert Redlich - Zum Telefon - - - - NEU : Zum Flohmarkt