Ubuntu 16.04
Sponsored Link

Configure iSCSI Taregt(targetcli)2016/04/23

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  ] |
|     dlp.srv.world    +----------+----------+     www.srv.world    |
|                      |                     |                      |
+----------------------+                     +----------------------+

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

mkdir /var/iscsi_disks

# enter the admin console


targetcli 3.0.pre4.1~ga55d018 (rtslib 3.0.pre4.1~g1b33ceb)
Copyright (c) 2011-2014 by Datera, Inc.
All rights reserved.

cd backstores/fileio
# create a disk-image with the name "disk01" on /var/iscsi_disks/disk01.img with 10G

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

Using buffered mode.
Created fileio disk01.
cd /iscsi
# create a target

create iqn.2016-04.world.srv:storage.target00

Created target iqn.2016-04.world.srv:storage.target00.
Selected TPG Tag 1.
Created TPG 1.
# set portal (set IP address to listen)

cd iqn.2016-04.world.srv:storage.target00/tpg1/portals


Using default IP port 3260
Created network portal
cd ../luns
# set LUN

create /backstores/fileio/disk01

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

create iqn.2016-04.world.srv:www.srv.world

Created Node ACL for iqn.2016-04.world.srv:www.srv.world:www.srv.world
Created mapped LUN 0.
cd iqn.2016-04.world.srv:www.srv.world
# set UserID for authentication

set auth userid=username

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

Parameter password is now 'password'.

Comparing startup and running configs...
Some changes need saving.
Save configuration? [Y/n]:

Saving new startup configuration
# after configuration above, the target enters in listening like follows

ss -napt | grep 3260

LISTEN     0      256          *:3260                     *:*

# set auto-start

/lib/systemd/systemd-sysv-install enable target
Matched Content