iSCSI initiator, also called client, can be used to connect to any iSCSI target. This is not restricted to the iSCSI target solution explained above. The configuration of iSCSI initiator involves two major steps—the discovery of available iSCSI targets and the setup of an iSCSI session. Both can be done with YaST.
The configuration is divided into three tabs. The iSNS server to use for the discovery. The default port for iSNS is 3205. The tab gives an overview of the currently connected iSCSI targets. Like the tab, it gives the option to add new targets to the system. is the tab to start with. It provides the possibility of discovering iSCSI targets in the network.tab may be used to enable the iSCSI initiator at boot time. It also offers to set a unique and an
Useto open the discovery dialog.
Enter the IP address and change the port if necessary.
If necessary, add theor authentication.
Useto start the discovery.
After a successful discovery, useto activate the target. You will be asked for authentication information to use the selected iSCSI target. finishes the configuration. If everything went well, the target now appears in .
The virtual iSCSI device is now available. Find the actual device with lsscsi:
lsscsi [1:0:0:0] disk IET VIRTUAL-DISK 0 /dev/sda
Both the discovery and the configuration of iSCSI connections require a running iscsid. When running the discovery the first time, the internal database of the iSCSI initiator is created in the directory /var/lib/open-iscsi.
If your discovery is password protected, provide the authentication information to iscsid. Because the internal database does not exist when doing the first discovery, it cannot be used at this time. Instead, the configuration file /etc/iscsid.conf must be edited to provide the information. To add your password information for the discovery, add the following lines to the end of /etc/iscsid.conf:
discovery.sendtargets.auth.authmethod = CHAP discovery.sendtargets.auth.username = <username> discovery.sendtargets.auth.password = <password>
The discovery stores all received values in an internal persistent database. In addition, it displays all detected targets. Run this discovery with the command iscsiadm -m discovery --type=st --portal=<targetip>. The output should look like:
To discover the available targets on a iSNS server, use the command iscsiadm --mode discovery --type isns --portal <targetip>
For each target defined on the iSCSI target, one line appears. Learn how to obtain more information about the stored data in Section 12.2.4, The iSCSI Client Databases.
The special --login option of iscsiadm creates all needed devices:
iscsiadm -m node -n iqn.2006-02.com.example.iserv:systems --login
The newly generated devices show up in the output of lsscsi and can now be accessed by mount.
LVM startup is supported by udev, so that any LVM volume groups will be activated automatically via udev once all required physical volumes have been detected.
LVM autoassembly in udev makes use of the udev helper program collect. This program takes as the first argument an abstract ID to be checked, followed by a list of component IDs. Once this program has been called with each of the component IDs as the first argument it'll return 0.
So for autoassembly the physical volume UUIDs for the given volume group is registered as argument list for collect. udev (or rather vol_id) is capable of detecting the physical volume UUID on a device and hence it can be passed as the first argument to collect.
Once collect has been called with all physical volume UUIDs (i.e. udev has received events for all component devices) the next rule triggers which just calls vgchange -a y <vgname> and the volume group will be activated.
Use the script /usr/share/doc/packages/lvm2/lvm-vg-to-udev-rules.sh. It takes as argument the volume group you want to start automatically. This script will generate the required udev rules. Now restart iSCSI to activate the volume groups. If you want to have the array started automatically on boot you have to switch the iSCSI component devices to automatic, so that the initiator will log into the target automatically on boot.
All information that was discovered by the iSCSI initiator is stored in two database files that reside in /var/lib/open-iscsi. There is one database for the discovery of targets and one for the discovered nodes. When accessing a database, you first must select if you want to get your data from the discovery or from the node database. Do this with the -m discovery and -m node parameters of iscsiadm. Using iscsiadm just with one of these parameters gives an overview of the stored records:
iscsiadm -m discovery 18.104.22.168:3260,1 iqn.2006-02.com.example.iserv:systems
The target name in this example is iqn.2006-02.com.example.iserv:systems. This name is needed for all actions that relate to this special data set. To examine the content of the data record with the ID iqn.2006-02.com.example.iserv:systems, use the following command:
iscsiadm -m node --targetname iqn.2006-02.com.example.iserv:systems node.name = iqn.2006-02.com.example.iserv:systems node.transport_name = tcp node.tpgt = 1 node.active_conn = 1 node.startup = manual node.session.initial_cmdsn = 0 node.session.reopen_max = 32 node.session.auth.authmethod = CHAP node.session.auth.username = joe node.session.auth.password = ******** node.session.auth.username_in = <empty> node.session.auth.password_in = <empty> node.session.timeo.replacement_timeout = 0 node.session.err_timeo.abort_timeout = 10 node.session.err_timeo.reset_timeout = 30 node.session.iscsi.InitialR2T = No node.session.iscsi.ImmediateData = Yes ....
To edit the value of one of these variables, use the command iscsiadm with the update operation. For example, if you want iscsid to log in to the iSCSI target when it initializes, set the variable node.startup to the value automatic:
iscsiadm -m node -n iqn.2006-02.com.example.iserv:systems --op=update --name=node.startup --value=automatic
Remove obsolete data sets with the operation delete. If the target iqn.2006-02.com.example.iserv:systems is no longer a valid record, delete this record with the command iscsiadm -m node -n iqn.2006-02.com.example.iserv:systems --op=delete. Use this option with caution because it deletes the record without any additional confirmation prompt.
To get a list of all discovered targets, run the command iscsiadm -m node.
The iSCSI protocol has been available for several years. There are many reviews and additional documentation comparing iSCSI with SAN solutions, doing performance benchmarks, or just describing hardware solutions. Important pages for more information about open-iscsi are:
There is also some online documentation available. See the manual pages of iscsiadm, iscsid, ietd.conf, and ietd and the example configuration file /etc/iscsid.conf.