為了給在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