Rhel 5.4 iscsi target 和iscsi initer配置

本文介绍如何配置iSCSI目标端和服务端。通过安装必要的rpm包,创建虚拟磁盘,并配置目标和服务,实现iSCSI存储共享。客户端通过iscsiadm命令进行连接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 
首先安装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

完成以上步骤后可以正常分区格式化。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值