Differences between revisions 8 and 9
Revision 8 as of 2022-01-15 23:30:41
Size: 2742
Editor: ?JuliaLongtin
Comment: another small fix.
Revision 9 as of 2022-01-22 21:56:21
Size: 3101
Editor: ?JuliaLongtin
Comment: add the service.
Deletions are marked like this. Additions are marked like this.
Line 60: Line 60:

=== Reboots and Persistence ===

The above configuration works great, once. you have to do a few things to get it to automatically start

 {{{
cd /etc/systemd/system
sudo curl https://raw.githubusercontent.com/open-iscsi/rtslib-fb/master/systemd/target.service -o target.service
sudo systemctl enable target.service
sudo service target start
 }}}

This page explains how to use LIO, the inkernel iscsi target, and the targetcli tool to configure LIO.

Quickstart

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.

Basic commands

"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 iqn.2005-03.org.open-iscsi.servername:iscsivolumea/tpg1/luns
    create /backstores/block/iscsivolume1
    4. configure the acl, add an authorized wwn and configure CHAP
    cd ../acls
    create iqn.2005-03.org.open-iscsi.clientname:abcdefgh1234
    cd 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 ../../portals
    delete 0.0.0.0 3260
    create <SERVERIP> 3260
    6. check the configuration, save configuration and exit
    cd /
    saveconfig
    exit

Useful Errors

If you fail to login, the kernel on the iscsi target will tell you what the wwn of the machine trying to talk to it is. for example:

  • [12887.039130] iSCSI Initiator Node: iqn.1993-08.org.debian:01:c89d139e65f is not authorized to access iSCSI target portal group: 1.
    [12887.039223] iSCSI Login negotiation failed.

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.

Reboots and Persistence

The above configuration works great, once. you have to do a few things to get it to automatically start

  • cd /etc/systemd/system
    sudo curl https://raw.githubusercontent.com/open-iscsi/rtslib-fb/master/systemd/target.service -o target.service
    sudo systemctl enable target.service
    sudo service target start