After you reach the point where everything is logged in (you are able to type iscsiadm –m session and get output), following is the generic syntax:
iscsiadm -m node -T <targetname> -p <ip:port> –op update -n node.conn[0].startup -v automatic
<br>
The parameters between < and > are substitutions.
The syntax for persistent binding devices discovered on an internal connection under Ubuntu would look like this:
iscsiadm -m node -p 172.16.16.1 –op update -n node.conn[0].startup -v automatic
<br>
Here’s a more complete breakout, with examples from another system with two volumes (vol1-test and vol2-test), each with two connection paths, to log in to:
root@xxx:/etc/iscsi# iscsiadm -m node -l
Login session [iface: default, target: iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol1-test.600176c30c272e438f96ea2d48669f4a, portal: 10.4.15.164,3260]
Login session [iface: default, target: iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol1-test.600176c30c272e438f96ea2d48669f4a, portal: 10.3.15.102,3260]
Login session [iface: default, target: iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol2-test.600176c34e91735e80bcbba748669f4a, portal: 10.4.15.164,3260]
Login session [iface: default, target: iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol2-test.600176c34e91735e80bcbba748669f4a, portal: 10.3.15.102,3260]
<br>
The following is used for persistent binding to just the first volume, by target name:
# iscsiadm -m node -T iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol1-test.600176c30c272e438f96ea2d48669f4a –op update -n node.conn[0].startup -v automatic
root@xxx:/etc/iscsi# /etc/init.d/open-iscsi restart
* Disconnecting iSCSI targets Logout session [sid: 1, target: iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol1-test.600176c30c272e438f96ea2d48669f4a, portal: 10.4.15.164,3260]
Logout session [sid: 2, target: iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol1-test.600176c30c272e438f96ea2d48669f4a, portal: 10.3.15.102,3260]
Logout session [sid: 3, target: iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol2-test.600176c34e91735e80bcbba748669f4a, portal: 10.4.15.164,3260]
Logout session [sid: 4, target: iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol2-test.600176c34e91735e80bcbba748669f4a, portal: 10.3.15.102,3260]
[ OK ]
* Stopping iSCSI initiator service [ OK ]
* Starting iSCSI initiator service iscsid [ OK ]
* Setting up iSCSI targets
Login session [iface: default, target: iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol1-test.600176c30c272e438f96ea2d48669f4a, portal: 10.4.15.164,3260]
Login session [iface: default, target: iqn.2003-01.com.pivot3:raige.vol:34xen.defaultpool.vol1-test.600176c30c272e438f96ea2d48669f4a, portal: 10.3.15.102,3260]
[ OK ]
<br>
NOTE: This just pulls in that target (vol1-test). Further, we could add by –p 10.3.15.164 in a second operation and pull in one other connection that the above did not add, for vol2-test on an IP basis (or, if this were the first operation, it would have added one connection to each volume). To turn off automatic binding for a given connection, you would use –v manual instead of -v automatic.
<br>
Also, none of this takes effect until the iSCSI daemon is restarted.
<br>
Starting-iSCSI-on-Startup-with-Linux-Systems.pdf