1 == Setup a new iscsi initiator ==
3 giustini is our storage, i.e. the target in iscsi terminology.
4 The initiator, i.e. the machine that wants to access iscsi
5 block devices, we will simply call host.
7 === host preparations ===
9 * On the host install open-iscsi
11 apt-get install open-iscsi
14 * Then run discovery once so that giustini knows it already. Saves
15 some copy/pasting later on:
17 iscsiadm -m discovery -t st -p 10.0.0.17
20 * You should now see two lines in the output of
24 corresponding to the two addresses that controller A has:
26 dijkstra:~# iscsiadm -m node
27 10.0.0.17:3260,1 iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a
28 10.0.0.18:3260,2 iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a
31 === Meanwhile on Melee Islan^W^WGiustini ===
33 * Log into the web config interface (see dsa-passwords for details)
34 * Go to **Manage** -> **General Config** -> **Manage Host List** and give
35 the new host a nice nickname (i.e. its name). If you did the
36 discovery above it should already be listed in the global host
37 list and you just need to set its name. Else you would also need to
38 manually set the host's iqn (iscsi qualifiled name) which you can
39 find on the host in {{{/etc/iscsi/initiatorname.iscsi}}}.
40 * Go to **Manage** -> **General Config** -> **Manage CHAP** to add a new
41 entry for the new host. Pick the correct node name, and set a
42 secret for it (N.B.: the maximum is 15, not 16 chars -
43 the interface and documentation lies). Also setup mutual chap:
44 As name use giustini's base iqn {{{iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda}}}
45 and again pick a secret (same constraints as above).
46 * Go to **Manage** -> **Volume Management** -> **volume menu** -> **add volume** to add
47 a new volume. Choose volume size and name as you wish (our policy for name
48 appears to be "//<targethost>//-//<mountpoint or purpose>//.
49 Leave LUN empty (i.e. NONE).
50 * Go to **Manage** -> **Volume Management** -> **volume mapping** and map the
51 new volume to a free LUN on the new host.
53 === Meanwhile on Melee Islan^W^WGiustini (telnet version) ===
55 * Log into the telnet config interface (see dsa-passwords for details)
56 * run {{{show iscsi-hosts}}}. You should see a iqn without a hostname attached.
57 Compare that one to **InitiatorName** in {{{/etc/iscsi/initiatorname.iscsi}}}.
58 If they are the same, set it like {{{set iscsi-host host iqn.1993-08.org.debian:01:f3c2e4746681 rossini}}}
59 **bad thing, you need to remember the iqn for the next step**
60 * run {{{show chap-records}}}, this will list you the already configured hosts.
61 To add a new host run something like {{{create chap-record name iqn.1993-08.org.debian:01:f3c2e4746681 secret foobar mutual-name iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda mutual-secret 1234567890ABCDEF }}}
62 * for volume management see [[export-iscsi]]
64 === Back on the host ===
66 * edit /etc/iscsi/iscsid.conf:
67 ** set {{{node.session.auth.authmethod = CHAP}}}
68 ** set {{{node.session.auth.username}}} to own initiatorname (again, see {{{/etc/iscsi/initiatorname.iscsi}}})
69 ** set {{{node.session.auth.password}}}
70 ** set {{{node.session.auth.username_in = iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda}}}
71 ** set {{{node.session.auth.password_in}}}
73 * stop and start iscsi:
75 /etc/init.d/open-iscsi stop &&
77 (cd / && env -i /etc/init.d/open-iscsi start)
80 * not sure if this is necessary again:
82 iscsiadm -m discovery -t st -p 10.0.0.17
85 * and just for fun, run this again.
89 The output should be the same as above:
91 dijkstra:~# iscsiadm -m node
92 10.0.0.17:3260,1 iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a
93 10.0.0.18:3260,2 iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a
96 * moment of truth. Login:
98 iscsiadm -m node --targetname "iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a" --login
101 * cat /proc/scsi/scsi, dmsg, the logs should show it having detected new block devices as sdX.
102 You should have gotten each volume twice (once via .17 and once via .18).
103 * more pretty status stuff, if you care:
105 dijkstra:~# iscsiadm -m session -P 1
106 Target: iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a
107 Current Portal: 10.0.0.17:3260,1
108 Persistent Portal: 10.0.0.17:3260,1
114 Iface Initiatorname: iqn.1993-08.org.debian:01:dea714656496
115 Iface IPaddress: 10.0.0.218
116 Iface HWaddress: default
117 Iface Netdev: default
119 iSCSI Connection State: LOGGED IN
120 iSCSI Session State: LOGGED_IN
121 Internal iscsid Session State: NO CHANGE
122 Current Portal: 10.0.0.18:3260,2
123 Persistent Portal: 10.0.0.18:3260,2
129 Iface Initiatorname: iqn.1993-08.org.debian:01:dea714656496
130 Iface IPaddress: 10.0.0.218
131 Iface HWaddress: default
132 Iface Netdev: default
134 iSCSI Connection State: LOGGED IN
135 iSCSI Session State: LOGGED_IN
136 Internal iscsid Session State: NO CHANGE
140 * next, install and configure multipath-tools
142 cat > /etc/multipath.conf << EOF
146 selector "round-robin 0"
147 path_grouping_policy multibus
148 getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n"
149 prio_callout /bin/true
150 path_checker readsector0
155 user_friendly_name yes
158 devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
159 devnode "^hd[a-z][[0-9]*]"
161 devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]"
169 wwid 3600c0ff000d5f6bde2d4cf4901000000
175 apt-get install multipath-tools
178 * look at the topology
180 echo show topology | multipathd -k
183 * for the wwid thing in there create an entry in multipath.conf with a proper name, then reload multipathd
185 vi /etc/multipath.conf
186 /etc/init.d/multipath-tools reload
187 echo show topology | multipathd -k
191 * If you are happy with what you have, change node.startup to automatic in iscsid.conf
193 vi /etc/iscsi/iscsid.conf
196 * see if it works out of the box after a reboot.
203 iscsiadm -m node --targetname "iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a" --rescan
204 iscsiadm -m node --targetname "iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a" --login
205 iscsiadm -m node --targetname "iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a" --logout