分类: LINUX
2007-04-17 14:41:53
磁带文件操作分析
请看图示
说明:一个文件集的结束也是另外一个文件集的开始
[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: 错误是不…