iscsi tools: fix iscsiadm return value on failed login
[open-iscsi.git] / README
blob9f24659dae29e1d711904de842c7b9aef8642bf9
1 =================================================================
3                 Linux* Open-iSCSI
5 =================================================================
7                                                    July 1, 2010
8 Contents
9 ========
11 - 1. In This Release
12 - 2. Introduction
13 - 3. Installation
14 - 4. Open-iSCSI daemon
15 - 5. Open-iSCSI Configuration Utility
16 - 6. Configuration
17 - 7. Getting Started
18 - 8. Advanced Configuration
19 - 9. iSCSI System Info
22 1. In This Release
23 ==================
25 This file describes the Linux* Open-iSCSI Initiator. The software was
26 tested on AMD Opteron (TM) and Intel Xeon (TM). 
28 The latest development release is available at:
29 http://www.open-iscsi.org
31 For questions, comments, contributions send e-mail to:
32 open-iscsi@googlegroups.com 
34     1.1. Features
35     
36     - highly optimized and very small-footprint data path;
37     - persistent configuration database;
38     - SendTargets discovery;
39     - CHAP;
40     - PDU header Digest;
41     - multiple sessions;
42     
43 2. Introduction
44 ===============
46 Open-iSCSI project is a high-performance, transport independent,
47 multi-platform implementation of RFC3720 iSCSI.
49 Open-iSCSI is partitioned into user and kernel parts.
51 The kernel portion of Open-iSCSI is a from-scratch code
52 licensed under GPL. The kernel part implements iSCSI data path
53 (that is, iSCSI Read and iSCSI Write), and consists of three
54 loadable modules: scsi_transport_iscsi.ko, libiscsi.ko and iscsi_tcp.ko.
56 User space contains the entire control plane: configuration
57 manager, iSCSI Discovery, Login and Logout processing,
58 connection-level error processing, Nop-In and Nop-Out handling,
59 and (in the future:) Text processing, iSNS, SLP, Radius, etc.
61 The user space Open-iSCSI consists of a daemon process called
62 iscsid, and a management utility iscsiadm.
65 3. Installation
66 ===============
68 As of today, the Open-iSCSI Initiator requires a host running the
69 Linux operating system with kernel version 2.6.16, or later. 2.6.14 and
70 2.6.15 are partially supported. Known issues with 2.6.14 - .15 support:
72 - If the device is using a write back cache, during session logout
73 the cache sync command will fail.
74 - iscsiadm's -P 3 option will not print out scsi devices.
75 - iscsid will not automatically online devices.
77 You need to enable "Cryptographic API" under "Cryptographic options" in the
78 kernel config. And you must enable "CRC32c CRC algorithm" even if
79 you do not use header or data digests. They are the kernel options,
80 CONFIG_CRYPTO and CONFIG_CRYPTO_CRC32C, respectively.
82 By default the kernel source found at
83 /lib/modules/`uname -a`/build
84 will be used to compile the open-iscsi modules. To specify a different
85 kernel to build against use:
87         make KSRC=<kernel-src>
89 or cross-compilation:
91         make KSRC=<kernel-src> KARCH="ARCH=um"
93 To compile on SUSE Linux you'll have to use
95         make KSRC=/usr/src/linux \
96              KBUILD_OUTPUT=/usr/src/linux-obj/<arch>/<config>
98 where <config> is the kernel configuration to use (eg. 'smp').
100 For Red Hat/Fedora and Debian distributions open-iscsi can be installed by
101 typing "make install". This will copy iscsid and iscsiadm to /usr/sbin, the
102 init script to /etc/init.d, and the kernel modules: iscsi_tcp.ko,
103 libiscsi_tcp.ko, libiscsi.ko and scsi_transport_iscsi to
104 /lib/modules/`uname -r`/kernel/drivers/scsi/ overwriting existing iscsi modules.
106 For Debian, be sure to install the linux-headers package that
107 corresponds to your kernel in order to compile the kernel modules
108 ('aptitude install linux-headers-`uname -r`').  You may also wish to
109 run 'make -C kernel/ dpkg_divert' before installing kernel modules if
110 you run a Debian-provided kernel.  This will use dpkg-divert(8) to
111 move the packaged kernel modules out of the way, and ensure that
112 future kernel upgrades will not overwrite them.
114 Also, please be aware that the compatibility patches that enable these
115 iscsi modules to run on kernels older than 2.6.25 will not update the
116 ib_iser module; you may get warnings related to mismatched symbols on
117 this driver, in which case you'll be unable to load ib_iser and
118 open-iscsi simultaneously.
120 4. Open-iSCSI daemon
121 ====================
123 The daemon implements control path of iSCSI protocol, plus some management
124 facilities. For example, the daemon could be configured to automatically 
125 re-start discovery at startup, based on the contents of persistent 
126 iSCSI database (see next section).
128 For help, run:
130         ./iscsid --help
132 Usage: iscsid [OPTION]
134   -c, --config=[path]     Execute in the config file (/etc/iscsi/iscsid.conf).
135   -f, --foreground        run iscsid in the foreground
136   -d, --debug debuglevel  print debugging information
137   -u, --uid=uid           run as uid, default is current user
138   -g, --gid=gid           run as gid, default is current user group
139   -h, --help              display this help and exit
140   -v, --version           display version and exit
144 5. Open-iSCSI Configuration Utility
145 ===================================
147 Open-iSCSI persistent configuration is implemented as a DBM database
148 available on all Linux installations.
150 The database contains two tables:
152 - Discovery table (/etc/iscsi/send_targets);
153 - Node table (/etc/iscsi/nodes).
155 The regular place for iSCSI database files: /etc/iscsi/nodes
157 The iscsiadm utility is a command-line tool to manage (update, delete,
158 insert, query) the persistent database.
160 The utility presents set of operations that a user can perform 
161 on iSCSI nodes, sessions, connections, and discovery records.
163 Open-iscsi does not use the term node as defined by the iSCSI RFC,
164 where a node is a single iSCSI initiator or target. Open-iscsi uses the
165 term node to refer to a portal on a target, so tools like iscsiadm
166 require that --targetname and --portal argument be used when in node mode.
168 For session mode, a session id (sid) is used. The sid of a session can be
169 found by running iscsiadm -m session -i. The session id is not currently
170 persistent and is partially determined by when the session is setup.
172 Note that some of the iSCSI Node and iSCSI Discovery operations 
173 do not require iSCSI daemon (iscsid) loaded.
175 For help, run:
177         ./iscsiadm --help
179 Usage: iscsiadm [OPTION]
181   -m, --mode <op>         specify operational mode op =
182                           <discovery|discoverydb|fw|iface|host|node>
184   -m discoverydb --type=[type] --interface=[iface...] --portal=[ip:port] \
185                         --print=[N] \
186                         --op=[op]=[NEW | UPDATE | DELETE | NONPERSISTENT] \                             --discover
188                           This command will use the discovery record settings
189                           matching the record with type=type and
190                           portal=ip:port]. If a record does not exist, it will
191                           create a record using the iscsid.conf discovery
192                           settings.
194                           By default, it will then remove records for
195                           portals no longer returned. And,
196                           if a portal is returned by the target, then the
197                           discovery command will create a new record or modify
198                           an existing one with values from iscsi.conf and the
199                           command line.
201                           [op] can be passed in multiple times to this
202                           command, and it will alter the node DB manipulation.
204                           If [op] is passed in and the value is
205                           "new", iscsiadm will add records for portals that do
206                           not yet have records in the db.
208                           If [op] is passed in and the value is
209                           "update", iscsiadm will update node records using
210                           info from iscsi.conf and the command line for portals
211                           that are returned during discovery and have
212                           a record in the db.
214                           If [op] is passed in and the value is "delete",
215                           iscsiadm will delete records for portals that
216                           were not returned during discovery.
218                           If [op] is passed in and the value is
219                           "nonpersistent" iscsiadm will not store
220                           the portals found in the node DB. This
221                           only useful with the --login command.
223                           See the example section for more info.
225                           See below for how to setup iscsi ifaces for
226                           software iscsi or override the system defaults.
228                           Multiple ifaces can be passed in during discovery.
230                           For the above commands "print" is optional. If
231                           used, N can be 0 or 1.
232                           0 = The old flat style of output is used.
233                           1 = The tree style with the inteface info is used.
235                           If print is not used the old flay style is used.
236   -m discoverydb --interface=[iface...] --type=[type] --portal=[ip:port] \
237                         --print=[N] \
238                         --op=[op]=[NEW | UPDATE | DELETE | NONPERSISTENT] \
239                         --discover --login
241                           This works like the previous discoverydb command
242                           with the --login argument passed in will also
243                           log into the portals that are found.
244   -m discoverydb --portal=[ip:port] --type=[type] \
245                         --op=[op] [--name=[name] --value=[value]]
247                           Perform specific DB operation [op] for 
248                           discovery portal. It could be one of:
249                           [new], [delete], [update] or [show]. In case of
250                           [update], you have to provide [name] and [value]
251                           you wish to update
253                           op=NEW will create a new discovery record
254                           using the iscsid.conf discovery settings. If it
255                           already exists, it will be overwritten using
256                           iscsid.conf discovery settings.
258                           op=DELETE will delete the discovery record
259                           and records for the targets found through
260                           that discovery source.
262                           op=SHOW will display the discovery record
263                           values. The --show arguemnt can be used to
264                           force the CHAP passwords to be displayed.
265   -m discovery --type=[type] --interface=iscsi_ifacename \
266                         --portal=[ip:port] --login --print=[N] \
267                         --op=[op]=[NEW | UPDATE | DELETE | NONPERSISTENT]
268                           perform [type] discovery for target portal with
269                           ip-address [ip] and port [port].
271                           This command will not use the discovery record
272                           settings. It will use the iscsid.conf discovery
273                           settings and it will overwrite the discovery
274                           record with iscsid.conf discovery settings if it
275                           exists. By default, it will then remove records for
276                           portals no longer returned. And,
277                           if a portal is returned by the target, then the
278                           discovery command will create a new record or modify
279                           an existing one with values from iscsi.conf and the
280                           command line.
282                           [op] can be passed in multiple times to this
283                           command, and it will alter the DB manipulation.
285                           If [op] is passed in and the value is
286                           "new", iscsiadm will add records for portals that do
287                           not yet have records in the db.
289                           If [op] is passed in and the value is
290                           "update", iscsiadm will update node records using
291                           info from iscsi.conf and the command line for portals
292                           that are returned during discovery and have
293                           a record in the db.
295                           If [op] is passed in and the value is "delete",
296                           iscsiadm will delete records for portals that
297                           were not returned during discovery.
299                           If [op] is passed in and the value is
300                           "nonpersistent" iscsiadm will not store
301                           the portals found in the node DB.
303                           See the example section for more info.
305                           See below for how to setup iscsi ifaces for
306                           software iscsi or override the system defaults.
308                           Multiple ifaces can be passed in during discovery.
309   -m discovery --print=[N] display all discovery records from internal
310                           persistent discovery database.
312   -m node                 display all discovered nodes from internal
313                           persistent discovery database
314   -m node --targetname=[name] --portal=[ip:port] \
315                                         --interface=iscsi_ifacename] \
316                                         [--login|--logout|--rescan|--stats]
317   -m node --targetname=[name] --portal=[ip:port]
318                                 --interface=[driver,HWaddress] \
319                                 --op=[op] [--name=[name] --value=[value]]
320   -m node --targetname=[name] --portal=[ip:port]
321                                 --interface=iscsi_ifacename] \
322                                 --print=[level]
323                           perform specific DB operation [op] for specific
324                           interface on host that will connect to portal on
325                           target. targetname, portal and interface are optional.
326                           See below for how to setup iscsi ifaces for
327                           software iscsi or override the system defaults.
329                           op could be one of:
330                           [new], [delete], [update] or [show]. In case of
331                           [update], you have to provide [name] and [value]
332                           you wish to update.
333                           [delete] - Note that if a session is using the
334                           node record, the session will be logged out then
335                           the record will be deleted.
337                           Print level can be 0 to 1.
339                           Rescan will perform a SCSI layer scan of the session
340                           to find new LUNs.
342                           Stats prints the iSCSI stats for the session.
343   -m node --logoutall=[all|manual|automatic]
344                           Logout "all" the running sessions or just the ones
345                           with a node startup value manual or automatic.
346                           Nodes marked as ONBOOT are skipped.
347   -m node --loginall=[all|manual|automatic]
348                           Login "all" the running sessions or just the ones
349                           with a node startup value manual or automatic.
350                           Nodes marked as ONBOOT are skipped.
351   -m session              display all active sessions and connections
352   -m session --sid=[sid] [ --print=level | --rescan | --logout ]
353                                 --op=[op] [--name=[name] --value=[value]]
354                           perform operation for specific session with
355                           session id sid. If no sid is given the operation
356                           will be performed on all running sessions if possible.
357                           --logout and --op work like they do in node mode,
358                           but in session mode targetname and portal info is
359                           is not passed in.
361                           Print level can be 0 to 2.
362                           1 = Print basic session info like node we are
363                           connected to and whether we are connected.
364                           2 = Print iscsi params used.
365                           3 = Print SCSI info like LUNs, device state.
366                           If no sid and no operation is given print out the
367                           running sessions.
368   -m iface --interface=iscsi_ifacename --op=[op] [--name=[name] --value=[value]]
369                                 --print=level
370                           perform operation on fiven interface with name
371                           iscsi_ifacename.
373                           See below for examples.
374   -m host --host=hostno|MAC --print=level
375                           Display information for a specific host. The host
376                           can be passed in by host number or by MAC address.
377                           If a host is not passed in then info
378                           for all hosts is printed.
380                           Print level can be 0 to 4.
381                           1 = Print info for how like its state, MAC, and
382                           netinfo if possible.
383                           2 = Print basic session info for nodes the host
384                           is connected to.
385                           3 = Print iscsi params used.
386                           4 = Print SCSI info like LUNs, device state.
387   -d, --debug debuglevel  print debugging information
388   -V, --version           display version and exit
389   -h, --help              display this help and exit
392 5.1 iSCSI iface setup
393 =====================
395 The next sections describe how to setup iSCSI ifaces so you can bind
396 a session to a NIC port when using software iscsi (section 5.1.1), and
397 it describes how to setup ifaces for use with offload cards from Chelsio
398 and Broadcm (section 5.1.2).
401 5.1.1 How to setup iSCSI interfaces (iface) for binding
402 =======================================================
404 If you wish to allow the network susbsystem to figure out
405 the best path/NIC to use then you can skip this section. For example
406 if you have setup your portals and NICs on different subnets then
407 this the following is not needed for software iscsi.
409 Warning!!!!!!
410 This feature is experimental. The interface may change. When reporting
411 bugs, if you cannot do a "ping -I ethX target_portal", then check your
412 network settings first. Make sure the rp_filter setting is set to 0 or 2
413 (see Prep section below for more info). If you cannot ping the portal,
414 then you will not be able to bind a session to a NIC.
416 What is a scsi_host and iface for software, hardware and partial
417 offload iscsi?
419 Software iscsi, like iscsi_tcp and iser, allocate a scsi_host per session
420 and does a single connection per session. As a result
421 /sys/class_scsi_host and /proc/scsi will report a scsi_host for
422 each connection/session you have logged into. Offload iscsi, like
423 Chelsio cxgb3i, allocates a scsi_host for each PCI device (each
424 port on a HBA will show up as a different PCI device so you get
425 a scsi_host per HBA port).
427 To manage both types of initiator stacks, iscsiadm uses the interface (iface)
428 structure. For each HBA port or for software iscsi for each network
429 device (ethX) or NIC, that you wish to bind sessions to you must create
430 a iface config /etc/iscsi/ifaces.
432 Prep:
434 The iface binding feature requires the sysctl setting
435 net.ipv4.conf.default.rp_filter to be set to 0 or 2. This can be set
436 in /etc/sysctl.conf by having the line:
438 net.ipv4.conf.default.rp_filter = N
440 where N is 0 or 2. Note that when setting this you may have to reboot
441 the box for the value to take effect.
444 rp_filter information from Documentation/networking/ip-sysctl.txt:
446 rp_filter - INTEGER
447         0 - No source validation.
448         1 - Strict mode as defined in RFC3704 Strict Reverse Path
449             Each incoming packet is tested against the FIB and if the interface
450             is not the best reverse path the packet check will fail.
451             By default failed packets are discarded.
452         2 - Loose mode as defined in RFC3704 Loose Reverse Path
453             Each incoming packet's source address is also tested against the FIB
454             and if the source address is not reachable via any interface
455             the packet check will fail.
458 Running:
460 # iscsiadm -m iface
461 iface0 qla4xxx,00:c0:dd:08:63:e8,20.15.0.7,default,iqn.2005-06.com.redhat:madmax
462 iface1 qla4xxx,00:c0:dd:08:63:ea,20.15.0.9,default,iqn.2005-06.com.redhat:madmax
464 Will report iface configurations that are setup in /etc/iscsi/ifaces.
465 The format is:
467 iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
469 For software iscsi, you can create the iface configs by hand, but it is
470 reccomended that you use iscsiadm's iface mode. There is a iface.example in
471 /etc/iscsi/ifaces which can be used as a template for the daring.
473 For each network object you wish to bind a session to you must create
474 a seperate iface config in /etc/iscsi/ifaces and each iface config file
475 must have a unique name which is less than or equal to 64 characters.
477 Example:
479 If you have NIC1 with MAC address 00:0F:1F:92:6B:BF and NIC2 with
480 MAC address 00:C0:DD:08:63:E7 and you wanted to do software iscsi over
481 TCP/IP. Then in /etc/iscsi/ifaces/iface0 you would enter:
483 iface.transport_name = tcp
484 iface.hwaddress = 00:0F:1F:92:6B:BF
486 and in /etc/iscsi/ifaces/iface1 you would enter:
488 iface.transport_name = tcp
489 iface.hwaddress = 00:C0:DD:08:63:E7
491 Warning: Do not name a iface config file  "default" or "iser".
492 They are special value/file that is used by the iscsi tools for
493 backward compatibility. If you name a iface default or iser, then
494 the behavior is not defined.
496 To use iscsiadm to create iface0 above for you run:
498 (This will create a new empty iface config. If there was already a iface
499 with the name "iface0" this command will overwrite it.)
500 # iscsiadm -m iface -I iface0 --op=new
502 (This will set the hwaddress.)
503 # iscsiadm -m iface -I iface0 --op=update -n iface.hwaddress -v 00:0F:1F:92:6B:BF
505 If you had sessions logged in iscsiadm will not update, overwrite
506 a iface. You must log out first. If you have a iface bound to a node/portal
507 but you have not logged in then, iscsiadm will update the config and
508 all existing bindings.
511 You should now skip to 5.1.3 to see how to log in using the iface and for
512 some helpful management commands.
516 5.1.2 Setting up a iface for a iSCSI offload card
517 =================================================
519 This section describes how to setup ifaces for use with Chelsio, Broadcom and
520 QLogic cards.
522 By default, iscsiadm will create a iface for each Broadcom, QLogic and Chelsio
523 port. The iface name will be of the form:
525 $transport/driver_name.$MAC_ADDRESS
527 Running:
529 # iscsiadm -m iface
530 default tcp,<empty>,<empty>,<empty>,<empty>
531 iser iser,<empty>,<empty>,<empty>,<empty>
532 cxgb3i.00:07:43:05:97:07 cxgb3i,00:07:43:05:97:07,<empty>,<empty>,<empty>
533 qla4xxx.00:0e:1e:04:8b:2e qla4xxx,00:0e:1e:04:8b:2e,<empty>,<empty>,<empty>
536 Will report iface configurations that are setup in /etc/iscsi/ifaces.
537 The format is:
539 iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
541 iface_name:             name of iface
542 transport_name:         name of driver
543 hwaddress:              MAC address
544 ipaddress:              IP address to use for this port
545 net_iface_name:         Net_ifacename will be <empty> because change between
546 reboots. It is used for software iSCSI's vlan or alias binding.
547 initiatorname:          Initiatorname to be used if you want to override the
548 default one in /etc/iscsi/initiatorname.iscsi.
552 To display these values in a more friendly way, run:
554 iscsiadm -m iface -I cxgb3i.00:07:43:05:97:07
555 # BEGIN RECORD 2.0-871
556 iface.iscsi_ifacename = cxgb3i.00:07:43:05:97:07
557 iface.net_ifacename = <empty>
558 iface.ipaddress = <empty>
559 iface.hwaddress = 00:07:43:05:97:07
560 iface.transport_name = cxgb3i
561 iface.initiatorname = <empty>
562 # END RECORD
565 Before you can use the iface, you must set the IP address for the port
566 with the following command:
568 iscsiadm -m iface -I cxgb3i.00:07:43:05:97:07 -o update -n iface.ipaddress -v 20.15.0.66
570 Note1.
572 For the name of the value we want to update we use the name from
573 the "iscsiadm -m iface -I cxgb3i.00:07:43:05:97:07" command which is
574 "iface.ipaddress".
576 Note2.
578 For QLogic ports after updating the iface record, for network settings to take
579 effect, one must apply or applyall the settings.
581 iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2e -o apply or
582 iscsiadm -m iface -H 00:0e:1e:04:8b:2e -o applyall
584 With operation "apply" network setting for the specified iface will take effect.
585 With operation "applyall" network settings for all ifaces on a specific host
586 will take take effect. The host can be specified using the -H/--host argument
587 by either the MAC address of the host or the host number.
590 Here is an example of setting multiple IPv6 address on single iSCSI interface
591 port.
592 First interface (no need to set iface_num, it is 0 by default)
594 iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \
595          -n iface.ipaddress -v fec0:ce00:7014:0041:1111:2222:1e04:9392
597 Create the second interface if it does not exist
599 iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a.1 -op=new
600 iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \
601          -n iface.iface_num -v 1 (iface_num is mandatory for second iface)
602 iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \
603          -n iface.ipaddress -v = fec0:ce00:7014:0041:1111:2222:1e04:9393
604 iscsiadm -m iface -H 00:0e:1e:04:8b:2a --op=applyall
606 Note: If there are common settings for multiple interfaces then the
607 settings from 0th iface would be considered valid.
609 Now, we can use this iface to login into targets, which is described in the
610 next section.
613 5.1.3 Discoverying iSCSI targets/portals 
614 ========================================
616 Be aware that iscsiadm will use the default route to do discovery. It will
617 not use the iface specified. So if you are using a offload card, you will
618 need a seperate network connection to the target for discovery purposes.
619 *This will be fixed in the next version of open-iscsi*
621 For compatibility reasons, when you run iscsiadm to do discovery, it
622 will check for interfaces in /etc/iscsi/iscsi/ifaces that are using
623 tcp for the iface.transport and it will bind the portals that are discovered
624 so that they will be logged in through those ifaces. This behavior can also
625 be overriden by passing in the interfaces you want to use. For the case
626 of offload like with cxgb3i and bnx2i this is required because the transport
627 will not be tcp.
629 For example if you had defined two interface but only wanted to use one
630 you can use the --interface/-I argument:
632 iscsiadm -m discoverydb -t st -p ip:port -I iface1 --discover -P 1
634 If you had defined interfaces but wanted the old behavior, where 
635 we do not bind a session to a iface, then you can use the special iface
636 "default":
638 iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1
640 And if you did not define any interfaces in /etc/iscsi/ifaces and do
641 not pass anything into iscsiadm, running iscsiadm will do the default
642 behavior, where we allow the network subsystem to decide which
643 device to use.
645 If you later want to remove the bindings for a specific target and
646 iface then  you can run:
648 iscsiadm -m node -T my_target -I iface0 --op=delete
650 To do this for a specific portal on a target run:
652 iscsiadm -m node -T my_target -p ip:port -I iface0 --op=delete
654 If you wanted to delete all bindinds for iface0 then you can run
656 iscsiadm -m node -I iface0 --op=delete
658 And for equalogic targets it is sometimes useful to remove by just portal
660 iscsiadm -m node -p ip:port -I iface0 --op=delete
663 To now log into targets it is the same as with sofware iscsi. See section
664 7 for how to get started.
669 5.2 iscsiadm examples
670 =====================
671     Usage examples using the one-letter options (see iscsiadm man page
672     for long options):
674     Discovery mode:
676     - SendTargets iSCSI Discovery using the default driver and interface and
677         using the discovery settings for the discovery record with the
678         ID [192.168.1.1:3260].
680             ./iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover
682         This will search /etc/iscsi/send_targets for a record with the
683         ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it
684         will perform discovery using the settings stored in the record.
685         If a record does not exist, it will be created using the iscsid.conf
686         discovery settings.
688         The argument to -p may also be a hostname instead of an address.
689             ./iscsiadm -m discoverydb -t st -p smoehost --discover
691         For the ifaces, iscsiadm will first search /etc/iscsi/ifaces for
692         interfaces using software iscsi. If any are found then nodes found
693         during discovery will be setup so that they can logged in through
694         those interfaces. To specify a specific iface, pass the
695         -I argument for each iface.
697     - SendTargets iSCSI Discovery updating existing target records:
699             ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
700                 -o update --discover
702         If there is a record for targetX and portalY exists in the DB, and
703         is returned during discovery, it will be updated with the info
704         from the iscsi.conf. No new portals will be added and stale
705         portals will not be removed.
707     - SendTargets iSCSI Discovery deleting existing target records:
709             ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
710                 -o delete --discover
712         If there a record for targetX and portalY exists in the DB, but
713         is not returned during discovery it will be removed from the DB.
714         No new portals will be added and existing portal records will not
715         be changed.
717         Note: If a session is logged into portal we are going to delete
718         a record for, it will be logged out then the record will be
719         deleted.
721      - SendTargets iSCSI Discovery adding new records:
723             ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
724                 -o new --discover
726         If there targetX and portalY is returned during discovery and does
727         not have a record, it will be added. Existing records are not
728         modified.
730      - SendTargets iSCSI Discovery using multiple ops:
732             ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
733                 -o new -o delete --discover
735         This command will add new portals and delete records for portals
736         no longer returned. It will not change the record information for
737         existing portals.
739      - SendTargets iSCSI Discovery in nonpersistent mode:
741             ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
742                 -o nonpersistent --discover
744         This command will perform discovery, but not manipulate the node DB.
746   - SendTargets iSCSI Discovery with a specific interface. If you
747         wish to only use a subset of the interfaces in /etc/iscsi/ifaces
748         then you can pass them in during discovery:
750              ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
751               --interface=iface0 --interface=iface1 --discover
753         Note that for software iscsi, we let the network layer select
754         which NIC to use for discovery, but for later logins iscsiadm
755         will use the NIC defined in the iface config.
757         qla4xxx support is very basic and experimental. It does not store
758         the record info in the card's FLASH or the node DB, so you must
759         rerun discovery every time the driver is reloaded.
761   - Manipulate SendTargets DB.
763         Create new SendTargets discovery record or overwrite an existing
764         discovery record with iscsid.conf discovery settings.
765             ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o new
767         See discovery settings.
768             ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o show
770         See hidden discovery settings like CHAP passwords
771             ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
772                 -o show --show
774         Set discovery setting.
775             ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
776                         -o update -n name -v value
778         Delete discovery record. This will also delete the records for
779         the targets found through the discovery source.
780             ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o delete
782     Node mode. In node mode you can specify which records you want to log
783     into by specifying the targetname, ip address, port or interface
784     (if specifying the interface it must already be setup in the node db).
785     iscsiadm will search the node db, for records which match the values
786     you pass in, so if you pass in the targetname and interface, iscsiadm
787     will search for records with those values and operate on only them.
788     Passing in none of them will result in all node records being operated on.
790     - iSCSI Login to all portals on every node/starget through each interface
791         set in the db:
793             ./iscsiadm -m node -l
795     - iSCSI login to all portals on a node/target through each interface set
796         in the db:
798             ./iscsiadm -m node -T iqn.2005-03.com.max -l
800     - iSCSI login to a specific portal through each interface set in the db:
802             ./iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 -l
804         To specify a IPv6 address the following can be used:
806             ./iscsiadm -m node -T iqn.2005-03.com.max \
807                                         -p 2001:c90::211:9ff:feb8:a9e9 -l
809         The above command would use the default port, 3260. To specify a
810         port use the following:
812             ./iscsiadm -m node -T iqn.2005-03.com.max \
813                                 -p [2001:c90::211:9ff:feb8:a9e9]:3260 -l
815         To specify a hostname the following can be used:
817             ./iscsiadm -m node -T iqn.2005-03.com.max -p somehost -l
819     - iSCSI Login to a specific portal through the NIC setup as iface0:
821             ./iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 \
822                                 -I iface0  -l
824     - iSCSI Logout to all portals on every node/starget through each interface
825         set in the db:
827             ./iscsiadm -m node -u
829         Warning: this does not check startup values like the logout/login all
830         option. Do not use this if you are running iscsi on your root disk.     
832     - iSCSI logout to all portals on a node/target through each interface set
833         in the db:
835             ./iscsiadm -m node -T iqn.2005-03.com.max -u
837     - iSCSI logout to a specific portal through each interface set in the db:
839             ./iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 -u
841     - iSCSI Logout to a specific portal through the NIC setup as iface0:
843             ./iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 \
844                                 -I iface0
846     - Changing iSCSI parameter:
848             ./iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 \
849                -o update -n node.cnx[0].iscsi.MaxRecvDataSegmentLength -v 65536
851         You can also change paramaters for multiple records at once, by
852         specifying different combinations of the target, portal and interface
853         like above.
855     - Adding custom iSCSI portal:
857             ./iscsiadm -m node -o new -T iqn.2005-03.com.max \
858                         -p 192.168.0.1:3260,2 -I iface4
860         The -I/--interface is optional. If not passed in, "default" is used.
861         For tcp or iser, this would allow the network layer to decide what is
862         best.
864         Note that for this command the target portal group tag (TPGT) should
865         be passed in. If it is not passed in on the initial creation command
866         then the user must run iscsiadm again to set the value. Also
867         if the TPGT is not initially passed in, the old behavior of not
868         tracking whether the record was statically or dynamically created
869         is used.
871     - Adding custom NIC config to multiple targets:
873             ./iscsiadm -m node -o new -I iface4
875         This command will add a interface config using the iSCSI and SCSI
876         settings from iscsid.conf to every target that is in the node db.
878     - Removing iSCSI portal:
880             ./iscsiadm -m node -o delete -T iqn.2005-03.com.max -p 192.168.0.4:3260
882         You can also delete multiple records at once, by specifying different
883         combinations of the target, portal and interface like above.
885     - Display iSCSI portal onfiguration:
887             ./iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260
889         or
891             ./iscsiadm -m node -o show -T iqn.2005-03.com.max -p 192.168.0.4:3260
892         You can also display multiple records at once, by specifying different
893         combinations of the target, portal and interface like above.
895         Note: running "iscsiadm -m node" will only display the records. It
896         will not display the configuration info. You must run,
897         "iscsiadm -m node -o show".
899     - Show all node records:
901             ./iscsiadm -m node
903         This will print the nodes using the old flat format where the
904         interface and driver are not displayed. To display that info
905         use the -P argument with the arguent "1":
907             ./iscsiadm -m node -P 1
909     - Show all records in discovery database:
911             ./iscsiadm -m discovery
913     - Show all records in discovery database and show the targets that
914         were discovered from each record:
916             ./iscsiadm -m discovery -P 1
918     - Display session statistics:
920             ./iscsiadm -m session -r 1 --stats
922         This function also works in node mode. Instead of the "-r $sid"
923         argument, you would pass in the node info like targetname and/or portal,
924         and/or interface.
926     - Perform a SCSI scan on a session
928             ./iscsiadm -m session -r 1 --rescan
930         This function also works in node mode. Instead of the "-r $sid"
931         argument, you would pass in the node info like targetname and/or portal,
932         and/or interface.
934         Note: Rescanning does not delete old LUNs. It will only pick up new
935         ones.
937     - Display running sessions:
939             ./iscsiadm -m session -P 1
941 6. Configuration
942 ================
944 The default configuration file is /etc/iscsi/iscsid.conf. This file contains
945 only configuration that could be overwritten by iSCSI Discovery,
946 or manualy updated via iscsiadm utility. Its OK if this file does not
947 exist in which case compiled-in default configuration will take place
948 for newer discovered Target nodes.
950 See the man page and the example file for the current syntax.
951 The manpages for iscsid, iscsiadm are in the doc subdirectory and can be
952 installed in the appropriate man page directories and need to be manually
953 copied into e.g. /usr/local/share/man8.
955 7. Getting Started
956 ==================
957 There are three steps needed to set up a system to use iSCSI storage:
958 7.1. iSCSI startup using the init script or manual startup.
959 7.2. Discover targets.
960 7.3. Automate target logins for future system reboots.
962 The init scripts will start the iSCSI daemon and log into any
963 portals that are set up for automatic login (discussed in 7.2)
964 or discovered through the discover daemon iscsid.conf params
965 (discussed in 7.1.2).
967 If your distro does not have a init script, then you will have to start the
968 daemon and log into the targets manually.
971 7.1.1 iSCSI startup using the init script
972 -----------------------------------------------
974 Red Hat or Fedora:
975 -----------------
976 To start open-iscsi in Red Hat/Fedora you can do:
978         service open-iscsi start
980 To get open-iscsi to automatically start at run time you may have to
981 run:
982         chkconfig --level <levels> open-iscsi on
983 Where <levels> are the run levels.
985 And, to automatically mount a file system during startup
986 you must have the partition entry in /etc/fstab marked with the "_netdev"
987 option. For example this would mount a iscsi disk sdb:
989         /dev/sdb /mnt/iscsi ext3 _netdev 0 0
991 SUSE or Debian:
992 ---------------
993 Otherwise, if there is a initd script for your distro in etc/initd that
994 gets installed with "make install"
996         /etc/init.d/open-iscsi start
998 will usually get you started.
1001 7.1.2 Manual Startup:
1002 ---------------------
1004 7.1.2.1 Starting up the iSCSI daemon (iscsid) and loading modules:
1005 -----------------------------------------------------------------
1006 If there is no initd script, you must start the tools by hand. First load the
1007 iscsi modules with:
1009         modprobe -q iscsi_tcp
1011 after that start iSCSI daemon process:
1013         ./iscsid
1015 or alternatively, start it with debug enabled and with output
1016 redirected to the current console:
1018         ./iscsid -d 8 -f &
1020 7.1.2.2 Logging into Targets:
1021 ---------------------------
1022 Use the configuration utility, iscsiadm, to add/remove/update Discovery
1023 records, iSCSI Node records or monitor active iSCSI sessions (see above or the
1024 iscsiadm man files and see section 7.2 below for how to discover targets).
1026         ./iscsiadm  -m node
1028 will print out the nodes that have been discovered as:
1030         10.15.85.19:3260,3 iqn.1992-08.com.netapp:sn.33615311 
1031         10.15.84.19:3260,2 iqn.1992-08.com.netapp:sn.33615311
1033 The format is:
1035 ip:port,target_portal_group_tag targetname
1037 If you are using the iface argument or want to see the driver
1038 info use the following:
1040         ./iscsiadm -m node -P 1
1042 Target: iqn.1992-08.com.netapp:sn.33615311
1043         Portal: 10.15.84.19:3260,2
1044                 Iface Name: iface2
1045         Portal: 10.15.85.19:3260,3
1046                 Iface Name: iface2
1048 The format is:
1050 Target: targetname
1051         Portal ip_address:port,tpgt
1052                 Iface: iface
1054 where targetname is the name of the target and ip_address:port is the address
1055 and port of the portal. tpgt, is the portal group tag of
1056 the portal, and is not used in iscsiadm commands except for static
1057 record creation. And iface name is the name of the iscsi interface
1058 defined in /etc/iscsi/ifaces. If no interface was defined in
1059 /etc/iscsi/ifaces or passed in, the default behavior is used.
1060 Default here is iscsi_tcp/tcp to be used over which ever NIC the
1061 network layer decides is best.
1063 To login, take the ip, port and targetname from above and run:
1065         ./iscsiadm -m node -T targetname -p ip:port -l
1067 In this example we would run
1069         ./iscsiadm -m node -T iqn.1992-08.com.netapp:sn.33615311 -p 10.15.84.19:3260 -l
1071         Note: drop the portal group tag from the "iscsiadm -m node" output.
1073 7.2. Discover Targets
1074 ---------------------
1075 Once the iSCSI service is running, you can perform discovery using
1076 SendTarget with:
1078 iscsiadm -m discoverydb -t sendtargets -p ip:port --discover
1080 where "ip" is the address of the portal and port is the port.
1082 To use iSNS you can run the discovery command with the type as "isns"
1083 and pass in the ip:port:
1085 iscsiadm -m discoverydb -t isns -p ip:port --discover
1087 Both commands will print out the list of all discovered targets and their
1088 portals:
1090 # iscsiadm -m discoverydb -t st -p 10.15.85.19:3260 --discover
1091 10.15.84.19:3260,2 iqn.1992-08.com.netapp:sn.33615311
1092 10.15.85.19:3260,3 iqn.1992-08.com.netapp:sn.33615311
1094 The format for the output is:
1096 ip:port,tpgt targetname
1098 In this example, for the first target the ip address is 10.15.85.19.
1099 The port is 3260. The target portal group is 3. The target name
1100 is iqn.1992-08.com.netapp:sn.33615311.
1102 If you would also like to see the iscsi inteface which will be used
1103 for each session then use the --print[N] option.
1105 iscsiadm -m discoverydb -t sendtargets -p ip:port -P 1 --discover
1107 will print:
1108     Target: iqn.1992-08.com.netapp:sn.33615311
1109         Portal: 10.15.84.19:3260,2
1110            Iface Name: iface2
1111         Portal: 10.15.85.19:3260,3
1112            Iface Name: iface2
1114 In this example, The IP address of the first portal is 10.15.84.19.
1115 The port is 3260. The target portal group is 3. The target name
1116 is iqn.1992-08.com.netapp:sn.33615311. The iface being used is iface2.
1118 While discovery targets are kept in the discovery db, they are
1119 useful only for re-discovery. The discovered targets (a.k.a. nodes)
1120 are stored as records in the node db.
1122 The discovered targets are not logged into yet. Rather than logging
1123 into the discovered nodes (making LUs from those nodes available as
1124 storage), it is better to automate the login to the nodes we need.
1126 If you wish to log into a target manually now, see section
1127 "7.1.2.2 Logging in targets" above.
1129 7.3. Automate Target Logins for Future System Statups
1130 -----------------------------------------------------
1131 Note: this may only work for distros with init scripts.
1133 To automate login to a node, use the following with the record ID
1134 (record ID is the targetname and portal) of the node discovered in the
1135 discovery above:
1136         iscsiadm -m node -T targetname -p ip:port --op update -n node.startup -v automatic
1138 To set the automatic setting to all portals on a target through every
1139 interface setup for each protal, the following can be run:
1140         iscsiadm -m node -T targetname --op update -n node.startup -v automatic
1142 Or to set the "node.startup" attribute to "startup" as default for
1143 all sessions add the following to the /etc/iscsi/iscsid.conf:
1145         node.startup = automatic
1147 Setting this in iscsid.conf, will not affect existing nodes. It will only
1148 affect nodes that are discovered after setting the value.
1150 To login to all the automated nodes, simply restart the iscsi service:
1151 e.g /etc/init.d/open-iscsi restart. On your next startup the nodes will
1152 be logged into autmotically.
1155 7.4 Automatic Discovery and Login
1156 -----------------------------------
1158 Instead of running the iscsiadm discovery command and editing the
1159 startup setting, iscsid can be configured so that every X seconds
1160 it performs discovery and logs in and out of the portals return or
1161 no longer returned. In this mode, when iscsid starts it will check the
1162 discovery db for iSNS records with:
1164 discovery.isns.use_discoveryd = Yes
1166 and it will check for SendTargets discovery records that have the setting:
1168 discovery.sendtargets.use_discoveryd = Yes
1170 If set, iscsid will perform discovery to the address every
1171 discovery.isns.discoveryd_poll_inval or
1172 discovery.sendtargets.discoveryd_poll_inval seconds,
1173 and it will log into any portals found from the discovery source using
1174 the ifaces in /etc/iscsi/ifaces.
1176 Note that for iSNS the poll_interval does not have to be set. If not set,
1177 iscsid will only perform rediscovery when it gets a SCN from the server.
1179 #   iSNS Note:
1180 #   For servers like Microsofts where they allow SCN registrations, but do not
1181 #   send SCN events, discovery.isns.poll_interval should be set to a non zero
1182 #   value to auto discover new targets. This is also useful for servers like
1183 #   linux-isns (SLES's iSNS server) where it sometimes does not send SCN
1184 #   events in the proper format, so they may not get handled.
1187 Example:
1188 --------
1190 SendTargets:
1191 ------------
1192 - Create a SendTargets record by passing iscsiadm the "-o new" argument in
1193   discoverydb mode.
1194 # iscsiadm -m discoverydb -t st -p 20.15.0.7:3260 -o new
1195 New discovery record for [20.15.0.7,3260] added.
1197 - Set the use_discoveryd setting for the record.
1198 # iscsiadm -m discoverydb -t st -p 20.15.0.7:3260  -o update -n discovery.sendtargets.use_discoveryd -v Yes
1200 - Set the polling interval.
1201 # iscsiadm -m discoverydb -t st -p 20.15.0.7:3260  -o update -n discovery.sendtargets.discoveryd_poll_inval -v 30
1203 To have the new settings take effect restart iscsid by restarting the
1204 iscsi service.
1206 Note:
1207 When iscsiadm is run with the -o new argument, it will use the
1208 discovery.sendtargets.use_discoveryd and
1209 discovery.sendtargets.discoveryd_poll_inval
1210 settings in iscsid.conf for the records initial settings. So if those
1211 are set in iscsid.conf, then you can skip the iscsiadm -o update
1212 commands.
1215 iSNS:
1216 ----
1217 - Create a iSNS record by passing iscsiadm the "-o new" argument in
1218   discoverydb mode.
1219 # iscsiadm -m discoverydb -t isns -p 20.15.0.7:3205 -o new
1220 New discovery record for [20.15.0.7,3205] added.
1222 - Set the use_discoveryd setting for the record.
1223 # iscsiadm -m discoverydb -t isns -p 20.15.0.7:3205  -o update -n discovery.isns.use_discoveryd -v Yes
1225 - [OPTIONAL: see iSNS note above] Set the polling interval if needed.
1226 # iscsiadm -m discoverydb -t st -p 20.15.0.7:3205  -o update -n discovery.isns.discoveryd_poll_inval -v 30
1228 To have the new settings take effect restart iscsid by restarting the
1229 iscsi service.
1231 Note:
1232 When iscsiadm is run with the -o new argument, it will use the
1233 discovery.isns.use_discoveryd and discovery.isns.discoveryd_poll_inval
1234 settings in iscsid.conf for the records initial settings. So if those
1235 are set in iscsid.conf, then you can skip the iscsiadm -o update
1236 commands.
1239 8. Advanced Configuration
1240 =========================
1242 8.1 iSCSI settings for dm-multipath
1243 -----------------------------------
1245 When using dm-multipath, the iSCSI timers should be set so that commands
1246 are quickly failed to the dm-multipath layer. For dm-multipath you should
1247 then set values like queue if no path, so that IO errors are retried and
1248 queued if all paths are failed in the multipath layer.
1251 8.1.1 iSCSI ping/Nop-Out settings
1252 ---------------------------------
1253 To quickly detect problems in the network, the iSCSI layer will send iSCSI
1254 pings (iSCSI NOP-Out requests) to the target. If a NOP-Out times out the
1255 iSCSI layer will respond by failing running commands and asking the SCSI
1256 layer to requeue them if possible (SCSI disk commands get 5 retries if not
1257 using multipath). If dm-multipath is being used the SCSI layer will fail
1258 the command to the multipath layer instead of retrying. The multipath layer
1259 will then retry the command on another path.
1261 To control how often a NOP-Out is sent the following value can be set:
1263 node.conn[0].timeo.noop_out_interval = X
1265 Where X is in seconds and the default is 10 seconds. To control the
1266 timeout for the NOP-Out the noop_out_timeout value can be used:
1268 node.conn[0].timeo.noop_out_timeout = X
1270 Again X is in seconds and the default is 15 seconds.
1272 Normally for these values you can use:
1274 node.conn[0].timeo.noop_out_interval = 5
1275 node.conn[0].timeo.noop_out_timeout = 10
1277 If there are a lot of IO error messages, then the above values may be too
1278 aggressive and you may need to increase the values for your network conditions
1279 and workload, or you may need to check your network for possible problems.
1282 8.1.2 replacement_timeout
1283 -------------------------
1284 The next iSCSI timer that will need to be tweaked is:
1286 node.session.timeo.replacement_timeout = X
1288 Here X is in seconds.
1290 replacement_timeout will control how long to wait for session re-establishment
1291 before failing pending SCSI commands and commands that are being operated on by
1292 the SCSI layer's error handler up to a higher level like multipath or to
1293 an application if multipath is not being used.
1296 8.1.2.1 Running Commands, the SCSI Error Handler, and replacement_timeout
1297 -------------------------------------------------------------------------
1298 Remember, from the Nop-out discussion that if a network problem is detected,
1299 the running commands are failed immediately. There is one exception to this
1300 and that is when the SCSI layer's error handler is running. To check if
1301 the SCSI error handler is running iscsiadm can be run as:
1303 iscsiadm -m session -P 3
1305 You will then see:
1307 Host Number: X State: Recovery
1309 When the SCSI EH is running, commands will not be failed until
1310 node.session.timeo.replacement_timeout seconds.
1312 To modify the timer that starts the SCSI EH, you can either write
1313 directly to the device's sysfs file:
1315 echo X > /sys/block/sdX/device/timeout
1317 where X is in seconds or on most distros you can modify the udev rule.
1319 To modify the udev rule open /etc/udev/rules.d/50-udev.rules, and find the
1320 following lines:
1322 ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="0|7|14", \
1323         RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'"
1325 And change the echo 60 part of the line to the value that you want.
1327 The default timeout for normal File System commands is 30 seconds when udev
1328 is not being used. If udev is used the default is the above value which
1329 is normally 60 seconds.
1332 8.1.2.2 Pending Commands and replacement_timeout
1333 ------------------------------------------------
1334 Commonly, the SCSI/BLOCK layer will queue 256 commands, but the path can
1335 only take 32. When a network problem is detected, the 32 commands
1336 in flight will be sent back to the SCSI layer immediately and because
1337 multipath is being used this will cause the commands to be sent to the multipath
1338 layer for execution on another path. However the other 96 commands that were
1339 still in the SCSI/BLOCK queue, will remain here until the session is
1340 re-established or until node.session.timeo.replacement_timeout seconds has
1341 gone by. After replacement_timeout seconds, the pending commands will be
1342 failed to the multipath layer, and all new incoming commands will be
1343 immediately failed back to the multipath layer. If a session is later
1344 re-established, then new commands will be queued and executed. Normally,
1345 multipathd's path tester mechanism will detect that the session has been
1346 re-established and the path is accessible again, and it will inform
1347 dm-multipath.
1350 8.1.3 Optimal replacement_timeout Value
1351 ---------------------------------------
1353 The default value for replacement_timeout is 120 seconds, but because
1354 multipath's queue_if_no_path and no_path_retry setting can prevent IO errors
1355 from being propagated to the application, replacement_timeout can be set to a
1356 shorter value like 5 to 15 seconds. By setting it lower pending IO is quickly
1357 sent to a new path and executed while the iSCSI layer attempts
1358 re-establishment of the session. If all paths end up being failed, then the
1359 multipath and device mapper layer will internally queue IO based on the
1360 multipath.conf settings, instead of the iSCSI layer.
1363 8.2 iSCSI settings for iSCSI root
1364 ---------------------------------
1366 When accessing the root partition directly through a iSCSI disk, the
1367 iSCSI timers should be set so that iSCSI layer has several chances to try to
1368 re-establish a session and so that commands are not quickly requeued to
1369 the SCSI layer. Basically you want the opposite of when using dm-multipath.
1371 For this setup, you can turn off iSCSI pings by setting:
1373 node.conn[0].timeo.noop_out_interval = 0
1374 node.conn[0].timeo.noop_out_timeout = 0
1376 And you can turn the replacement_timer to a very long value:
1378 node.session.timeo.replacement_timeout = 86400
1381 9. iSCSI System Info
1382 ====================
1384 To get information about the running sessions: including the session and
1385 device state, session ids (sid) for session mode, and some of the
1386 negotiated parameters, run:
1388         iscsiadm -m session -P 2
1390 If you are looking for something shorter like just the sid to node mapping
1391 run:
1393         iscsiadm -m session -P 0
1394         or
1395         iscsiadm -m session
1397 This will print the list of running sessions with the format:
1399 driver [sid] ip:port,target_portal_group_tag targetname
1401 # iscsiadm -m session
1402 tcp [2] 10.15.84.19:3260,2 iqn.1992-08.com.netapp:sn.33615311
1403 tcp [3] 10.15.85.19:3260,3 iqn.1992-08.com.netapp:sn.33615311
1405 To print the hw address info use the -P option with "1":
1407        iscsiadm -m session -P 1
1409 This will print the sessions with the following format:
1410 Target: targetname
1411         Current Portal: portal currently logged into
1412         Persistent Portal: portal we would fall back to if we had got redirected                                during login
1413                 Iface Transport: driver/transport_name
1414                 Iface IPaddress: IP address of iface being used
1415                 Iface HWaddress: HW address used to bind session
1416                 Iface Netdev: netdev value used to bind session
1417                 SID: iscsi sysfs session id
1418                 iSCSI Connection State: iscsi state
1420 Note: if a older kernel is being used or if the session is not bound
1421 then the keyword "default" is print to indicate that the default
1422 network behavior is being used.
1424 Example:
1425 #iscsiadm -m session -P 1
1426 Target: iqn.1992-08.com.netapp:sn.33615311
1427         Current Portal: 10.15.85.19:3260,3
1428         Persistent Portal: 10.15.85.19:3260,3
1429                 Iface Transport: tcp
1430                 Iface IPaddress: 10.11.14.37
1431                 Iface HWaddress: default
1432                 Iface Netdev: default
1433                 SID: 7
1434                 iSCSI Connection State: LOGGED IN
1435                 Internal iscsid Session State: NO CHANGE
1437 The connection state is currently not available for qla4xxx.
1440 To get a HBA/Host view of the session there is the host mode.
1442 Example:
1444 iscsiadm -m host
1445 cxgb3i: [7] 10.10.15.51,[00:07:43:05:97:07],eth3 <empty>
1447 This prints the list of iSCSI hosts in the system with the format:
1448 driver [hostno] ipaddress,[hwaddress],net_ifacename,initiatorname
1451 To print this info in a more user friendly way the -P argument can be used:
1453 iscsiadm -m host -P 1
1454 Host Number: 7
1455         State: running
1456         Transport: cxgb3i
1457         Initiatorname: <empty>
1458         IPaddress: 10.10.15.51
1459         HWaddress: 00:07:43:05:97:07
1460         Netdev: eth3
1462 Here, you can also see the sate of the host.
1464 You can also pass in any value from 1 - 4 to print more info like the
1465 sessions running through the host, what ifaces are being used and what
1466 devices are accessed through it.
1468 To print the info for a specific host then you can pass in the -H argument
1469 with the host number:
1470 iscsiadm -m host -P 1 -H 7