mhvtl虚拟磁带库(提供软件包)

简介:

                                Mhvtl虚拟磁带库

1.安装开发工具gcc make rpm-buid

# yum groupinstall "Developmenttools"


2.需要安装kernel-devel

# yum install kernel-devel


3.mhvtl源代码制作成rpm

# cd /tmp/

# tar xf mhvtl-2013-03-22.tgz

# cd mhvtl-1.4/

# rpmbuild -ta /tmp/mhvtl-2013-03-22.tgz

error: Failed build dependencies:

      lzo-develis needed by mhvtl-utils-1.4-7.el6.x86_64

      zlib-develis needed by mhvtl-utils-1.4-7.el6.x86_64



在制作rpm的过程中需要解决依赖性

# yum install zlib-devel

# ls

lzo-devel-2.03-3.1.el6.x86_64.rpm      

lzo-minilzo-2.03-3.1.el6.x86_64.rpm  

mhvtl-1.4                            

mhvtl-2013-03-22.tgz                

# yum localinstall lzo-*


再次安装过程会报错需要创建uservtl

# rpmbuild -ta /tmp/mhvtl-2013-03-22.tgz

# adduser vtl



再次执行命令得到RPM软件包

]# rpmbuild -ta /tmp/mhvtl-2013-03-22.tgz

# cd ~/rpmbuild/

[root@localhost rpmbuild]# ls

BUILD BUILDROOT  RPMS  SOURCES SPECS  SRPMS

[root@localhost rpmbuild]# cd RPMS/

[root@localhost RPMS]# ls

x86_64

[root@localhost RPMS]# cd x86_64/

[root@localhost x86_64]# ls

mhvtl-utils-1.4-7.el6.x86_64.rpm



安装mhvtl

[root@localhost x86_64]# rpm -ivhmhvtl-utils-1.4-7.el6.x86_64.rpm

Preparing...               ########################################### [100%]

 1:mhvtl-utils           ########################################### [100%]





启动mhvtl服务但是会出现问题

[root@localhost x86_64]# service mhvtlstart


Could not locate library config file:/etc/mhvtl/library_contents.10

Creating a default one

Please stop mhvtl & edit/etc/mhvtl/library_contents.10 to suit your requirements


Could not locate library config file:/etc/mhvtl/library_contents.30

Creating a default one

Please stop mhvtl & edit/etc/mhvtl/library_contents.30 to suit your requirements

FATAL: Module mhvtl not found.

No kernel module loaded to feed thesedaemons.


Need mhvtl kernel module version at least0.18.11


Did you remember to compile the 'mhvtl'kernel module ?


Please seehttp://sites.google.com/site/linuxvtl2/



返回源代码目录编译所需内核模块

[root@localhost x86_64]# cd/tmp/mhvtl-1.4/kernel

[root@localhost kernel]# ls

fetch24.c fetch26.c  fetch27.c  fetch.c Makefile  mhvtl.c  vtl_common.h

[root@localhost kernel]# make

[root@localhost kernel]# make install

[root@localhost kernel]# ls/lib/modules/2.6.32-358.el6.x86_64/kernel/drivers/scsi/mhvtl.ko

/lib/modules/2.6.32-358.el6.x86_64/kernel/drivers/scsi/mhvtl.ko



再次启动服务OK

[root@localhost kernel]# service mhvtlstart

vtllibrary process PID is 8631

vtllibrary process PID is 8634



磁带库的磁盘所存放的位置每一个目录就是一盘磁带

[root@localhost kernel]# cd /opt/mhvtl/

[root@localhost mhvtl]# ls

CLN101L4 E01005L4  E01012L4  E01019L4 F01035L5  G03003TA  G03010TA G03017TA  G03024TA  G03031TA G03038TA

CLN102L5 E01006L4  E01013L4  E01020L4 F01036L5  G03004TA  G03011TA G03018TA  G03025TA  G03032TA G03039TA

CLN303TA E01007L4  E01014L4  F01030L5 F01037L5  G03005TA  G03012TA G03019TA  G03026TA  G03033TA

E01001L4 E01008L4  E01015L4  F01031L5 F01038L5  G03006TA  G03013TA G03020TA  G03027TA  G03034TA

E01002L4 E01009L4  E01016L4  F01032L5 F01039L5  G03007TA  G03014TA G03021TA  G03028TA  G03035TA

E01003L4 E01010L4  E01017L4  F01033L5 G03001TA  G03008TA  G03015TA G03022TA  G03029TA  G03036TA

E01004L4 E01011L4  E01018L4  F01034L5 G03002TA  G03009TA  G03016TA G03023TA  G03030TA  G03037TA


[root@localhost mhvtl]# cd CLN101L4

[root@localhost CLN101L4]# ls

data indx  meta


data        数据文件

meta       设备描述文件

indx       索引文件



可以配置每个磁盘的大小

[root@localhost CLN101L4]# cd /etc/mhvtl/

[root@localhost mhvtl]# cat mhvtl.conf

# Default media capacity (500 M)       指定每个磁盘大小

CAPACITY=500  


#yum install lsscsi

使用lsscsi命令我们可以看到2个虚拟磁带库

[root@localhost mhvtl]# lsscsi

[0:0:0:0]   disk              Multiple        Card  Reader                 1.00      /dev/sdb

[2:0:0:0]   disk              ATA           ST1000LM024 HN-M   2AR1    /dev/sda

[5:0:0:0]   cd/dvd     PLDS         DVD-RW DS8A8SH          KL31    /dev/sr0

[7:0:0:0]   disk              WD          My Passport 0730         1015      /dev/sdc

[7:0:0:1]   enclosu    WD          SESDevice                    1015      -      

[9:0:0:0]  mediumx   STK      L700               0104      /dev/sch0  一个磁带库

[9:0:1:0]   tape    IBM      ULT3580-TD5      0104 /dev/st0

[9:0:2:0]   tape    IBM      ULT3580-TD5      0104 /dev/st1

[9:0:3:0]   tape    IBM      ULT3580-TD4      0104 /dev/st2

[9:0:4:0]   tape    IBM      ULT3580-TD4      0104 /dev/st3

[9:0:8:0]  mediumx STK      L80                          0104      /dev/sch1  一个磁带库

[9:0:9:0]   tape    STK      T10000B          0104 /dev/st4

[9:0:10:0]  tape    STK      T10000B          0104 /dev/st5

[9:0:11:0]  tape    STK      T10000B          0104 /dev/st6

[9:0:12:0]  tape    STK      T10000B          0104 /dev/st7


[root@localhost mhvtl]# lsscsi -g

[0:0:0:0]   disk       Multiple        Card  Reader                 1.00      /dev/sdb   /dev/sg1

[2:0:0:0]   disk       ATA           ST1000LM024 HN-M   2AR1    /dev/sda   /dev/sg0

[5:0:0:0]   cd/dvd  PLDS           DVD-RWDS8A8SH          KL31     /dev/sr0   /dev/sg2

[7:0:0:0]   disk       WD          My Passport 0730         1015      /dev/sdc  /dev/sg3

[7:0:0:1]   enclosu WD              SES Device                    1015      -             /dev/sg4

[9:0:0:0]   mediumx  STK          L700             0104  /dev/sch0 /dev/sg13

[9:0:1:0]   tape    IBM      ULT3580-TD5      0104 /dev/st0   /dev/sg5

[9:0:2:0]   tape    IBM      ULT3580-TD5      0104 /dev/st1   /dev/sg6

[9:0:3:0]   tape    IBM      ULT3580-TD4      0104 /dev/st2   /dev/sg7

[9:0:4:0]   tape    IBM      ULT3580-TD4      0104 /dev/st3   /dev/sg8

[9:0:8:0]   mediumx  STK          L80              0104  /dev/sch1 /dev/sg14

[9:0:9:0]   tape    STK      T10000B          0104 /dev/st4   /dev/sg9

[9:0:10:0]  tape    STK      T10000B          0104 /dev/st5   /dev/sg10

[9:0:11:0]  tape    STK      T10000B          0104 /dev/st6   /dev/sg11

[9:0:12:0]  tape    STK      T10000B          0104 /dev/st7   /dev/sg12



安装磁带库工具

[root@localhost mhvtl]# yum install mtx*   mt-st  sg3_utils




查看磁带库

[root@localhost ~]# mtx -f /dev/sg13 status

Storage Changer /dev/sg13:4 Drives, 43 Slots ( 4 Import/Export )

Data Transfer Element 0:Empty           #4个磁带机

Data Transfer Element 1:Empty

Data Transfer Element 2:Empty

Data 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:Full :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 13: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 Element 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

    Storage 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=F01036L5                            

    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:Empty



[root@localhost ~]# mtx -f /dev/sg13 status| head

Storage Changer /dev/sg13:4 Drives, 43 Slots ( 4 Import/Export )

Data Transfer Element 0:Empty

Data Transfer Element 1:Empty

Data Transfer Element 2:Empty

Data 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    




StorageElement 位置上的磁带设备放置到Data Transfer Element  的磁带机中


StorageElement 1 位置上的磁带设备放置到Data Transfer Element  0 的磁带机中

[root@localhost ~]# mtx -f /dev/sg13 load 10

Loading media from Storage Element 1 intodrive 0...done


[root@localhost ~]# mtx -f /dev/sg13 status| head

Storage Changer /dev/sg13:4 Drives, 43 Slots ( 4 Import/Export )

Data Transfer Element 0:Full (StorageElement 1 Loaded):VolumeTag = E01001L4                            

Data Transfer Element 1:Empty

Data Transfer Element 2:Empty

Data Transfer Element 3:Empty

    Storage Element 1:Empty

    Storage Element 2:Full :VolumeTag=E01002L4                            

    Storage Element 3:Full :VolumeTag=E01003L4                            

    Storage Element 4:Full :VolumeTag=E01004L4                            

    Storage Element 5:Full :VolumeTag=E01005L4    


StorageElement 2 位置上的磁带设备放置到Data Transfer Element  1 的磁带机中

[root@localhost ~]# mtx -f /dev/sg13 load 21

Loading media from Storage Element 2 intodrive 1...done



[root@localhost ~]# mtx -f /dev/sg13 status| head

Storage Changer /dev/sg13:4 Drives, 43 Slots ( 4 Import/Export )

Data Transfer Element 0:Full (StorageElement 1 Loaded):VolumeTag = E01001L4                            

Data Transfer Element 1:Full (StorageElement 2 Loaded):VolumeTag = E01002L4                            

Data Transfer Element 2:Empty

Data Transfer Element 3:Empty

     Storage Element 1:Empty

    Storage Element 2:Empty

    Storage Element 3:Full :VolumeTag=E01003L4                            

    Storage Element 4:Full :VolumeTag=E01004L4                            

    Storage Element 5:Full :VolumeTag=E01005L4  






测试向磁带中归档数据


[root@localhost ~]# tar -cf /dev/st0/etc/hosts

tar: Removing leading `/' from member names

[root@localhost ~]# tar -tf /dev/st0

etc/hosts


st0/dev/sg13磁带库中的第一个磁带机

[root@localhost mhvtl]# lsscsi -g

[0:0:0:0]   disk       Multiple        Card  Reader                 1.00      /dev/sdb   /dev/sg1

[2:0:0:0]   disk       ATA           ST1000LM024 HN-M   2AR1    /dev/sda   /dev/sg0

[5:0:0:0]   cd/dvd  PLDS           DVD-RWDS8A8SH          KL31     /dev/sr0   /dev/sg2

[7:0:0:0]   disk       WD          MyPassport 0730         1015      /dev/sdc   /dev/sg3

[7:0:0:1]   enclosu WD              SES Device                    1015      -             /dev/sg4

[9:0:0:0]   mediumx  STK          L700             0104  /dev/sch0 /dev/sg13

[9:0:1:0]   tape    IBM      ULT3580-TD5      0104 /dev/st0   /dev/sg5

[9:0:2:0]   tape    IBM      ULT3580-TD5      0104 /dev/st1   /dev/sg6

[9:0:3:0]   tape    IBM      ULT3580-TD4      0104 /dev/st2   /dev/sg7

[9:0:4:0]   tape    IBM      ULT3580-TD4      0104 /dev/st3   /dev/sg8

[9:0:8:0]   mediumx  STK          L80              0104  /dev/sch1 /dev/sg14

[9:0:9:0]   tape    STK      T10000B          0104 /dev/st4   /dev/sg9

[9:0:10:0]  tape    STK      T10000B          0104 /dev/st5   /dev/sg10

[9:0:11:0]  tape    STK      T10000B          0104 /dev/st6   /dev/sg11

[9:0:12:0]  tape    STK      T10000B          0104 /dev/st7   /dev/sg12



查看/dev/sg13磁带机的状态发现第一个磁带机放置的是E01001L4磁带

[root@localhost ~]# mtx -f /dev/sg13 status| head

Storage Changer /dev/sg13:4 Drives, 43 Slots ( 4 Import/Export )

Data Transfer Element 0:Full (StorageElement 1 Loaded):VolumeTag = E01001L4                            

Data Transfer Element 1:Full (StorageElement 2 Loaded):VolumeTag = E01002L4                            

Data Transfer Element 2:Empty

Data Transfer Element 3:Empty

    Storage Element 1:Empty

    Storage Element 2:Empty

    Storage Element 3:Full :VolumeTag=E01003L4                            

    Storage Element 4:Full :VolumeTag=E01004L4                            

    Storage Element 5:Full :VolumeTag=E01005L4  



[root@localhost ~]# cd /opt/mhvtl/

[root@localhost mhvtl]# ls

CLN101L4 E01005L4  E01012L4  E01019L4 F01035L5  G03003TA  G03010TA G03017TA  G03024TA  G03031TA G03038TA

CLN102L5 E01006L4  E01013L4  E01020L4 F01036L5  G03004TA  G03011TA G03018TA  G03025TA  G03032TA G03039TA

CLN303TA E01007L4  E01014L4  F01030L5 F01037L5  G03005TA  G03012TA G03019TA  G03026TA  G03033TA

E01001L4 E01008L4  E01015L4  F01031L5 F01038L5  G03006TA  G03013TA G03020TA  G03027TA  G03034TA

E01002L4 E01009L4  E01016L4  F01032L5 F01039L5  G03007TA  G03014TA G03021TA  G03028TA  G03035TA

E01003L4 E01010L4  E01017L4  F01033L5 G03001TA  G03008TA  G03015TA G03022TA  G03029TA  G03036TA

E01004L4 E01011L4  E01018L4  F01034L5 G03002TA  G03009TA  G03016TA G03023TA  G03030TA  G03037TA




[root@localhost mhvtl]# cd E01001L4/

[root@localhost E01001L4]# ls -l

total 12

-rw-rw----. 1 vtl vtl  211 Aug 20 22:16 data

-rw-rw----. 1 vtl vtl 1024 Aug 20 22:16indx

-rw-rw----. 1 vtl vtl 1540 Aug 20 22:16meta


查看data数据可以看出归档的/etc/hosts文件中的部分内容

[root@localhost E01001L4]# cat data

etc/hosts 90000644|L.0236113230743660114200 9H[1](d ustar root(T0$>|0D127.0.0.1   localpA(%.[1]


domain(U4)(* 4


::a    


96(96*:6


[1][root@localhostE01001L4]#





将磁带从 DataTransfer Element  的磁带机中的移出


[root@localhost ~]# mtx -f /dev/sg13 unload2 0

Unloading drive 0 into Storage Element2...done


[root@localhost ~]# mtx -f /dev/sg13 unload1 1

Unloading drive 1 into Storage Element1...done


[root@localhost ~]# mtx -f /dev/sg13 status| head

Storage Changer /dev/sg13:4 Drives, 43 Slots ( 4 Import/Export )

Data Transfer Element 0:Empty

Data Transfer Element 1:Empty

Data Transfer Element 2:Empty

Data Transfer Element 3:Empty

    Storage Element 1:Full :VolumeTag=E01002L4     #位置会有变化

    Storage Element 2:Full :VolumeTag=E01001L4                            

    Storage Element 3:Full :VolumeTag=E01003L4                            

    Storage Element 4:Full :VolumeTag=E01004L4                            

    Storage Element 5:Full :VolumeTag=E01005L4  


软件包请翻阅其他文档 在下面有提供  百度云盘地址 登陆下载




      本文转自潘阔 51CTO博客,原文链接:http://blog.51cto.com/pankuo/1392600,如需转载请自行联系原作者




相关文章
|
虚拟化
【虚拟化】VMware 新增网卡后找不到网卡配置问题(已解决)
【虚拟化】VMware 新增网卡后找不到网卡配置问题(已解决)
838 0
【虚拟化】VMware 新增网卡后找不到网卡配置问题(已解决)
|
3月前
|
存储 文件存储 虚拟化
ESXi8下安装iStoreOS软路由兼轻NAS系统
ESXi8下安装iStoreOS软路由兼轻NAS系统
262 0
|
存储 监控 数据安全/隐私保护
【FusionCompute】基于FreeNAS部署并使用虚拟存储(五)
【FusionCompute】基于FreeNAS部署并使用虚拟存储(五)
399 0
【FusionCompute】基于FreeNAS部署并使用虚拟存储(五)
|
虚拟化
vmware虚拟软件的网络模式
vmware虚拟软件的网络模式
124 0
|
虚拟化 数据安全/隐私保护 网络架构
在ESXi上搭建自己的OpenWRT软路由系统
在ESXi上搭建自己的OpenWRT软路由系统
在ESXi上搭建自己的OpenWRT软路由系统
|
固态存储 虚拟化