Howto‎ > ‎

How to do iscsi in Debian Linux

This page will discuss how to implement iSCSI in Debian/Linux.


iSCSI is a protocol used in SAN. Initiators issue disk commands to targets. That is, client software called an initiator connects to a machine where it accesses different disks, either physical or virtual, call targets over a network connection. This makes the target look like a local device. In Linux, something like /dev/sdb, and in Windows, something like E:.

A target can being either a physical hard disk, a virtualized hard disk (i.e. RAID, VMware) or a file. A device name would look something like Conventionally, the part before the : is a unique string that identifies the initiator software being used, and the part after the : is a unique string that identifies the particular target being accessed on the server. More formally, they are usually IQN's which have the format iqn.yyyy-mm.{reversed domain name}. The date component is used because domain names can change ownership when public domains are used. To be clear, the yyyy-mm indicates when the domain was acquired.

Targets have logins on a per-target basis, usually implemented with Microsoft CHAP security (MS-CHAP) which requires passwords of exactly 12 characters. You can also have global logins that prevent remote computers from browsing the list of targets without login.

Level of Debian support

In Debian, both target and initiator support is easily available. I'm using Debian `etch' and with a couple easy steps (well documented online) got up and running.

Edit /etc/apt/sources.list and add deb unstable/

apt-get update && apt-get install iscsitarget-source iscsitarget module-assistant debhelper && m-a a-i iscsitarget

Then create and edit /etc/ietd.conf using something like the following:

        IncomingUser mike 123456789012
        Lun 0 Path=/home/iscsi-target1,Type=fileio
        Alias target1
        MaxConnections 1

/etc/init.d/iscsitarget start

You can then map the target using the initiator. With the Microsoft initiator, you basically enter in the IP of your iSCSI server as a target portal, then go to the target tab to see the list of available targets, click on Log On... button at bottom of screen, go into advanced to set your MS-CHAP username and secret. Once the target is mapped, you'll get a disk in the disk management console that you can initialize, format and assign a drive letter to.