redhat6 安裝虛擬帶庫筆記

wmlm發表於2012-11-30

作業系統版本
[root@node1 ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.0 (Santiago)

先安裝一些 scsi和磁帶機相關的軟體包:
zlib-devel
lsscsi
mt-st
mtx

另外需要安裝 liblzo2-dev 包 作業系統光碟上沒有此安裝包 .
還是下載RPM包安裝快捷

liblzo2_2-2.03-6.el6.i686.rpm
上傳安裝完成。


操作過程:

[@more@]

[root@node1 ~]# cd /media/RHEL_6.0 i386 Disc 1/Packages/
[root@node1 Packages]# ls ls*
lslk-1.29-23.el6.i686.rpm lsscsi-0.23-2.el6.i686.rpm
lsof-4.82-1.2.el6.i686.rpm
[root@node1 Packages]# rpm -ivh lsscsi-0.23-2.el6.i686.rpm
warning: lsscsi-0.23-2.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:lsscsi ########################################### [100%]
[root@node1 Packages]#
[root@node1 Packages]# rpm -qa|grep mt
systemtap-1.2-9.el6.i686
mtools-4.0.12-1.el6.i686
mtr-0.75-5.el6.i686
systemtap-runtime-1.2-9.el6.i686
[root@node1 Packages]#
[root@node1 Packages]#
[root@node1 Packages]# ls mt*
mtools-4.0.12-1.el6.i686.rpm mt-st-1.1-4.el6.i686.rpm
mtr-0.75-5.el6.i686.rpm mtx-1.3.12-5.el6.i686.rpm
[root@node1 Packages]# rpm -ivh mt-st-1.1-4.el6.i686.rpm
warning: mt-st-1.1-4.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:mt-st ########################################### [100%]
[root@node1 Packages]# rpm -ivh mtx-1.3.12-5.el6.i686.rpm
warning: mtx-1.3.12-5.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:mtx ########################################### [100%]
[root@node1 Packages]#
[root@node1 Packages]#
[root@node1 Packages]#


下載mhvtl 編譯mhvtl
論壇地址:

當前版本下載地址:

編譯過程如下:
[root@node1 ~]# rpm -Uvh mhvtl-*.rpm
error: Failed dependencies:
liblzo2.so.2 is needed by mhvtl-utils-1.4-4.i586
1:mhvtl-utils ########################################### [100%]
[root@node1 ~]#
[root@node1 ~]# tar -xzf mhvtl-2012-09-13.tgz
[root@node1 ~]#
[root@node1 ~]# ls
anaconda-ks.cfg install.log.syslog mhvtl-utils-1.4-4.i586.rpm rpmbuild
Desktop lzo-2.04 mhvtl-utils-1.4-4.src.rpm Templates
Documents lzo-2.04.tar.gz Music Videos
Downloads mhvtl-1.4 Pictures
install.log mhvtl-2012-09-13.tgz Public
[root@node1 ~]#
[root@node1 ~]# cd mhvtl-1.4/
[root@node1 mhvtl-1.4]#
[root@node1 mhvtl-1.4]# pwd
/root/mhvtl-1.4
[root@node1 mhvtl-1.4]#

新增vtl使用者
[root@node1 mhvtl-1.4]# useradd vtl
[root@node1 mhvtl-1.4]# passwd vtl
Changing password for user vtl.
New password:
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@node1 mhvtl-1.4]#
[root@node1 mhvtl-1.4]#

新增路徑
mkdir /opt/mhvtl //虛擬帶庫儲存路徑
mkdir /etc/mhvtl //配置檔案路徑
chown -R vtl.vtl /opt/mhvtl/ /etc/mhvtl/

開始編譯kernel
[root@node1 mhvtl-1.4]# pwd
/root/mhvtl-1.4
[root@node1 mhvtl-1.4]# cd kernel
[root@node1 kernel]# pwd
/root/mhvtl-1.4/kernel
[root@node1 kernel]# ls
fetch24.c fetch26.c fetch27.c fetch.c Makefile mhvtl.c vtl_common.h
[root@node1 kernel]#
[root@node1 kernel]# make && make install
make -C /lib/modules/2.6.32-71.el6.i686/build SUBDIRS=/root/mhvtl-1.4/kernel modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-71.el6.i686'
CC [M] /root/mhvtl-1.4/kernel/mhvtl.o
/root/mhvtl-1.4/kernel/mhvtl.c:305: warning: initialization from incompatible pointer type
In file included from /root/mhvtl-1.4/kernel/mhvtl.c:334:
/root/mhvtl-1.4/kernel/fetch27.c: In function âvtl_sg_copy_userâ:
/root/mhvtl-1.4/kernel/fetch27.c:51: warning: cast from pointer to integer of different size
/root/mhvtl-1.4/kernel/fetch27.c:52: warning: cast from pointer to integer of different size
Building modules, stage 2.
MODPOST 1 modules
CC /root/mhvtl-1.4/kernel/mhvtl.mod.o
LD [M] /root/mhvtl-1.4/kernel/mhvtl.ko.unsigned
NO SIGN [M] /root/mhvtl-1.4/kernel/mhvtl.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.32-71.el6.i686'
install -o root -g root -m 644 mhvtl.ko /lib/modules/`uname -r`/kernel/drivers/scsi/;
depmod -a;
if [ -f "/etc/modprobe.d/unsupported-modules" ]; then
sed -i 's/^allow_unsupported_modules 0/allow_unsupported_modules 1/' /etc/modprobe.d/unsupported-modules;
fi
[root@node1 kernel]#

載入mhvtl
[root@node1 kernel]# modprobe mhvtl
[root@node1 kernel]# lsmod |grep mhvtl
mhvtl 17974 0

開始編譯mhvtl
[root@node1 mhvtl-1.4]# pwd
/root/mhvtl-1.4
[root@node1 mhvtl-1.4]# ls
doc include kernel man README usr
etc INSTALL Makefile mhvtl-utils.spec scripts
[root@node1 mhvtl-1.4]# ls /etc/init.d/mhvtl
ls: cannot access /etc/init.d/mhvtl: No such file or directory
[root@node1 mhvtl-1.4]# make && make install

[root@node1 mhvtl-1.4]# ls /etc/init.d/mhvtl
/etc/init.d/mhvtl

[root@node1 mhvtl-1.4]# ls /etc/mhvtl/
[root@node1 mhvtl-1.4]# ls /opt/mhvtl/
[root@node1 mhvtl-1.4]#
[root@node1 mhvtl-1.4]#
[root@node1 mhvtl-1.4]# /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
vtltape: error while loading shared libraries: liblzo2.so.2: cannot open shared object file: No such file or directory
vtltape: error while loading shared libraries: liblzo2.so.2: cannot open shared object file: No such file or directory
vtltape: error while loading shared libraries: liblzo2.so.2: cannot open shared object file: No such file or directory
vtltape: error while loading shared libraries: liblzo2.so.2: cannot open shared object file: No such file or directory
vtltape: error while loading shared libraries: liblzo2.so.2: cannot open shared object file: No such file or directory
vtltape: error while loading shared libraries: liblzo2.so.2: cannot open shared object file: No such file or directory
vtltape: error while loading shared libraries: liblzo2.so.2: cannot open shared object file: No such file or directory
vtltape: error while loading shared libraries: liblzo2.so.2: cannot open shared object file: No such file or directory
vtllibrary process PID is 15983
vtllibrary process PID is 15987
[root@node1 mhvtl-1.4]#
報錯原因是開始沒有安裝lzo2,安裝完成後,可以再次啟動mhvtl !

再次啟動mhvtl
/etc/init.d/mhvtl start

[root@node1 ~]# /etc/init.d/mhvtl start
mhvtl already running...
[root@node1 ~]#
[root@node1 ~]# /etc/init.d/mhvtl stop
shutdown of mhvtl
Sending exit to 10
Sending exit to 30
[root@node1 ~]#
[root@node1 ~]# /etc/init.d/mhvtl start
vtllibrary process PID is 20877
vtllibrary process PID is 20881
[root@node1 ~]#
[root@node1 ~]#
現在不再報liblzo2.so.2錯誤了。 /etc/mhvtl /opt/mhvtl 兩個目錄下面也有了內容.
[root@node1 ~]# ls /etc/mhvtl/
device.conf library_contents.10 library_contents.30 mhvtl.conf
[root@node1 ~]#
[root@node1 ~]# ls /opt/mhvtl/
這些與Storage Element對應,對應每一盤磁帶
透過命令 mtx -f /dev/sg11 status 檢視有磁帶的槽位,sg10有32個 sg11有40個
正好共有72個磁帶,每個預設500M,如果要測試備份,需要擴充套件/opt的容量
CLN101L4 E01007L4 E01016L4 F01034L5 G03004TA G03013TA G03022TA G03031TA
CLN102L5 E01008L4 E01017L4 F01035L5 G03005TA G03014TA G03023TA G03032TA
CLN303TA E01009L4 E01018L4 F01036L5 G03006TA G03015TA G03024TA G03033TA
E01001L4 E01010L4 E01019L4 F01037L5 G03007TA G03016TA G03025TA G03034TA
E01002L4 E01011L4 E01020L4 F01038L5 G03008TA G03017TA G03026TA G03035TA
E01003L4 E01012L4 F01030L5 F01039L5 G03009TA G03018TA G03027TA G03036TA
E01004L4 E01013L4 F01031L5 G03001TA G03010TA G03019TA G03028TA G03037TA
E01005L4 E01014L4 F01032L5 G03002TA G03011TA G03020TA G03029TA G03038TA
E01006L4 E01015L4 F01033L5 G03003TA G03012TA G03021TA G03030TA G03039TA
[root@node1 ~]#

檢視帶庫相關資訊
[root@node1 ~]# lsscsi -g
[1:0:0:0] cd/dvd NECVMWar VMware IDE CDR10 1.00 /dev/sr0 /dev/sg0
[2:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda /dev/sg1
[3:0:0:0] mediumx STK L700 0104 /dev/sch0 /dev/sg10
[3:0:1:0] tape IBM ULT3580-TD5 0104 /dev/st0 /dev/sg2
[3:0:2:0] tape IBM ULT3580-TD5 0104 /dev/st1 /dev/sg3
[3:0:3:0] tape IBM ULT3580-TD4 0104 /dev/st2 /dev/sg4
[3:0:4:0] tape IBM ULT3580-TD4 0104 /dev/st3 /dev/sg5
[3:0:8:0] mediumx STK L80 0104 /dev/sch1 /dev/sg11
[3:0:9:0] tape STK T10000B 0104 /dev/st4 /dev/sg6
[3:0:10:0] tape STK T10000B 0104 /dev/st5 /dev/sg7
[3:0:11:0] tape STK T10000B 0104 /dev/st6 /dev/sg8
[3:0:12:0] tape STK T10000B 0104 /dev/st7 /dev/sg9
[root@node1 ~]#

[root@node1 ~]# mtx -f /dev/sg11 status
Storage Changer /dev/sg11:4 Drives, 44 Slots ( 4 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
......
[root@node1 ~]#


將磁帶從1號槽位裝入driver 0
[root@node1 ~]# mtx -f /dev/sg11 load 1 0
Loading media from Storage Element 1 into drive 0...done
[root@node1 ~]# mtx -f /dev/sg11 status
Storage Changer /dev/sg11:4 Drives, 44 Slots ( 4 Import/Export )
Data Transfer Element 0:Full (Storage Element 1 Loaded):VolumeTag = G03001TA
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
......

將磁帶從 driver 0 解除安裝
[root@node1 ~]# mtx -f /dev/sg11 unload 1 0
Unloading drive 0 into Storage Element 1...done
[root@node1 ~]# mtx -f /dev/sg11 status
Storage Changer /dev/sg11:4 Drives, 44 Slots ( 4 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty

[root@node1 ~]# 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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271063/viewspace-1059841/,如需轉載,請註明出處,否則將追究法律責任。

相關文章