In an earlier post, I wrote about using a Linux-based iSCSI target. The software I used was iSCSI Enterprise Target. In that post, the method to create an extra disk was to shut down the virtual machine, add a VMware virtual disk, boot the machine, modify /etc/ietd.conf and then restart ietd.

Although the above method will deliver the best performance, you might want to offer iSCSI disks using files instead of block devices. To do this, first create such a file with dd. For example:

dd if=/dev/zero of=./disk-image count=204800

This creates a 100MB file in the current directory. Now, update /etc/ietd.conf with the following line (under some defined target):

Lun # Path=/some-directory/disk-image

Now restart ietd with:

/etc/init.d/iscsi-target restart

If you now configure your iSCSI initiator to connect to the target, you should see a new disk.

Enjoy!