mt command
This command enables direct tape manipulation.
Syntax
mt[ -f tape-device-name ] command [count ]
Commands
status Displays status information about the tape drive
rewind Rewinds the tape
retention Rewinds the cartridge tape completely
erase Erases the entire tape
fsf Forward skips count tape files
bsf Backward skips count tape files
eom Skips to the end of the records cd media
Table
Note :
Let consider the given example
How do they both tar and mt commands are used in Solaris?
#tar cvf/dev/rmt/0ntest
a test/ 0 tape blocks
a test/test1 3 tape blocks
in this instance we are copying a directory test to tape with no
rewind option
/dev/rmt/0 - logiacl the device name of tape drive
n - no rewind option
#tar cvf/dev/rmt/0n oracle
a oracle/ 0 tape blocks
a oracle/initorcl.ora 6 tape blocks
Above also we are copying a directory oracle with no rewind option
#tar cvf/dev/rmt/0 doc
a doc/ 0 tape blocks
a doc/doc1 2 tape blocks
a doc/doc24 tape blocks
In the example doc directory for copied with no rewind option then the tape rewind automatically now I want move to the third archive if I want to restore the doc directly since the first two tape archives holds test and oracle directory respectively use mt to move to the third archive as display below:
mt -f /dev/rmt/0n fsf 2
-f-dump file(device we use to take the backup, here it is the tape)
/dev/rmt/0n - the tape that we used to take the backup
n-no rewind option
fsf 2 - Forward Skip File-skips 2 files
now use tar to restore doc directory
tar xvf /dev/rmt/0
x doc, 0 bytes, 0 tape blocks
x doc/doc1, 500 bytes, 2 tape blocks
x doc/doc2, 1000 bytes, 4 tape blocks