Summary of Tape Commands/Examples

发表于:2007-06-09来源:作者:点击数: 标签:
Note:ThefollowingdocassumesaPATHvariablethatcontains/usr/binand/usr/sbin Forcommandsorfilesthatnormallyexistoutsideofthesecommondirectories, fullpathsaregiven. Tapecommands. Command:mt-ma .net ictape Purpose:Toknowthestatusofatape,andtoper

Note: The following doc assumes a PATH variable that contains /usr/bin and /usr/sbin
      For commands or files that normally exist outside of these common directories,
      full paths are given.

Tape commands.

Command:  mt - ma.netic tape 
Purpose:  To know the status of a tape, and to perform rewind, erase, etc.
Path:  /usr/bin/mt

Syntax:mt [ -f tape device name ] command [count]
where tape device name is usually /dev/rmt/0

commands are:
status -Displays status information about the tape drive
rewind -Rewinds the tape
retension-Smooth out tape tension
erase -Erases the entire tape
fsf -Forward skips count tape files
bsf -Backward skips count tape files
eom -Skips to the end of the recorded media

Count refers to the number of times that the requested operation is to be performed.
        By default, mt performs a command once; multiple operations of a command may be 
performed by specifying count.
 
Examples:
mt -f /dev/rmt/0 status ---> This command displays the status of the tape
mt -f /dev/rmt/0 rewind ---> This command rewinds the tape
mt -f /dev/rmt/0n fsf 2 ---> This command forwards the first two files
mt -f /dev/rmt/0n bsf 2 ---> This command backwards two files


Command:  tar - tape archive
Purpose:  To create or restore tape archives. It is used to back up single or multiple 
  files in a directory hierarchy.
Path:  /usr/bin/tar

Syntax:tar options device-name file-name

Where options are
cCreates the tar file from the beginning.  
rReplace the existing one
tDisplays the table of contents of tape archive
uUpdate. The named files are written at the end of the tarfile if 
they are not already in the tarfile, or if they have been modified 
since last written to that tarfile.  An update can be rather slow.
A tarfile created on a 5.x system cannot be updated on a 4.x system.
xExtract or restore. The named files are extracted from the tarfile 
and written to the directory specified in the tarfile, relative to the  
current directory. Use the relative path names of files and directories 
to be extracted.
VVerbose. Output the name of each file preceded by the function letter.

Where device name is typically /dev/rmt/0. It may also be a file name.
Where file name is the name of the file to be archived.

Examples:
tar cvf /dev/rmt/0 /export/home/user1 --> Creates the tape archive of 
/export/home/user1 on the tape /dev/rmt/0

tar tvf /dev/rmt/0 ---> Displays the table of contents of /dev/rmt/0

tar xvf /dev/rmt/0 ---> Restores the data from /dev/rmt/0

Note: In the above commands, /dev/rmt/0n can be used in place of 
/dev/rmt/0.  /dev/rmt/0n will not rewind the tape after the backup.            

Command:  ufsdump
Purpose:  Used to back up a file system, files or directories. It may be a full backup 
  or incremental backup.
Path:  /usr/sbin/ufsdump

Syntax:ufsdump options device-name files-to-dump

Where options are
0 to 9Specifies the dump level option. Level 0 is the lowest level, which is
 used for full backup. Levels 1 to 9 are used for incremental backups.
uUpdates the dump record /etc/dumpdates with the date and dump 
level of this backup.
fSpecifies the device to which the files are written. It requires the 
device name.
vVerifies the data on the tape against data on the file system.

Where device-name is /dev/rmt/0
Where files-to-dump means raw file system /dev/rdsk/c0t2d0s0 or block file 
system /dev/dsk/c0t2d0s0. Also it may be the name of the file system /export/home 
or a file or directory name /export/home/user1.

Examples:
ufsdump 0uf /dev/rmt/0 /export/home ---> Dumps /export/home file system to 
/dev/rmt/0 which is full backup.

ufsdump 1uf /dev/rmt/0 /dev/dsk/c0t2d0s4 --> Dumps /dev/dsk/c0t2d0s4 file 
system to /dev/rmt/0. But remember this is 1st level incremental backup.

ufsdump 4uf dbserver:/dev/rmt/0 /export/home/user1 --> Dumps 4th increment
level backup of /export/home/user1 to dev/rmt/0 tape device which is mounted 
on remote box dbserver. Here, note that the tape device is not on the local 
machine.  It is on the remote machine dbserver.            

Command:  ufsrestore
Purpose:  Used to restore/extract the files from a backup which is created by ufsdump
Path:  /usr/sbin/ufsrestore

Syntax:ufsrestore options device-name file-to-restore
Where options are
iTo restore the files interactively
rRestore the entire backup
tList the table of contents of the backup
xRestore the files named on the command line
f Specify the device name /dev/rmt/0
vDisplay the path names as they are being restored (verbose mode). 
Note: this is different from the v(verify) option used with 
ufsdump command.

Examples:
ufsrestore xvf /dev/rmt/0 ./etc/hosts ---> Restores /etc/hosts file to the 
current directory.

ufsrestore ivf /dev/rmt/0 ---> Prompts to select the files which are to be
 restored.

ufsrestore rvf /dev/rmt/0 ./opt ---> Restores /opt file system to the 
current directory

ufsrestore tvf /dev/rmt/0 ---> Displays the table of contents on /dev/rmt/0                  


 starwang 回复于:2002-09-21 19:36:49
mt bsf 

mt nbsf 
之间的区别在哪里?

原文转自:http://www.ltesting.net