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

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:

and possibly:

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

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

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).

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

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