Monday, June 21, 2010

Linux tape commands (DBA summary)

Every DBA sooner or later will have a chance to work with tape drives. For that Linux has several commands.

Because I always search Internet for some command, this post is made just to be mine backup comprehensive place for all important tape commands in Linux.

Save to tape

1. Rewind
mt -f /dev/nst0 rewind

2. Move to end of last block
mt -f /dev/st0 eod

3. Save and compress content to tape
tar cvf /dev/nst0 ./bg*.gz

4. Rewind
mt -f /dev/nst0 rewind

Take the tape to treasury

Eject tape
mt -f /dev/st0 eject

Restore from tape

1. Rewind
mt -f /dev/nst0 rewind

2. Move to block from which you want to restore (0,1,2,3 etc.- number of block)
mt -f /dev/nst0 fsf 1 
"1" is second block, because it starts from 0.

3. Restore from tape to current directory
tar xvf /dev/nst0

The end

Maybe someone find them useful too.

Cheers!

No comments:

Post a Comment