About Linux FAQ

Browse More FAQs:

Linux tape backup with mt and tar command - howto

Posted by Vivek Gite [Last updated: November 21, 2007]

Magnetic tape is a non-volatile storage medium consisting of a magnetic coating on a thin plastic strip. Nearly all recording tape is of this type, whether used for video, audio storage or general purpose digital data storage using a computer.

Linux (and other Unixish system) use mt command to control magnetic tape drive operation. You need to use mt command while working with tape drive. It allows you to reading and writing to tape.

The default tape drive under Linux is /dev/st0 (first SCSI tape device name). You can read more about tape drives naming convention used under Linux here. Following paragraph summaries command you need to use control tape drive for backup/restore purpose.

Rewind tape drive:# mt -f /dev/st0 rewindBackup directory /www and /home with tar command (z - compressed):# tar -czf /dev/st0 /www /homeFind out what block you are at with mt command:# mt -f /dev/st0 tellDisplay list of files on tape drive:# tar -tzf /dev/st0Restore /www directory:# cd /
# mt -f /dev/st0 rewind
# tar -xzf /dev/st0 www
Unload the tape:# mt -f /dev/st0 offlineDisplay status information about the tape unit:# mt -f /dev/st0 statusErase the tape:# mt -f /dev/st0 eraseYou can go BACKWARD or FORWARD on tape with mt command itself:
(a) Go to end of data:# mt -f /dev/nst0 eod(b) Goto previous record:# mt -f /dev/nst0 bsfm 1(c) Forward record:# mt -f /dev/nst0 fsf 1 Replace /dev/st0 with your actual tape drive name.
See also:

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Discussion on This FAQ

  1. vinayak nageli Says:

    I am new to Red Hat Linux. I want to know How to copy the whole content of tape drive to thum drive or on system directory

  2. nikto Says:

    I think you should talk about verifying the backup just after copying files to tape

  3. Exclude certain files when creating a tarball using tar command | Frequently Asked Questions Says:

    [...] A. The GNU version of the tar archiving utility has –exclude and -X options. So to exclude abc and xyz file you need to type the command as follows: $ tar -zcvf /tmp/mybackup.tar.gz –exclude=’abc’ –exclude=’xyz’ /home/me [...]

  4. Leon Says:

    Hi. My name in leon. I thanks you for the support shown for linux. I wish you all the very best and good luck on your work.

  5. Chris Says:

    Info about how to manage multiple tapes, and what happens when a tape gets full would be handy!

  6. Vijay Says:

    whall all should be checked as regular health check of the HP proliant servers having Linux OS platform. what all are the commands to do so?

    Regards,

  7. Athan Says:

    Hi am new to linux redhat and require some information in determining if tape drive compression is enabled on the system (ibm ultrium lto3

  8. Glen Says:

    I have found that on RHL FC8 the mt command doesn’t work. I have had to use the full mount command and it tells me its already mounted. Has the command changed for the free version versus enterprise?

    some help on this would be appreciated.

  9. orionsune Says:

    mt is not mount… if mt doesn’t work then you don’t have the utility installed.
    mt stands for magentic tape, it is not short for ‘mount’ like your probably thinking.

  10. vz Says:

    Hi Glen,

    On my fedora FC8 mt was not installed from the beginning. The suitable package for installation is mt-st (something, mt-st-0.9b-4.fc8.i386)

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.