Friday, October 21, 2005

Tape Control -the mt Command:

Tape Control -the mt Command:

This assume that the device is at the 0 address.

Shows whether device is valid, whether tape is loaded, and status of tape

mt -f /dev/rmt/0 status:

Rewinds tape to start

mt -f /dev/rmt/0 rewind:

Shows table of contents of archive. If tar tvf produces an error, then
there are no more records on the tape.

tar tvf /dev/rmt/0:

Advanced to the next archive on the tape.

mt -f /dev/rmt/0 fsf:

Moves the tape to the end of the last archive that it can detect.

mt -f /dev/rmt/0 eom:

Erases the tape. Use with care.

mt -f /dev/rmt/0 erase:

Ejects the tape, if the device supports that option.

mt -f /dev/rmt/0 offline:

To extract lengthy archives even if you plan to log out, use the nohup
command as follows:

nohup tar xvf /dev/rmt/0 &

Identify the tape device

dmesg | grep st

Check the status of the tape drive

mt -f /dev/rmt/0 status

Tarring files to a tape

tar cvf /dev/rmt/0 *

Cpioing files to a tape

find . -print | cpio -ovcB > /dev/rmt/0

Viewing cpio files on a tape

cpio -ivtB < /dev/rmt/0

Restoring a cpio

cpio -ivcB < /dev/rmt/0

To compress a file

compress -v some.file

To uncompress a file

uncompress some.file.Z

To encode a file

uuencode some.file.Z some.file.Z

To unencode a file

uudecode some.file.Z some.file.Z

To dump a disk slice using ufsdump

ufsdump 0cvf /dev/rmt/0 /dev/rdsk/c0t0d0s0
ufsdump 0cvf /dev/rmt/0 /export/home

To restore a dump with ufsrestore

ufsrestore rvf /dev/rmt/0

To duplicate a disk slice directly

ufsdump 0f - /dev/rdsk/c0t0d0s7 |(cd /home;ufsrestore xf -)


Blogger BIJUCYBORG said...

An interesting command is

ufsrestore -ivfs /dev/rmt/0n 1

combines two steps that of mt fsf and ufsrestore.

2:41 PM  

Post a Comment

<< Home