create your own iSCSI Target (with Linux…)

You don’t know what an iSCSI Target is? Well simply an iSCSI Target is the “device” that represents a logical disk volume on an iSCSI Server. If you don’t know what iSCSI is – please read here and come back.

So let’s take the case that you would like to make a harddisk volume available across the network. The best block oriented protocol that you could use (and the best sounding…BUZZWOOOOOOORD!) is iSCSI. So there are some commercial iSCSI Implementations for Windows and there are some iSCSI Implementations for Linux. Today cosrahn implemented a solution based on the Linux iSCSI Enterprise Target Project.

This article will give you a list of things you have to do to get it to work by yourself:

You would need:

  1. a linux server with a kernel version 2.6.11 or later

  2. a free disk volume/partition/block device (even a file)

  3. a direct network connection to the machine that would like to use the iSCSI Target

    1. alternatively you have a iSCSI enabled network switch…quite expensive…

  4. a linux or windows machine that has an iSCSI Initiator installed

The iSCSI Initiator is the client part of the solution. It can either be software (like the Microsoft iSCSI Initiator) or hardware (like the Adaptec 7211C). In our case it’s a complete software solution.

Cosrahn installed a Gentoo Linux with a kernel. That took the most of the setup-time. Then he downloaded the source from the iSCSI Enterprise Target page and compiled and installed it.

Then he edited the config file in /etc/ietd.conf:

# iscsi target configuration

# the password NEEDs to be minimum 12 characters to be standard conform
IncomingUser username longpassword

# Targets definitions start with “Target” and the target name.
# The target name must be a globally unique name, the iSCSI
# standard defines the “iSCSI Qualified Name” as follows:
# iqn.yyyy-mm.[:identifier]
# “yyyy-mm” is the date at which the domain is valid and the identifier
# is freely selectable. For further details please check the iSCSI spec.


# Users, who can access this target
# (no users means anyone can access the target)

IncomingUser username specialtargetpassword

# Logical Unit definition
# You must define one logical unit at least.
# Block devices, regular files, LVM, and RAID can be offered
# to the initiators as a block device.
# in our case /dev/sda4 is a partition without any filesystem.

Lun 0 Path=/dev/sda4,Type=fileio

# Alias name for this target
Alias iSCSI-Test-Volume

# various iSCSI parameters
MaxConnections 1
InitialR2T Yes
ImmediateData Yes
MaxRecvDataSegmentLength 8192
MaxBurstLength 262144
FirstBurstLength 65536
DefaultTime2Wait 2
DefaultTime2Retain 20
MaxOutstandingR2T 8
DataPDUInOrder Yes
DataSequenceInOrder Yes
ErrorRecoveryLevel 0
#HeaderDigest CRC32C,None
#DataDigest CRC32C,None

After that we started the iSCSI Target daemon and configured the Windows Client to use the target.

This is the “startup-screen” of the Microsoft iSCSI Initiator.
You can see the node name of the iSCSI client.

This is the “iSCSI Server Discovery” Tab of the Initiator.
This is where you enter the “username” and the “longpassword”

Now there’s the Target Tab of the iSCSI Initiator. If you entered the Logon-Information to the iSCSI Server correctly you should see the target that are exported by the iSCSI Enterprise Target daemon. In our case there are two targets available.(despite the configuration above just exports one…just ignore it, you can create as much as you like)

You have the choice to let the iSCSI Initiator reconnect to the Target automatically on boot time and of course you have to authenticate yourself to the target. In this case it’s “username” and “specialtargetpassword”.

After you entered everything correctly the “inactive” flag would become a “connected” flag. Now fire up the Disk Management in the Computer Management MMC-SnapIn.

Voilá! You should now see a Disk with the size of the exported target…Just start using it like any other hard disk. Create a partition and a filesystem.

Simply as it could be. That’s it. There are some more options like the Header/Data digest – which is an option to ensure data integrity. While this surely will increase data security it also will increase the CPU usage when you access the iSCSI drive. In our test a 1.7 Ghz Pentium-M CPU had an utilization of about 35-40 percent whilst the iSCSI server only had about 7 percent. We think that the client has so much utilization because of the quite cheap network interface card (realtek…). In fact the utilization is quite massive if you enable Header/Data digest-

Source 1:
Source 2: iSCSI Enterprise Target
Source 3: Microsoft iSCSI Initiator
Source 4: Adaptec 7211C (iSCSI HBA Copper)

Comments are closed.