DOC

RHEL_5_ISCSI_Install

By Lester Elliott,2014-10-08 15:18
8 views 0
RHEL_5_ISCSI_Install

     RHEL 5 ISCSI Install

1. 安装,

    yum install iscsi-initiator-utils

Check

    [root@rhel5 /]# rpm -qa|grep iscsi iscsi-initiator-utils-6.2.0.742-0.5.el5

启动iSCSI服务,

    /etc/init.d/iscsi start

    备注,可以不用更改/etc/iscsi/iscsi.conf任何参数?大部分用默认的即可

搜索target

    iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260

iSCSI登陆,

    iscsiadm -m node -T iqn.2006-04.wenzk.net:storage -p 192.168.1.1:3260 l

    备注,Login后会自动记录该SessionSession自动保存在

    /var/lib/iscsi/send_targets/?下次iSCSI服务启动时自动调用该Session

如果没有错误提示?可以使用dmesg看到新的SCSI设备了

    可以使用mount进行操作。

iSCSI登出,

    iscsiadm -m node -T iqn.2006-04.wenzk.net:storage -p 192.168.1.1:3260 u

iSCSI删除,

    iscsiadm -m node -o delete -T iqn.2006-04.wenzk.net:storag --portal

    192.168.1.1:3260

iSCSI 会话具体信息,

    iscsiadm -m session -i|more

    [root@rhel5 /]# iscsiadm -m session -i|more iscsiadm version 2.0-742

    ************************************

    Session (sid 0) using module tcp: ************************************ TargetName: iqn.1992-04.com.emc:ax.fcnpr054300275.a0

    Portal Group Tag: 1

    Network Portal: 192.168.1.10:3260 iSCSI Connection State: LOGGED IN Internal iscsid Session State: NO CHANGE

************************

    Negotiated iSCSI params:

    ************************

    HeaderDigest: None

    DataDigest: None

    MaxRecvDataSegmentLength: 65536 MaxXmitDataSegmentLength: 65536 FirstBurstLength: 0

    MaxBurstLength: 262144

    ImmediateData: No

    InitialR2T: Yes

    MaxOutstandingR2T: 1

************************

    Attached SCSI devices:

    ************************

    Host Number: 3 State: running

scsi3 Channel 00 Id 0 Lun: 0

    Attached scsi disk sdb State: running

    scsi3 Channel 00 Id 0 Lun: 1

    Attached scsi disk sdc State: running

    ************************************ Session (sid 1) using module tcp: ************************************ TargetName: iqn.1992-04.com.emc:ax.fcnpr054300275.b0

    Portal Group Tag: 2

    Network Portal: 192.168.1.11:3260 iSCSI Connection State: LOGGED IN Internal iscsid Session State: NO CHANGE

************************

    Negotiated iSCSI params:

    ************************

    HeaderDigest: None

    DataDigest: None

    MaxRecvDataSegmentLength: 65536

MaxXmitDataSegmentLength: 65536

    FirstBurstLength: 0

    MaxBurstLength: 262144

    ImmediateData: No

    InitialR2T: Yes

    MaxOutstandingR2T: 1

************************

    Attached SCSI devices:

    ************************

    Host Number: 4 State: running

scsi4 Channel 00 Id 0 Lun: 0

    Attached scsi disk sdd State: running scsi4 Channel 00 Id 0 Lun: 1

    Attached scsi disk sde State: running

2. RHEL5 Open iSCSI配置文件,

    [root@rhel5 /]# ls -l /etc/iscsi/

    total 12

    -rw-r--r-- 1 root root 53 Jun 24 13:51 initiatorname.iscsi

    -rw------- 1 root root 5871 Jan 23 2007 iscsid.conf 备注, iscsid.conf默认的参数可以不用作更改就可以使用?若要配CHAP请该相应

    的参数

    [root@rhel5 ~]# grep -v "#" /etc/iscsi/iscsid.conf |grep -v "^$"

    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 = 10 node.conn[0].timeo.noop_out_timeout = 15 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 = 65536

3. RHEL 5 Open iSCSI DB

    [root@rhel5 /]# ls -l /var/lib/iscsi/ total 8

    drwxr-xr-x 4 root root 4096 Jul 28 11:27 nodes drwxr-xr-x 2 root root 4096 Jul 28 11:27 send_targets [root@rhel5 /]# ls -l /var/lib/iscsi/nodes/ total 8

    drw------- 2 root root 4096 Jul 28 11:27 iqn.1992-04.com.emc:ax.fcnpr054300275.a0 drw------- 2 root root 4096 Jul 28 11:27 iqn.1992-04.com.emc:ax.fcnpr054300275.b0

[root@rhel5 /]# ls -l /var/lib/iscsi/send_targets/

    total 4

    -rw------- 1 root root 527 Jul 28 11:27 192.168.1.10,3260

    备注,该文件是iSCSI session文件

    [root@rhel5 ~]# more /var/lib/iscsi/send_targets/192.168.1.10,3260 discovery.startup = manual

    discovery.type = sendtargets

    discovery.sendtargets.address = 192.168.1.10

    discovery.sendtargets.port = 3260

    discovery.sendtargets.continuous = 0

    discovery.sendtargets.send_async_text = 0

    discovery.sendtargets.auth.authmethod = None

    discovery.sendtargets.timeo.login_timeout = 15

    discovery.sendtargets.reopen_max = 5

    discovery.sendtargets.timeo.auth_timeout = 45

    discovery.sendtargets.timeo.active_timeout = 5

    discovery.sendtargets.timeo.idle_timeout = 60

    discovery.sendtargets.timeo.ping_timeout = 5

4. RHEL 5 Open iSCSI Command

[root@rhel5 /]# iscsi

    iscsiadm iscsid iscsi-iname iscsistart

    [root@rhel5 /]# iscsi-iname

    iqn.2005-03.com.redhat:01.70acbf9f6b3

    [root@rhel5 /]# iscsiadm

    iscsiadm -m discovery [ -dhV ] [ -t type -p ip:port [ -l ] ] | [ -p ip:port ] [ -o operation ] [ -n name ] [ -v value ]

    iscsiadm -m node [ -dhV ] [ -L all,manual,automatic ] [ -U all,manual,automatic ] [ -S ] [ [ -T targetname -p ip:port | -M sysdir ] [ -l | -u ] ] [ [ -o operation ] [ -n name ] [ -v value ] [ -p ip:port ] ]

    iscsiadm -m session [ -dhV ] [ -r sessionid [ -i | -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]

[root@rhel5 Documentation]# lsmod |grep iscsi

iscsi_tcp 25537 0

    libiscsi 26945 2 ib_iser,iscsi_tcp scsi_transport_iscsi 29001 4 ib_iser,iscsi_tcp,libiscsi scsi_mod 130893 10

    ib_iser,iscsi_tcp,libiscsi,scsi_transport_iscsi,sg,libata,mptsas,mptscsih,scsi_transport_sas,

    sd_mod

1. Open iSCSI内核原理图

2. Open iSCSI 登陆过程,

3. Multi Session原理,

4. Connection State:

参考,

    http://www.open-iscsi.org/

    http://blog.chinaunix.net/u/27852/article_43965.html

http://en.wikipedia.org/wiki/Iscsi

    http://linuxwiki.us.dell.com/Linux_iSCSI_Support

Report this document

For any questions or suggestions please email
cust-service@docsford.com