mhvtl虚拟磁带库(提供软件包)
(2014-04-09 10:06:27)
标签:
it |
分类: linux |
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:
在制作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
[root@localhost rpmbuild]# ls
BUILD
[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...
启动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
[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
CLN102L5
CLN303TA
E01001L4
E01002L4
E01003L4
E01004L4
[root@localhost mhvtl]# cd CLN101L4
[root@localhost CLN101L4]# ls
data
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]
[2:0:0:0]
[5:0:0:0]
[7:0:0:0]
[7:0:0:1]
[9:0:0:0]
[9:0:1:0]
[9:0:2:0]
[9:0:3:0]
[9:0:4:0]
[9:0:8:0]
[9:0:9:0]
[9:0:10:0]
[9:0:11:0]
[9:0:12:0]
[root@localhost mhvtl]# lsscsi -g
[0:0:0:0]
[2:0:0:0]
[5:0:0:0]
[7:0:0:0]
[7:0:0:1]
[9:0:0:0]
[9:0:1:0]
[9:0:2:0]
[9:0:3:0]
[9:0:4:0]
[9:0:8:0]
[9:0:9:0]
[9:0:10:0]
[9:0:11:0]
[9:0:12:0]
安装磁带库工具
[root@localhost mhvtl]# yum install
mtx*
查看磁带库
[root@localhost ~]# mtx -f /dev/sg13 status
Data Transfer Element
0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
[root@localhost ~]# mtx -f /dev/sg13 status | head
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
将Storage Element 位置上的磁带设备放置到 Data Transfer
Element
将Storage Element 1 位置上的磁带设备放置到 Data Transfer
Element
[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
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 2 位置上的磁带设备放置到 Data Transfer
Element
[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
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
测试,向磁带中归档数据
[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]
[2:0:0:0]
[5:0:0:0]
[7:0:0:0]
[7:0:0:1]
[9:0:0:0]
[9:0:1:0]
[9:0:2:0]
[9:0:3:0]
[9:0:4:0]
[9:0:8:0]
[9:0:9:0]
[9:0:10:0]
[9:0:11:0]
[9:0:12:0]
查看/dev/sg13磁带机的状态发现第一个磁带机放置的是E01001L4磁带
[root@localhost ~]# mtx -f /dev/sg13 status | head
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
[root@localhost ~]# cd /opt/mhvtl/
[root@localhost mhvtl]# ls
CLN101L4
CLN102L5
CLN303TA
E01001L4
E01002L4
E01003L4
E01004L4
[root@localhost mhvtl]# cd E01001L4/
[root@localhost E01001L4]# ls -l
total 12
-rw-rw----. 1 vtl vtl
-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
domain(U4)(*�4
::a
96(96*:6
将磁带从 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
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
软件包看以前的文档