Building iSCSI target - old

Much of this was taken from It was written in 2009, so some of the things have changed. I am not building a redundant array at this time (though that is the plan for the future), so this simply covers building the iSCSI target. As per the document, we're using IET.

First, set up your underlying storage for the iSCSI target. I use LVM2 sitting on top of mdadm.

# create RAID-6 software RAID consisting of sdb, sdc, sdd, sde
mdadm --create /dev/md1 --raid-devices=4 --spare-devices=0 --level=6 --run /dev/sd[bcde]
# now, add it (and all others) to the mdadm configuration file
cp /etc/mdadm/mdadm.conf /etc/mdadm/
/usr/share/mdadm/mkconf --generate > /etc/mdadm/mdadm.conf
# add LVM volume group on top of it (apt-get install lvm2 if you haven't already)
vgcreate iscsi-pool /dev/md1
# create logical volume named 'test' of 10G to make sure things are working (will be slow as mdadm is syncing the disks)
lvcreate -L 10G -n test iscsi-pool
mke2fs -j /dev/iscsi-pool/test
mount /dev/isci-pool/test /mnt
cp /etc/passwd /mnt
cat /mnt/passwd
rm /mnt/passwd
# you can see the progress of the madm build as follows:
cat /proc/mdstat

Now, start setting up iSCSI. We'll use IET for this install, though there are many more listed in the markaround article

# install iscsitarget
# this will automatically build the kernel module and install it also
apt-get install iscsitarget iscsitarget-dkms # edit /etc/default/iscsitarget to enable !!!
/etc/init.d/iscsitarget start # verify iscsi working
grep -i iscsi /var/log/messages
  Jan 1 15:26:58 serenity kernel: [11767.027654] iSCSI Enterprise Target Software - version    Jan 1 15:26:58 serenity kernel: [11767.027719] iscsi_trgt: Registered io type fileio    Jan 1 15:26:58 serenity kernel: [11767.027721] iscsi_trgt: Registered io type blockio    Jan 1 15:26:58 serenity kernel: [11767.027723] iscsi_trgt: Registered io type nullio # look at the iet conf directory to see the files created
ls /etc/iet
# OUTPUT ietd.conf initiators.allow targets.allow
# build a target # see for naming # create new target, id=1 ietadm --op new --tid=1 --params # add LUN ID 0 to target and assign to LVM volume as backing store. Set access as fileio ietadm --op new --tid=1 --lun=0 --params Type=fileio,Path=/dev/iscsi-pool/test # verify creation cat /proc/net/iet/volume tid:1 lun:0 state:0 iotype:fileio iomode:wt path:/dev/isci-pool/test # Add to /etc/iet/ietd.conf so it will be there on restart
echo 'Target' >> /etc/iet/ietd.conf echo 'Lun 0 Path=/dev/storage/test,Type=fileio' >> /etc/iet/ietd.conf echo 'Alias test' >> /etc/iet/ietd.conf # restart daemon and show that target re-appears /etc/init.d/iscsitarget restart cat /proc/net/iet/volume


Ok, this is cheating because you don't really learn what is going on, but Webmin ( has a very nice web interface for creating iSCSI targets. You still have to know something, but this will help a lot.

Debian does not have an installer for it, either because of the security or because of the fact there is a commercial side to it (I don't remember), but they have a Debian .deb package ( which will install just fine. I strongly suggest you ensure it is secure because you are opening up a very powerful piece of code (able to manipulate your system as root) to a fairly insecure UI.

Actually, you can add their repository also, which is great since you'll get updates faster and it will satisfy the dependencies. See for details.


iSCSI appliance distros


Last update:
2015-08-05 06:07
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.