Jul 312014
 

This article will show you how to configure Open-iSCSI initiator (client) to connect to an existing iSCSI target (server).  I will not actually review how to  setup the  iSCSI Target in this article.   If you don’t already have an iSCSI Target available in your environent, you might take a look at OpenFiler.

In this guide, I am using a CentOS 6.5 system as the iSCSI initiator (client) and will connect to an existing iSCSI target.

Install the Open-iSCSI software

On my CentOS 6.5 system, the Open-iSCSI package is not installed by default.  You can check to see if your system has the package installed by running the following command:

[root@linux ~]# rpm -qa | grep iscsi-initiator-utils

If the iscsi-initiator-utils package is not already installed, use the “yum” command to install it:

[root@linux ~]# yum install iscsi-initiator-utils

Start the iSCSI service

After installing the iscsi-initiator-utils packs, start the iscsid service and configure both the iscsid and iscsi services to automatically start each time the system boots:

[root@linux ~]# /etc/init.d/iscsid start
[root@linux ~]# chkconfig iscsid on
[root@linux ~]# chkconfig iscsi on

Discover iSCSI Targets

Use the iscsiadm command to discover all of the iSCSI targets on your iSCSI Target server (i.e. your iSCSI SAN.  In this case my server running OpenFiler):

[root@linux ~]# iscsiadm -m discovery -t sendtargets -p 192.168.197.201
192.168.197.201:3260,1 iqn.2006-01.com.openfiler:tsn.target1

Note: In my example, the hostname of my iSCSI Target (SAN) is “openfiler.mydomain.com” and has an IP address of 192.168.197.201

Login to the iSCSI Target and configure automatic login at boot time

[root@linux ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler:tsn.target1 -p 192.168.197.201 --login
[root@linux ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler:tsn.target1 -p 192.168.197.201 --op update -n node.startup -v automatic

Verify iSCSI session is active

[root@linux ~]# iscsiadm -m session
tcp: [1] 192.168.197.201:3260,1 iqn.2006-01.com.openfiler:tsn.target1

Identify which device the iSCSI target maps to

[root@linux ~]# (cd /dev/disk/by-path; ls -l *iscsi* | awk '{FS=" "; print $9 " " $10 " " $11}')
ip-192.168.197.201:3260-iscsi-iqn.2006-01.com.openfiler:tsn.target1-lun-0 -> ../../sdc

This tells us that the iSCSI target has been mapped to /dev/sdc on the system.  From here, use standard partitioning/formatting commands (fdisk, mkfs, etc) to setup the disk as desired!

 Posted by at 4:57 pm

  4 Responses to “Step By Step: Connect to an iSCSI target using Open-iSCSI initiator software”

  1. Hi,
    Using Centos nodes & Openfiler. Quorum disk shows up as sdb on node1 and the quorum disk is sdc on node2. Similarly shared-disk is sdc on node1 and sdb on node2. I have tried rediscovering the targets(logout,delete,discover & relogin) and reloading the iscsi service as well. Getting a couple of disks for “quorum” disk and “shared disk” i.e a total of 4 disks on 1 node each…maybe the 2 interfaces which I am using on the virtual-box is giving this o/p !!!!. Is there any way to fix this.

  2. You should be able to create udev rules to accomplish this. Here are some links that may help:

    https://jablonskis.org/2011/persistent-iscsi-lun-device-name/index.html

    http://www.cyberciti.biz/tips/linux-assign-static-names-to-scsi-devices.html

    Hope this helps,
    TonyT

  3. Hi, i belierve that i ssaw you visited my weblog soo i got here to
    return the choose?.I’m attempting to to ind things to enhance mmy site!I
    assume iits ok to make use of some of your ideas!!

  4. It must be cutting edge, vibrant, a very good selling tool until have
    a live question.It is a huge distinction that you really,
    really need to bbe sure you get. In CPA marketing, making of sales iss not
    necessary.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)