RHEL 5 iSCSI-Target配置

 
 
开源的LINUX下的iSCSI-Target软件以前只有iSCSI Enterprise Target一种,但在RHEL 5中红帽公司已经放出了红帽的iSCSI-Target软件,只不过该iSCSI-Target软件采用的并非标准的iSCSI协议,用该iSCSI-Target软件做成的IPSAN只能用 LINUX下的iscsi-initiator来连接。WINDOWSAIX下的iscsi-initiator软件只能发现iSCSI磁盘,但是没有磁盘的驱动,iscsi HBA卡更是无法链接该iSCSI-Target磁盘。所以RHEL 5 iSCSI-Target只能适合于全LINUX的环境。
 
 
1 、环境介绍
操作系统:CentOS 5.5
iSCSI-Target 软件:scsi-target-utils-0.0-6.20091205snap.el5_4.1
 
2 、软件安装:
# yum install scsi-target-utils
# service tgtd start
# chkconfig --level 2345 tgtd on
 
3 scsi-target-utils配置
scsi-target-utils 配置介绍文件:/usr/share/doc/scsi-target-utils-0.0/README.iscsi
一般我们只需要按照该文档一步一步就能正确配置成功scsi-target-utils
 
4 、一个实际配置案例:
image
tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2010-07.com.wish:ipsan-data
设置tid 1iqn号为:iqn.2010-07.com.wish:ipsan-data
 
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb1
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 2 -b /dev/sdb2
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 3 -b /dev/sdb3
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 4 -b /dev/sdb4
/dev/sdb1映射到tid 1lun 1/dev/sdb2映射到tid 1lun 2/dev/sdb3映射到tid 1lun3/dev/sdb4映射到tid 1lun 4,不同于其它的iscsi-target,这里 lun 0不能被映射。
 
tgtadm --lld iscsi --op bind --mode target --tid 1 -I 192.168.30.101
tgtadm --lld iscsi --op bind --mode target --tid 1 -I 192.168.30.102
只允许192.168.30.101192.168.30.101的客户端来连接此tid 1
 
 
5 、查看tgtadm配置情况
# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2010-07.com.wish:ipsan-data
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
        I_T nexus: 1
            Initiator: iqn.1994-05.com.redhat:2d2be11ee910
            Connection: 0
                IP Address: 192.168.30.101
    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: 304 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/sdb1
        LUN: 2
            Type: disk
            SCSI ID: IET     00010002
            SCSI SN: beaf12
            Size: 411 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/sdb2
        LUN: 3
            Type: disk
            SCSI ID: IET     00010003
            SCSI SN: beaf13
            Size: 3307 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/sdb3
        LUN: 4
            Type: disk
            SCSI ID: IET     00010004
            SCSI SN: beaf14
            Size: 2418 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/sdb4
    Account information:
    ACL information:
        192.168.30.101
        192.168.30.102
 
6 、保存配置
由于每次生启tgtd服务都会使以前的配置失效,所以我们把刚才所有的命令加入到/etc/rc.local文件中。
tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2010-07.com.wish:ipsan-data
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb1
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 2 -b /dev/sdb2
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 3 -b /dev/sdb3
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 4 -b /dev/sdb4
tgtadm --lld iscsi --op bind --mode target --tid 1 -I 192.168.30.101
tgtadm --lld iscsi --op bind --mode target --tid 1 -I 192.168.30.102

你可能感兴趣的:(职场,休闲,网络存储,ipsan)