• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

磁带操作实用命令 ZT

发布: 2007-6-08 22:43 | 作者: seanhe | 来源: | 查看: 25次 | 进入软件测试论坛讨论

领测软件测试网
[b:ac208009de]Retensioning a Ma.netic Tape[/b:ac208009de]

If errors occur when reading a tape, retension the tape, clean the tape drive, and then try again. Type mt -f /dev/rmt/n retension and press Return. The tape in the tape drive you specify is retensioned.

In this example, the tape in drive /dev/rmt/1 is retensioned:

[color=red:ac208009de]oak% mt -f /dev/rmt/1 retension
oak%[/color:ac208009de]

[b:ac208009de]Rewinding a Magnetic Tape[/b:ac208009de]

To rewind a magnetic tape, type mt -f /dev/rmt/n rewind and press Return. The tape in the tape drive you specify by the device number n is rewound.

In this example, the tape in drive /dev/rmt/1 is rewound:

[color=red:ac208009de]oak% mt -f /dev/rmt/1 rewind
oak%[/color:ac208009de]

[b:ac208009de]Showing the Status of a Magnetic Tape Drive[/b:ac208009de]

To show the status of a magnetic tape drive, type mt -f /dev/rmt/n status and press Return. Status for the tape drive you specify is displayed.

In this example, there is no tape in drive /dev/rmt /1:

[color=red:ac208009de]oak% mt -f /dev/rmt/1 status
/dev/rmt/1: no tape loaded or drive offline
oak%[/color:ac208009de]

In this example, status is shown for the tape in drive /dev/rmt/1:

[color=red:ac208009de]oak% mt -f /dev/rmt/1 status
Archive QIC-15Ø tape drive:
   sense key(Øx6)= unit attention   residual= Ø   retries= Ø
   file no= Ø   block no= Ø
oak%[/color:ac208009de]

[b:ac208009de]The tar Command[/b:ac208009de]
 
Use the tar command to copy files and directory subtrees to a single tape. The advantages of the tar command are that it is available on most UNIX operating systems and public domain versions are readily available. The disadvantages of the tar command are that tar is not aware of file system boundaries, full path name length cannot exceed 255 characters, it does not copy empty directories or special files such as device files, and it cannot be used to create multiple tape volumes.

The following sections describe how to use the tar command to copy files to a tape, list the files, append the files, and retrieve the files.

[b:ac208009de]Copying Files to a Tape (tar)[/b:ac208009de]

Follow these steps to copy files to a tape: 

1.  Change to the directory that contains the file you want to copy. 
2   Insert a write-enabled tape into the tape drive. 


--------------------------------------------------------------------------------
[i:ac208009de]CAUTION! Copying files to a tape using the c option to tar destroys any files already on the tape. If you want to preserve the files already on the tape, use the r option described in "Appending Files to a Tape (tar)" later.[/i:ac208009de]
--------------------------------------------------------------------------------
 
Type tar cvf /dev/rmt/n filename filename filename ... and press Return. 

The c (copy) option copies the files you specify, the v (verbose) option displays information about the files as they are copied, and the f (files) option followed by the tape device name specifies where the tar files are to be written. The file names you specify are copied to the tape, overwriting any existing files on the tape. 


--------------------------------------------------------------------------------
[i:ac208009de]NOTE:  You can use metacharacters (? and *) as part of the file names you specify. For example, to copy all documents with a .doc suffix, type *.doc as the file name argument. If you specify a directory name as the file name, the directory and all its subdirectories are recursively copied to the tape.[/i:ac208009de]
--------------------------------------------------------------------------------
 
4.  Remove the tape from the drive and write the names of the files on the tape label.
In this example, two files are copied to a tape in tape drive 0: 

[color=red:ac208009de]oak% cd /home/winsor
oak% ls evaluation*
evaluation.doc   evaluation.doc.backup
oak% tar cvf /dev/rmt/Ø evaluation*
a evaluation.doc 86 blocks
a evaluation.doc.backup 84 blocks
oak%[/color:ac208009de]

[b:ac208009de]Listing the Files on a Tape (tar)[/b:ac208009de]

Follow these steps to list the files on a tape: 

1.  Insert a tape into the tape drive. 
2.  Type tar tvf /dev/rmt/n and press Return. The t (table) option lists the files you specify, the v (verbose) option displays complete information about the files as they are listed in a form similar to the ls -l command, and the f (files) option followed by the tape device name specifies the device where the tar files are located. 
In this example, the table of contents for the tape in drive 0 contains two files: 

[color=red:ac208009de]oak% tar tvf /dev/rmt/Ø
rw-rw-rw-6693/1Ø  44032 Apr 23 14:54 1991 evaluation.doc
rw-rw-rw-6693/1Ø  43008 Apr 23 14:47 1991 evaluation.doc.backup
oak%[/color:ac208009de]

Reading from left to right, the first column shows the permissions for the file; the second column shows the UID and GID file ownership; the third column shows the number of characters (bytes) in the file; the fourth, fifth, sixth, and seventh columns contain the month, day, date, and year the file was last modified, and the final column contains the name of the file. 

[b:ac208009de]Appending Files to a Tape (tar)[/b:ac208009de]

Follow these steps to append files without overwriting files already on the tape: 

1.  Change to the directory that contains the file you want to copy. 
2.  Insert a tape that is not write-protected into the tape drive. 
3.  Type tar rvf /dev/rmt/n filename filename filename ... and press Return. The file names you specify are appended to the files already on the tape in the drive you specify. 


--------------------------------------------------------------------------------
[i:ac208009de]NOTE:  You can use metacharacters (? and *) as part of the file names you specify. For example, to copy all documents with a .doc suffix, type *.doc as the file name argument.[/i:ac208009de]
--------------------------------------------------------------------------------
 
4.  Remove the tape from the drive and write the names of the files on the tape label. 
In this example, one file is appended to the files already on the tape in drive 0: 

[color=red:ac208009de]oak% cd /home/winsor
oak% tar cvf /dev/rmt/Ø junk
a junk 1 blocks
oak% tar rvf /dev/rmt/Ø
rw-rw-rw-6693/1Ø  44032 Apr 23 14:54 1991 evaluation.doc
rw-rw-rw-6693/1Ø  43008 Apr 23 14:47 1991 evaluation.doc.backup
rw-rw-rw-6693/1Ø     18 Dec 1Ø 11:36 1991 junk
oak%[/color:ac208009de]

You can put more than one set of tar files on a tape if you use the n (no-rewind) option as part of the tape device name. For example, type tar cvf /dev/rmt/nn filename. The tape is not rewound after the files are copied, and the next time you use the tape, the files are written at the end of the previous set of files.

 lianyong 回复于:2003-10-23 08:55:55
老大,这个追加文件的例子是否有错???
[code:1:c07673f6ec]
4. Remove the tape from the drive and write the names of the files on the tape label. 
In this example, one file is appended to the files already on the tape in drive 0: 

oak% cd /home/winsor 
oak% tar cvf /dev/rmt/Ø junk 
a junk 1 blocks 
oak% tar rvf /dev/rmt/Ø 
rw-rw-rw-6693/1Ø 44032 Apr 23 14:54 1991 evaluation.doc 
rw-rw-rw-6693/1Ø 43008 Apr 23 14:47 1991 evaluation.doc.backup 
rw-rw-rw-6693/1Ø 18 Dec 1Ø 11:36 1991 junk 
oak% 

[/code:1:c07673f6ec]

 race 回复于:2003-10-23 09:09:05
那是script下来的,估计不会错

 liwenguo 回复于:2003-10-23 10:52:06
已用的 剩余的

 procrus 回复于:2003-10-23 12:45:03
好,收藏!!!

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网