Creating an iSCSI target on Linux

Creating a disk image

Create an empty file to be the disk image:

  dd if=/dev/zero of=/path/to/image/file.img bs=1M count=0 seek=8192

where /path/to/image/file.img is the path where you want to store the disk image file, and 8192 is the size of the disk image that you want to create, in megabytes.

Creating an iSCSI target

Edit the file /etc/ietd.conf and add:

      Lun 0 Path=/path/to/image/file.img,Type=fileio

where /path/to/image/file.img is the path to your disk image file, and is your DNS name in reverse order.

(For completeness, you should also replace 2007-08 with the year and month in which you first obtained your DNS domain. The iSCSI naming schemes are somewhat pedantic, but it won't affect anything in practice; as long as the target name is unique then everything will work just fine.)

Restart the iSCSI target service:

  /etc/init.d/iscsi-target restart

Make a note of the iSCSI target IQN that you chose ( in the above example). You are now ready to:

QR Code
QR Code sanboot:iscsi_create_via_linux (generated for current page)