This walkthrough describes the setup of the linux ISCSI initiator and target. All commands must be executed as root:

Setup of the iSCSI initiator

1. Take a look at already registered LUNs:

iscsiadm -m node

2. Find LUNs at a given IP:

iscsiadm -m discovery -t sendtargets -p

3. Connect and login (without authentification):

iscsiadm -m node -T iqn.2010-04.local-test:disk-1 -p --login

4. See if session runs:

iscsiadm --mode session

5. Format with a filesystem and mount it:

mkfs.ext3 /dev/sdc1
mount /dev/sdc1 /iscsi

6. Work with the mounted disk

7. Unmount and clean up

umount /iscsi
iscsiadm --mode node --targetname iqn.2010-04.local-test:disk-1 --portal --logout

iSCSI Enterprise Target Setup

Setting up an iSCSI enterprise target under Ubuntu follows the following workflows (taken from here):

1. Install the packages:

aptitude install iscsitarget iscsitarget-source iscsitarget-dkms

2. Enable the target:

pico /etc/default/iscsitarget
#Insert the following content

3. Create Sparseimage:

mkdir storage
dd if=/dev/zero of=/storage/lun1.img bs=1024k count=20000

4. Define iSCSI LUN

pico /etc/iet/ietd.conf
#Insert the following content
Lun 0 Path=/storage/lun1.img,Type=fileio
Alias LUN1

5. Enable the iSCSI LUN

pico pico /etc/iet/initiators.allow
#Insert the following content

6. Start the target

/etc/init.d/iscsitarget start