编程部分简略 Storing Files to Tape( 将文件存储到磁带上 ) l ANT : normal" roman??="" new="" times=""> To stor" name="description" />
ShellMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">编程部分简略
Storing Files to Tape(将文件存储到磁带上)
lANT: normal" roman??="" new="" times=""> To store files to a tape you must kno the device file name for your tape device.
l Tupical names might be
/dev/rmt/om 9-track tape or DDS tape (old name)
/dev/rmt/c0t3d0BEST 9-track tape or DDS tape
l Ask your system administrator which device file aclearcase/" target="_blank" >ccesses the tape device.
l Commands to perform file backups include.
tar
cpio
The tar Command
Syntax:
tar -key [f device_file][file…]
Examples:
Create an archive:
$tar -cvf /dev/rmt/0m myfile
Get a table of contents from the archive:
$tar -tvf /dev/rmt/0m
Extract a file from the archive:
$tar -xvf /dev/rmt/0m myfile
注释:
tar命令用来将磁带文件归档。它能将文件保存和恢复到磁带上。其功能决定于第一个参数,这种参数被称为关键参数(key argument).
n c 创建一个新的归档文件。
n x 将文件从归档库中提取出来。
n t 打印档案的内容列表。
n r 将文件追加到归档库的末尾。
n u 如果要追加的文件是新文件或者已经被更新,将该文件追加到归档
库的末尾。
n v 归档或恢复文件时,将这些文件的名字显示到屏幕上(verbose)
n f file 指定归档库写向的文件。注意:这个文件不一定是一个设备文件。你可以在你的磁盘,目录下创建归档文件。默认为/dev/rmt/0m。
The cpio Command
Two modes:
cpio -o[cvx] Generate an archive.Real list of files from stdin.Archive is written to stdout.
cpio -i[cdmtuvx] Restore from an archive.Archive is read from stdin.
Examples:
Create an archive of all files under current directory:
$find . | cpio -ocv>/dev/rmt/0m
Restore all files from an archive:
$ cpio -icdmv
cpio代表copy input to output.
cpio两种模式:
n -o 建立一个备份。从标准输入读出文件,将每个文件拷贝到标准输出设备上。
n -i 恢复一个备份。从标准输入读出备份数据,在磁盘上恢复这些数据。
与-o和-i配合使用的选项
-o -i 选项功能
-c -c 以ASCII格式写文件头(如果在归档时已经和-o配合使用,恢复归档时一定要和-i配合使用)
— -d 按指定的需要重新创建目录结构
— -m 保留现有的修改日期。(对于版本管理很重要)
— -t 显示档案的内容列表
— -u 无条件恢复(如果文件已经存在,用这个选项将覆盖掉这个文件)
-v -v 显示已经拷贝的文件列表
-x -x 处理特殊(设备)文件