Mt
From Christoph's Personal Wiki
- The correct title of this article is mt. The initial letter is capitalized due to technical restrictions.
mt is a command used to control and backup data onto magnetic tapes.
Contents
Example usage
Note: The default device name should be /dev/st0
(i.e. first SCSI tape device).
- Rewind tape drive:
% mt -f /dev/st0 rewind
- Backup directory /data and /home with tar command (z - compressed):
% tar -czf /dev/st0 /data /home
- Return ("tell") current block:
% mt -f /dev/st0 tell
- Display list of files on tape drive:
% tar -tzf /dev/st0
- Restore /data directory:
% cd / % mt -f /dev/st0 rewind % tar -xzf /dev/st0 data
- Unload (i.e. enable eject) the tape:
% mt -f /dev/st0 offline
- Display status information about the tape unit:
% mt -f /dev/st0 status
- Erase the tape:
% mt -f /dev/st0 erase
- Go to end of data:
% mt -f /dev/nst0 eod
- Goto previous record:
% mt -f /dev/nst0 bsfm 1
- Forward record:
% mt -f /dev/nst0 fsf 1
Backup via ssh
% tar zcvf - /data | ssh root@www.example.com "cat > /backup/data.tar.gz"
- Or, using the dd command:
% tar cvzf - /data | ssh root@www.example.com "dd of=/backup/data.tar.gz"
- Or, backup to a remote tape device:
% tar cvzf - /data | ssh root@www.example.com "cat > /dev/nst0"
- Also, using the mt command to rewind the tape and then dump to it:
% tar cvzf - /data | ssh root@www.example.com $(mt -f /dev/nst0 rewind; cat > /dev/nst0)$
- Finally, restore the data over a ssh session:
% ssh root@www.example.com "cat /backup/data.tar.gz" | tar zxvf -
Linux tape drives naming conventions
SCSI tape device names
The st
driver provides the interface to a variety of SCSI tape devices under Linux.
- First (auto rewind) SCSI tape device name: /dev/st0
- Second (auto rewind) SCSI tape device name: /dev/st1
- First the non-rewind SCSI tape devices: /dev/nst0
- Second the non-rewind SCSI tape devices: /dev/nst1
IDE tape device names
The ht
driver provides the interface to a variety of IDE tape devices under Linux.
- First (auto rewind) IDE tape device name: /dev/ht0
- Second (auto rewind) IDE tape device name: /dev/ht1
- First the non-rewind IDE tape devices: /dev/nht0
- Second the non-rewind IDE tape devices: /dev/nht1
Main tape types
- Digital Data Storage (DDS);
- Digital Audio Tape (DAT); and
- Digital Linear Tape (DLT)
See also
External links
- Linux tape backup with mt and tar command - howto
- Howto: Use tar command through network over ssh session
- Tape drives naming convention under Linux
Linux command line programs | |||
---|---|---|---|
File and file system management: | cat | cd | chmod | chown | chgrp | umask | cp | du | df | file | fsck | ln | ls | lsof | mkdir | more | mount | mv | pwd | rcp | rm | rmdir | split | touch | tree | ||
Process management: | anacron | at | chroot | cron/crontab | kill | nice | ps | sleep | screen | time | timex | top | nice/renice | wait | ||
User Management/Environment: | env | finger | id | locale | mesg | passwd | su | sudo | uname | uptime | w | wall | who | write | ||
Text processing: | awk | cut | diff | ex | head | tac | tee | iconv | join | less | more | paste | sed | sort | tail | tr | uniq | wc | xargs | perl | ||
Shell programming: | echo | expr | unset | Printing: | lp |
Communications: inetd | netstat | ping | rlogin | traceroute |
Searching: |
Miscellaneous: |