====== iSCSI Initiator (client) ======
As root.
===== Install open-iscsi package =====
> apt-get install open-iscsi
Setting up open-iscsi (2.0.873+git0.3b4b4500-1) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
===== Configure initiator =====
> nano -c /etc/iscsi/iscsid.conf
# line 53: uncomment
node.session.auth.authmethod = CHAP
# line 57,58: uncomment and set username and password which set on iSCSI Target
node.session.auth.username = username
node.session.auth.password = password
> /etc/init.d/open-iscsi restart
==== Adding an appropriate IP address ====
Depending on the server's iscsi portal configuration, it might be necessary to add an appropriate IP address to the initiator's machine network interface (NIC). If this is required, here is how to do it, in this case temporarily adding the appropriate IP address to the eth0 interface ([[https://www.garron.me/en/linux/add-secondary-ip-linux.html|reference]]):
> sudo ip address add 10.1.1.55/24 dev eth0
Once done, the temporary IP address can be removed using:
> sudo ip address del 10.1.1.55/24 dev eth0
===== discover target =====
> sudo iscsiadm -m discovery -t sendtargets -p <10.0.0.50>
10.0.0.50:3260,1 iqn.2013-05.world.server:target00
=== Confirm status after discovery ===
> sudo iscsiadm -m node -o show [-n iqn.2013-05.world.server:target00]
# BEGIN RECORD 2.0-873
node.name = iqn.2013-05.world.server:target00
node.tpgt = 1
node.startup = manual
node.leading_login = No
.....
.....
# END RECORD
=== Login to target ===
**Login to all targets**
> sudo iscsiadm -m node --login
Logging in to [iface: default, target: iqn.2013-05.world.server:target00, portal: 10.0.0.50,3260] (multiple)
Login to [iface: default, target: iqn.2013-05.world.server:target00, portal: 10.0.0.50,3260] successful.
**Login to one target**
> sudo iscsiadm -m node --target iqn.2014-05.4d --portal 10.1.1.2:3260 --login
Associated iSCSI disks should show up on the machine.
**Disconnect from node (unmounting iSCSI volumes):**
> sudo iscsiadm -m node -u
=== Confirm session ===
> sudo iscsiadm -m session -o show
tcp: [1] 10.0.0.50:3260,1 iqn.2013-05.world.server:target00
=== Confirm partitions ===
> cat /proc/partitions
major minor #blocks name
8 0 488386584 sda
8 1 204800 sda1
8 2 26460160 sda2
8 3 1 sda3
8 5 435505152 sda5
8 6 10485760 sda6
8 7 5242880 sda7
8 8 10482688 sda8
11 0 1048575 sr0
8 16 204800 sdb
-----
On Debian, iSCSI discovery stores nodes (targets to extents associations, or LUNs) in **/etc/iscsi/nodes**
-----
=== iSCSI Documentation ===
[[https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Online_Storage_Reconfiguration_Guide/iscsilogin.html]]