重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4476|回复: 0
打印 上一主题 下一主题

Redhat Linux下安装mhvtl虚拟磁带库

[复制链接]
跳转到指定楼层
楼主
发表于 2012-9-15 00:11:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
 


http://www.liusuping.com/ubuntu-linux/redhat-linux-mhvtl.html

mhvtl是一个在linux下的虚拟带宽软件,可以在系统中将磁盘虚拟成一个虚拟磁带库,可以配置Networker或者netbackup等备份软件进行数据的备份及恢复。同时也可以作为学习磁带库搭建一个实验环境。

安装支持包,其中mtx、mt-st是磁带操作工具,lsscsi是scsi设备管理工具。

[root@a ~]# yum install gcc mtx mt-st zlib-devel sg3_devel kernel-devel

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
gcc i386 4.1.2-48.el5 base 5.2 M
kernel-devel i686 2.6.18-194.el5 base 5.4 M
mt-st i386 0.9b-2.2.2 base 39 k
mtx i386 1.2.18-9 base 95 k
zlib-devel i386 1.2.3-3 base 100 k
Installing for dependencies:
glibc-devel i386 2.5-49 base 2.0 M
glibc-headers i386 2.5-49 base 601 k
libgomp i386 4.4.0-6.el5 base 70 k
Updating for dependencies:
cpp i386 4.1.2-48.el5 base 2.6 M
glibc i686 2.5-49 base 5.2 M
glibc-common i386 2.5-49 base 16 M
libgcc i386 4.1.2-48.el5 base 95 k

Transaction Summary
=============================================================================
Install 8 Package(s)
Update 4 Package(s)
Remove 0 Package(s)

Total download size: 38 M

[root@a ~]# yum install lsscsi kernel-headers kernel

创建用户

[root@a ~]# useradd vtl
[root@a ~]# passwd vtl
Changing password for user vtl.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@a ~]#

创建目录

[root@a ~]# mkdir /opt/mhvtl
[root@a ~]# mkdir /etc/mhvtl
[root@a ~]# chown -Rf vtl:vtl /opt/mhvtl/
[root@a ~]# chown -Rf vtl:vtl /etc/mhvtl/

下载软件http://sites.google.com/site/linuxvtl2,这个地址被墙了,请翻墙下载。

下载后将源文件复制到/tmp目录,解压。

安装内核

[root@a tmp]# cd mhvtl-0.18/
[root@a mhvtl-0.18]# cd kernel/
[root@a kernel]# make && make install

安装mhvtl虚拟带宽

[root@a kernel]# cd ..
[root@a mhvtl-0.18]# make

在这个过程中会出现如下错误,不要理会。

vtlcart.c:249: 警告:格式 ‘%lld’ 需要类型 ‘long long int’,但实参 4 的类型为 ‘uint32_t’

执行安装

[root@a mhvtl-0.18]# make install

启动mhvtl虚拟带宽

[root@a mhvtl-0.18]# /etc/init.d/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
which: no setuidgid in (/usr/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/bin)

停止mhvtl虚拟带库

[root@a mhvtl-0.18]# /etc/init.d/mhvtl stop
shutdown of mhvtl
Sending exit to 11
Sending exit to 12
Sending exit to 13
Sending exit to 14
Sending exit to 31
Sending exit to 32
Sending exit to 33
Sending exit to 34
Sending exit to 10
Sending exit to 30

重新启动mhvtl虚拟带库,不会再报上述错误。

[root@a mhvtl-0.18]# /etc/init.d/mhvtl start
vtltape: version 0.18.11
vtltape: version 0.18.11
vtltape: version 0.18.11
vtltape: version 0.18.11
vtltape: version 0.18.11
vtltape: version 0.18.11
vtltape: version 0.18.11
vtltape: version 0.18.11
vtllibrary: version 0.18.11
vtllibrary process PID is 6017
vtllibrary: version 0.18.11
vtllibrary process PID is 6141
[root@a mhvtl-0.18]#

至此mhvtl虚拟带库安装完毕。

查看配置文件

[root@b ~]# cat /etc/mhvtl/mhvtl.conf

# Home directory for config file(s)
MHVTL_CONFIG_PATH=/etc/mhvtl

# Default media capacity (500 M)
CAPACITY=500 //磁带容量

# Set default verbosity [0|1|2|3]
VERBOSE=1

# Set kernel module debuging [0|1]
VTL_DEBUG=0

查看虚拟带库设备,可以看到两个机械臂和8个驱动器

[root@b ~]# lsscsi -g
[1:0:0:0] mediumx STK L700 550V - /dev/sg10
[1:0:1:0] tape IBM ULT3580-TD5 550V /dev/st0 /dev/sg2
[1:0:2:0] tape IBM ULT3580-TD5 550V /dev/st1 /dev/sg3
[1:0:3:0] tape IBM ULT3580-TD4 550V /dev/st2 /dev/sg4
[1:0:4:0] tape IBM ULT3580-TD4 550V /dev/st3 /dev/sg5
[1:0:8:0] mediumx SPECTRA PYTHON 550V - /dev/sg11
[1:0:9:0] tape IBM ULT3580-TD4 550V /dev/st4 /dev/sg6
[1:0:10:0] tape IBM ULT3580-TD4 550V /dev/st5 /dev/sg7
[1:0:11:0] tape IBM ULT3580-TD4 550V /dev/st6 /dev/sg8
[1:0:12:0] tape IBM ULT3580-TD4 550V /dev/st7 /dev/sg9

查看机械臂状态,4个驱动器,43个槽位

[root@b ~]# mtx -f /dev/sg10 status
Storage Changer /dev/sg10: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 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

将1槽位的磁带放到0驱动器里

[root@b ~]# mtx -f /dev/sg10 load 1 0

再看机械臂状态

[root@b ~]# mtx -f /dev/sg10 status
Storage Changer /dev/sg10: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

往磁带上写数据

[root@b ~]# tar -cvf /dev/st0 liusuping.com.txt
liusuping.com.txt

查看磁带上的数据

[root@b ~]# tar -tvf /dev/st0
-rw-r--r-- root/root 0 2010-11-09 11:53:41 liusuping.com.txt
[root@b ~]#

对虚拟带库的操作和真实的物理带库是一样的。

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-5-14 05:32 , Processed in 0.089399 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表