Configuring the server (target) using IET
# aptitude install iscsitarget iscsitarget-dkms
This will involve (automatically) building a kernel module for your specific machine, which means that binutils, cpp, gcc, kernel headers, make and all sorts of other stuff which you might not have expected, will get installed first.
Note that you do not need to reboot after the kernel module has been rebuilt - it gets installed automatically and works with your already-running kernel.
The next step is to create a configuration file for what you want to share from this machine.
The existing file /etc/iet/ietd.conf contains only comments, you can either overwrite it, rename it and create a new file, or edit it, as you prefer. Personally I rename it to ietd.conf.dist and then create my own ietd.conf. I do the same with initiators.allow.
Example
I want to share the Logical Volume /dev/SCSItarget/share to any machine on my local network 192.168.42.0/24
/etc/iet/ietd.conf contains:
Target iqn.2017-04.de.dehy.retinal:SCSIshare Lun 0 Path=/dev/SCSItarget/share,Type=fileio,ScsiId=xyz,ScsiSN=xyz
/etc/iet/initiators.allow contains:
iqn.2017-04.de.dehy.retinal:SCSIshare 192.168.42.0/24
Notes:
- iqn. should be used verbatim
- 2017-04 is the date you set up the share (I have no idea of any significance to this, but it's conventional)
- de.dehy.retinal is conventionally the reverse of the hostname of the server (which in my case is retinal.dehy.de), however you can set it to anything you might prefer so long as it looks like a reversed DNS name
- SCSIshare is the name of the shared device as it will appear to the client/s
- Each Target may have multiple LUNs (just the same as standard SCSI devices) but you generally won't use this - just set up multiple targets, each with a single LUN (numbered 0)
- The Path is where to find the shared device or file
- Leave Type=fileio,ScsiId=xyz,ScsiSN=xyz as they are, until you learn any good reason to change them
Modify /etc/default/iscsitarget so that ISCSITARGET_ENABLE=true on the first line.
Once you've created those config files, restart the iSCSI service:
# /etc/init.d/iscsitarget restart
Note that the iSCSI service and the configured shares will be restarted automatically on reboot.
Go up
Return to main index.