Centos 5 上配置 iSCSI 設定

  • 安裝 iscsitarget
    yum install kernel-devel openssl-devel gcc rpm-build
    rpm -q kernel-devel openssl-devel gcc rpm-build
    wget http://downloads.sourceforge.net/project/iscsitarget/iscsitarget/1.4.18/iscsitarget-1.4.18.tar.gz
    tar -xvf iscsitarget-1.4.18.tar.gz
    cd iscsitarget-1.4.18
    make 
    make install

看執行過程

  • 建立 iSCSI 使用硬碟空間區塊
    make /data1t/iSCSI
    dd if=/dev/zero of=/data1t/iSCSI/LUN0 bs=1024 count=40000
    dd if=/dev/zero of=/data1t/iSCSI/LUN1 bs=1024 count=40000
  • 設定 IET daemon
    vi /etc/initiators.allow
    #iqn.<year>-<month>.<hostname>:<LVM diskname>
    #iqn.2009-03.pd920:mydiskname
    ALL 192.168.11.236
    vi /etc/initiators.deny
    #ALL:ALL
    vi /etc/ietd.conf
    Target iqn.2009-10.com.ichiayi:storage.data1t.iscsi.data01
            #IncomingUser trysoft trysoft
            #OutgoingUser trysoft trysoft
            Lun 0 Path=/data1t/iSCSI/LUN0,Type=fileio
            Lun 1 Path=/data1t/iSCSI/LUN1,Type=fileio
            Lun 2 Path=/data1t/iSCSI/LUN2,Type=fileio
            Alias iSCSI for ichiayi
            MaxConnections          1
            InitialR2T              Yes
            ImmediateData           Yes
  • 設定與啟動 iSCSI-Target 服務
    chkconfig iscsi-target on
    service iscsi-target start
  • 安裝 iscsi-initiator-utils
    yum install iscsi-initiator-utils
  • 設定與啟動 iSCSI-initiator
    vi  /etc/iscsi/iscsid.conf 
    node.startup = automatic
    node.session.timeo.replacement_timeout = 120
    node.conn[0].timeo.login_timeout = 15
    node.conn[0].timeo.logout_timeout = 15
    node.conn[0].timeo.noop_out_interval = 15
    node.conn[0].timeo.noop_out_timeout = 15
    node.session.initial_login_retry_max = 10
    node.session.cmds_max = 128
    node.session.queue_depth = 32
    node.session.iscsi.InitialR2T = No
    node.session.iscsi.ImmediateData = Yes
    node.session.iscsi.FirstBurstLength = 262144
    node.session.iscsi.MaxBurstLength = 16776192
    node.conn[0].iscsi.MaxRecvDataSegmentLength = 131072
    discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
    node.session.iscsi.FastAbort = No
    vi /etc/iscsi/initiatorname.iscsi
    InitiatorName=iqn.2009-10.com.ichiayi:vm-mail
    chkconfig --list | grep iscsi

看執行過程

  • 找尋 iSCSI-target 與重起 iSCSI-initiator
    iscsiadm -m discovery -t sendtargets -p 192.168.11.250
    service iscsi restart

看執行過程

  • 如果出現無法登入的狀況,可能要調整權限設定的部份
  • 可以透過 iscsiadm 工具執行檢視問題點 Exp.
    iscsiadm -m node -p 192.168.11.250 -T iqn.2009-10.com.ichiayi:storage.data1t.iscsi.data01 -l -d 10
      * 如果有正常連上就會有以上的訊息 login to [xxx] : successful 
  • 使用 iSCSI 磁碟
    fdisk -l 
  • tech/centos_iscsi.txt
  • 上一次變更: 2022/06/10 09:07
  • jonathan