实验目的:构建SAN网络存储 实验环境:redhat 5.4三台,scanstorage作为存储服务,IP地址是:192.168.9.79。node1,node2作为客户端测试 实验步骤: 一、配置服务端: 1、添加一块20G的盘 [root@scanstorage ~]# fdisk -l |grep Disk Disk /dev/sdc: 21.4 GB, 21474836480 bytes 2、在RHEL5中安装如下的包: 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目录下) [root@scanstorage ~]# yum -y install iscsi-initiator-utils perl-Config-General scsi-target-utils 3、通过linux中的命令生成IQN编号 [root@scanstorage ~]# iscsi-iname iqn.1994-05.com.redhat:a3c8bc769291 4、编辑配置文件 [root@scanstorage ~]# vim /etc/tgt/targets.conf <target iqn.1994-05.com.redhat:4d4fa666619> backing-store /dev/sdb </target> 5、启动服务 [root@scanstorage ~]# /etc/init.d/tgtd start Starting SCSI target daemon: Starting target framework daemon 6、查看配置信息 [root@scanstorage ~]# tgtadm --lld iscsi --op show --mode target Target 1: iqn.1994-05.com.redhat:bc2c8763fcdb System information: Driver: iscsi State: ready I_T nexus information: LUN information: LUN: 0 Type: controller SCSI ID: IET 00010000 SCSI SN: beaf10 Size: 0 MB Online: Yes Removable media: No Backing store type: rdwr Backing store path: None LUN: 1 Type: disk SCSI ID: IET 00010001 SCSI SN: beaf11 Size: 21475 MB Online: Yes Removable media: No Backing store type: rdwr Backing store path: /dev/sdb Account information: ACL information: ALL [root@scanstorage ~]# 以上就是ISCSI服务的配置,注意,ISCSI的链接端口是3260,保证防火墙正常通过。接下来我们配置客户端。 二、配置客户端 客户端的配置的时候只需要安装一个ISCSI Initiator的包即可。以node1,node2为例: 1、安装包 [root@node1 ~]# yum -y install iscsi-initiator-utils [root@node2 ~]# yum -y install iscsi-initiator-utils 2、使用iSCSI存储 [root@node1 ~]# iscsiadm -m discovery -t st -p 192.168.9.79 192.168.9.79:3260,1 iqn.1994-05.com.redhat:bc2c8763fcdb [root@node2 ~]# iscsiadm -m discovery -t st -p 192.168.9.79 192.168.9.79:3260,1 iqn.1994-05.com.redhat:bc2c8763fcdb 在node1和node2上开启服务如下服务:iscsid network iscsi netfs,然后登录: [root@node1 ~]# iscsiadm -m node -T iqn.1994-05.com.redhat:bc2c8763fcdb -p 192.168.9.79 -l [root@node1 ~]# fdisk -l Disk /dev/sda: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 3393 27254241 83 Linux /dev/sda2 3394 3915 4192965 82 Linux swap / Solaris Disk /dev/sdb: 21.4 GB, 21474836480 bytes64 heads, 32 sectors/track, 20480 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Disk /dev/sdb doesn't contain a valid partition table [root@node1 ~]# iscsiadm -m node -T iqn.1994-05.com.redhat:bc2c8763fcdb -p 192.168.9.79 -l [root@node2 ~]# fdisk -l Disk /dev/sda: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 3393 27254241 83 Linux /dev/sda2 3394 3915 4192965 82 Linux swap / Solaris Disk /dev/sdb: 21.4 GB, 21474836480 bytes64 heads, 32 sectors/track, 20480 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Disk /dev/sdb doesn't contain a valid partition table