back

iSCSI Initiator software

This page describes the installation of iSCSI Initiator software.

Kernel configuration

The software I use for this is from www.open-iscsi.org. The software consists of a kernel-part and a userland-part. The kernel-part is now part of the standard Linux kernel and doesn't need to be downloaded. It only needs to be part of your Linux kernel. Make sure it is configured in the kernel (install and reboot if necessary):
Device Drivers
	SCSI device support
		[v] SCSI low-level drivers
			[M] iSCSI initiator over TCP/IP
This creates the kernel module iscsi_tcp.ko (and uses / builds: libscsi_tcp, libiscsi, scsi_transport_iscsi).

Software creation and installation

Apparently, there is no official Slackware package for this software, so I'm installing it commando-style.
Get the entire software using Git or just download the most recent version:
Git version:

  git clone git://github.com/mikechristie/open-iscsi.git
  cd open-iscsi
  get checkout -b my_iscsi_branch origin/iscsi

Stable release:

  wget http://www.open-iscsi.org/bits/open-iscsi-2.0-873.tar.gz
  tar xzf open-iscsi-2.0-873.tar.gz
  cd open-iscsi

Compile:

  make 
  su -
  make install
This creates and installs (among others)
  • /usr/iscsid - iSCSI daemon
  • /usr/iscsiadmin - management application
  • /usr/iscsistart - boot'tool'
Also, a number of configuration files are created at /etc/iscsi.

Two changes are needed to make sure the initiator is started at boot. One is to start the daemon in /etc/rc.local, the other is to change the default node.startup setting so nodes will log on automatically.

/etc/rc.d/rc.local

Add this line to connect to all registered iSCSI devices:
# Log in to all discovered iSCSI devices
/sbin/iscsiadm -m node -L all

/etc/iscsi/iscsid.conf

Apply this change (change node.startup from "manual" to "automatic"):
-#node.startup="automatic"
+node.startup="automatic"

-node.startup="manual"
+#node.startup="manual"

/etc/iscsi/initiatorname.iscsi

The contents of this file identifies the Initiator to the target. Change the contents to something meaningfull and unique within your storage network.
I came up with this before I understood what it meant:
iqn.2012-07.nl.san:1234567890
TWA overload: this is the iqn of the acl in the tpg you created in your iSCSI target.

Configuration

The Initiator needs to initiate any connection between storage server and client. In the example storage server that was created when configuring the iSCSI Target software, a small iSCSI disk was made available.
To connect to a drive on some Target, the Initiator must first discover if there is an iSCSI target (st="send target") offered on the Target's IP addres (10.0.0.142 in this case):
(the two commands do the same. Pick one):
$ iscsiadm --mode discovery --type st --portal 10.0.0.142
$ iscsiadm -m discovery -t st -p 10.0.0.142
10.0.0.142:3260,1 iqn.2003-01.org.linux-iscsi.hermiod.i686:sn.b31d38f66410
This confirms there is a iSCSI target at that address at default port 3260. One target portal group (1) is discovered, named "iqn.2003-01.org.linux-iscsi.hermiod.i686:sn.b31d38f66410". Now, connect to all LUNs in that portal group assigned to this initiator:
$ iscsiadm -m node -L all
Logging in to [iface: default, target: iqn.2003-01.org.linux-iscsi.hermiod.i686:sn.b31d38f66410, portal: 10.0.0.142,3260] (multiple)
Login to [iface: default, target: iqn.2003-01.org.linux-iscsi.hermiod.i686:sn.b31d38f66410, portal: 10.0.0.142,3260] successful.
All iSCSI devices offered by the target should now be available on the client. Running 'dmesg' should show something like this:
$ dmesg
...
[40959.822268] scsi 15:0:0:0: Direct-Access     LIO-ORG  FILEIO           4.0  PQ: 0 ANSI: 5
[40959.822441] sd 15:0:0:0: Attached scsi generic sg2 type 0
[40964.576331] sd 15:0:0:0: [sdb] 20481 512-byte logical blocks: (10.4 MB/10.0 MiB)
...
The new device, /dev/sdb, can now be used as if it were a local disk.
back   (last change: 31-7-2012 14:21)