Humble Trader

Tuesday, May 09, 2006

Tape Commands

These commands assume the tape device to be /dev/rmt0.

General:

Rewind / Check tape readiness
# mt -f /dev/rmt0 rewind

Rewinds tape. Returns 0 if successful, >0 if failed. Where this fails, the tape is not ready.
Write to tape
# tar cvf /dev/rmt0 [path]

Where [path] is the entry-point in the file system of the backup to be made. e.g. '/' will write the entire file system to tape, '/home' will write all user's home directories to tape.
Check tape
# tapechk [n]

Where [n] is the number of files on the tape to check. This operation rewinds the tape and then checks the first [n] files. If [n] is not specified, the first physical block only is checked. The tape device is defined in the environmental variable 'TAPE' and defaults to /dev/rmt0 if not defined. This returns 0 if the check passes, >0 if it fails.

Recommended usage: tapechk 1 to check the first file.
List contents of tape device
# tar -tvf /dev/rmt0

This lists all the files on the tape to stdout.
Recover files from a tape device
# tar -xvf/dev/rmt0 [path1] [path2] [...]

Copies the files defined by the root directories [path1], [path2] [etc] from tape to the current working directory.

AIX Specific:

Backup files
# cd [path]
# find . -print | backup -ipvf /dev/rmt0


'backup' works across multiple tapes by prompting for a tape change.

This is a RELATIVE backup. './' is appended to all file names so that they can be restored to a local directory for checking before being moved to their original position.

Switches:
- i: read stdin (from 'find' in this case).
- p: pack (compress) data. If used, restore automatically unpacks it.
- v: verbose - list files.
- f: name tape device (next parameter).
Recover tables of contents / backup date
# restore -Tvf /dev/rmt0
Restore specific files
# restore -xvf /dev/rmt0 ./[path]/[file(s)]

For example, ./home/steve/dev/*.sh will restore all steve's shell scripts in his dev directory.
Restore a directory
# restore -xdvf /dev/rmt0 ./[path]

For example, ./home/steve will restore steve's home directory.
Restore full tape
# restore -xvf /dev/rmt0

Restores everything that was backed up.

0 Comments:

Post a Comment

<< Home