Chinaunix首页 | 论坛 | 博客
  • 博客访问: 156983
  • 博文数量: 31
  • 博客积分: 2085
  • 博客等级: 大尉
  • 技术积分: 350
  • 用 户 组: 普通用户
  • 注册时间: 2005-11-07 13:16
文章分类

全部博文(31)

文章存档

2014年(1)

2011年(4)

2010年(6)

2009年(2)

2008年(2)

2007年(5)

2006年(8)

2005年(3)

我的朋友

分类: LINUX

2007-04-17 14:41:53

磁带文件操作分析

请看图示

说明:一个文件集的结束也是另外一个文件集的开始

这个磁带包含四个备份,从头开始使用tar tvf /dev/nst0列目录会出现:有文件,无文件,有文件,无文件,有文件,无文件,有文件,无文件,错误这一系列结果(很有意思)。 另外说明一下/dev/nst0 里的n是不倒带的意思,意味着对它的操作不会自动倒带。 图片里的箭头是磁头的位置。 这里只是我一个人的想法,也不知道实际情况是否如此!
 
列目录、读和写目录文件,下面是对磁带机读写命令的介绍:
列磁带目录:tar tvf  磁带机设备文件名
首次写入磁带:tar cvf  磁带机设备文件名  欲记录的文件或目录名
增量写入磁带:tar rvf  磁带机设备文件名  欲记录的文件或目录名
读磁带: tar xvf  磁带机设备文件名  欲读出的文件或目录名

[root@localhost cidai]# mt -f /dev/nst0 rewind 磁带到起点

[root@localhost cidai]# mt -f /dev/nst0 status 查磁带状态(不转动磁带)

SCSI 2 tape drive:

File number=0, block number=0, partition=0. 文件集号码0,块数0,分区0 (磁带可以被格式化为多个分区,需要设备支持)

Tape block size 512 bytes. Density code 0x47 (TR-5). 块尺寸为512字节,密度代码0x47 (TR-5)

Soft error count since last status=0软错误0

General status bits on (41010000):

 BOT ONLINE IM_REP_EN (我猜是begin of type

 

[root@localhost cidai]# tar tvf /dev/nst0 执行前磁头位于第一个文件集的开始,执行后磁头位于第一个文件集的EOF

-rw-r--r-- oracle/oinstall 10240 2007-04-16 10:03:48 waitdemo.c

[root@localhost cidai]# mt -f /dev/nst0 status 磁头位于第一个文件集的EOF

SCSI 2 tape drive:

File number=0, block number=40, partition=0. 说明第一个文件集占用40*512字节(这文件集只包含一个文件: waitdemo.c

Tape block size 512 bytes. Density code 0x47 (TR-5).

Soft error count since last status=0

General status bits on (1010000):

 ONLINE IM_REP_EN

 

[root@localhost cidai]# tar tvf /dev/nst0执行前磁头位于第一个文件集的EOF,执行后位于EOF(也就是第二个文件集的开始)

[root@localhost cidai]# mt -f /dev/nst0 status磁头位于第二个文件集的开始

SCSI 2 tape drive:

File number=1, block number=0, partition=0.

Tape block size 512 bytes. Density code 0x47 (TR-5).

Soft error count since last status=0

General status bits on (81010000):

 EOF ONLINE IM_REP_EN

[root@localhost cidai]# tar tvf /dev/nst0执行前磁头位于第二个文件集的开始,执行后位于EOF

-rw-r--r-- oracle/oinstall 60712 2007-04-12 15:24:23 addvalue.pc

[root@localhost cidai]# mt -f /dev/nst0 status

SCSI 2 tape drive:

File number=1, block number=140, partition=0. 说明第二个文件集占用140*512字节(这文件集只包含一个文件: addvalue.pc

Tape block size 512 bytes. Density code 0x47 (TR-5).

Soft error count since last status=0

General status bits on (1010000):

 ONLINE IM_REP_EN

[root@localhost cidai]# tar tvf /dev/nst0执行前磁头位于第二个文件集的EOF,执行后位于EOF(也就是第三个文件集的开始)

[root@localhost cidai]# mt -f /dev/nst0 status磁头位于第三个文件集的开始

SCSI 2 tape drive:

File number=2, block number=0, partition=0.

Tape block size 512 bytes. Density code 0x47 (TR-5).

Soft error count since last status=0

General status bits on (81010000):

 EOF ONLINE IM_REP_EN

[root@localhost cidai]# tar tvf /dev/nst0 执行前磁头位于第三个文件集的开始,执行后位于EOF

-rw-r--r-- oracle/oinstall 8305 2006-11-16 09:33:38 et.c

[root@localhost cidai]# mt -f /dev/nst0 status

SCSI 2 tape drive:

File number=2, block number=20, partition=0. 说明第三个文件集占用20*512字节(这文件集只包含一个文件: et.c

Tape block size 512 bytes. Density code 0x47 (TR-5).

Soft error count since last status=0

General status bits on (1010000):

 ONLINE IM_REP_EN

[root@localhost cidai]# tar tvf /dev/nst0执行前磁头位于第三个文件集的EOF,执行后位于EOF(也就是第四个文件集的开始)

[root@localhost cidai]# mt -f /dev/nst0 status

SCSI 2 tape drive:

File number=3, block number=0, partition=0.

Tape block size 512 bytes. Density code 0x47 (TR-5).

Soft error count since last status=0

General status bits on (81010000):

 EOF ONLINE IM_REP_EN

[root@localhost cidai]# tar tvf /dev/nst0执行前磁头位于第四个文件集的开始,执行后位于EOF

-rw-r--r-- oracle/oinstall 2152 2006-11-16 09:33:38 qall.c

-rw-r--r-- oracle/oinstall 3537 2006-11-16 09:33:38 et.h

[root@localhost cidai]# mt -f /dev/nst0 status

SCSI 2 tape drive:

File number=3, block number=20, partition=0. 说明第四个文件集占用20*512字节(这文件集只包含两个文件: qall.c et.h

Tape block size 512 bytes. Density code 0x47 (TR-5).

Soft error count since last status=0

General status bits on (1010000):

 ONLINE IM_REP_EN

[root@localhost cidai]# tar tvf /dev/nst0执行前磁头位于第四个文件集的EOF,执行后位于EOF(也就是第五个文件集的开始)

[root@localhost cidai]# mt -f /dev/nst0 status

SCSI 2 tape drive:

File number=4, block number=0, partition=0

Tape block size 512 bytes. Density code 0x47 (TR-5).

Soft error count since last status=0

General status bits on (81010000):

 EOF ONLINE IM_REP_EN

[root@localhost cidai]# tar tvf /dev/nst0执行前磁头位于第五个文件集的开始,因为没有第五个文件集,磁带稍转,磁头前移

[root@localhost cidai]# mt -f /dev/nst0 status

SCSI 2 tape drive:

File number=4, block number=-1, partition=0.

Tape block size 512 bytes. Density code 0x47 (TR-5).

Soft error count since last status=0

General status bits on (9010000):

 EOD ONLINE IM_REP_EN (我猜是End of Device

[root@localhost cidai]# tar tvf /dev/nst0 由于已经到尾部, 磁带不能继续前转

tar: /dev/nst0:无法 read: 输入/输出错误

tar: 处于磁带的起点,现在退出

tar: 错误是不

 

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