### How to create an iSCSI target (server) on Debian Lenny? ###
       
       
       First of all, we need to install the package containging the iSCSI Enterprise Target server (IET):
       
         apt-get install iscsitarget
       
       Next, I had to enable iscsitarget in /etc/default/iscsitarget ("ISCSITARGET_ENABLE=true")
       Then, let's configure the /etc/ietd.conf configuration file. Here is a simple example of a LUN:
       
         Target iqn.2010-03.com.netasq.tac:StorageDisk
                 Lun 0 Path=/storage/testdisk.img,Type=fileio,IOMode=rw
       
       By default, the required kernel module is not installed (). Fortunately, there is a ready-to-use package containging the module precompiled for the kernel 2.6, so installing it is trivial:
       
         apt-get install iscsitarget-modules-2.6-686
       
       The last thing you need to do is creating the de facto disk image file. My prefered way to do so is to use the old good dd command (here, I am creating a 4 GiB blank disk image in /storage/):
       
         dd if=/dev/zero of=/storage/testdisk.img bs=1024 count=4194304
       
       Now, you can finally start the iscsitarget daemon:
       
         /etc/init.d/iscsitarget restart
       
       From now on, you should have the iscsitarget daemon listening on port (use netstat -antp to check that out), and any iSCSI initiator should be able to get an iSCSI connection with your shiny new iSCSI target.
       
       Note, that in this example I used no authentication. It means that anyone can access my iSCSI LUN. To add authentication on top of that, you will definitely need to read the authentication part of "man ietd.conf". ;-)
       
       Warning: I used my iSCSI server as a storage for a VMWare ESX 4 server. At first it kept crashing with errors like "iscsi_trgt: Abort Task (01) issued on tid:1 lun:0 by sid:282574492336640 (Unknown Task)" in kernel logs. The solution was to disable the "Delayed ACK" support in the iSCSI storage adapter advanced properties on the ESX host (it seems that the "Delayed ACK" feature was genereting a huge amount of I/O requests, which the iSCSI engine wasn't able to process).