5

I am trying to set up a iSCSI target:

[root@localhost /]# targetcli
targetcli shell version 2.1.fb37
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> cd backstores/fileio 
/backstores/fileio> create disk01 /iscsi_disks/disk01.img 5G
Created fileio disk01 with size 5368709120
/backstores/fileio> cd /iscsi 
/iscsi> create iqn.2015-06.world.server:storage.target01
Created target iqn.2015-06.world.server:storage.target01.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/iscsi> cd iqn.2015-06.world.server:storage.target01/tpg1/luns
/iscsi/iqn.20...t01/tpg1/luns> create /backstores/fileio/disk01 
Created LUN 0.
/iscsi/iqn.20...t01/tpg1/luns> cd ../acls 
/iscsi/iqn.20...t01/tpg1/acls> create iqn.2015-06.world.server:www.server.world
Created Node ACL for iqn.2015-06.world.server:www.server.world
Created mapped LUN 0.
/iscsi/iqn.20...t01/tpg1/acls> cd iqn.2015-06.world.server:www.server.world/
/iscsi/iqn.20....server.world> set auth userid=foo
Parameter userid is now 'foo'.
/iscsi/iqn.20....server.world> set auth password=bar
Parameter password is now 'bar'.
/iscsi/iqn.20....server.world> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
[root@localhost /]# service iscsid restart
Redirecting to /bin/systemctl restart iscsid.service
[root@localhost /]# service iscsi restart
Redirecting to /bin/systemctl restart iscsi.service

Here's the structure (open image in a new window to see it full size):

enter image description here

Discovery seems to work fine:

[root@linuxbox ~]# iscsiadm -m discovery -t sendtargets -p 10.0.0.60
10.0.0.60:3260,1 iqn.2015-06.world.server:storage.target01

However, when I try to connect, I get this authorization failure message:

[root@linuxbox ~]# iscsiadm -m node --targetname "iqn.2015-06.world.server:storage.target01" --portal "10.0.0.60:3260" --login 
Logging in to [iface: default, target: iqn.2015-06.world.server:storage.target01, portal: 10.0.0.60,3260] (multiple)
iscsiadm: Could not login to [iface: default, target: iqn.2015-06.world.server:storage.target01, portal: 10.0.0.60,3260].
iscsiadm: initiator reported error (24 - iSCSI login failed due to authorization failure)
iscsiadm: Could not log into all portals
2

On the client machine you have to edit the initiatorname in the file initiatorname.iscsi. The name is the iqn which is created as ACL.

$ vi /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2015-06.world.server:www.server.world
  • 2
    After changing the initiatorname in the initiatorname.iscsi file run following commands: # service iscsi stop # service iscsid stop # service iscsid start # service iscsi start – LinuxBdK Nov 21 '16 at 10:27
4

In my case there was a problem with the iqn of the initiator - I edited the file /etc/iscsi/initiatorname.iscsi and run service iscsi restart but still saw errors in /etc/messages on target:

Dec  2 14:51:05 iscsi-target-vm kernel: iSCSI Initiator Node: iqn.1994-05.com.redhat:47fbcf58e10 is not authorized to access iSCSI target portal group: 1.

Dec 2 14:51:05 iscsi-target-vm kernel: iSCSI Login negotiation failed.`

So the solution was to run service iscsid restart at the initiator to reload the iqn.

  • 2
    "systemctl restart iscsid" in systemd – Albert T. Wong May 4 '17 at 23:59

protected by Community Apr 20 '18 at 8:06

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.