Debian 9 Stretch
Sponsored Link

Configure iSCSI Taregt(targetcli)2017/06/21

Configure Storage Server with iSCSI.
A storage on a network is called iSCSI Target, a Client which connects to iSCSI Target is called iSCSI Initiator.
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [   iSCSI Target   ] | || [ iSCSI Initiator  ] |
|    +----------+----------+    |
|                      |                     |                      |
+----------------------+                     +----------------------+

[1] Install administration tools first.
apt -y install targetcli-fb
[2] Configure iSCSI Target.
For example, create an disk-image under the [/var/lib/iscsi_disks] directory and set it as a SCSI device.
# create a directory

mkdir /var/lib/iscsi_disks

# enter the admin console


Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli shell version 2.1.fb43
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

cd backstores/fileio
# create a disk-image with the name [disk01] on [/var/lib/iscsi_disks/] with 10G

create disk01 /var/lib/iscsi_disks/disk01.img 10G

Created fileio disk01 with size 10737418240
cd /iscsi
# create a target


Created target
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (, port 3260.

# set LUN

create /backstores/fileio/disk01

Created LUN 0.
cd ../acls
# set ACL (it's the IQN of an initiator you permit to connect)


Created Node ACL for
Created mapped LUN 0.
# set UserID for authentication

set auth userid=username

Parameter userid is now 'username'.
set auth password=password

Parameter password is now 'password'.

Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/rtslib-fb-target/backup.
Configuration saved to /etc/rtslib-fb-target/saveconfig.json
# after configuration above, the target enters in listening like follows

ss -napt | grep 3260

LISTEN     0      256          *:3260                     *:*
Matched Content