Problem solve Get help with specific problems with your technologies, process and projects.

Hosting iSCSI Targets on Ubuntu Linux

Fibre Channel (FC) is dead, long live Internet Small Computer Systems Interface (iSCSI)! At least that is how our expert feels about the storage protocol. With the inevitable commoditization of 10 gigabit Ethernet at hand, FC is facing competition from iSCSI. This article introduces IT administrators to iSCSI and show how to host an iSCSI target on an Ubuntu Linux (Edgy Eft) server installation.

With Fibre Channel too expensive for most customers, the Internet Small Computer Systems Interface (iSCSI) protocol is poised to become the standard for architecting dedicated storage solutions. Small-to-medium businesses (SMBs) and enterprise customers alike should prepare for the inevitable adoption of iSCSI by encouraging their information technology staff to learn how to install and configure iSCSI today.

Here, we will show you how to install and configure the iSCSI Enterprise Target project on an Ubuntu Linux (Edgy Eft) server in order to expose an iSCSI target logical unit number (LUN) to be used by VMware ESX.

If you have not already installed and configured Ubuntu Linux, take a look at my guide on installing, configuring, and securing a basic Ubuntu Linux server installation. Once the operating system is up and running, download the latest stable sources for the iSCSI Enterprise Project (which is 0.4.15 at the time of this article).

For this article I am going to save the tarball in /usr/local/src. Change directories to /usr/local/src and decompress the tarball. A directory called iscsitarget-0.4.15 will be created. Compiling the iSCSI Enterprise Target is quite simple under Edgy; ensure that the following packages are installed:

build-essentials libssl-dev linux-headers-$(uname -r)

Then simply type make. Once the sources have compiled, type make install to install the binaries in their proper places. Save this source directory. If you want to, you can always type make uninstall to completely uninstall the program.

Now you need to expose a disk as an iSCSI LUN. This is a relatively painless process. At minimum, to create an iSCSI LUN, all you need to do is edit the file /etc/ietd.conf and create two lines:

Target iqn.2007-03.local.lostcreations:storage.disk1 Lun 0 Path=/dev/sdb,Type=blockio

Those two lines will expose the raw disk device /dev/sdb as an iSCSI LUN with an iSCSI qualified name (IQN). An iSCSI LUN's IQN is similar to a network device's DNS name. In fact, IQNs even have their own DNS server: an Internet Storage Name Service (iSNS) server. In a future article I will show you how to configure your very own iSNS server on Ubuntu. For now you obviously you need to edit your ietd.conf to match the path to your own raw disk. You will also want to make sure that your LUN's IQN is unique. For more information on IQNs simply type man ietd.conf from your server's console.

Once the LUN is configured type /etc/init.d/iscsitarget start to start the iSCSI Enterprise Target service.

Oops – it didn't start? That's because there's a bug in the init script. The init script is calling on /bin/sh but using a syntax that shell does not recognize. Edit the init script /etc/init.d/iscsitarget and replace the first line with '#!/bin/bash'. Now, you can start the service.

Type lsof | grep ietd and (if you have IPv6 support enabled) two lines will appear similar to the following:

ietd 14157 root 7u IPv6 8013732 TCP *:3260 (LISTEN) ietd 14157 root 8u IPv4 8013733 TCP *:3260 (LISTEN)

The iSCSI targets are now available on port 3260. Any client that can take advantage of iSCSI, such as VMware ESX, can now point to your server for its iSCSI needs.

About the author: Andrew Kutz is a Microsoft Certified Solutions Developer (MCSD) and a SANS/GIAC Certified Windows Security Administrator (GCWN). An avid fan of .NET, open source, Terminal Services, and coding, he is currently focused on the world of virtualization. Andrew graduated from the University of Texas at Austin with a B.A. in Ancient History and Classical Civilization and currently lives in Austin, Texas with his wife Mandy and their two puppies, Lucy and CJ.

Dig Deeper on Linux servers

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.