加载中…
个人资料
潘阔
潘阔
  • 博客等级:
  • 博客积分:0
  • 博客访问:7,217
  • 关注人气:7
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

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

(2014-04-09 10:06:27)
标签:

it

分类: linux

                                  Mhvtl虚拟磁带库

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

# yum groupinstall "Development tools"

 

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-devel is needed by mhvtl-utils-1.4-7.el6.x86_64

       zlib-devel is 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-*

 

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

# 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 -ivh mhvtl-utils-1.4-7.el6.x86_64.rpm

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

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

 

 

 

 

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

[root@localhost x86_64]# service mhvtl start

 

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 these daemons.

 

Need mhvtl kernel module version at least 0.18.11

 

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

 

Please see http://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 mhvtl start

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          SES Device                    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-RW DS8A8SH          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    

 

 

 

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

 

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

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

Loading media from Storage Element 1 into drive 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 (Storage Element 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   

 

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

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

Loading media from Storage Element 2 into drive 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 (Storage Element 1 Loaded):VolumeTag = E01001L4                           

Data Transfer Element 1:Full (Storage Element 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-RW DS8A8SH          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

 

 

查看/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 (Storage Element 1 Loaded):VolumeTag = E01001L4                           

Data Transfer Element 1:Full (Storage Element 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:16 indx

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

 

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

[root@localhost E01001L4]# cat data

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


domain(U4)(*�4

::a    ��


96(96*:6

  ��[1][root@localhost E01001L4]#

 

 

 

                       

将磁带从 Data Transfer Element  的磁带机中的移出

                         

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

Unloading drive 0 into Storage Element 2...done

 

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

Unloading drive 1 into Storage Element 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: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  

 

软件包看以前的文档  在最下面的有百度云盘 账号 登陆下载软件包

 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有