Differences between revisions 19 and 20
Revision 19 as of 2013-09-12 15:12:42
Size: 5122
Editor: ?WagnerBruna
Comment: fix sourceforge faq link
Revision 20 as of 2013-09-13 08:41:25
Size: 4021
Editor: GeoffSimmons
Comment: Drop Lenny references, iscsitarget-source went away in Wheezy (obsoleted by iscsitarget-dkms).
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:

''' DebianPkg:iscsitarget is available in Debian Lenny and newer'''
Line 12: Line 10:
 * The module : DebianPkg:iscsitarget-dkms (DebianPkg:iscsitarget-module prior to Squeeze).  * The module : DebianPkg:iscsitarget-dkms
Line 49: Line 47:
 You should refer to the [[DebianMan:8/ietd|ietd(8)]] and [[DebianMan:5/ietd.conf|ietd.conf(5)]] manpages for more information..  You should refer to the [[DebianMan:8/ietd|ietd(8)]] and [[DebianMan:5/ietd.conf|ietd.conf(5)]] manpages for more information.
Line 57: Line 55:

=== Building iscsitarget-module : iscsi_trgt ===
If you need, here's how to compile the kernel module using [[ModuleAssistant|module-assistant]] (which deserves its name).
 * The module now comes pre-compiled ( DebianPkg:iscsitarget-modules)
 * However, if you still need to compile it yourself, here's how to compile it :
apt-get install iscsitarget iscsitarget-source wget
m-a prepare
m-a update
m-a a-i iscsitarget

==== iscsitarget 0. + kernel 2.6.23 ====
As described in bug DebianBug:449237 , the iscsitarget-module_0.4.15-5 won't compile on kernel 2.6.23. Until the bug is fixed, you can compile by running :
m-a prepare -t
m-a update -t
m-a clean iscsitarget -t
m-a unpack iscsitarget -t
cd /usr/src/modules/iscsitarget/
wget -O - 'http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=kernel-2.6.23-support.diff;att=1;bug=449237' | patch -p0 || exit
m-a a-i iscsitarget --not-unpack -t

This page provides some information on how to use IET on Debian. ( iSCSI Enterprise Target is known as iscsitarget under Debian). reminder, the target is the name of the "server" under iSCSI terminology (i.e The one that actually have the disk).


1. Install IET's package and module

IET is made of two packages :

2. Configure

You need to configure /etc/ietd.conf (here's a simple test page).

  • # Example iscsi target configuration
    # a first account
    IncomingUser jdoe YourSecurePwd1
    # another one, for a windows user.
    IncomingUser iqn.1991-05.com.microsoft:JDOE-PC YourSecurePwd2
    #If mutual CHAP shall be employed, you need
    OutgoingUser jack YourSecurePwd2
    # The target name must be a globally unique name, the iSCSI
    # standard defines the "iSCSI Qualified Name" as follows:
    # iqn.yyyy-mm.<reversed domain name>[:identifier]
    Target iqn.2007-01.org.debian.foobar:mydisk1
            IncomingUser joe YourSecurePwd1
            OutgoingUser jim YourSecurePwd2
            #make sure the partition isn't mounted :
            #Lun 0 Path=/dev/sdh,Type=fileio
    Target iqn.2007-01.org.debian.foobar:CDs
            IncomingUser joe YourSecurePwd1
            OutgoingUser jim YourSecurePwd2
            #make sure the partition isn't mounted :
            Lun 0 Path=/dev/scd0,Type=fileio,IOMode=ro
            Lun 1 Path=/dev/scd1,Type=fileio,IOMode=ro
            #Lun 2 Path=/dev/hdX,Type=fileio,IOMode=ro
            Lun 3 Path=/srv/debian-20070313-kfreebsd-i386-install.iso,Type=fileio,IOMode=ro

    You should refer to the ietd(8) and ietd.conf(5) manpages for more information.

3. Restart the daemon

  • invoke-rc.d iscsitarget restart

    That's It ! you can use it.

Online administration / Dynamic configuration

Adding a target / LUN

First, Let's add a Target.

  • ietadm --op new --tid=[id] --params Name=iqn.foo.bar:test1

[id] must be unused. You can get a list of the currently used Target IDs by: cat /proc/net/iet/session

Then add a LUN to a pre-existing target.

  • ietadm --op new --tid=[id] --lun=[lun] --params Path=/path/to/exported/file,Type=fileio

[id] must be an already existing Target ID (listed in /proc/net/iet/session)

refer to the manpage on how to disconnect a connexion, change the settings or remove a LUN or a target.

Adding a user

  • {i} If you use mutual CHAP authentication, you also need to configure --params=OutgoingUser=foobar user.

First, create a user for "discovery" :

  • ietadm --op new  --user --params=IncomingUser=jdoe,Password=Compl3xPassw00rd

Then, create a user for "iqn.foo.bar:test2" :

  • cat /proc/net/iet/session 
    tid:1 name:iqn.foo.bar:test1
    tid:2 name:iqn.foo.bar:test2
    ietadm --op new --tid=2 --user --params=IncomingUser=jdoe,Password=Compl3xPassw00rd

refer to the manpage on how to "delete" a user.


How to share an ISO file with Windows ?
When should I use "fileio" vs "blockio" ?

more FAQs on iscsitarget FAQ at Sourceforge.

See also