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