为了给在windows 2008 server R2上安装oracle10g rac的实验提供共享存储,用一台普通的linux 系统的PC机,安装iscsi target软件作为存储服务器。
我使用的redhat linux 4.8的系统,内核版本是2.6.9,这个版本只能使用比较老的iscsi target 0.4.0版本,现在最新版本已经到1.4.2了,下载路径为:http://sourceforge.net/projects/iscsitarget/files/iscsitarget/
这是我系统的分区情况:
[root@yy ~]# fdisk -l
Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3200 25599577+ 8e Linux LVM
/dev/sda3 3201 3983 6289447+ 82 Linux swap
/dev/sda4 3984 9726 46130647+ 5 Extended
/dev/sda5 3984 5808 14659281 83 Linux
/dev/sda6 5809 7633 14659281 83 Linux
sda5和sda6是我准备共享的分区。不过我在测试的时候只用到了sda5
安装配置步骤很简单,主要有如下几步:
上传安装文件到服务器的/tmp目录
[root@yy tmp]#gunzip iscsitarget-0.4.0.tar.gz
[root@yy tmp]#tar -xvf iscsitarget-0.4.0.tar
[root@yy tmp]#cd iscsitarget-0.4.0
下面开始正式安装。
在执行make和make install时需要指定kernel modules的目录,可以直接指定KERNELSRC环境变量,也可以在每个命令后面直接指定路径
[root@yy iscsitarget-0.4.0]# export KERNELSRC=/usr/src/kernels/2.6.9-89.EL-smp-i686
[root@yy iscsitarget-0.4.0]# make
make -C usr
make[1]: Entering directory `/tmp/iscsitarget-0.4.0/usr'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/tmp/iscsitarget-0.4.0/usr'
make modules -C /usr/src/kernels/2.6.9-89.EL-smp-i686 SUBDIRS=/tmp/iscsitarget-0.4.0/kernel
make[1]: Entering directory `/usr/src/kernels/2.6.9-89.EL-smp-i686'
CC [M] /tmp/iscsitarget-0.4.0/kernel/target_cmnd.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/iscsi.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/workerthread.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/config.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/digest.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/conn.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/session.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/target.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/volume.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/iotype.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/daemon.o
CC [M] /tmp/iscsitarget-0.4.0/kernel/file-io.o
LD [M] /tmp/iscsitarget-0.4.0/kernel/iscsi_trgt.o
Building modules, stage 2.
MODPOST
CC /tmp/iscsitarget-0.4.0/kernel/iscsi_trgt.mod.o
LD [M] /tmp/iscsitarget-0.4.0/kernel/iscsi_trgt.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.9-89.EL-smp-i686'
[root@yy iscsitarget-0.4.0]# make install
`usr/ietd' -> `/usr/sbin/ietd'
`usr/ietadm' -> `/usr/sbin/ietadm'
if [ -f /etc/debian_version ]; then \
install -v -m 755 etc/initd/initd.debian /etc/init.d/iscsi-target; \
elif [ -f /etc/redhat-release ]; then \
install -v -m 755 etc/initd/initd.redhat /etc/init.d/iscsi-target; \
elif [ -f /etc/slackware-version ]; then \
install -v -m 755 etc/initd/initd /etc/rc.d/iscsi-target; \
else \
install -v -m 755 etc/initd/initd /etc/init.d/iscsi-target; \
fi
`etc/initd/initd.redhat' -> `/etc/init.d/iscsi-target'
install: creating directory `/lib/modules/2.6.9-89.ELsmp/kernel/iscsi'
`kernel/iscsi_trgt.ko' -> `/lib/modules/2.6.9-89.ELsmp/kernel/iscsi/iscsi_trgt.ko'
depmod -aq
安装完成,剩下的就是稍微配置一下。
[root@yy iscsitarget-0.4.0]# cp etc/ietd.conf /etc
现在是我测试用的iscsi target配置文件。
[root@yy iscsitarget-0.4.0]# vi /etc/ietd.conf
# Example iscsi target configuration
#
# Everything until the first target definition belongs
# to the global configuration.
# Right now this is only the user configuration used
# during discovery sessions:
#User joe secret