在linux下配置虚拟磁带库,让oracle备份更近生产。
一、编译RHEL5.4内核1.1、安装软件包
使用yum或者rpm命令安装如下软件包
gcc-4.*
gcc-c++-4.*
rpm-4.*rpm-build-4.*
redhat-rpm-config-8.*
unifdef-1.*
subversion-1.*1.2、安装内核源代码,
将内核源代码kernel-2.6.18-194.8.1.el5.src.rpm拷贝到/usr/src/redhat/SPECS/用rpm -i kernel-2.6.18-194.8.1.el5.src.rpm命令安装准备源文件:# cd /usr/src/redhat/SPECS# rpmbuild -bp --target=x86_64 kernel-2.6.spec生成的源文件树位于/usr/src/redhat/BUILD下拷贝linux-2.6.18.x86_64目录下所有源文件到/usr/src/kernels/# cp -Rf /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.x86_64 /usr/src/kernels/1.3、为内核源代码安装补丁
将iscsi-scst-1.0.1.1.tar、scst-1.0.1.1.tar、scstadmin-1.0.6.tar拷贝到/root/下并解压缩用chown -R root:root /root/XXXX和chmod -R 775 /root/XXXX命令分配用户和给予权限安装补丁# cd /usr/src/kernels/linux-2.6.18.x86_64/# patch -p1 < /root/iscsi-scst-1.0.1.1/kernel/patches/put_page_callback-2.6.18.1.patch# patch -p1 < /root/scst-1.0.1.1/kernel/scst_exec_req_fifo-2.6.18.patch1.4、编译内核并安装
# cd /usr/src/kernels/linux-2.6.18.x86_64/# make# make modules# make modules_install# make install检查/boot/grub/menu.lst,确认里面有2.6.18-prep这一条。重新启动系统,选择新编译的内核。要默认从新内核启动,将“default=1”修改。二、安装SCST(iSCSI Target)
2.1、安装SCST所需软件包
从新内核2.6.18-prep启动使用yum或者rpm命令安装如下软件包openssl-0.*openssl-devel-0.*2.2、安装SCST# cd /root/scst-1.0.1.1/src# make all# make install# cd /root/scstadmin-1.0.6# make all# make install# cd /root/iscsi-scst-1.0.1.1# make all# make install# cp etc/initiators.* /etc/# cp etc/iscsi-scstd.conf /etc/三、安装MHVTL3.1、安装MHVTL所需软件包
从新内核2.6.18-prep启动,使用yum或者rpm命令安装如下软件包zlib-1.*zlib-devel-1.*sg3_utils-libs-1.*sg3_utils-1.*lsscsi-0.*mt-st-0.*mtx-1.*3.2、安装MHVTL用chown -R root:root /storage/mhvtl-0.18和chmod -R 775 /storage/mhvtl-0.18命令分配用户和给予权限必须有vtl用户和vlt组(安装可以不使用vtl用户和vlt组,使用root用户)# mkdir -p /opt/mhvtl# mkdir -p /etc/mhvtl# chown -Rf vtl:vtl /opt/mhvtl# chown -Rf vtl:vtl /etc/mhvtl# chmod -R 775 /storage/mhvtl-0.18# cd /storage/mhvtl-0.18/kernel/# make# make install# cd /storage/mhvtl-0.18/# make# make install# /etc/init.d/mhvtl start四、配置虚拟磁带库
4.1、查看设备
从新内核2.6.18-prep启动(以下是一个事例)# /etc/init.d/mhvtl start先不要启动scst和iscsi-scst# lsscsi -g
disk
VMware
VMware Virtual S
1.0
/dev/sda
/dev/sg0
medium
STK
L700
550V
-
/dev/sg9
tape
IBM
ULT3580-TD5
550V
/dev/st0
/dev/sg1
tape
IBM
ULT3580-TD5
550V
/dev/st1
/dev/sg2
tape
IBM
ULT3580-TD4
550V
/dev/st2
/dev/sg3
tape
IBM
ULT3580-TD4
550V
/dev/st3
/dev/sg4
medium
SPECTRA
PYTHON
550V
-
/dev/sg10
tape
IBM
ULT3580-TD4
550V
/dev/st4
/dev/sg5
tape
IBM
ULT3580-TD4
550V
/dev/st5
/dev/sg6
tape
IBM
ULT3580-TD4
550V
/dev/st6
/dev/sg7
tape
IBM
ULT3580-TD4
550V
/dev/st7
/dev/sg8注:其中sg9和sg10是机械手。加载相关模块# modprobe scst# modprobe scst_tape# modprobe scst_changer修改启动脚本,来加载相应的程序。 # vi /etc/init.d/scst修改SCST_MODULES="scst scst-disk scst_vdisk"改为SCST_MODULES="scst scst_tape scst_changer"检查磁带和带库处理程序# cat /proc/scsi_tgt/scsi_tgtDevice (host:ch:id:lun or name)
Device handler0:0:0:0
none1:0:1:0
dev_tape1:0:2:0
dev_tape1:0:3:0
dev_tape1:0:4:0
dev_tape1:0:9:0
dev_tape1:0:10:0
dev_tape1:0:11:0
dev_tape1:0:12:0
dev_tape1:0:0:0
dev_changer1:0:8:0
dev_changer4.2、自动添加设备
将make_scst_config.sh拷贝到/root/脚本中IQN=iqn.2010-10.com.mhvtl名称可以更改,在同一网段内需要更改使用不同名称# chmod -R 775 /root/make_scst_config.sh# ./make_scst_config.sh执行后出现如下显示表示成功检查/etc/iscsi-scstd.conf和/etc/scst.conf有类似如下信息,表示设备添加成功(注意设备号是否对应)# cat /etc/iscsi-scstd.confTarget iqn.2010-10.com.mhvtl:1:0:0:0Target iqn.2010-10.com.mhvtl:1:0:1:0Target iqn.2010-10.com.mhvtl:1:0:2:0Target iqn.2010-10.com.mhvtl:1:0:3:0Target iqn.2010-10.com.mhvtl:1:0:4:0Target iqn.2010-10.com.mhvtl:1:0:8:0Target iqn.2010-10.com.mhvtl:1:0:9:0Target iqn.2010-10.com.mhvtl:1:0:10:0Target iqn.2010-10.com.mhvtl:1:0:11:0Target iqn.2010-10.com.mhvtl:1:0:12:0 # cat /etc/scst.confDEVICE 1:0:0:0DEVICE 1:0:8:0DEVICE 1:0:1:0DEVICE 1:0:2:0DEVICE 1:0:3:0DEVICE 1:0:4:0DEVICE 1:0:9:0DEVICE 1:0:10:0DEVICE 1:0:11:0DEVICE 1:0:12:0DEVICE 1:0:0:0,0DEVICE 1:0:1:0,0DEVICE 1:0:2:0,0DEVICE 1:0:3:0,0DEVICE 1:0:4:0,0DEVICE 1:0:8:0,0DEVICE 1:0:9:0,0DEVICE 1:0:10:0,0DEVICE 1:0:11:0,0DEVICE 1:0:12:0,04.3、启动服务
启动:# /etc/init.d/mhvtl start# /etc/init.d/scst start# /etc/init.d/iscsi-scst start停止# /etc/init.d/iscsi-scst stop# /etc/init.d/scst stop# /etc/init.d/mhvtl stop 没有去做一些实验,但是感觉不错。
大家可以体验一下虚拟带库。 我也是刚才学的,也还没和oracle有机的结合
页:
[1]