1.Target-side configuration
The target side is the disk array or other host with disk. The Iscsitarget tool maps disk space to the network, and the initiator side can find and use the disk.
Note that a target host can map multiple target to a network, that is, multiple block devices can be mapped to the network.
1) package
Iscsitarget
You can download the latest version from http://sourceforge.net/projects/iscsitarget/files/.
2) Compile and install
Very simple, unpack, compile, install.
Tar zxvf iscsitarget-1.4.19.tar.gz
CD iscsitarget-1.4.19/
Make
Make install
The package installs the kernel modules, user layer tools, service startup scripts, configuration files, man manuals, etc. that Iscsitarget needs into the system.
Including:
Iscsi_trgt.ko Kernel Module
IETD Iscsitarget's daemon process
Ietadm Iscsitarget User-level management tools
/etc/init.d/iscsi-target iscsitarget Startup script
/etc/ietd.conf iscsitarget configuration file
/etc/initiators.allow controls initiator access to target.
/etc/initiators.deny controls initiator access to target.
/etc/iet/targets.allow controls the access rights of different target.
3) Configure/etc/ietd.conf
Target iqn.2001-04.com.example:storage.disk2.sys1.xyz
Lun 0 Path=/dev/sda1,type=fileio
Alias Lun0
General Description:
Target IQN.2001-04.COM.EXAMPLE:STORAGE.DISK2.SYS1.XYZ represents the name of the iSCSI Target, which should be unique within the same subnet, and the standard naming method is:
"Target" + Target name (format: iqn.yyyy-mm.<reversed domain Name>[:identifier])
Lun 0 PATH=/DEV/SDA1 indicates that the block device number is 0 and the mapped disk is/dev/sda1.
The Type in this configuration is set to "FileIO", and I am primarily used to store and share a disk.
It can also be set to: "File" or "LVM", as needed.
In addition, there are many other parameters can be set, specific reference:
Http://manpages.ubuntu.com/manpages/hardy/man5/ietd.conf.5.html