ISCSI/Initiator
An iSCSI initiator is a machine that connects to a storage machine on the network. The opposite side of the connection, the storage machine itself, is referred to as the iSCSI Target. Multiple iSCSI initiators can be pointed to one iSCSI Target.
Installation
Kernel configuration
[*] Networking support --->
Networking options --->
[M] TCP/IP networking
Device Drivers --->
SCSI device support --->
<*> SCSI disk support
[*] SCSI low-level drivers --->
<*> iSCSI Initiator over TCP/IP
SCSI Transports --->
{M} iSCSI Transport Attributes
When connecting a tape device, RAID device, or any other special device via iSCSI, remember to select the proper drivers for each device in the kernel. If the devices are known, it is best to enable the appropriate options in the kernel now, instead of waiting to later.
In-kernel support can be enabled by building the driver into the kernel (as suggested with the *
). If building the driver as an external module (as suggested with the M
) running the make modules_install command will install all the modules into the kernel, which is essentially the same as building in the modules initially. Anyway sys-block/open-iscsi says builtin doesn't work. Built-in modules for an active kernel are listened in the /lib/modules/$(uname -r)/modules.builtin file. To check to see if if the iscsi_tcp.ko driver has been built-in, run:
user $
grep iscsi_tcp.ko "/lib/modules/$(uname -r)/modules.builtin"
USE flags
USE flags for sys-block/open-iscsi A performant, transport independent, multi-platform implementation of RFC3720
+tcp
|
Support iSCSI over TCP |
debug
|
Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces |
infiniband
|
Enable Infiniband RDMA transport support |
rdma
|
Support iSCSI over RDMA |
systemd
|
Enable use of systemd-specific libraries and features like socket activation or session tracking |
Emerge
After USE flags have been set (or unset) emerge the iSCSI package:
root #
emerge --ask sys-block/open-iscsi
Configuration
Loading the module
This section is only applicable when the driver has been built as a loadable kernel module (modules are external to the kernel). If the kernel configuration was set and then built as In-kernel support, then the driver will be built-in to the kernel effectively rendering this section unnecessary. Skip down to Usage if this is the case.
Before iscsid startup the lsmod command can be used to confirm the module has been loaded:
root #
lsmod | grep iscsi_tcp
If output is seen from the command above, then the following step is not needed:
root #
modprobe iscsi_tcp
Service
OpenRC
To add the iSCSI daemon to the default runlevel:
root #
rc-update add iscsid default
To start the iSCSI daemon now:
root #
service iscsid start
Usage
Target discovery
Discover the targetnames:
root #
iscsiadm -m discovery -t st -p <ip> -P 1
Adding targets
Add a target to the configuration:
root #
iscsiadm -m node -T iqn.2004-04.com.<targethost>:<targetname> [-p <ip[:port]>] -l
Target persistence
And tell the iscid service to start a target automatically on startup
root #
iscsiadm -m node -T iqn.2004-04.com.<targethost>:<targetname> [-p <ip[:port]>] -o update -n node.startup -v automatic node.conn[0].startup = automatic
See also
- ISCSI/Target — machines that offer storage via iSCSI to a network.