一、编译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.patch 1.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 [0:0:0:0]
disk
VMware
VMware Virtual S
1.0
/dev/sda
/dev/sg0 [1:0:0:0]
medium
STK
L700
550V
-
/dev/sg9 [1:0:1:0]
tape
IBM
ULT3580-TD5
550V
/dev/st0
/dev/sg1 [1:0:2:0]
tape
IBM
ULT3580-TD5
550V
/dev/st1
/dev/sg2 [1:0:3:0]
tape
IBM
ULT3580-TD4
550V
/dev/st2
/dev/sg3 [1:0:4:0]
tape
IBM
ULT3580-TD4
550V
/dev/st3
/dev/sg4 [1:0:8:0]
medium
SPECTRA
Python
550V
-
/dev/sg10 [1:0:9:0]
tape
IBM
ULT3580-TD4
550V
/dev/st4
/dev/sg5 [1:0:10:0]
tape
IBM
ULT3580-TD4
550V
/dev/st5
/dev/sg6 [1:0:11:0]
tape
IBM
ULT3580-TD4
550V
/dev/st6
/dev/sg7 [1:0:12:0]
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_tgt Device (host:ch:id:lun or name)
Device handler 0:0:0:0
none 1:0:1:0
dev_tape 1:0:2:0
dev_tape 1:0:3:0
dev_tape 1:0:4:0
dev_tape 1:0:9:0
dev_tape 1:0:10:0
dev_tape 1:0:11:0
dev_tape 1:0:12:0
dev_tape 1:0:0:0
dev_changer 1:0:8:0
dev_changer 4.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.conf Target iqn.2010-10.com.mhvtl:1:0:0:0 Target iqn.2010-10.com.mhvtl:1:0:1:0 Target iqn.2010-10.com.mhvtl:1:0:2:0 Target iqn.2010-10.com.mhvtl:1:0:3:0 Target iqn.2010-10.com.mhvtl:1:0:4:0 Target iqn.2010-10.com.mhvtl:1:0:8:0 Target iqn.2010-10.com.mhvtl:1:0:9:0 Target iqn.2010-10.com.mhvtl:1:0:10:0 Target iqn.2010-10.com.mhvtl:1:0:11:0 Target iqn.2010-10.com.mhvtl:1:0:12:0 # cat /etc/scst.conf [HANDLER changer] DEVICE 1:0:0:0 DEVICE 1:0:8:0 [HANDLER tape] DEVICE 1:0:1:0 DEVICE 1:0:2:0 DEVICE 1:0:3:0 DEVICE 1:0:4:0 DEVICE 1:0:9:0 DEVICE 1:0:10:0 DEVICE 1:0:11:0 DEVICE 1:0:12:0 [GROUP Default_iqn.2010-10.com.mhvtl:1:0:0:0] [GROUP Default_iqn.2010-10.com.mhvtl:1:0:1:0] [GROUP Default_iqn.2010-10.com.mhvtl:1:0:2:0] [GROUP Default_iqn.2010-10.com.mhvtl:1:0:3:0] [GROUP Default_iqn.2010-10.com.mhvtl:1:0:4:0] [GROUP Default_iqn.2010-10.com.mhvtl:1:0:8:0] [GROUP Default_iqn.2010-10.com.mhvtl:1:0:9:0] [GROUP Default_iqn.2010-10.com.mhvtl:1:0:10:0] [GROUP Default_iqn.2010-10.com.mhvtl:1:0:11:0] [GROUP Default_iqn.2010-10.com.mhvtl:1:0:12:0] [ASSIGNMENT Default_iqn.2010-10.com.mhvtl:1:0:0:0] DEVICE 1:0:0:0,0 [ASSIGNMENT Default_iqn.2010-10.com.mhvtl:1:0:1:0] DEVICE 1:0:1:0,0 [ASSIGNMENT Default_iqn.2010-10.com.mhvtl:1:0:2:0] DEVICE 1:0:2:0,0 [ASSIGNMENT Default_iqn.2010-10.com.mhvtl:1:0:3:0] DEVICE 1:0:3:0,0 [ASSIGNMENT Default_iqn.2010-10.com.mhvtl:1:0:4:0] DEVICE 1:0:4:0,0 [ASSIGNMENT Default_iqn.2010-10.com.mhvtl:1:0:8:0] DEVICE 1:0:8:0,0 [ASSIGNMENT Default_iqn.2010-10.com.mhvtl:1:0:9:0] DEVICE 1:0:9:0,0 [ASSIGNMENT Default_iqn.2010-10.com.mhvtl:1:0:10:0] DEVICE 1:0:10:0,0 [ASSIGNMENT Default_iqn.2010-10.com.mhvtl:1:0:11:0] DEVICE 1:0:11:0,0 [ASSIGNMENT Default_iqn.2010-10.com.mhvtl:1:0:12:0] DEVICE 1:0:12:0,0 4.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 |