Table of Contents

Using the Linux iSCSI software initiator

Requirements

You'll need:

Overview

There are two halves to the iSCSI software initiator:

  1. Kernel parts, which do "read block", "write block"
  2. Userland parts: administration, login, logout, etc.

Basically, the process of mounting a LUN works as follows:

  1. In userland, "discover" the target & lun, save info to a config file.
  2. In userland, "login" to target, which makes the kernel create a /dev/sd? device for the LUN(s)
  3. Mess with device as normal.

Procedure

$ sudo apt-get install open-iscsi
$ sudo YourEditorOfChoice /etc/iscsi/initiatorname.iscsi

In RedHat:

$ sudo service open-iscsi start

Elsewhere:

$ sudo /etc/init.d/open-iscsi start

This makes dmesg say:

Loading iSCSI transport class v2.0-724.
iscsi: registered transport (tcp)
iscsi: registered transport (iser)
$ iscsiadm -m discovery -t sendtargets -p 10.60.118.14:3260
10.60.118.14:3260,1001 iqn.1992-08.com.netapp:sn.101166881
$ iscsiadm -m node -T iqn.1992-08.com.netapp:sn.101166881 -p 10.60.118.14:3260 -l

This makes dmesg say:

scsi4 : iSCSI Initiator over TCP/IP
scsi 4:0:0:0: Direct-Access     NETAPP   LUN              0.2  PQ: 0 ANSI: 4
SCSI device sdb: 16777216 512-byte hdwr sectors (8590 MB)
sdb: Write Protect is off
sdb: Mode Sense: bd 00 00 08
SCSI device sdb: write cache: disabled, read cache: enabled, doesn't support DPO or FUA
SCSI device sdb: 16777216 512-byte hdwr sectors (8590 MB)
sdb: Write Protect is off
sdb: Mode Sense: bd 00 00 08
SCSI device sdb: write cache: disabled, read cache: enabled, doesn't support DPO or FUA
 sdb: sdb1 sdb2
sd 4:0:0:0: Attached scsi disk sdb
sd 4:0:0:0: Attached scsi generic sg1 type 0
$ fdisk /dev/sdb
$ mount /dev/sdb2 /mnt/mylun
$ chkconfig --level <levels> open-iscsi on