This page explains how to use LIO, the inkernel iscsi target, and the targetcli tool to configure LIO.
Install the software
LIO is shipped with the linux kernel.
The targetcli tool was packaged for Debian 7 as targetcli from the original source code produced by ?RisingTide Systems, now Datera. It was discontinued in Debian 8. Functioning packages can still be created from the source code for Debian 8.
There is a new package in Debian 9 named targetcli-fb ("free branch"). You may need to also install the package dbus if the system is not a new Debian 9 install (has been upgraded from Jessie). All configuration is done through the CLI by executing targetcli. A basic configuration is created upon first use.
"ls" lists the existing configuration tree. "help" or "help [command] provides help on the targetcli command line commands. Configuration changes should be made by navigating the tree and using the appropriate commands to add new enties. The CLI supports autocomplete and lists available commands in each context when tab is hit.
Example workflow for adding a target:
1. add a block device to be provided cd backstores/block create iscsivolume1 /dev/sdb1 2. create a target cd /iscsi create iqn.2005-03.org.open-iscsi.servername:iscsivolumea 3. attach the block device to the target cd luns create /backstores/block/iscsivolume1 4. configure the acl, add an authorized wwn and configure CHAP cd ../.. create iqn.2005-03.org.open-iscsi.clientname:abcdefgh1234 set auth userid=clientid set auth password=123456789abc 5. attach the listening IP addresses, in this case replace the default all interfaces with a single one cd ../.. delete 0.0.0.0 3260 create 10.0.0.1 3260 6. check the configuration, save configuration and exit cd / saveconfig exit
Configuration files and updates
Usage of the CLI is similar for the targetcli and targetcli-fb versions, but the configuration files are different and incompatible. targetcli stores its configuration in a text file in /etc/target/scsi_target.lio. targetcli-fb stores its configuration in /etc/rtslib-fb-target/saveconfig.json.