Creating an iSCSI Initiator

This will create an iSCSI Initiator, which is the term used for the "client" in an iSCSI environment. An Initiator uses the block devices provided by a target. If you want to know how to build your own target, see Building iSCSI target device. That article also has links to some nice appliance distributions which provide iSCSI targets (see bottom of article).

Your initiator can be a server, a workstation, anything which needs access to a very efficient block device available over a network.

Building an iSCSI initiator is fairly straight forward under Debian Wheezy. I use open-iscsi for this.

apt-get install open-iscsi
# edit /etc/iscsi/iscsid.conf and change the following line to bring 
# up iSCSI automatically # node.startup = automatic /etc/init.d/open-iscsi restart

With open-iscsi started, you now need to find the targets you want to connect to. I strongly recommend you set static IP's on your iSCSI targets, or be sure you use sticky IP's from your DHCP. I'm using the IP address in the following

# first, find out what targets are offered by the target machine
iscsiadm -m discovery -t st -p # now, display which nodes exist
iscsiadm -m node # Using the output of the above command, create an entry in the
# local iSCSI configuration and log into the machine.
# The iqn and ip are taken from the output of the previous command iscsiadm -m node --targetname "" --portal "" --login


Now that you have it, what do you do with it? Well, that depends on what it is you're getting.

Raw Device

If you are using a raw device, udev will automatically assign it a hard drive name (ie, /dev/sdb, /dev/sdx), but I have seen that change depending on your boot. You can always figure it out, then use the UUID or LABEL to mount it automagically, but there is one place (on Debian) where it is always the same; /dev/disk/by-path

To find a persistent drive name, look in

ls /dev/disk/by-path/

You will find a link in the form of: ip-ipaddress:port-iscsi-iqn-lun-#. So, if you are attaching to, port 3620, with an iqn of 2013-01-com.example:test on LUN 1, you will see:


this will persist across all Debian servers (at least)

See iSCSI tricks and techniques for some of the ways of manipulating your targets.

Debian brings up iscsi drives before network, so we must re-order on initiator. Tried _netdev, but did not work as advertised. Also, Debian will shut down iSCSI before Xendomains, effectively yanking the drives out from under running DOMU's. Need to fix this also.


Last update:
2015-08-05 08:19
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.