AT the storage client machine, do:
yum install iscsi-initiator-utils
Edit file /etc/iscsi/initiatorname.iscsi to set your name, example:
InitiatorName=iqn.2010-07.com.example:node1
Start the daemon as it is not started by default:
service iscsid start
Import target devices into database:
iscsiadm --mode discovery --type sendtargets --portal 192.168.0.120
# tree /var/lib/iscsi/ /var/lib/iscsi/ |-- ifaces |-- isns |-- nodes | `-- iqn.2010-07.com.example:storage.disk | `-- 192.168.0.120,3260,1 | `-- default |-- send_targets | `-- 192.168.0.120,3260 | |-- iqn.2010-07.com.example:storage.disk,192.168.0.120,3260,1,default -> /var/lib/iscsi/nodes/iqn.2010-07.com.example:storage.disk/192.168.0.120,3260,1 | `-- st_config |-- slp `-- static
Note: For debian, the node database is under /etc/iscsi/.
Connect (login) to the target
iscsiadm -m node -T iqn.2010-07.com.example:storage.disk -l
Logging in to [iface: default, target: iqn.2010-07.com.example:storage.disk, portal: 192.168.0.120,3260] Login to [iface: default, target: iqn.2010-07.com.example:storage.disk, portal: 192.168.0.120,3260]: successful
The disk is connected as /dev/sda. Sample dmesg output:
scsi1 : iSCSI Initiator over TCP/IP Vendor: IET Model: Controller Rev: 0001 Type: RAID ANSI SCSI revision: 05 Vendor: IET Model: VIRTUAL-DISK Rev: 0001 Type: Direct-Access ANSI SCSI revision: 05 SCSI device sda: 4194104 512-byte hdwr sectors (2147 MB) sda: Write Protect is off sda: Mode Sense: 79 00 00 08 SCSI device sda: drive cache: write back SCSI device sda: 4194104 512-byte hdwr sectors (2147 MB) sda: Write Protect is off sda: Mode Sense: 79 00 00 08 scsi 1:0:0:0: Attached scsi generic sg0 type 12 SCSI device sda: drive cache: write back sda: sda1 sd 1:0:0:1: Attached scsi disk sda sd 1:0:0:1: Attached scsi generic sg1 type 0
At the target, check who is connected:
# tgtadm --lld iscsi --mode target --op show
Target 1: iqn.2010-07.com.example:storage.disk
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 1
Initiator: iqn.2010-07.com.example:node1
Connection: 0
IP Address: 192.168.0.101
I_T nexus: 2
Initiator: iqn.2010-07.com.example:node2
Connection: 0
IP Address: 192.168.0.102
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path: None
LUN: 1
Type: disk
SCSI ID: iscsi_lun1
SCSI SN: ad58f470
Size: 2147 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path: /dev/drbd0
Account information:
ACL information:
192.168.0.0/24