免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1526 | 回复: 0
打印 上一主题 下一主题

linux 磁带文件操作分析 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-04-17 14:41 |只看该作者 |倒序浏览


磁带文件操作分析
请看图示
说明:一个文件集的结束也是另外一个文件集的开始
这个磁带包含四个备份,从头开始使用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: 错误是不…



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/11408/showart_279887.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP