ISCSI/Initiator

From Gentoo Wiki
< ISCSI
Jump to: navigation, search
This page contains changes which are not marked for translation.

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

KERNEL Enabling the iSCSI driver: CONFIG_INET=y, CONFIG_BLK_DEV_SD=y, CONFIG_SCSI_LOWLEVEL=y, CONFIG_ISCSI_TCP=M and CONFIG_SCSI_ISCSI_ATTRS=M
[*] 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
Note
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 device are known is best to enable the appropriate options in the kernel now, instead of waiting to a later time.

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"
kernel/drivers/scsi/libiscsi_tcp.ko kernel/drivers/scsi/iscsi_tcp.ko

USE flags

USE flags for sys-block/open-iscsi A performant, transport independent, multi-platform implementation of RFC3720

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
libressl Use dev-libs/libressl instead of dev-libs/openssl when applicable (see also the ssl useflag)
rdma Support iSCSI over RDMA
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking
tcp Support iSCSI over TCP

Emerge

After USE flags have been set (or unset) emerge the iSCSI package:

root #emerge --ask sys-block/open-iscsi

Configuration

Loading the module

Note
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

See also