User Tools

Site Tools


nndocs:iscsi

This is an old revision of the document!


Table of Contents

TODO: Make all the initiator and target names match please

TODO: Explain why I don't have iSCSI boot working yet, please

IQNs

We do IQNs by the book, but as simply as possible. A couple of examples:

  iqn.2014-08.rocks.narf.sadness
  iqn.2004-12.com.naptastic.quirk

IQNs can also have :more.stuff on the end. I can't come up with a use case, since hostnames are already fully-qualified and unique.

There are still some :01 suffixes lurking around the network. Fix them or don't; just don't make new ones.

Ideally, /etc/iscsi/initiatorname.iscsi gets the right value as part of system provisioning, and the target only ever has to use the host's correct name. There's a strong warning about changing IninitatorName in that file; if you're changing it to the correct value (i.e., the value in the target's ACL) then it's fine.

Target

File as a backstore this time

  targetcli
  > /backstores/fileio/ create file_or_dev=/var/lib/libvirt/images/sunday.img name=sunday

Creating a target is easy

  > /iscsi/ create

replace the default portal:

  > cd /iscsi/your_target/tpg1/
  > portals/ create 172.19.12.1 3260
  > portals/172.19.12.1:3260 enable_iser boolean=true

TODO: enable_iser doesn't work on shark. Any ideas why yet? Or is it just time to nuke and re-pave?

Initiator

Discover targets at a given IP address

  iscsiadm --mode discoverydb --type sendtargets --portal 172.20.64.11 --discover

Login. Must use a node record id found by the discovery

  iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 172.20.64.11:3260 --login

https://www.thegeekdiary.com/iscsi-connection-command-examples-cheat-sheet/

List active sessions

  # iscsiadm -m session
  tcp: [1] 172.21.0.80:3260,1 iqn.2003-01.org.linux-iscsi.happy.x8664:sn.9eb52ac74563 (non-flash)

The session number (sid) is the 1 in brackets.

Use iSER instead of TCP (initiator side)

If performance is poor, the initiator may have logged in using TCP instead of iSER. In my testing, to a ramdisk over IB, TCP got ~520 MiB/s, where iSER got 1.9 GiB/s.

You know you got TCP if dmesg describes your LUN like this:

  [123.45678] scsi host1: iSCSI Initiator over TCP/IP
  [123.45678] scsi 1:0:0:0: Direct-Access     LIO-ORG  volume       4.0  PQ: 0 ANSI: 6

It should say iSER instead of TCP/IP. Log out of that session, then run this command. It also logs in, which makes me wonder if the initiator name argument above is necessary.

  iscsi_discovery 172.20.64.13 -t iser -l

Now dmesg should show something more like this:

  [123.45678] scsi host1: iSCSI Initiator over iSER
  [123.45678] scsi 1:0:0:0: Direct-Access     LIO-ORG  volume       4.0  PQ: 0 ANSI: 6

FDR InfiniBand should be able to move over 6 GB/s of traffic. 1.9 GiB/s is nothing to be sad about.

Rescan after the target adds a LUN

  # iscsiadm -m session --sid=1 --rescan
  Rescanning session [sid: 1, target: iqn.2003-01.org.linux-iscsi.happy.x8664:sn.9eb52ac74563, portal: 172.21.0.80,3260]

Log out when you're done (very, very carefully)

Just one specific target:

  iscsiadm --mode node --target <IQN> --portal 192.0.2.* --logout

–portal seems to be optional.

All of the targets:

  iscsiadm --mode node --logoutall=all
nndocs/iscsi.1709132128.txt.gz · Last modified: 2024/02/28 14:55 by naptastic