最近几天研究了磁带工作机制以及SSC4,写了个磁带模块,加入到 pyTarget 中,这样 pyTarget 又增加 VTL 功能。目前正在测试中,先粘贴部分功能测试过程。测试稳定后再上传代码。
代码在:
#
# open-iscsi 连接 pyTarget,
# pyTarget中配置了了一个机械手,3个磁带 (目前机械手功能没有实现)
#
[root@localhost src]# cat /proc/scsi/scsi
Attached devices:
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: pyTarget Model: iSCSI-device Rev: 0.2
Type: Medium Changer ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 00 Lun: 01
Vendor: pyTarget Model: iSCSI-device Rev: 0.2
Type: Sequential-Access ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 00 Lun: 02
Vendor: pyTarget Model: iSCSI-device Rev: 0.2
Type: Sequential-Access ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 00 Lun: 03
Vendor: pyTarget Model: iSCSI-device Rev: 0.2
Type: Sequential-Access ANSI SCSI revision: 02
#
# 将文件打包到磁带中,再从磁带中解开
# 数据完整。
#
[root@localhost src]# ls
kernels open-iscsi-2.0-871.3 open-iscsi-2.0-871.3.tar.gz redhat src test
[root@localhost src]# mt -f /dev/st0 setblk 1
[root@localhost src]# tar jcf /dev/st0 *
[root@localhost src]# rm -rf *
[root@localhost src]# ls
[root@localhost src]# tar jxf /dev/st0
bzip2: (stdin): trailing garbage after EOF ignored
[root@localhost src]# ls
kernels open-iscsi-2.0-871.3 open-iscsi-2.0-871.3.tar.gz redhat src test
[root@localhost src]#
[root@localhost src]# dd if=open-iscsi-2.0-871.3.tar.gz of=/dev/st0 bs=1
347626+0 records in
347626+0 records out
347626 bytes (348 kB) copied, 259.566 seconds, 1.3 kB/s
#
# 通过 cpio 来备份与恢复,md5校验,数据无误
#
[root@localhost tmp]# cd /boot/
[root@localhost boot]# ls
config-2.6.18-8.el5 initrd-2.6.18-8.el5.img System.map-2.6.18-8.el5
grub symvers-2.6.18-8.el5.gz vmlinuz-2.6.18-8.el5
[root@localhost boot]# md5sum *
eb88e9484c288150168ffefd370a9418 config-2.6.18-8.el5
md5sum: grub: Is a directory
440f5958a2a4e5ca6af90d39abd927f6 initrd-2.6.18-8.el5.img
0cba29e9a82c8eb54533b335d769f7ab symvers-2.6.18-8.el5.gz
3d3cee9fc9a5c6854a31cb6eeda8291e System.map-2.6.18-8.el5
md5sum: tmp: Is a directory
27eec540988a3f639872288f2a093b59 vmlinuz-2.6.18-8.el5
[root@localhost boot]# find * | cpio -oc >/dev/st0
8854 blocks
[root@localhost boot]# mkdir tmp
[root@localhost boot]# cd tmp/
[root@localhost tmp]# cpio -i 8854 blocks
[root@localhost tmp]# ls
config-2.6.18-8.el5 initrd-2.6.18-8.el5.img System.map-2.6.18-8.el5
grub symvers-2.6.18-8.el5.gz vmlinuz-2.6.18-8.el5
[root@localhost tmp]# md5sum *
eb88e9484c288150168ffefd370a9418 config-2.6.18-8.el5
md5sum: grub: Is a directory
440f5958a2a4e5ca6af90d39abd927f6 initrd-2.6.18-8.el5.img
0cba29e9a82c8eb54533b335d769f7ab symvers-2.6.18-8.el5.gz
3d3cee9fc9a5c6854a31cb6eeda8291e System.map-2.6.18-8.el5
27eec540988a3f639872288f2a093b59 vmlinuz-2.6.18-8.el5
阅读(1021) | 评论(0) | 转发(0) |