Chinaunix首页 | 论坛 | 博客
  • 博客访问: 239307
  • 博文数量: 91
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 955
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-12 09:38
文章分类

全部博文(91)

文章存档

2017年(1)

2011年(1)

2008年(15)

2007年(74)

我的朋友

分类: LINUX

2007-08-19 15:19:18

during restoration(恢复) of files from a tape with multiple archives, the need arises to position the tape to the archive that holds the necessary files. to accomplish this control, use the mt command,(the name comes from "magnetic(有磁性的,有吸收力的) tape"). the mt command uses a set of simple instructions that directs the tape drive to perform a particular action.

tar
  syntax [options] files
  archive or restore files. tar recursively creates archives of files and directories, including file properities. it requires at least one basic option to specify the operational mode.
  -c create a new tarfile
  -t list the contents of a tarfile
  -x exact files from a tarfile
  -f tarfile unless tar is using standard I/O, use the -f option with tar to specify the tarfile. this might be simply a regular file or it may be a device such as /dev/st0
  -v verbose mode.
  -w interactive mode. in this mode, tar asks for confirmation before archiving or restoring files. this option is useful only for small archives.
  -z enable compression. when using -z, data is filtered through the gzip compression program prior to being written to the tarfile. saving additional space.
  -N date store only files newer than the date specified. this option can be used to construct an incremental or differental backup scheme.
  -V "label" adds a label to the .tar archive. quotes(引用) are required to prevent the label from being interpreted as a filename. a label is handy if you find an unmarked tape or poorly named tarfile.
  -u Adds the files specified by one or more File parameters to the end of the archive only if the files are not in the archive already, or if they have been modified since being written to the archive. The -u flag is not valid for any tape devices because such devices do not support the addition of information at the end of a tape.
  -r append files to the end of an archive.
  -m Uses the time of extraction as the modification time. The default is to preserve the modification time of the files.
 -C Performs a chdir (see cd(1)) operation on directory and performs the c (create) or r (replace) operation on file . Use short relative path names for file . If file is `.', archive all files in directory. This option enables archiving files from multiple directories not related by a close common parent.
such as:
 tar cvf -C directory1 file1 file2 . -C directory2 file3 file4 .
  example
    create an archive on SCSI tape o of the /etc directory. reporting progress:
   tar cvf /dev/sto /etc
   
   list the contents of the tar archive on SCSI tape 0:
  tar tf /dev/sto
  list the contents of the compress archive
  tar -tzvf mystuff.tgz
  Note that .tgz is the same thing as .tar.gz
  
  extract the entire contents of the tar archive on SCSI tape 0. reporting progress:
  tar xvf /dev/st0
  
  create a compressed archived of root'
s home directory on a floppy:
   tar cvzf .dev/fd0 -V "root home dir" /root
   
   Adding the j option to the tar command enables tar to compress files and/or directories using bzip. In the below example the home directory and all its subdirectories are added to the compressed test.tbz file.
    tar -cjvf test.tbz home/
    In the below example command the system would uncompress (untar) the myfile.tar file in the current directory.
    tar -xvvf myfile.tar
    In the below example command the system would create a tar file named home.tar in the directory you currently are in of the home directory.
        tar -cvvf home.tar home/
    Append the new files or newer stored in the tar archive to the end of the files.tar
    tar -uf files.tar /mnt/usb
    
    Suppose, you wish to archive the subdirectories "/usr/local" and "spssdir" which is in your home directory. In this case the tar command executed in your home directory will be:
      tar -cvf files1.tar -C backup_shell . -C ~/mnt/usb/ .
      note: above the two dot(.) sign can't omit. remember it forever.上面这两个圆点是不能省略的,省略后就会报错的.千万要记住.

阅读(404) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~