Differences between revisions 10 and 11
Revision 10 as of 2012-01-11 08:16:29
Size: 4268
Editor: GeoffSimmons
Comment: Update InterWiki, fix links.
Revision 11 as of 2012-03-15 21:30:39
Size: 4544
Editor: StefanEggers
Comment: add info about finding the iSCSI initiator's iqn
Deletions are marked like this. Additions are marked like this.
Line 66: Line 66:
=== Finding out the iSCSI initiator's iqn ===

The iSCSI initiator also has an iqn which you will find in /etc/iscsi/initiatorname.iscsi. After installation of open-iscsi it just contains "!GenerateName=yes". During the first start of the demon the iqn gets generated.

SAN/iSCSI > SAN/iSCSI/open-iscsi


Debian as an iSCSI Initiator

This page focus on the open-iscsi.org Initiator (package open-iscsi). Reminder: The initiator is the "client".

Quickstart

1. Install the software

The module in iscsi_tcp is shipped in Debian's standard kernel since etch. So you'll just have to install open-iscsi, configure 6 lines in /etc/iscsi/iscsid.conf:

  • discovery.sendtargets.auth.authmethod = CHAP
  • discovery.sendtargets.auth.username = jdoe
  • discovery.sendtargets.auth.password = YourSecurePwd1

  • node.session.auth.authmethod = CHAP
  • node.session.auth.username = jdoe
  • node.session.auth.password = YourSecurePwd1

and possibly:

  • node.startup = automatic

Please note that some targets cannot use a password for the discovery phase, while other targets only support the same password for both discovery and session phase.

Otherwise, you can also create a single connexion (a file /etc/iscsi/nodes/iqn.2007-01.org.debian.foobar:CDs/192.168.0.1,3260 is automatically created)

iscsiadm   --mode node  --targetname "iqn.2007-01.org.debian.foobar:CDs"  -p 192.168.0.1:3260 --op=update --name node.session.auth.authmethod --value=CHAP
iscsiadm   --mode node  --targetname "iqn.2007-01.org.debian.foobar:CDs"  -p 192.168.0.1:3260 --op=update --name node.session.auth.username --value=$Id
iscsiadm   --mode node  --targetname "iqn.2007-01.org.debian.foobar:CDs"  -p 192.168.0.1:3260 --op=update --name node.session.auth.password --value=$MDP
iscsiadm   --mode node  --targetname "iqn.2007-01.org.debian.foobar:CDs"  -p 192.168.0.1:3260 --login

Using

Let's query the target (server) about the service it knows

  • iscsiadm  -m discovery -t st -p 192.168.0.20
    192.168.0.1:3260,1 iqn.2007-01.org.debian.foobar:CDs
    192.168.0.1:3260,1 iqn.2007-01.org.debian.foobar:USB

Next let's open a session to a given Target:

  • iscsiadm  -m node  --targetname "iqn.2007-01.org.debian.foobar:CDs" --portal "192.168.0.1:3260" --login

If this is successful, a new /dev/sdx device will show up, and automatically linked to /dev/disk/by-path/ip-*. You can then use that device as if it were a regular disk.

You can then mount the new device, but under most situation, you will want to use LABEL= syntax in /etc/fstab (see e2label).

  • #device         mount point     FS      Options Backup  fsck
    LABEL=data1     /mnt/data1      ext3    _netdev 0       0

Once you have finished working, you can release the iSCSI target.

  • iscsiadm  -m node  --targetname "iqn.2007-01.org.debian.foobar:CDs" --portal "192.168.0.1:3260" --logout

Finding out the iSCSI initiator's iqn

The iSCSI initiator also has an iqn which you will find in /etc/iscsi/initiatorname.iscsi. After installation of open-iscsi it just contains "GenerateName=yes". During the first start of the demon the iqn gets generated.

FAQ & common error messages

ietd: CHAP initiator auth.: No valid user/pass combination for initiator iqn.1993-08.org.debian:01:123456789abcd found
The initiator's user account and/or password is wrong !

iscsiadm: Login failed to authenticate with target
iscsiadm: discovery login to 192.168.0.20 rejected: initiator error (02/01), non-retryable, giving up ::wrong "discovery" username or password.

How does udev looks like ?
udev won't help you mounting the device. use "LABEL=" in /etc/fstab instead.
$ udevinfo -a -p $(udevinfo -q path -n /dev/sdb)
  looking at parent device '/devices/platform/host98/session1/target98:0:0/98:0:0:2':
    KERNELS=="98:0:0:2"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{modalias}=="scsi:t-0x00"
    ATTRS{ioerr_cnt}=="0x0"
    ATTRS{iodone_cnt}=="0x1f"
    ATTRS{iorequest_cnt}=="0x1f"
    ATTRS{iocounterbits}=="32"
    ATTRS{timeout}=="30"
    ATTRS{state}=="running"
    ATTRS{rev}=="0   "
    ATTRS{model}=="VIRTUAL-DISK    "
    ATTRS{vendor}=="IET     "
    ATTRS{scsi_level}=="5"
    ATTRS{type}=="0"
    ATTRS{queue_type}=="none"
    ATTRS{queue_depth}=="32"
    ATTRS{device_blocked}=="0"

See also