1、centos65+mhvtl+gui+iscsitgt虚拟磁带库的安装与应用剖析一Mhvtl+mhvtl gui+iscsi1.安装:yum install lsscsi mt-st mtx zlib-devel sg3_utils zlib lzo-devel kernel-devel kernel-headers gcc接着创建vtl用户:#useradd vtl#passwd vtl#mkdir /opt/mhvtl# mkdir /etc/mhvtl# chown -Rf vtl:vtl /opt/mhvtl#chown -Rf vtl:vtl /etc/mhvtl(/etc/mhvt
2、l为配置文件路径 /opt/mhvtl为虚拟带库存储路径)2. 编译安装MHVLT# tar -zxvf mhvtl-2013-03-22.tgzrootcentos001 tool# cd mhvtl-1.4rootcentos001 mhvtl-1.4# cd kernelrootcentos001 kernel# make;make installrootcentos001 mhvtl-1.4# make;make install如果未安装lzo和lzo-devel开发环境将收到如下报错:Note:Since mhvtl-1.3, both lzo and zlib are requir
3、ed to build vtltapeTypical error (missing lzo devel package) looks like:cc -Wall -Wshadow -g -O2 -D_LARGEFILE64_SOURCE -I./kernel -DMHVTL_VERSION=1.4.0 -DMHVTL_DEBUG -DUSR=vtl -DMHVTL_HOME_PATH=/opt/mhvtl -DMHVTL_CONFIG_PATH=/etc/mhvtl -c -o vtltape.o vtltape.cvtltape.c:92:25:error:lzo/lzoconf.h: No
4、 such file or directoryvtltape.c:93:23:error:lzo/lzo1x.h: No such file or directoryvtltape.c:In function uncompress_lzo_blockrootcentos001 mhvtl-1.4# service mhvtl statusCould not locate library config file: /etc/mhvtl/library_contents.10Creating a default onePlease stop mhvtl & edit /etc/mhvtl/libr
5、ary_contents.10 to suit your requirementsCould not locate library config file: /etc/mhvtl/library_contents.30Creating a default onePlease stop mhvtl & edit /etc/mhvtl/library_contents.30 to suit your requirementsUsage: /etc/init.d/mhvtl start|stop|shutdownrootcentos001 mhvtl-1.4# service mhvtl start
6、vtllibrary process PID is 1729vtllibrary process PID is 1733查看虚拟带库状态信息rootcentos001 mhvtl-1.4# lsscsi -g1:0:0:0 cd/dvd NECVMWar VMware IDE CDR10 1.00 /dev/sr0 /dev/sg02:0:0:0 disk VMware, VMware Virtual S 1.0 /dev/sda /dev/sg13:0:0:0 mediumx STK L700 0104 /dev/sch0 /dev/sg103:0:1:0 tape IBM ULT3580-
7、TD5 0104 /dev/st0 /dev/sg23:0:2:0 tape IBM ULT3580-TD5 0104 /dev/st1 /dev/sg33:0:3:0 tape IBM ULT3580-TD4 0104 /dev/st2 /dev/sg43:0:4:0 tape IBM ULT3580-TD4 0104 /dev/st3 /dev/sg53:0:8:0 mediumx STK L80 0104 /dev/sch1 /dev/sg113:0:9:0 tape STK T10000B 0104 /dev/st4 /dev/sg63:0:10:0 tape STK T10000B
8、0104 /dev/st5 /dev/sg73:0:11:0 tape STK T10000B 0104 /dev/st6 /dev/sg83:0:12:0 tape STK T10000B 0104 /dev/st7 /dev/sg9rootcentos001 mhvtl-1.4# lsscsi -l1:0:0:0 cd/dvd NECVMWar VMware IDE CDR10 1.00 /dev/sr0 state=running queue_depth=1 scsi_level=6 type=5 device_blocked=0 timeout=302:0:0:0 disk VMwar
9、e, VMware Virtual S 1.0 /dev/sda state=running queue_depth=32 scsi_level=3 type=0 device_blocked=0 timeout=303:0:0:0 mediumx STK L700 0104 /dev/sch0 state=running queue_depth=32 scsi_level=6 type=8 device_blocked=0 timeout=03:0:1:0 tape IBM ULT3580-TD5 0104 /dev/st0 state=running queue_depth=32 scsi
10、_level=6 type=1 device_blocked=0 timeout=9003:0:2:0 tape IBM ULT3580-TD5 0104 /dev/st1 state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=9003:0:3:0 tape IBM ULT3580-TD4 0104 /dev/st2 state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=9003:0:4:0 tape IBM
11、 ULT3580-TD4 0104 /dev/st3 state=running queue_depth=32 scsi_level=6 type=1 device_blocked=0 timeout=9003:0:8:0 mediumx STK L80 0104 /dev/sch1 state=running queue_depth=32 scsi_level=6 type=8 device_blocked=0 timeout=03:0:9:0 tape STK T10000B 0104 /dev/st4 state=running queue_depth=32 scsi_level=0 t
12、ype=1 device_blocked=0 timeout=9003:0:10:0 tape STK T10000B 0104 /dev/st5 state=running queue_depth=32 scsi_level=0 type=1 device_blocked=0 timeout=9003:0:11:0 tape STK T10000B 0104 /dev/st6 state=running queue_depth=32 scsi_level=0 type=1 device_blocked=0 timeout=9003:0:12:0 tape STK T10000B 0104 /
13、dev/st7 state=running queue_depth=32 scsi_level=0 type=1 device_blocked=0 timeout=900这里的/dev/sg10和/dev/sg11是机械手。这个默认的容量是500MB,这个可以查看mhvtl的配置文件mhvtl.conf:rootcentos001 mhvtl-1.4# cat /etc/mhvtl/mhvtl.conf# Home directory for config file(s)MHVTL_CONFIG_PATH=/etc/mhvtl# Default media capacity (500 M)CA
14、PACITY=500# Set default verbosity 0|1|2|3VERBOSE=1# Set kernel module debuging 0|1VTL_DEBUG=0capacity=500就是指默认容量为500MB。3.简单应用:查看机械手状态:rootcentos001 mhvtl-1.4# mtx -f /dev/sg10 status Storage Changer /dev/sg10:4 Drives, 43 Slots ( 4 Import/Export )Data Transfer Element 0:EmptyData Transfer Element 1:
15、EmptyData Transfer Element 2:EmptyData Transfer Element 3:Empty Storage Element 1:Full :VolumeTag=E01001L4 Storage Element 2:Full :VolumeTag=E01002L4 Storage Element 3:Full :VolumeTag=E01003L4 Storage Element 4:Full :VolumeTag=E01004L4 Storage Element 5:Full :VolumeTag=E01005L4 Storage Element 6:Ful
16、l :VolumeTag=E01006L4 Storage Element 7:Full :VolumeTag=E01007L4 Storage Element 8:Full :VolumeTag=E01008L4 Storage Element 9:Full :VolumeTag=E01009L4 Storage Element 10:Full :VolumeTag=E01010L4 Storage Element 11:Full :VolumeTag=E01011L4 Storage Element 12:Full :VolumeTag=E01012L4 Storage Element 1
17、3:Full :VolumeTag=E01013L4 Storage Element 14:Full :VolumeTag=E01014L4 Storage Element 15:Full :VolumeTag=E01015L4 Storage Element 16:Full :VolumeTag=E01016L4 Storage Element 17:Full :VolumeTag=E01017L4 Storage Element 18:Full :VolumeTag=E01018L4 Storage Element 19:Full :VolumeTag=E01019L4 Storage E
18、lement 20:Full :VolumeTag=E01020L4 Storage Element 21:Empty Storage Element 22:Full :VolumeTag=CLN101L4 Storage Element 23:Full :VolumeTag=CLN102L5 Storage Element 24:Empty Storage Element 25:Empty Storage Element 26:Empty Storage Element 27:Empty Storage Element 28:Empty Storage Element 29:Empty St
19、orage Element 30:Full :VolumeTag=F01030L5 Storage Element 31:Full :VolumeTag=F01031L5 Storage Element 32:Full :VolumeTag=F01032L5 Storage Element 33:Full :VolumeTag=F01033L5 Storage Element 34:Full :VolumeTag=F01034L5 Storage Element 35:Full :VolumeTag=F01035L5 Storage Element 36:Full :VolumeTag=F01
20、036L5 Storage Element 37:Full :VolumeTag=F01037L5 Storage Element 38:Full :VolumeTag=F01038L5 Storage Element 39:Full :VolumeTag=F01039L5 Storage Element 40 IMPORT/EXPORT:Empty Storage Element 41 IMPORT/EXPORT:Empty Storage Element 42 IMPORT/EXPORT:Empty Storage Element 43 IMPORT/EXPORT:Emptyrootcen
21、tos001 mhvtl-1.4# mtx -f /dev/sg11 status Storage Changer /dev/sg11:4 Drives, 44 Slots ( 4 Import/Export )Data Transfer Element 0:EmptyData Transfer Element 1:EmptyData Transfer Element 2:EmptyData Transfer Element 3:Empty Storage Element 1:Full :VolumeTag=G03001TA Storage Element 2:Full :VolumeTag=
22、G03002TA Storage Element 3:Full :VolumeTag=G03003TA Storage Element 4:Full :VolumeTag=G03004TA Storage Element 5:Full :VolumeTag=G03005TA Storage Element 6:Full :VolumeTag=G03006TA Storage Element 7:Full :VolumeTag=G03007TA Storage Element 8:Full :VolumeTag=G03008TA Storage Element 9:Full :VolumeTag
23、=G03009TA Storage Element 10:Full :VolumeTag=G03010TA Storage Element 11:Full :VolumeTag=G03011TA Storage Element 12:Full :VolumeTag=G03012TA Storage Element 13:Full :VolumeTag=G03013TA Storage Element 14:Full :VolumeTag=G03014TA Storage Element 15:Full :VolumeTag=G03015TA Storage Element 16:Full :V
24、olumeTag=G03016TA Storage Element 17:Full :VolumeTag=G03017TA Storage Element 18:Full :VolumeTag=G03018TA Storage Element 19:Full :VolumeTag=G03019TA Storage Element 20:Full :VolumeTag=G03020TA Storage Element 21:Full :VolumeTag=G03021TA Storage Element 22:Full :VolumeTag=G03022TA Storage Element 23
25、:Full :VolumeTag=G03023TA Storage Element 24:Full :VolumeTag=G03024TA Storage Element 25:Full :VolumeTag=G03025TA Storage Element 26:Full :VolumeTag=G03026TA Storage Element 27:Full :VolumeTag=G03027TA Storage Element 28:Full :VolumeTag=G03028TA Storage Element 29:Full :VolumeTag=G03029TA Storage El
26、ement 30:Full :VolumeTag=G03030TA Storage Element 31:Full :VolumeTag=G03031TA Storage Element 32:Full :VolumeTag=G03032TA Storage Element 33:Full :VolumeTag=G03033TA Storage Element 34:Full :VolumeTag=G03034TA Storage Element 35:Full :VolumeTag=G03035TA Storage Element 36:Full :VolumeTag=G03036TA St
27、orage Element 37:Full :VolumeTag=G03037TA Storage Element 38:Full :VolumeTag=G03038TA Storage Element 39:Full :VolumeTag=G03039TA Storage Element 40:Full :VolumeTag=CLN303TA Storage Element 41 IMPORT/EXPORT:Empty Storage Element 42 IMPORT/EXPORT:Empty Storage Element 43 IMPORT/EXPORT:Empty Storage E
28、lement 44 IMPORT/EXPORT:Empty将磁带从1号槽位装入driver 0:rootcentos001 mhvtl-1.4# mtx -f /dev/sg10 load 1 0sLoading media from Storage Element 1 into drive 0.donerootcentos001 mhvtl-1.4# mtx -f /dev/sg10 status Storage Changer /dev/sg10:4 Drives, 43 Slots ( 4 Import/Export )Data Transfer Element 0:Full (Stor
29、age Element 1 Loaded):VolumeTag = E01001L4 Data Transfer Element 1:EmptyData Transfer Element 2:EmptyData Transfer Element 3:Empty Storage Element 1:Empty Storage Element 2:Full :VolumeTag=E01002L4 Storage Element 3:Full :VolumeTag=E01003L4查看磁带状态:rootcentos001 mhvtl-1.4# mt -f /dev/st0 statusSCSI 2
30、tape drive:File number=0, block number=0, partition=0.Tape block size 0 bytes. Density code 0x46 (LTO-4).Soft error count since last status=0General status bits on (41010000): BOT ONLINE IM_REP_EN使用tar命令测试下,能否写入文件:rootcentos001 mhvtl-1.4# tar -cvvf /dev/st1 /boottar: Removing leading / from member n
31、amesdr-xr-xr-x root/root 0 2014-09-11 16:58 /boot/-rw-r-r- root/root 2519609 2014-07-25 17:00 /boot/System.map-2.6.32-431.20.5.el6.x86_64drwxr-xr-x root/root 0 2013-11-13 18:04 /boot/efi/drwxr-xr-x root/root 0 2013-11-13 18:04 /boot/efi/EFI/drwxr-xr-x root/root 0 2014-07-30 14:55 /boot/efi/EFI/redhat/-rwxr-xr-x root/root 252990 2014-07-25 20:08 /boot/efi/EFI/redhat/grub.efi-rw-r-r- root/root 105200 2014-09-10 06:02 /boot/con
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1