help iscsi-initiator discovery

13 views
Skip to first unread message

xi qihao

unread,
Nov 19, 2009, 3:36:53 AM11/19/09
to open-...@googlegroups.com
Hi all:

I a newbie of iscsi. Now I use two PC to test software iscsi.
My problem is how to fix connect of iscsi target?

The below are the detail:
SAN: iscsi target device ip: 192.168.3.2
master: iscsi initiator ip: 192.168.3.124

1. configure on SAN
1)install iscsi-target
[root@SAN ~]# yum -y install scsi-target-utils

2)create two files
[root@SAN ~]# dd if=/dev/zero of=/lun/lun1.img bs=1M count=4096
[root@SAN ~]# dd if=/dev/zero of=/lun/lun2.img bs=1M count=4096

3)add the content to /etc/tgt/targets.conf
<target iqn.2009-09.com.test:sa-1:tgtd>
backing-store /lun/lun1.img
initiator-address 192.168.3.124
</target>
<target iqn.2009-09.com.test:sa-2:tgtd>
backing-store /lun/lun2.img
initiator-address 192.168.3.124
</target>

4) restart tgt service
[root@SAN tgt]# /etc/init.d/tgtd restart

5) check iscsi target
[root@SAN tgt]# tgtadm --op show --mode target
Target 1: iqn.2009-09.com.test:sa-1:tgtd
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 8
Initiator: iqn.1994-05.com.redhat:155e0ebbe8c
Connection: 0
IP Address: 192.168.3.124
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: /lun/lun1.img
Account information:
ACL information:
192.168.3.124
Target 2: iqn.2009-09.com.test:sa-2:tgtd
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 7
Initiator: iqn.1994-05.com.redhat:155e0ebbe8c
Connection: 0
IP Address: 192.168.3.124
LUN information:
LUN: 0
Type: controller
SCSI ID: deadbeaf2:0
SCSI SN: beaf20
Size: 0 MB
Online: Yes
Removable media: No
Backing store: No backing store
LUN: 1
Type: disk
SCSI ID: deadbeaf2:1
SCSI SN: beaf21
Size: 4295 MB
Online: Yes
Removable media: No
Backing store: /lun/lun2.img
Account information:
ACL information:
192.168.3.124

2 configure iscsi initiator on master
1) install
[root@master ~]# rpm -ql iscsi-initiator-utils

2) discovery iscsi target
[root@master scsi]# iscsiadm -m discovery -t sendtargets -p 192.168.3.2
192.168.3.2:3260,1 iqn.2009-09.com.test:sa-1:tgtd
192.168.3.2:3260,1 iqn.2009-09.com.test:sa-2:tgtd

3) check
[root@master scsi]# sfdisk -s
/dev/sda: 78150744
/dev/sdb: 4194304
/dev/sdc: 4194304
total: 86539352 blocks

[root@master scsi]# fdisk -l

Disk /dev/sdb: 4294 MB, 4294967296 bytes
Disk /dev/sdc: 4294 MB, 4294967296 bytes


My problem is how to setup fix connect on master after reboot?
ex: lun1.img /dev/sdb lun2.img /dev/sdc
if lun1.img does not exist, lun2.img is still /dev/sdc.
How can I configure it? I should set tgt or initiator?

Thanks!

Mike Christie

unread,
Nov 19, 2009, 3:04:32 PM11/19/09
to open-...@googlegroups.com
What distro are you using? If you look in /dev/disk/by-id there should
be names that are persistent across reboots.

xi qihao

unread,
Nov 19, 2009, 11:12:23 PM11/19/09
to open-...@googlegroups.com
It is CentOS (2.6.18-128.1.16.el5xen) x86_64

[root@master ~]# ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx 1 root root 9 Nov 20 11:00
scsi-SATA_WDC_WD800BD-22M_WD-WMAM9YU42742 -> ../../sda
lrwxrwxrwx 1 root root 10 Nov 20 11:00
scsi-SATA_WDC_WD800BD-22M_WD-WMAM9YU42742-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 20 11:00
scsi-SATA_WDC_WD800BD-22M_WD-WMAM9YU42742-part2 -> ../../sda2
lrwxrwxrwx 1 root root 9 Nov 20 11:01 scsi-S_beaf11 -> ../../sdc
lrwxrwxrwx 1 root root 10 Nov 20 11:01 scsi-S_beaf11-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 9 Nov 20 11:01 scsi-S_beaf21 -> ../../sdb

you mean scsi-S_beaf are persistent?


Mike Christie

unread,
Nov 23, 2009, 6:31:06 PM11/23/09
to open-...@googlegroups.com
xi qihao wrote:
>> What distro are you using? If you look in /dev/disk/by-id there should
>> be names that are persistent across reboots.
>
> It is CentOS (2.6.18-128.1.16.el5xen) x86_64
>
> [root@master ~]# ls -l /dev/disk/by-id/
> total 0
> lrwxrwxrwx 1 root root 9 Nov 20 11:00
> scsi-SATA_WDC_WD800BD-22M_WD-WMAM9YU42742 -> ../../sda
> lrwxrwxrwx 1 root root 10 Nov 20 11:00
> scsi-SATA_WDC_WD800BD-22M_WD-WMAM9YU42742-part1 -> ../../sda1
> lrwxrwxrwx 1 root root 10 Nov 20 11:00
> scsi-SATA_WDC_WD800BD-22M_WD-WMAM9YU42742-part2 -> ../../sda2
> lrwxrwxrwx 1 root root 9 Nov 20 11:01 scsi-S_beaf11 -> ../../sdc
> lrwxrwxrwx 1 root root 10 Nov 20 11:01 scsi-S_beaf11-part1 -> ../../sdc1
> lrwxrwxrwx 1 root root 9 Nov 20 11:01 scsi-S_beaf21 -> ../../sdb
>
> you mean scsi-S_beaf are persistent?
>

Yes.

qihao.xi

unread,
Nov 23, 2009, 8:01:03 PM11/23/09
to open-...@googlegroups.com
I use multipath-tools to check the iscsi. It recognize beaf11 and
beaf21. And configure a device map for it. Thanks!

>
>--
>
>You received this message because you are subscribed to the Google Groups "open-iscsi" group.
>To post to this group, send email to open-...@googlegroups.com.
>To unsubscribe from this group, send email to open-iscsi+...@googlegroups.com.
>For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=.
>
>
Reply all
Reply to author
Forward
0 new messages