首先安装AS5 U4,完毕后安装需要的rpm:
iscsi-initiator-utils-6.2.0.868-0.18.el5.i386.rpm
perl-Config-General-2.40-1.el5.noarch.rpm
scsi-target-utils-0.0-5.20080917snap.el5.i386.rpm (这个包在光盘的cluster storage目录下)
安装完毕后执行:
dd if=/dev/zero of=/root/test.img bs=1k count=5M
此句相当于建立一个5GB的img文件。(也可以使用实际的物理硬盘或是分区)
创建完毕后编辑vi /etc/tgt/targets.conf,增加如下内容:
<target iqn.2009-4.maxiaohui.cc:storage>
# List of files to export as LUNs
backing-store /root/test.img
# Authentication :
# if no "incominguser" is specified, it is not used
#incominguser backup secretpass12
# Access control :
# defaults to ALL if no "initiator-address" is specified
#initiator-address 192.168.1.2
</target>
然后启动tgtd服务,如果已经启动,请先kill掉:
service tgtd start
如果没有报错,请执行:
tgtadm --lld iscsi --op show --mode target
输出如下:
[root@localhost iscsi]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2009-4.maxiaohui.cc:storage
System information:
Driver: iscsi
State: ready
LUN information:
LUN: 0
Type: controller
SCSI ID: deadbeaf1:0
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store: No backing store
LUN: 1
Type: disk
SCSI ID: deadbeaf1:1
SCSI SN: beaf11
Size: 5369 MB
Online: Yes
Removable media: No
Backing store: /root/test.img
Account information:
ACL information:
ALL
则说明配置成功,使用iSCSI Initiator就可以了,连接方法请参见相关文档。并注意将Linux防火墙允许3260端口。
客户端配置:
1、安装iscsi-initiator包
2、启动iscsi服务
#service iscsi restart
3、搜寻盘阵
#iscsiadm --mode discovery --type sendtargets --portal 192.168.210.150 IP地址为:iscsi target IP
或
#iscsiadm -m discovery -t sendtargets -p 192.168.210.150:3260
返回结果:
192.168.210.150:3260,1 iqn.2010-06.rhel55:tgtd
iscsi target 服务端口:3260
iscsi target 名称:iqn.2010-06.rhel55:tgtd
4、显示盘阵
#iscsiadm --mode node
返回结果:
192.168.210.150:3260,1 iqn.2010-06.rhel55:tgtd
5、登陆盘阵
#iscsiadm --mode node --targetname iqn.2010-06.rhel55:tgtd --portal 192.168.210.150:3260 --login
或
#iscsiadm -m node -T iqn.2010-06.rhel55:tgtd -p 192.168.210.150:3260,1 -1
返回结果:
Logging in to [iface: default, target: iqn.2010-06.rhel55:tgtd, portal: 192.168.210.150,3260]
Login to [iface: default, target: iqn.2010-06.rhel55:tgtd, portal: 192.168.210.150,3260]: successful
退出盘阵:
#iscsiadm -m node -T iqn.2010-06.rhel55:tgtd -p 192.168.210.150:3260,1 -u
6、完成以上步骤后在iscsi target端可以查看target当状连接状态
[root@udb01 sch]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2010-06.rhel55:tgtd
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 2
Initiator: iqn.1994-05.com.redhat:c82fc63ea12f
Connection: 0
IP Address: 192.168.210.155
I_T nexus: 4
Initiator: iqn.1994-05.com.redhat:1f82a0b7c92f
Connection: 0
IP Address: 192.168.210.156
LUN information:
LUN: 0
Type: controller
SCSI ID: deadbeaf1:0
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store: No backing store
LUN: 1
Type: disk
SCSI ID: deadbeaf1:1
SCSI SN: beaf11
Size: 4295 MB
Online: Yes
Removable media: No
Backing store: /u01/sch/sharedisk.img
Account information:
ACL information:
ALL
7、设置自启动盘阵服务
vi /etc/iscsi/iscsi.conf
*****************
# Startup settings
#*****************
iscsiadm --mode node --targetname iqn.2010-06.rhel55:tgtd --portal 192.168.210.150:3260 --login
完成以上步骤后可以正常分区格式化。