Blame README

Packit Service 646995
=================================================================
Packit Service 646995
Packit Service 646995
                Linux* Open-iSCSI
Packit Service 646995
Packit Service 646995
=================================================================
Packit Service 646995
Packit Service 646995
                                                   Sep 29, 2016
Packit Service 646995
Contents
Packit Service 646995
========
Packit Service 646995
Packit Service 646995
- 1. In This Release
Packit Service 646995
- 2. Introduction
Packit Service 646995
- 3. Installation
Packit Service 646995
- 4. Open-iSCSI daemon
Packit Service 646995
- 5. Open-iSCSI Configuration Utility
Packit Service 646995
- 6. Configuration
Packit Service 646995
- 7. Getting Started
Packit Service 646995
- 8. Advanced Configuration
Packit Service 646995
- 9. iSCSI System Info
Packit Service 646995
Packit Service 646995
Packit Service 646995
1. In This Release
Packit Service 646995
==================
Packit Service 646995
Packit Service 646995
This file describes the Linux* Open-iSCSI Initiator. The software was
Packit Service 646995
tested on AMD Opteron (TM) and Intel Xeon (TM).
Packit Service 646995
Packit Service 646995
The latest development release is available at:
Packit Service 646995
	http://www.open-iscsi.com
Packit Service 646995
Packit Service 646995
For questions, comments, contributions send e-mail to:
Packit Service 646995
	open-iscsi@googlegroups.com
Packit Service 646995
Packit Service 646995
Packit Service 646995
1.1. Features
Packit Service 646995
=============
Packit Service 646995
Packit Service 646995
- highly optimized and very small-footprint data path;
Packit Service 646995
- persistent configuration database;
Packit Service 646995
- SendTargets discovery;
Packit Service 646995
- CHAP;
Packit Service 646995
- PDU header Digest;
Packit Service 646995
- multiple sessions;
Packit Service 646995
Packit Service 646995
Packit Service 646995
2. Introduction
Packit Service 646995
===============
Packit Service 646995
Packit Service 646995
The Open-iSCSI project is a high-performance, transport independent,
Packit Service 646995
multi-platform implementation of RFC3720 iSCSI.
Packit Service 646995
Packit Service 646995
Open-iSCSI is partitioned into user and kernel parts.
Packit Service 646995
Packit Service 646995
The kernel portion of Open-iSCSI is a from-scratch code
Packit Service 646995
licensed under GPL. The kernel part implements iSCSI data path
Packit Service 646995
(that is, iSCSI Read and iSCSI Write), and consists of three
Packit Service 646995
loadable modules: scsi_transport_iscsi.ko, libiscsi.ko and iscsi_tcp.ko.
Packit Service 646995
Packit Service 646995
User space contains the entire control plane: configuration
Packit Service 646995
manager, iSCSI Discovery, Login and Logout processing,
Packit Service 646995
connection-level error processing, Nop-In and Nop-Out handling,
Packit Service 646995
and (in the future:) Text processing, iSNS, SLP, Radius, etc.
Packit Service 646995
Packit Service 646995
The user space Open-iSCSI consists of a daemon process called
Packit Service 646995
iscsid, and a management utility iscsiadm.
Packit Service 646995
Packit Service 646995
Packit Service 646995
3. Installation
Packit Service 646995
===============
Packit Service 646995
Packit Service 646995
As of today, the Open-iSCSI Initiator requires a host running the
Packit Service 646995
Linux operating system with kernel version 2.6.16 or later. 2.6.14 and
Packit Service 646995
2.6.15 are partially supported. Known issues with 2.6.14 - .15 support:
Packit Service 646995
Packit Service 646995
- If the device is using a write back cache, during session logout
Packit Service 646995
the cache sync command will fail.
Packit Service 646995
- iscsiadm's -P 3 option will not print out scsi devices.
Packit Service 646995
- iscsid will not automatically online devices.
Packit Service 646995
Packit Service 646995
The userspace components iscsid, iscsiadm and iscsistart require the
Packit Service 646995
open-isns library, which can be found here:
Packit Service 646995
	https://github.com/gonzoleeman/open-isns/releases
Packit Service 646995
Packit Service 646995
To install the open-isns headers and library required for open-iscsi, download
Packit Service 646995
the current release and run:
Packit Service 646995
Packit Service 646995
	./configure
Packit Service 646995
	make
Packit Service 646995
	make install
Packit Service 646995
	make install_hdrs
Packit Service 646995
	make install_lib
Packit Service 646995
Packit Service 646995
By default the kernel's iSCSI modules will be used. Running:
Packit Service 646995
Packit Service 646995
	make
Packit Service 646995
	make install
Packit Service 646995
Packit Service 646995
will install the iSCSI tools iscsiadm and iscsid to /sbin.
Packit Service 646995
Packit Service 646995
For 2.6.14 - 2.6.34 the modules in the kernel dir can be built and installed
Packit Service 646995
by running:
Packit Service 646995
Packit Service 646995
	make kernel
Packit Service 646995
Packit Service 646995
When building those modules the kernel source found at
Packit Service 646995
	/lib/modules/`uname -r`/build
Packit Service 646995
Packit Service 646995
will be used to compile the open-iscsi modules. To specify a different
Packit Service 646995
kernel to build against, use:
Packit Service 646995
	make kernel KSRC=<kernel-src>
Packit Service 646995
Packit Service 646995
or to use cross-compilation:
Packit Service 646995
	make kernel KSRC=<kernel-src> KARCH="ARCH=um"
Packit Service 646995
Packit Service 646995
To compile on SUSE Linux you'll have to use
Packit Service 646995
Packit Service 646995
	make kernel KSRC=/usr/src/linux \
Packit Service 646995
	     KBUILD_OUTPUT=/usr/src/linux-obj/<arch>/<config>
Packit Service 646995
Packit Service 646995
where <config> is the kernel configuration to use (eg. 'smp').
Packit Service 646995
Packit Service 646995
To install the kernel modules that were built, run:
Packit Service 646995
Packit Service 646995
	make install_kernel
Packit Service 646995
Packit Service 646995
This will copy iscsi_tcp.ko, libiscsi_tcp.ko, libiscsi.ko and
Packit Service 646995
scsi_transport_iscsi.ko to
Packit Service 646995
	/lib/modules/`uname -r`/kernel/drivers/scsi/
Packit Service 646995
overwriting existing iscsi modules.
Packit Service 646995
Packit Service 646995
For Debian, be sure to install the linux-headers package that
Packit Service 646995
corresponds to your kernel in order to compile the kernel modules
Packit Service 646995
('aptitude install linux-headers-`uname -r`').  You may also wish to
Packit Service 646995
run 'make -C kernel/ dpkg_divert' before installing kernel modules if
Packit Service 646995
you run a Debian-provided kernel.  This will use dpkg-divert(8) to
Packit Service 646995
move the packaged kernel modules out of the way, and ensure that
Packit Service 646995
future kernel upgrades will not overwrite them.
Packit Service 646995
Packit Service 646995
Also, please be aware that the compatibility patches that enable these
Packit Service 646995
iscsi modules to run on kernels older than 2.6.25 will not update the
Packit Service 646995
ib_iser module; you may get warnings related to mismatched symbols on
Packit Service 646995
this driver, in which case you'll be unable to load ib_iser and
Packit Service 646995
open-iscsi simultaneously.
Packit Service 646995
Packit Service 646995
Packit Service 646995
4. Open-iSCSI daemon
Packit Service 646995
====================
Packit Service 646995
Packit Service 646995
The daemon implements control path of iSCSI protocol, plus some management
Packit Service 646995
facilities. For example, the daemon could be configured to automatically
Packit Service 646995
re-start discovery at startup, based on the contents of persistent
Packit Service 646995
iSCSI database (see next section).
Packit Service 646995
Packit Service 646995
For help, run:
Packit Service 646995
	iscsid --help
Packit Service 646995
Packit Service 646995
The output will be similar to the following.
Packit Service 646995
Packit Service 646995
Usage: iscsid [OPTION]
Packit Service 646995
Packit Service 646995
  -c, --config=[path]     Execute in the config file (/etc/iscsi/iscsid.conf).
Packit Service 646995
  -f, --foreground        run iscsid in the foreground
Packit Service 646995
  -d, --debug debuglevel  print debugging information
Packit Service 646995
  -u, --uid=uid           run as uid, default is current user
Packit Service 646995
  -g, --gid=gid           run as gid, default is current user group
Packit Service 646995
  -h, --help              display this help and exit
Packit Service 646995
  -v, --version           display version and exit
Packit Service 646995
Packit Service 646995
Packit Service 646995
5. Open-iSCSI Configuration Utility
Packit Service 646995
===================================
Packit Service 646995
Packit Service 646995
Open-iSCSI persistent configuration is stored in a number of
Packit Service 646995
directories under a configuration root directory, using a flat-file
Packit Service fad540
format. This configuration root directory is /var/lib/iscsi by default.
Packit Service 646995
Packit Service 646995
Configuration is contained in directories for:
Packit Service 646995
Packit Service 646995
- nodes
Packit Service 646995
- slp
Packit Service 646995
- isns
Packit Service 646995
- static
Packit Service 646995
- fw
Packit Service 646995
- send_targets
Packit Service 646995
- ifaces
Packit Service 646995
Packit Service 646995
The iscsiadm utility is a command-line tool to manage (update, delete,
Packit Service 646995
insert, query) the persistent database.
Packit Service 646995
Packit Service 646995
The utility presents set of operations that a user can perform
Packit Service 646995
on iSCSI nodes, sessions, connections, and discovery records.
Packit Service 646995
Packit Service 646995
Open-iSCSI does not use the term node as defined by the iSCSI RFC,
Packit Service 646995
where a node is a single iSCSI initiator or target. Open-iSCSI uses the
Packit Service 646995
term node to refer to a portal on a target, so tools like iscsiadm
Packit Service 646995
require that --targetname and --portal argument be used when in node mode.
Packit Service 646995
Packit Service 646995
For session mode, a session id (sid) is used. The sid of a session can be
Packit Service 646995
found by running
Packit Service 646995
	iscsiadm -m session -P 1
Packit Service 646995
Packit Service 646995
The session id is not currently persistent and is partially determined by
Packit Service 646995
when the session is setup.
Packit Service 646995
Packit Service 646995
Note that some of the iSCSI Node and iSCSI Discovery operations
Packit Service 646995
do not require iSCSI daemon (iscsid) loaded.
Packit Service 646995
Packit Service 646995
For help, run:
Packit Service 646995
	iscsiadm --help
Packit Service 646995
Packit Service 646995
The output will be similar to the following.
Packit Service 646995
Packit Service 646995
iscsiadm -m discoverydb [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip:port -I ifaceN ... [ -Dl ] ] | [ [ -p ip:port -t type] [ -o operation ] [ -n name ] [ -v value ] [ -lD ] ] 
Packit Service 646995
iscsiadm -m discovery [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip:port -I ifaceN ... [ -l ] ] | [ [ -p ip:port ] [ -l | -D ] ] 
Packit Service 646995
iscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,automatic ] [ -W ] [ -U all,manual,automatic ] [ -S ] [ [ -T targetname -p ip:port -I ifaceN ] [ -l | -u | -R | -s] ] [ [ -o  operation  ] [ -n name ] [ -v value ] ]
Packit Service 646995
iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P  printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]
Packit Service 646995
iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename | -H hostno|MAC ] [ [ -o  operation  ] [ -n name ] [ -v value ] ] [ -C ping [ -a ip ] [ -b packetsize ] [ -c count ] [ -i interval ] ]
Packit Service 646995
iscsiadm -m fw [ -d debug_level ] [ -l ]
Packit Service 646995
iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -x chap_tbl_idx ] ] | [ -C flashnode [ -A portal_type ] [ -x flashnode_idx ] ] | [ -C stats ] ] [ [ -o operation ] [ -n name ] [ -v value ] ] 
Packit Service 646995
iscsiadm -k priority
Packit Service 646995
Packit Service 646995
Packit Service 646995
The first parameter specifies the mode to operate in:
Packit Service 646995
  -m, --mode <op>	specify operational mode op =
Packit Service 646995
			<discoverydb|discovery|node|session|iface|fw|host>
Packit Service 646995
Packit Service 646995
Mode "discoverydb"
Packit Service 646995
------------------
Packit Service 646995
Packit Service 646995
  -m discoverydb --type=[type] --interface=[iface…] --portal=[ip:port] \
Packit Service 646995
			--print=[N] \
Packit Service 646995
			--op=[op]=[NEW | UPDATE | DELETE | NONPERSISTENT] \
Packit Service 646995
			--discover
Packit Service 646995
Packit Service 646995
			  This command will use the discovery record settings
Packit Service 646995
			  matching the record with type=type and
Packit Service 646995
			  portal=ip:port]. If a record does not exist, it will
Packit Service 646995
			  create a record using the iscsid.conf discovery
Packit Service 646995
			  settings.
Packit Service 646995
Packit Service 646995
			  By default, it will then remove records for
Packit Service 646995
			  portals no longer returned. And,
Packit Service 646995
			  if a portal is returned by the target, then the
Packit Service 646995
			  discovery command will create a new record or modify
Packit Service 646995
			  an existing one with values from iscsi.conf and the
Packit Service 646995
			  command line.
Packit Service 646995
Packit Service 646995
			  [op] can be passed in multiple times to this
Packit Service 646995
			  command, and it will alter the node DB manipulation.
Packit Service 646995
Packit Service 646995
			  If [op] is passed in and the value is
Packit Service 646995
			  "new", iscsiadm will add records for portals that do
Packit Service 646995
			  not yet have records in the db.
Packit Service 646995
Packit Service 646995
			  If [op] is passed in and the value is
Packit Service 646995
			  "update", iscsiadm will update node records using
Packit Service 646995
			  info from iscsi.conf and the command line for portals
Packit Service 646995
			  that are returned during discovery and have
Packit Service 646995
			  a record in the db.
Packit Service 646995
Packit Service 646995
			  If [op] is passed in and the value is "delete",
Packit Service 646995
			  iscsiadm will delete records for portals that
Packit Service 646995
			  were not returned during discovery.
Packit Service 646995
Packit Service 646995
			  If [op] is passed in and the value is
Packit Service 646995
			  "nonpersistent", iscsiadm will not store
Packit Service 646995
			  the portals found in the node DB. This is
Packit Service 646995
			  only useful with the --login command.
Packit Service 646995
Packit Service 646995
			  See the example section for more info.
Packit Service 646995
Packit Service 646995
			  See below for how to setup iscsi ifaces for
Packit Service 646995
			  software iscsi or override the system defaults.
Packit Service 646995
Packit Service 646995
			  Multiple ifaces can be passed in during discovery.
Packit Service 646995
Packit Service 646995
			  For the above commands, "print" is optional. If
Packit Service 646995
			  used, N can be 0 or 1.
Packit Service 646995
			  0 = The old flat style of output is used.
Packit Service 646995
			  1 = The tree style with the inteface info is used.
Packit Service 646995
Packit Service 646995
			  If print is not used, the old flat style is used.
Packit Service 646995
Packit Service 646995
  -m discoverydb --interface=[iface...] --type=[type] --portal=[ip:port] \
Packit Service 646995
			--print=[N] \
Packit Service 646995
			--op=[op]=[NEW | UPDATE | DELETE | NONPERSISTENT] \
Packit Service 646995
			--discover --login
Packit Service 646995
Packit Service 646995
			  This works like the previous discoverydb command
Packit Service 646995
			  with the --login argument passed in will also
Packit Service 646995
			  log into the portals that are found.
Packit Service 646995
Packit Service 646995
  -m discoverydb --portal=[ip:port] --type=[type] \
Packit Service 646995
			--op=[op] [--name=[name] --value=[value]]
Packit Service 646995
Packit Service 646995
			  Perform specific DB operation [op] for
Packit Service 646995
			  discovery portal. It could be one of:
Packit Service 646995
			  [new], [delete], [update] or [show]. In case of
Packit Service 646995
			  [update], you have to provide [name] and [value]
Packit Service 646995
			  you wish to update
Packit Service 646995
Packit Service 646995
			  op=NEW will create a new discovery record
Packit Service 646995
			  using the iscsid.conf discovery settings. If it
Packit Service 646995
			  already exists, it will be overwritten using
Packit Service 646995
			  iscsid.conf discovery settings.
Packit Service 646995
Packit Service 646995
			  op=DELETE will delete the discovery record
Packit Service 646995
			  and records for the targets found through
Packit Service 646995
			  that discovery source.
Packit Service 646995
Packit Service 646995
			  op=SHOW will display the discovery record
Packit Service 646995
			  values. The --show argument can be used to
Packit Service 646995
			  force the CHAP passwords to be displayed.
Packit Service 646995
Packit Service 646995
Mode "discovery"
Packit Service 646995
----------------
Packit Service 646995
Packit Service 646995
  -m discovery --type=[type] --interface=iscsi_ifacename \
Packit Service 646995
			--portal=[ip:port] --login --print=[N] \
Packit Service 646995
			--op=[op]=[NEW | UPDATE | DELETE | NONPERSISTENT]
Packit Service 646995
Packit Service 646995
			  perform [type] discovery for target portal with
Packit Service 646995
			  ip-address [ip] and port [port].
Packit Service 646995
Packit Service 646995
			  This command will not use the discovery record
Packit Service 646995
			  settings. It will use the iscsid.conf discovery
Packit Service 646995
			  settings and it will overwrite the discovery
Packit Service 646995
			  record with iscsid.conf discovery settings if it
Packit Service 646995
			  exists. By default, it will then remove records for
Packit Service 646995
			  portals no longer returned. And,
Packit Service 646995
			  if a portal is returned by the target, then the
Packit Service 646995
			  discovery command will create a new record or modify
Packit Service 646995
			  an existing one with values from iscsi.conf and the
Packit Service 646995
			  command line.
Packit Service 646995
Packit Service 646995
			  [op] can be passed in multiple times to this
Packit Service 646995
			  command, and it will alter the DB manipulation.
Packit Service 646995
Packit Service 646995
			  If [op] is passed in and the value is
Packit Service 646995
			  "new", iscsiadm will add records for portals that do
Packit Service 646995
			  not yet have records in the db.
Packit Service 646995
Packit Service 646995
			  If [op] is passed in and the value is
Packit Service 646995
			  "update", iscsiadm will update node records using
Packit Service 646995
			  info from iscsi.conf and the command line for portals
Packit Service 646995
			  that are returned during discovery and have
Packit Service 646995
			  a record in the db.
Packit Service 646995
Packit Service 646995
			  If [op] is passed in and the value is "delete",
Packit Service 646995
			  iscsiadm will delete records for portals that
Packit Service 646995
			  were not returned during discovery.
Packit Service 646995
Packit Service 646995
			  If [op] is passed in and the value is
Packit Service 646995
			  "nonpersistent", iscsiadm will not store
Packit Service 646995
			  the portals found in the node DB.
Packit Service 646995
Packit Service 646995
			  See the example section for more info.
Packit Service 646995
Packit Service 646995
			  See below for how to setup iscsi ifaces for
Packit Service 646995
			  software iscsi or override the system defaults.
Packit Service 646995
Packit Service 646995
			  Multiple ifaces can be passed in during discovery.
Packit Service 646995
Packit Service 646995
  -m discovery --print=[N]
Packit Service 646995
Packit Service 646995
			  display all discovery records from internal
Packit Service 646995
			  persistent discovery database.
Packit Service 646995
Packit Service 646995
Mode "node"
Packit Service 646995
-----------
Packit Service 646995
Packit Service 646995
  -m node		  display all discovered nodes from internal
Packit Service 646995
			  persistent discovery database
Packit Service 646995
Packit Service 646995
  -m node --targetname=[name] --portal=[ip:port] \
Packit Service 646995
			--interface=iscsi_ifacename] \
Packit Service 646995
			[--login|--logout|--rescan|--stats] [-W]
Packit Service 646995
  -m node --targetname=[name] --portal=[ip:port]
Packit Service 646995
			--interface=[driver,HWaddress] \
Packit Service 646995
			--op=[op] [--name=[name] --value=[value]]
Packit Service 646995
  -m node --targetname=[name] --portal=[ip:port]
Packit Service 646995
			--interface=iscsi_ifacename] \
Packit Service 646995
			--print=[level]
Packit Service 646995
Packit Service 646995
			  perform specific DB operation [op] for specific
Packit Service 646995
			  interface on host that will connect to portal on
Packit Service 646995
			  target. targetname, portal and interface are optional.
Packit Service 646995
			  See below for how to setup iscsi ifaces for
Packit Service 646995
			  software iscsi or override the system defaults.
Packit Service 646995
Packit Service 646995
			  op could be one of:
Packit Service 646995
			  [new], [delete], [update] or [show]. In case of
Packit Service 646995
			  [update], you have to provide [name] and [value]
Packit Service 646995
			  you wish to update.
Packit Service 646995
			  [delete] - Note that if a session is using the
Packit Service 646995
			  node record, the session will be logged out then
Packit Service 646995
			  the record will be deleted.
Packit Service 646995
Packit Service 646995
			  --rescan will perform a SCSI layer scan of the session
Packit Service 646995
			  to find new LUNs.
Packit Service 646995
Packit Service 646995
			  --stats prints the iSCSI stats for the session.
Packit Service 646995
Packit Service 646995
			  --login normally sends a login request to the specified
Packit Service 646995
			  target and normally waits for the results. If
Packit Service 646995
			  -W/--no_wait is supplied return success if we are
Packit Service 646995
			  able to send the login request, and do not wait
Packit Service 646995
			  for the response. The user will have to poll for
Packit Service 646995
			  success
Packit Service 646995
Packit Service 646995
			  Print level can be 0 to 1.
Packit Service 646995
Packit Service 646995
  -m node --logoutall=[all|manual|automatic]
Packit Service 646995
			  Logout "all" the running sessions or just the ones
Packit Service 646995
			  with a node startup value manual or automatic.
Packit Service 646995
			  Nodes marked as ONBOOT are skipped.
Packit Service 646995
Packit Service 646995
  -m node --loginall=[all|manual|automatic] [-W]
Packit Service 646995
			  Login "all" the running sessions or just the ones
Packit Service 646995
			  with a node startup value manual or automatic.
Packit Service 646995
			  Nodes marked as ONBOOT are skipped.
Packit Service 646995
Packit Service 646995
			  If -W is supplied then do not wait for the login
Packit Service 646995
			  response for the target, returning success if we
Packit Service 646995
			  are able to just send the request. The client
Packit Service 646995
			  will have to poll for success.
Packit Service 646995
Packit Service 646995
Mode "session"
Packit Service 646995
--------------
Packit Service 646995
Packit Service 646995
  -m session		  display all active sessions and connections
Packit Service 646995
Packit Service 646995
  -m session --sid=[sid] [ --print=level | --rescan | --logout ]
Packit Service 646995
			--op=[op] [--name=[name] --value=[value]]
Packit Service 646995
Packit Service 646995
			  perform operation for specific session with
Packit Service 646995
			  session id sid. If no sid is given, the operation
Packit Service 646995
			  will be performed on all running sessions if possible.
Packit Service 646995
			  --logout and --op work like they do in node mode,
Packit Service 646995
			  but in session mode targetname and portal info
Packit Service 646995
			  is not passed in.
Packit Service 646995
Packit Service 646995
			  Print level can be 0 to 2.
Packit Service 646995
			  1 = Print basic session info like node we are
Packit Service 646995
			  connected to and whether we are connected.
Packit Service 646995
			  2 = Print iscsi params used.
Packit Service 646995
			  3 = Print SCSI info like LUNs, device state.
Packit Service 646995
Packit Service 646995
			  If no sid and no operation is given print out the
Packit Service 646995
			  running sessions.
Packit Service 646995
Packit Service 646995
Mode "iface"
Packit Service 646995
------------
Packit Service 646995
Packit Service 646995
  -m iface --interface=iscsi_ifacename --op=[op] [--name=[name] --value=[value]]
Packit Service 646995
			--print=level
Packit Service 646995
Packit Service 646995
			  perform operation on given interface with name
Packit Service 646995
			  iscsi_ifacename.
Packit Service 646995
Packit Service 646995
			  See below for examples.
Packit Service 646995
Packit Service 646995
  -m iface --interface=iscsi_ifacename -C ping --ip=[ipaddr] --packetsize=[size]
Packit Service 646995
			--count=[count] --interval=[interval]
Packit Service 646995
Packit Service 646995
Mode "host"
Packit Service 646995
-----------
Packit Service 646995
Packit Service 646995
  -m host [--host=hostno|MAC] --print=level -C chap --op=[SHOW]
Packit Service 646995
Packit Service 646995
			  Display information for a specific host. The host
Packit Service 646995
			  can be passed in by host number or by MAC address.
Packit Service 646995
			  If a host is not passed in, then info
Packit Service 646995
			  for all hosts is printed.
Packit Service 646995
Packit Service 646995
			  Print level can be 0 to 4.
Packit Service 646995
			  1 = Print info for how like its state, MAC, and
Packit Service 646995
			  netinfo if possible.
Packit Service 646995
			  2 = Print basic session info for nodes the host
Packit Service 646995
			  is connected to.
Packit Service 646995
			  3 = Print iscsi params used.
Packit Service 646995
			  4 = Print SCSI info like LUNs, device state.
Packit Service 646995
Packit Service 646995
  -m host --host=hostno|MAC -C chap --op=[DELETE] --index=[chap_tbl_idx]
Packit Service 646995
Packit Service 646995
			  Delete chap entry at the given index from chap table.
Packit Service 646995
Packit Service 646995
  -m host --host=hostno|MAC -C chap --op=[NEW | UPDATE] --index=[chap_tbl_idx] \
Packit Service 646995
			--name=[name] --value=[value]
Packit Service 646995
Packit Service 646995
			  Add new or update existing chap entry at the given
Packit Service 646995
			  index with given username and password pair. If index
Packit Service 646995
			  is not passed then entry is added at the first free
Packit Service 646995
			  index in chap table.
Packit Service 646995
Packit Service 646995
  -m host --host=hostno|MAC -C flashnode
Packit Service 646995
Packit Service 646995
			  Display list of all the targets in adapter's
Packit Service 646995
			  flash (flash node), for the specified host,
Packit Service 646995
			  with ip, port, tpgt and iqn.
Packit Service 646995
Packit Service 646995
  -m host --host=hostno|MAC -C flashnode --op=[NEW] --portal_type=[ipv4|ipv6]
Packit Service 646995
Packit Service 646995
			  Create new flash node entry for the given host of the
Packit Service 646995
			  specified portal_type. This returns the index of the
Packit Service 646995
			  newly created entry on success.
Packit Service 646995
Packit Service 646995
  -m host --host=hostno|MAC -C flashnode --index=[flashnode_index] \
Packit Service 646995
			--op=[UPDATE] --name=[name] --value=[value]
Packit Service 646995
Packit Service 646995
			  Update the params of the speficied flash node.
Packit Service 646995
			  The [name] and [value] pairs must be provided for the
Packit Service 646995
			  params that need to be updated. Multiple params can
Packit Service 646995
			  be updated using a single command.
Packit Service 646995
Packit Service 646995
  -m host --host=hostno|MAC -C flashnode --index=[flashnode_index] \
Packit Service 646995
			--op=[SHOW | DELETE | LOGIN | LOGOUT]
Packit Service 646995
Packit Service 646995
			  op=DELETE|LOGIN|LOGOUT will perform deletion/login/
Packit Service 646995
			  logout operation on the specified flash node.
Packit Service 646995
Packit Service 646995
			  op=SHOW will list all params with the values for the
Packit Service 646995
			  specified flash node. This is the default operation.
Packit Service 646995
Packit Service 646995
			  See the iscsiadm example section for more info.
Packit Service 646995
Packit Service 646995
Other arguments
Packit Service 646995
---------------
Packit Service 646995
Packit Service 646995
  -d, --debug debuglevel  print debugging information
Packit Service 646995
Packit Service 646995
  -V, --version		  display version and exit
Packit Service 646995
Packit Service 646995
  -h, --help		  display this help and exit
Packit Service 646995
Packit Service 646995
Packit Service 646995
5.1 iSCSI iface setup
Packit Service 646995
=====================
Packit Service 646995
Packit Service 646995
The next sections describe how to setup iSCSI ifaces so you can bind
Packit Service 646995
a session to a NIC port when using software iscsi (section 5.1.1), and
Packit Service 646995
it describes how to setup ifaces for use with offload cards from Chelsio
Packit Service 646995
and Broadcom (section 5.1.2).
Packit Service 646995
Packit Service 646995
Packit Service 646995
5.1.1 How to setup iSCSI interfaces (iface) for binding
Packit Service 646995
=======================================================
Packit Service 646995
Packit Service 646995
If you wish to allow the network susbsystem to figure out
Packit Service 646995
the best path/NIC to use, then you can skip this section. For example
Packit Service 646995
if you have setup your portals and NICs on different subnets, then
Packit Service 646995
the following is not needed for software iscsi.
Packit Service 646995
Packit Service 646995
Warning!!!!!!
Packit Service 646995
This feature is experimental. The interface may change. When reporting
Packit Service 646995
bugs, if you cannot do a "ping -I ethX target_portal", then check your
Packit Service 646995
network settings first. Make sure the rp_filter setting is set to 0 or 2
Packit Service 646995
(see Prep section below for more info). If you cannot ping the portal,
Packit Service 646995
then you will not be able to bind a session to a NIC.
Packit Service 646995
Packit Service 646995
What is a scsi_host and iface for software, hardware and partial
Packit Service 646995
offload iscsi?
Packit Service 646995
Packit Service 646995
Software iscsi, like iscsi_tcp and iser, allocates a scsi_host per session
Packit Service 646995
and does a single connection per session. As a result
Packit Service 646995
/sys/class_scsi_host and /proc/scsi will report a scsi_host for
Packit Service 646995
each connection/session you have logged into. Offload iscsi, like
Packit Service 646995
Chelsio cxgb3i, allocates a scsi_host for each PCI device (each
Packit Service 646995
port on a HBA will show up as a different PCI device so you get
Packit Service 646995
a scsi_host per HBA port).
Packit Service 646995
Packit Service 646995
To manage both types of initiator stacks, iscsiadm uses the interface (iface)
Packit Service 646995
structure. For each HBA port or for software iscsi for each network
Packit Service 646995
device (ethX) or NIC, that you wish to bind sessions to you must create
Packit Service fad540
a iface config /var/lib/iscsi/ifaces.
Packit Service 646995
Packit Service 646995
Prep
Packit Service 646995
----
Packit Service 646995
Packit Service 646995
The iface binding feature requires the sysctl setting
Packit Service 646995
net.ipv4.conf.default.rp_filter to be set to 0 or 2.
Packit Service 646995
This can be set in /etc/sysctl.conf by having the line:
Packit Service 646995
	net.ipv4.conf.default.rp_filter = N
Packit Service 646995
Packit Service 646995
where N is 0 or 2. Note that when setting this you may have to reboot
Packit Service 646995
for the value to take effect.
Packit Service 646995
Packit Service 646995
Packit Service 646995
rp_filter information from Documentation/networking/ip-sysctl.txt:
Packit Service 646995
Packit Service 646995
rp_filter - INTEGER
Packit Service 646995
	0 - No source validation.
Packit Service 646995
	1 - Strict mode as defined in RFC3704 Strict Reverse Path
Packit Service 646995
	    Each incoming packet is tested against the FIB and if the interface
Packit Service 646995
	    is not the best reverse path the packet check will fail.
Packit Service 646995
	    By default failed packets are discarded.
Packit Service 646995
	2 - Loose mode as defined in RFC3704 Loose Reverse Path
Packit Service 646995
	    Each incoming packet's source address is also tested against the FIB
Packit Service 646995
	    and if the source address is not reachable via any interface
Packit Service 646995
	    the packet check will fail.
Packit Service 646995
Packit Service 646995
Running
Packit Service 646995
-------
Packit Service 646995
Packit Service 646995
The command
Packit Service 646995
	iscsiadm -m iface
Packit Service 646995
Packit Service fad540
will report iface configurations that are setup in /var/lib/iscsi/ifaces:
Packit Service 646995
Packit Service 646995
	iface0 qla4xxx,00:c0:dd:08:63:e8,20.15.0.7,default,iqn.2005-06.com.redhat:madmax
Packit Service 646995
	iface1 qla4xxx,00:c0:dd:08:63:ea,20.15.0.9,default,iqn.2005-06.com.redhat:madmax
Packit Service 646995
Packit Service 646995
The format is:
Packit Service 646995
	iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
Packit Service 646995
Packit Service 646995
For software iscsi, you can create the iface configs by hand, but it is
Packit Service 646995
recommended that you use iscsiadm's iface mode. There is an iface.example in
Packit Service fad540
/var/lib/iscsi/ifaces which can be used as a template for the daring.
Packit Service 646995
Packit Service 646995
For each network object you wish to bind a session to, you must create
Packit Service fad540
a separate iface config in /var/lib/iscsi/ifaces and each iface config file
Packit Service 646995
must have a unique name which is less than or equal to 64 characters.
Packit Service 646995
Packit Service 646995
Example
Packit Service 646995
-------
Packit Service 646995
Packit Service 646995
If you have NIC1 with MAC address 00:0F:1F:92:6B:BF and NIC2 with
Packit Service 646995
MAC address 00:C0:DD:08:63:E7, and you wanted to do software iscsi over
Packit Service fad540
TCP/IP, then in /var/lib/iscsi/ifaces/iface0 you would enter:
Packit Service 646995
Packit Service 646995
	iface.transport_name = tcp
Packit Service 646995
	iface.hwaddress = 00:0F:1F:92:6B:BF
Packit Service 646995
Packit Service fad540
and in /var/lib/iscsi/ifaces/iface1 you would enter:
Packit Service 646995
Packit Service 646995
	iface.transport_name = tcp
Packit Service 646995
	iface.hwaddress = 00:C0:DD:08:63:E7
Packit Service 646995
Packit Service 646995
Warning: Do not name an iface config file  "default" or "iser".
Packit Service 646995
They are special values/files that are used by the iscsi tools for
Packit Service 646995
backward compatibility. If you name an iface default or iser, then
Packit Service 646995
the behavior is not defined.
Packit Service 646995
Packit Service 646995
To use iscsiadm to create an iface0 similar to the above example, run:
Packit Service 646995
	iscsiadm -m iface -I iface0 --op=new
Packit Service 646995
Packit Service 646995
(This will create a new empty iface config. If there was already an iface
Packit Service 646995
with the name "iface0", this command will overwrite it.)
Packit Service 646995
Packit Service 646995
Next, set the hwaddress:
Packit Service 646995
	iscsiadm -m iface -I iface0 --op=update \
Packit Service 646995
		-n iface.hwaddress -v 00:0F:1F:92:6B:BF
Packit Service 646995
Packit Service 646995
If you had sessions logged in, iscsiadm will not update or overwrite
Packit Service 646995
an iface. You must log out first. If you have an iface bound to a node/portal
Packit Service 646995
but you have not logged in, then iscsiadm will update the config and
Packit Service 646995
all existing bindings.
Packit Service 646995
Packit Service 646995
You should now skip to 5.1.3 to see how to log in using the iface, and for
Packit Service 646995
some helpful management commands.
Packit Service 646995
Packit Service 646995
Packit Service 646995
5.1.2 Setting up an iface for an iSCSI offload card
Packit Service 646995
===================================================
Packit Service 646995
Packit Service 646995
This section describes how to setup ifaces for use with Chelsio, Broadcom and
Packit Service 646995
QLogic cards.
Packit Service 646995
Packit Service 646995
By default, iscsiadm will create an iface for each Broadcom, QLogic and Chelsio
Packit Service 646995
port. The iface name will be of the form:
Packit Service 646995
	$transport/driver_name.$MAC_ADDRESS
Packit Service 646995
Packit Service 646995
Running the following command:
Packit Service 646995
	iscsiadm -m iface
Packit Service 646995
Packit Service fad540
will report iface configurations that are setup in /var/lib/iscsi/ifaces:
Packit Service 646995
Packit Service 646995
	default tcp,<empty>,<empty>,<empty>,<empty>
Packit Service 646995
	iser iser,<empty>,<empty>,<empty>,<empty>
Packit Service 646995
	cxgb3i.00:07:43:05:97:07 cxgb3i,00:07:43:05:97:07,<empty>,<empty>,<empty>
Packit Service 646995
	qla4xxx.00:0e:1e:04:8b:2e qla4xxx,00:0e:1e:04:8b:2e,<empty>,<empty>,<empty>
Packit Service 646995
Packit Service 646995
The format is:
Packit Service 646995
	iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
Packit Service 646995
Packit Service 646995
iface_name:		name of iface
Packit Service 646995
transport_name:		name of driver
Packit Service 646995
hwaddress:		MAC address
Packit Service 646995
ipaddress:		IP address to use for this port
Packit Service 646995
net_iface_name:		will be <empty> because change between reboots.
Packit Service 646995
			It is used for software iSCSI's vlan or alias binding.
Packit Service 646995
initiatorname:		Initiatorname to be used if you want to override the
Packit Service 646995
			default one in /etc/iscsi/initiatorname.iscsi.
Packit Service 646995
Packit Service 646995
To display these values in a more friendly way, run:
Packit Service 646995
	iscsiadm -m iface -I cxgb3i.00:07:43:05:97:07
Packit Service 646995
Packit Service 646995
Example output:
Packit Service 646995
	# BEGIN RECORD 2.0-871
Packit Service 646995
	iface.iscsi_ifacename = cxgb3i.00:07:43:05:97:07
Packit Service 646995
	iface.net_ifacename = <empty>
Packit Service 646995
	iface.ipaddress = <empty>
Packit Service 646995
	iface.hwaddress = 00:07:43:05:97:07
Packit Service 646995
	iface.transport_name = cxgb3i
Packit Service 646995
	iface.initiatorname = <empty>
Packit Service 646995
	# END RECORD
Packit Service 646995
Packit Service 646995
Before you can use the iface, you must set the IP address for the port.
Packit Service 646995
We determine the corresponding variable name that we want to update from
Packit Service 646995
the output above, which is "iface.ipaddress".
Packit Service 646995
Then we fill this empty variable with the value we desire, with this command:
Packit Service 646995
	iscsiadm -m iface -I cxgb3i.00:07:43:05:97:07 -o update \
Packit Service 646995
		-n iface.ipaddress -v 20.15.0.66
Packit Service 646995
Packit Service 646995
Note for QLogic ports: After updating the iface record, you must apply or
Packit Service 646995
applyall the settings for the changes to take effect:
Packit Service 646995
Packit Service 646995
	iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2e -o apply
Packit Service 646995
	iscsiadm -m iface -H 00:0e:1e:04:8b:2e -o applyall
Packit Service 646995
Packit Service 646995
With "apply", the network settings for the specified iface will take effect.
Packit Service 646995
With "applyall", the network settings for all ifaces on a specific host will
Packit Service 646995
take effect. The host can be specified using the -H/--host argument by either
Packit Service 646995
the MAC address of the host or the host number.
Packit Service 646995
Packit Service 646995
Here is an example of setting multiple IPv6 addresses on a single iSCSI
Packit Service 646995
interface port.
Packit Service 646995
First interface (no need to set iface_num, it is 0 by default):
Packit Service 646995
	iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \
Packit Service 646995
		 -n iface.ipaddress -v fec0:ce00:7014:0041:1111:2222:1e04:9392
Packit Service 646995
Packit Service 646995
Create the second interface if it does not exist (iface_num is mandatory here):
Packit Service 646995
	iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a.1 -op=new
Packit Service 646995
	iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \
Packit Service 646995
		 -n iface.iface_num -v 1
Packit Service 646995
	iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \
Packit Service 646995
		 -n iface.ipaddress -v fec0:ce00:7014:0041:1111:2222:1e04:9393
Packit Service 646995
	iscsiadm -m iface -H 00:0e:1e:04:8b:2a --op=applyall
Packit Service 646995
Packit Service 646995
Note: If there are common settings for multiple interfaces then the
Packit Service 646995
settings from 0th iface would be considered valid.
Packit Service 646995
Packit Service 646995
Now, we can use this iface to login into targets, which is described in the
Packit Service 646995
next section.
Packit Service 646995
Packit Service 646995
Packit Service 646995
5.1.3 Discoverying iSCSI targets/portals
Packit Service 646995
========================================
Packit Service 646995
Packit Service 646995
Be aware that iscsiadm will use the default route to do discovery. It will
Packit Service 646995
not use the iface specified. So if you are using an offload card, you will
Packit Service 646995
need a separate network connection to the target for discovery purposes.
Packit Service 646995
*This will be fixed in the next version of open-iscsi*
Packit Service 646995
Packit Service 646995
For compatibility reasons, when you run iscsiadm to do discovery, it
Packit Service fad540
will check for interfaces in /var/lib/iscsi/iscsi/ifaces that are using
Packit Service 646995
tcp for the iface.transport, and it will bind the portals that are discovered
Packit Service 646995
so that they will be logged in through those ifaces. This behavior can also
Packit Service 646995
be overridden by passing in the interfaces you want to use. For the case
Packit Service 646995
of offload, like with cxgb3i and bnx2i, this is required because the transport
Packit Service 646995
will not be tcp.
Packit Service 646995
Packit Service 646995
For example if you had defined two interfaces but only wanted to use one,
Packit Service 646995
you can use the --interface/-I argument:
Packit Service 646995
	iscsiadm -m discoverydb -t st -p ip:port -I iface1 --discover -P 1
Packit Service 646995
Packit Service 646995
If you had defined interfaces but wanted the old behavior, where we do not
Packit Service 646995
bind a session to an iface, then you can use the special iface "default":
Packit Service 646995
	iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1
Packit Service 646995
Packit Service fad540
And if you did not define any interfaces in /var/lib/iscsi/ifaces and do
Packit Service 646995
not pass anything into iscsiadm, running iscsiadm will do the default
Packit Service 646995
behavior, allowing the network subsystem to decide which device to use.
Packit Service 646995
Packit Service 646995
If you later want to remove the bindings for a specific target and
Packit Service 646995
iface, then you can run:
Packit Service 646995
	iscsiadm -m node -T my_target -I iface0 --op=delete
Packit Service 646995
Packit Service 646995
To do this for a specific portal on a target, run:
Packit Service 646995
	iscsiadm -m node -T my_target -p ip:port -I iface0 --op=delete
Packit Service 646995
Packit Service 646995
If you wanted to delete all bindinds for iface0, then you can run:
Packit Service 646995
	iscsiadm -m node -I iface0 --op=delete
Packit Service 646995
Packit Service 646995
And for equalogic targets it is sometimes useful to remove just by portal:
Packit Service 646995
	iscsiadm -m node -p ip:port -I iface0 --op=delete
Packit Service 646995
Packit Service 646995
Packit Service 646995
Now logging into targets is the same as with software iscsi. See section 7
Packit Service 646995
for how to get started.
Packit Service 646995
Packit Service 646995
Packit Service 646995
5.2 iscsiadm examples
Packit Service 646995
=====================
Packit Service 646995
Packit Service 646995
Usage examples using the one-letter options (see iscsiadm man page
Packit Service 646995
for long options):
Packit Service 646995
Packit Service 646995
Discovery mode
Packit Service 646995
--------------
Packit Service 646995
Packit Service 646995
- SendTargets iSCSI Discovery using the default driver and interface and
Packit Service 646995
		using the discovery settings for the discovery record with the
Packit Service 646995
		ID [192.168.1.1:3260]:
Packit Service 646995
	iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover
Packit Service 646995
Packit Service fad540
	This will search /var/lib/iscsi/send_targets for a record with the
Packit Service 646995
	ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it
Packit Service 646995
	will perform discovery using the settings stored in the record.
Packit Service 646995
	If a record does not exist, it will be created using the iscsid.conf
Packit Service 646995
	discovery settings.
Packit Service 646995
Packit Service 646995
	The argument to -p may also be a hostname instead of an address:
Packit Service 646995
		iscsiadm -m discoverydb -t st -p somehost --discover
Packit Service 646995
Packit Service fad540
	For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for
Packit Service 646995
	interfaces using software iscsi. If any are found then nodes found
Packit Service 646995
	during discovery will be setup so that they can logged in through
Packit Service 646995
	those interfaces. To specify a specific iface, pass the
Packit Service 646995
	-I argument for each iface.
Packit Service 646995
Packit Service 646995
- SendTargets iSCSI Discovery updating existing target records:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
Packit Service 646995
		-o update --discover
Packit Service 646995
Packit Service 646995
	If there is a record for targetX, and portalY exists in the DB, and
Packit Service 646995
	is returned during discovery, it will be updated with the info from
Packit Service 646995
	the iscsi.conf. No new portals will be added and stale portals
Packit Service 646995
	will not be removed.
Packit Service 646995
Packit Service 646995
- SendTargets iSCSI Discovery deleting existing target records:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
Packit Service 646995
		-o delete --discover
Packit Service 646995
Packit Service 646995
	If there is a record for targetX, and portalY exists in the DB, but
Packit Service 646995
	is not returned during discovery, it will be removed from the DB.
Packit Service 646995
	No new portals will be added and existing portal records will not
Packit Service 646995
	be changed.
Packit Service 646995
Packit Service 646995
	Note: If a session is logged into portal we are going to delete
Packit Service 646995
	a record for, it will be logged out then the record will be
Packit Service 646995
	deleted.
Packit Service 646995
Packit Service 646995
- SendTargets iSCSI Discovery adding new records:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
Packit Service 646995
		-o new --discover
Packit Service 646995
Packit Service 646995
	If there is targetX, and portalY is returned during discovery, and does
Packit Service 646995
	not have a record, it will be added. Existing records are not modified.
Packit Service 646995
Packit Service 646995
- SendTargets iSCSI Discovery using multiple ops:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
Packit Service 646995
		-o new -o delete --discover
Packit Service 646995
Packit Service 646995
	This command will add new portals and delete records for portals
Packit Service 646995
	no longer returned. It will not change the record information for
Packit Service 646995
	existing portals.
Packit Service 646995
Packit Service 646995
- SendTargets iSCSI Discovery in nonpersistent mode:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
Packit Service 646995
		-o nonpersistent --discover
Packit Service 646995
Packit Service 646995
	This command will perform discovery, but not manipulate the node DB.
Packit Service 646995
Packit Service 646995
- SendTargets iSCSI Discovery with a specific interface.
Packit Service 646995
		If you wish to only use a subset of the interfaces in
Packit Service fad540
		/var/lib/iscsi/ifaces, then you can pass them in during discovery:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
Packit Service 646995
		--interface=iface0 --interface=iface1 --discover
Packit Service 646995
Packit Service 646995
Packit Service 646995
	Note that for software iscsi, we let the network layer select
Packit Service 646995
	which NIC to use for discovery, but for later logins iscsiadm
Packit Service 646995
	will use the NIC defined in the iface config.
Packit Service 646995
Packit Service 646995
	qla4xxx support is very basic and experimental. It does not store
Packit Service 646995
	the record info in the card's FLASH or the node DB, so you must
Packit Service 646995
	rerun discovery every time the driver is reloaded.
Packit Service 646995
Packit Service 646995
- Manipulate SendTargets DB: Create new SendTargets discovery record or
Packit Service 646995
		overwrite an existing discovery record with iscsid.conf
Packit Service 646995
		discovery settings:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o new
Packit Service 646995
Packit Service 646995
- Manipulate SendTargets DB: Display discovery settings:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o show
Packit Service 646995
Packit Service 646995
- Manipulate SendTargets DB: Display hidden discovery settings like
Packit Service 646995
		 CHAP passwords:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
Packit Service 646995
		-o show --show
Packit Service 646995
Packit Service 646995
- Manipulate SendTargets DB: Set discovery setting.
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
Packit Service 646995
		-o update -n name -v value
Packit Service 646995
Packit Service 646995
- Manipulate SendTargets DB: Delete discovery record. This will also delete
Packit Service 646995
		the records for the targets found through the discovery source.
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o delete
Packit Service 646995
Packit Service 646995
- Show all records in discovery database:
Packit Service 646995
	iscsiadm -m discovery
Packit Service 646995
Packit Service 646995
- Show all records in discovery database and show the targets that were
Packit Service 646995
		discovered from each record:
Packit Service 646995
	iscsiadm -m discovery -P 1
Packit Service 646995
Packit Service 646995
Node mode
Packit Service 646995
---------
Packit Service 646995
Packit Service 646995
In node mode you can specify which records you want to log
Packit Service 646995
into by specifying the targetname, ip address, port or interface
Packit Service 646995
(if specifying the interface it must already be setup in the node db).
Packit Service 646995
iscsiadm will search the node db for records which match the values
Packit Service 646995
you pass in, so if you pass in the targetname and interface, iscsiadm
Packit Service 646995
will search for records with those values and operate on only them.
Packit Service 646995
Passing in none of them will result in all node records being operated on.
Packit Service 646995
Packit Service 646995
- iSCSI Login to all portals on every node/starget through each interface
Packit Service 646995
		set in the db:
Packit Service 646995
	iscsiadm -m node -l
Packit Service 646995
Packit Service 646995
- iSCSI login to all portals on a node/target through each interface set
Packit Service 646995
		in the db, but do not wait for the login response:
Packit Service 646995
	iscsiadm -m node -T iqn.2005-03.com.max -l -W
Packit Service 646995
Packit Service 646995
- iSCSI login to a specific portal through each interface set in the db:
Packit Service 646995
	iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 -l
Packit Service 646995
Packit Service 646995
	To specify an iPv6 address, the following can be used:
Packit Service 646995
		iscsiadm -m node -T iqn.2005-03.com.max \
Packit Service 646995
			-p 2001:c90::211:9ff:feb8:a9e9 -l
Packit Service 646995
Packit Service 646995
	The above command would use the default port, 3260. To specify a
Packit Service 646995
	port, use the following:
Packit Service 646995
		iscsiadm -m node -T iqn.2005-03.com.max \
Packit Service 646995
			-p [2001:c90::211:9ff:feb8:a9e9]:3260 -l
Packit Service 646995
Packit Service 646995
	To specify a hostname, the following can be used:
Packit Service 646995
		iscsiadm -m node -T iqn.2005-03.com.max -p somehost -l
Packit Service 646995
Packit Service 646995
- iSCSI Login to a specific portal through the NIC setup as iface0:
Packit Service 646995
	iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 \
Packit Service 646995
		-I iface0  -l
Packit Service 646995
Packit Service 646995
- iSCSI Logout of all portals on every node/starget through each interface
Packit Service 646995
		set in the db:
Packit Service 646995
	iscsiadm -m node -u
Packit Service 646995
Packit Service 646995
	Warning: this does not check startup values like the logout/login all
Packit Service 646995
	option. Do not use this if you are running iscsi on your root disk.
Packit Service 646995
Packit Service 646995
- iSCSI logout of all portals on a node/target through each interface set
Packit Service 646995
		in the db:
Packit Service 646995
	iscsiadm -m node -T iqn.2005-03.com.max -u
Packit Service 646995
Packit Service 646995
- iSCSI logout of a specific portal through each interface set in the db:
Packit Service 646995
	iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 -u
Packit Service 646995
Packit Service 646995
- iSCSI Logout of a specific portal through the NIC setup as iface0:
Packit Service 646995
	iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 \
Packit Service 646995
		-I iface0
Packit Service 646995
Packit Service 646995
- Changing iSCSI parameter:
Packit Service 646995
	iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 \
Packit Service 646995
		-o update -n node.cnx[0].iscsi.MaxRecvDataSegmentLength -v 65536
Packit Service 646995
Packit Service 646995
	You can also change parameters for multiple records at once, by
Packit Service 646995
	specifying different combinations of target, portal and interface
Packit Service 646995
	like above.
Packit Service 646995
Packit Service 646995
- Adding custom iSCSI portal:
Packit Service 646995
	iscsiadm -m node -o new -T iqn.2005-03.com.max \
Packit Service 646995
		-p 192.168.0.1:3260,2 -I iface4
Packit Service 646995
Packit Service 646995
	The -I/--interface is optional. If not passed in, "default" is used.
Packit Service 646995
	For tcp or iser, this would allow the network layer to decide what is
Packit Service 646995
	best.
Packit Service 646995
Packit Service 646995
	Note that for this command, the Target Portal Group Tag (TPGT) should
Packit Service 646995
	be passed in. If it is not passed in on the initial creation command,
Packit Service 646995
	then the user must run iscsiadm again to set the value. Also,
Packit Service 646995
	if the TPGT is not initially passed in, the old behavior of not
Packit Service 646995
	tracking whether the record was statically or dynamically created
Packit Service 646995
	is used.
Packit Service 646995
Packit Service 646995
- Adding custom NIC config to multiple targets:
Packit Service 646995
	iscsiadm -m node -o new -I iface4
Packit Service 646995
Packit Service 646995
	This command will add an interface config using the iSCSI and SCSI
Packit Service 646995
	settings from iscsid.conf to every target that is in the node db.
Packit Service 646995
Packit Service 646995
- Removing iSCSI portal:
Packit Service 646995
	iscsiadm -m node -o delete -T iqn.2005-03.com.max -p 192.168.0.4:3260
Packit Service 646995
Packit Service 646995
	You can also delete multiple records at once, by specifying different
Packit Service 646995
	combinations of target, portal and interface like above.
Packit Service 646995
Packit Service 646995
- Display iSCSI portal onfiguration:
Packit Service 646995
	iscsiadm -m node [-o show] -T iqn.2005-03.com.max -p 192.168.0.4:3260
Packit Service 646995
Packit Service 646995
	You can also display multiple records at once, by specifying different
Packit Service 646995
	combinations of target, portal and interface like above.
Packit Service 646995
Packit Service 646995
	Note: running "iscsiadm -m node" will only display the records. It
Packit Service 646995
	will not display the configuration info. For the latter, run:
Packit Service 646995
		iscsiadm -m node -o show
Packit Service 646995
Packit Service 646995
- Show all node records:
Packit Service 646995
	iscsiadm -m node
Packit Service 646995
Packit Service 646995
	This will print the nodes using the old flat format where the
Packit Service 646995
	interface and driver are not displayed. To display that info
Packit Service 646995
	use the -P option with the argument "1":
Packit Service 646995
		iscsiadm -m node -P 1
Packit Service 646995
Packit Service 646995
Session mode
Packit Service 646995
------------
Packit Service 646995
Packit Service 646995
- Display session statistics:
Packit Service 646995
	iscsiadm -m session -r 1 --stats
Packit Service 646995
Packit Service 646995
	This function also works in node mode. Instead of the "-r $sid"
Packit Service 646995
	argument, you would pass in the node info like targetname and/or portal,
Packit Service 646995
	and/or interface.
Packit Service 646995
Packit Service 646995
- Perform a SCSI scan on a session
Packit Service 646995
	iscsiadm -m session -r 1 --rescan
Packit Service 646995
Packit Service 646995
	This function also works in node mode. Instead of the "-r $sid"
Packit Service 646995
	argument, you would pass in the node info like targetname and/or portal,
Packit Service 646995
	and/or interface.
Packit Service 646995
Packit Service 646995
	Note: Rescanning does not delete old LUNs. It will only pick up new
Packit Service 646995
	ones.
Packit Service 646995
Packit Service 646995
- Display running sessions:
Packit Service 646995
	iscsiadm -m session -P 1
Packit Service 646995
Packit Service 646995
Host mode with flashnode submode
Packit Service 646995
--------------------------------
Packit Service 646995
Packit Service 646995
- Display list of flash nodes for a host
Packit Service 646995
	iscsiadm -m host -H 6 -C flashnode
Packit Service 646995
Packit Service 646995
	This will print list of all the flash node entries for the given host
Packit Service 646995
	along with their ip, port, tpgt and iqn values.
Packit Service 646995
Packit Service 646995
- Display all parameters of a flash node entry for a host
Packit Service 646995
	iscsiadm -m host -H 6 -C flashnode -x 0
Packit Service 646995
Packit Service 646995
	This will list all the parameter name,value pairs for the
Packit Service 646995
	flash node entry at index 0 of host 6.
Packit Service 646995
Packit Service 646995
- Add a new flash node entry for a host
Packit Service 646995
	iscsiadm -m host -H 6 -C flashnode -o new -A [ipv4|ipv6]
Packit Service 646995
Packit Service 646995
	This will add new flash node entry for the given host 6 with portal
Packit Service 646995
	type of either ipv4 or ipv6. The new operation returns the index of
Packit Service 646995
	the newly created flash node entry.
Packit Service 646995
Packit Service 646995
- Update a flashnode entry
Packit Service 646995
	iscsiadm -m host -H 6 -C flashnode -x 1 -o update \
Packit Service 646995
		-n flashnode.conn[0].ipaddress -v 192.168.1.12 \
Packit Service 646995
		-n flashnode.session.targetname \
Packit Service 646995
		-v iqn.2002-03.com.compellent:5000d310004b0716
Packit Service 646995
Packit Service 646995
	This will update the values of ipaddress and targetname params of
Packit Service 646995
	the flash node entry at index 1 of host 6.
Packit Service 646995
Packit Service 646995
- Login to a flash node entry
Packit Service 646995
	iscsiadm -m host -H 6 -C flashnode -x 1 -o login
Packit Service 646995
Packit Service 646995
- Logout from a flash node entry
Packit Service 646995
	Logout can be performed either using the flash node index:
Packit Service 646995
		iscsiadm -m host -H 6 -C flashnode -x 1 -o logout
Packit Service 646995
Packit Service 646995
	or by using the corresponding session index:
Packit Service 646995
		iscsiadm -m session -r $sid -u
Packit Service 646995
Packit Service 646995
- Delete a flash node entry
Packit Service 646995
	iscsiadm -m host -H 6 -C flashnode -x 1 -o delete
Packit Service 646995
Packit Service 646995
Host mode with chap submode
Packit Service 646995
---------------------------
Packit Service 646995
Packit Service 646995
- Display list of chap entries for a host
Packit Service 646995
	iscsiadm -m host -H 6 -C chap -o show
Packit Service 646995
Packit Service 646995
- Delete a chap entry for a host
Packit Service 646995
	iscsiadm -m host -H 6 -C chap -o delete -x 5
Packit Service 646995
Packit Service 646995
	This will delete any chap entry present at index 5.
Packit Service 646995
Packit Service 646995
- Add/Update a local chap entry for a host
Packit Service 646995
	iscsiadm -m host -H 6 -C chap -o update -x 4 -n username \
Packit Service 646995
			-v value -n password -v value
Packit Service 646995
Packit Service 646995
	This will update the local chap entry present at index 4. If index 4
Packit Service 646995
	is free, then a new entry of type local chap will be created at that
Packit Service 646995
	index with given username and password values.
Packit Service 646995
Packit Service 646995
- Add/Update a bidi chap entry for a host
Packit Service 646995
	iscsiadm -m host -H 6 -C chap -o update -x 5 -n username_in \
Packit Service 646995
		-v value -n password_in -v value
Packit Service 646995
Packit Service 646995
	This will update the bidi chap entry present at index 5. If index 5
Packit Service 646995
	is free then entry of type bidi chap will be created at that index
Packit Service 646995
	with given username_in and password_in values.
Packit Service 646995
Packit Service 646995
Host mode with stats submode
Packit Service 646995
----------------------------
Packit Service 646995
Packit Service 646995
- Display host statistics:
Packit Service 646995
	iscsiadm -m host -H 6 -C stats
Packit Service 646995
Packit Service 646995
	This will print the aggregate statistics on the host adapter port.
Packit Service 646995
	This includes MAC, TCP/IP, ECC & iSCSI statistics.
Packit Service 646995
Packit Service 646995
Packit Service 646995
6. Configuration
Packit Service 646995
================
Packit Service 646995
Packit Service 646995
The default configuration file is /etc/iscsi/iscsid.conf. This file contains
Packit Service 646995
only configuration that could be overwritten by iSCSI Discovery,
Packit Service 646995
or manualy updated via iscsiadm utility. Its OK if this file does not
Packit Service 646995
exist, in which case compiled-in default configuration will take place
Packit Service 646995
for newer discovered Target nodes.
Packit Service 646995
Packit Service 646995
See the man page and the example file for the current syntax.
Packit Service 646995
The manpages for iscsid, iscsiadm are in the doc subdirectory and can be
Packit Service 646995
installed in the appropriate man page directories and need to be manually
Packit Service 646995
copied into e.g. /usr/local/share/man8.
Packit Service 646995
Packit Service 646995
Packit Service 646995
7. Getting Started
Packit Service 646995
==================
Packit Service 646995
Packit Service 646995
There are three steps needed to set up a system to use iSCSI storage:
Packit Service 646995
7.1. iSCSI startup using the systemd units or manual startup.
Packit Service 646995
7.2. Discover targets.
Packit Service 646995
7.3. Automate target logins for future system reboots.
Packit Service 646995
Packit Service 646995
The systemd startup units will start the iSCSI daemon and log into any
Packit Service 646995
portals that are set up for automatic login (discussed in 7.2)
Packit Service 646995
or discovered through the discover daemon iscsid.conf params
Packit Service 646995
(discussed in 7.1.2).
Packit Service 646995
Packit Service 646995
If your distro does not have an init script, then you will have to start the
Packit Service 646995
daemon and log into the targets manually.
Packit Service 646995
Packit Service 646995
Packit Service 646995
7.1.1 iSCSI startup using the init script
Packit Service 646995
=========================================
Packit Service 646995
Packit Service 646995
Red Hat or Fedora:
Packit Service 646995
-----------------
Packit Service 646995
To start open-iscsi in Red Hat/Fedora you can do:
Packit Service 646995
Packit Service eca926
	systemctl start iscsi
Packit Service 646995
Packit Service 646995
To get open-iscsi to automatically start at run time you may have to
Packit Service 646995
run:
Packit Service eca926
	systemctl enable iscsi
Packit Service 646995
Packit Service 646995
And, to automatically mount a file system during startup
Packit Service 646995
you must have the partition entry in /etc/fstab marked with the "_netdev"
Packit Service 646995
option. For example this would mount an iscsi disk sdb:
Packit Service 646995
Packit Service 646995
	/dev/sdb /mnt/iscsi ext3 _netdev 0 0
Packit Service 646995
Packit Service 646995
SUSE or Debian:
Packit Service 646995
---------------
Packit Service 646995
The open-iscsi service is socket activated, so there is no need to
Packit Service 646995
enable the open-iscsi service. Likewise, the iscsi.service login
Packit Service 646995
service is enabled automatically, so setting 'startup' to "automatic'
Packit Service 646995
will enable automatic login to open-iscsi targets.
Packit Service 646995
Packit Service 646995
Packit Service 646995
7.1.2 Manual Startup
Packit Service 646995
====================
Packit Service 646995
Packit Service 646995
7.1.2.1 Starting up the iSCSI daemon (iscsid) and loading modules
Packit Service 646995
=================================================================
Packit Service 646995
Packit Service 646995
If there is no initd script, you must start the tools by hand. First load the
Packit Service 646995
iscsi modules:
Packit Service 646995
	modprobe -q iscsi_tcp
Packit Service 646995
Packit Service 646995
After that, start iSCSI as a daemon process:
Packit Service 646995
	iscsid
Packit Service 646995
Packit Service 646995
or alternatively, start it with debug enabled, in a seperate window,
Packit Service 646995
which will force it into "foreground" mode:
Packit Service 646995
	iscsid -d 8 
Packit Service 646995
Packit Service 646995
Packit Service 646995
7.1.2.2 Logging into Targets
Packit Service 646995
============================
Packit Service 646995
Packit Service 646995
Use the configuration utility, iscsiadm, to add/remove/update Discovery
Packit Service 646995
records, iSCSI Node records or monitor active iSCSI sessions (see above or the
Packit Service 646995
iscsiadm man files and see section 7.2 below for how to discover targets):
Packit Service 646995
	iscsiadm  -m node
Packit Service 646995
Packit Service 646995
will print out the nodes that have been discovered as:
Packit Service 646995
Packit Service 646995
	10.15.85.19:3260,3 iqn.1992-08.com.netapp:sn.33615311
Packit Service 646995
	10.15.84.19:3260,2 iqn.1992-08.com.netapp:sn.33615311
Packit Service 646995
Packit Service 646995
The format is:
Packit Service 646995
	ip:port,target_portal_group_tag targetname
Packit Service 646995
Packit Service 646995
If you are using the iface argument or want to see the driver
Packit Service 646995
info, use the following:
Packit Service 646995
	iscsiadm -m node -P 1
Packit Service 646995
Packit Service 646995
Example output:
Packit Service 646995
	Target: iqn.1992-08.com.netapp:sn.33615311
Packit Service 646995
	        Portal: 10.15.84.19:3260,2
Packit Service 646995
	                Iface Name: iface2
Packit Service 646995
	        Portal: 10.15.85.19:3260,3
Packit Service 646995
	                Iface Name: iface2
Packit Service 646995
Packit Service 646995
The format is:
Packit Service 646995
	Target: targetname
Packit Service 646995
		Portal ip_address:port,tpgt
Packit Service 646995
			Iface: ifacename
Packit Service 646995
Packit Service 646995
where targetname is the name of the target and ip_address:port is the address
Packit Service 646995
and port of the portal. tpgt is the Target Portal Group Tag of
Packit Service 646995
the portal, and is not used in iscsiadm commands except for static
Packit Service 646995
record creation. ifacename is the name of the iscsi interface
Packit Service fad540
defined in /var/lib/iscsi/ifaces. If no interface was defined in
Packit Service fad540
/var/lib/iscsi/ifaces or passed in, the default behavior is used.
Packit Service 646995
Default here is iscsi_tcp/tcp to be used over whichever NIC the
Packit Service 646995
network layer decides is best.
Packit Service 646995
Packit Service 646995
To login, take the ip, port and targetname from above and run:
Packit Service 646995
	iscsiadm -m node -T targetname -p ip:port -l
Packit Service 646995
Packit Service 646995
In this example we would run:
Packit Service 646995
	iscsiadm -m node -T iqn.1992-08.com.netapp:sn.33615311 \
Packit Service 646995
		-p 10.15.84.19:3260 -l
Packit Service 646995
Packit Service 646995
	Note: drop the portal group tag from the "iscsiadm -m node" output.
Packit Service 646995
Packit Service 646995
If you wish, for example to login to all targets represented in the node
Packit Service 646995
database, but not wait for the login responses:
Packit Service 646995
Packit Service 646995
	iscsiadm -m node -l -W
Packit Service 646995
Packit Service 646995
after which you can use "session" mode to detect when the logins complete:
Packit Service 646995
Packit Service 646995
	iscsiadm -m session
Packit Service 646995
Packit Service 646995
7.2. Discover Targets
Packit Service 646995
=====================
Packit Service 646995
Packit Service 646995
Once the iSCSI service is running, you can perform discovery using
Packit Service 646995
SendTarget with:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p ip:port --discover
Packit Service 646995
Packit Service 646995
where "ip" is the address of the portal and port is the port.
Packit Service 646995
Packit Service 646995
To use iSNS you can run the discovery command with the type as "isns"
Packit Service 646995
and pass in the ip:port:
Packit Service 646995
	iscsiadm -m discoverydb -t isns -p ip:port --discover
Packit Service 646995
Packit Service 646995
Both commands will print out the list of all discovered targets and their
Packit Service 646995
portals:
Packit Service 646995
Packit Service 646995
	# iscsiadm -m discoverydb -t st -p 10.15.85.19:3260 --discover
Packit Service 646995
	10.15.84.19:3260,2 iqn.1992-08.com.netapp:sn.33615311
Packit Service 646995
	10.15.85.19:3260,3 iqn.1992-08.com.netapp:sn.33615311
Packit Service 646995
Packit Service 646995
The format for the output is:
Packit Service 646995
	ip:port,tpgt targetname
Packit Service 646995
Packit Service 646995
In this example, for the first target the ip address is 10.15.85.19.
Packit Service 646995
The port is 3260. The target portal group is 3. The target name
Packit Service 646995
is iqn.1992-08.com.netapp:sn.33615311.
Packit Service 646995
Packit Service 646995
If you would also like to see the iscsi inteface which will be used
Packit Service 646995
for each session then use the --print=[N]/-P [N] option:
Packit Service 646995
	iscsiadm -m discoverydb -t sendtargets -p ip:port -P 1 --discover
Packit Service 646995
Packit Service 646995
will print:
Packit Service 646995
    Target: iqn.1992-08.com.netapp:sn.33615311
Packit Service 646995
        Portal: 10.15.84.19:3260,2
Packit Service 646995
           Iface Name: iface2
Packit Service 646995
        Portal: 10.15.85.19:3260,3
Packit Service 646995
           Iface Name: iface2
Packit Service 646995
Packit Service 646995
In this example, The IP address of the first portal is 10.15.84.19.
Packit Service 646995
The port is 3260. The target portal group is 3. The target name
Packit Service 646995
is iqn.1992-08.com.netapp:sn.33615311. The iface being used is iface2.
Packit Service 646995
Packit Service 646995
While discovery targets are kept in the discovery db, they are
Packit Service 646995
useful only for re-discovery. The discovered targets (a.k.a. nodes)
Packit Service 646995
are stored as records in the node db.
Packit Service 646995
Packit Service 646995
The discovered targets are not logged into yet. Rather than logging
Packit Service 646995
into the discovered nodes (making LUs from those nodes available as
Packit Service 646995
storage), it is better to automate the login to the nodes we need.
Packit Service 646995
Packit Service 646995
If you wish to log into a target manually now, see section
Packit Service 646995
"7.1.2.2 Logging in targets" above.
Packit Service 646995
Packit Service 646995
Packit Service 646995
7.3. Automate Target Logins for Future System Statups
Packit Service 646995
=====================================================
Packit Service 646995
Packit Service 646995
Note: this may only work for distros with init scripts.
Packit Service 646995
Packit Service 646995
To automate login to a node, use the following with the record ID
Packit Service 646995
(record ID is the targetname and portal) of the node discovered in the
Packit Service 646995
discovery above:
Packit Service 646995
	iscsiadm -m node -T targetname -p ip:port --op update -n node.startup -v automatic
Packit Service 646995
Packit Service 646995
To set the automatic setting to all portals on a target through every
Packit Service 646995
interface setup for each protal, the following can be run:
Packit Service 646995
	iscsiadm -m node -T targetname --op update -n node.startup -v automatic
Packit Service 646995
Packit Service 646995
Or to set the "node.startup" attribute to "automatic" as default for
Packit Service 646995
all sessions add the following to the /etc/iscsi/iscsid.conf:
Packit Service 646995
	node.startup = automatic
Packit Service 646995
Packit Service 646995
Setting this in iscsid.conf will not affect existing nodes. It will only
Packit Service 646995
affect nodes that are discovered after setting the value.
Packit Service 646995
Packit Service 646995
To login to all automated nodes, simply restart the iscsi login service, e.g. with:
Packit Service 646995
	systemctl restart iscsi
Packit Service 646995
Packit Service 646995
On your next startup the nodes will be logged into automatically.
Packit Service 646995
Packit Service 646995
Packit Service 646995
7.4 Automatic Discovery and Login
Packit Service 646995
=================================
Packit Service 646995
Packit Service 646995
Instead of running the iscsiadm discovery command and editing the
Packit Service 646995
startup setting, iscsid can be configured so that every X seconds
Packit Service 646995
it performs discovery and logs in and out of the portals returned or
Packit Service 646995
no longer returned. In this mode, when iscsid starts it will check the
Packit Service 646995
discovery db for iSNS records with:
Packit Service 646995
	discovery.isns.use_discoveryd = Yes
Packit Service 646995
Packit Service 646995
and it will check for SendTargets discovery records that have the setting:
Packit Service 646995
	discovery.sendtargets.use_discoveryd = Yes
Packit Service 646995
Packit Service 646995
If set, iscsid will perform discovery to the address every
Packit Service 646995
discovery.isns.discoveryd_poll_inval or
Packit Service 646995
discovery.sendtargets.discoveryd_poll_inval seconds,
Packit Service 646995
and it will log into any portals found from the discovery source using
Packit Service fad540
the ifaces in /var/lib/iscsi/ifaces.
Packit Service 646995
Packit Service 646995
Note that for iSNS the poll_interval does not have to be set. If not set,
Packit Service 646995
iscsid will only perform rediscovery when it gets a SCN from the server.
Packit Service 646995
Packit Service 646995
#   iSNS Note:
Packit Service 646995
#   For servers like Microsoft's where they allow SCN registrations, but do not
Packit Service 646995
#   send SCN events, discovery.isns.poll_interval should be set to a non zero
Packit Service 646995
#   value to auto discover new targets. This is also useful for servers like
Packit Service 646995
#   linux-isns (SLES's iSNS server) where it sometimes does not send SCN
Packit Service 646995
#   events in the proper format, so they may not get handled.
Packit Service 646995
Packit Service eca926
To set the startup value, so that nodes are not logged into automatically
Packit Service eca926
use the value "manual".
Packit Service eca926
Packit Service 646995
Examples
Packit Service 646995
--------
Packit Service 646995
Packit Service 646995
SendTargets
Packit Service 646995
-----------
Packit Service 646995
Packit Service 646995
- Create a SendTargets record by passing iscsiadm the "-o new" argument in
Packit Service 646995
		discoverydb mode.
Packit Service 646995
	iscsiadm -m discoverydb -t st -p 20.15.0.7:3260 -o new
Packit Service 646995
Packit Service 646995
	On success, this will output something like:
Packit Service 646995
		New discovery record for [20.15.0.7,3260] added.
Packit Service 646995
Packit Service 646995
- Set the use_discoveryd setting for the record.
Packit Service 646995
	iscsiadm -m discoverydb -t st -p 20.15.0.7:3260  -o update \
Packit Service 646995
		-n discovery.sendtargets.use_discoveryd -v Yes
Packit Service 646995
Packit Service 646995
- Set the polling interval.
Packit Service 646995
	iscsiadm -m discoverydb -t st -p 20.15.0.7:3260  -o update \
Packit Service 646995
		-n discovery.sendtargets.discoveryd_poll_inval -v 30
Packit Service 646995
Packit Service 646995
To have the new settings take effect, restart iscsid by restarting the
Packit Service 646995
iscsi services.
Packit Service 646995
Packit Service 646995
Note:
Packit Service 646995
When iscsiadm is run with the -o new argument, it will use the
Packit Service 646995
discovery.sendtargets.use_discoveryd and
Packit Service 646995
discovery.sendtargets.discoveryd_poll_inval
Packit Service 646995
settings in iscsid.conf for the records initial settings. So if those
Packit Service 646995
are set in iscsid.conf, then you can skip the iscsiadm -o update
Packit Service 646995
commands.
Packit Service 646995
Packit Service 646995
iSNS
Packit Service 646995
----
Packit Service 646995
Packit Service 646995
- Create an iSNS record by passing iscsiadm the "-o new" argument in
Packit Service 646995
		discoverydb mode.
Packit Service 646995
	iscsiadm -m discoverydb -t isns -p 20.15.0.7:3205 -o new
Packit Service 646995
Packit Service 646995
	Response on success:
Packit Service 646995
		New discovery record for [20.15.0.7,3205] added.
Packit Service 646995
Packit Service 646995
- Set the use_discoveryd setting for the record.
Packit Service 646995
	iscsiadm -m discoverydb -t isns -p 20.15.0.7:3205  -o update \
Packit Service 646995
		-n discovery.isns.use_discoveryd -v Yes
Packit Service 646995
Packit Service 646995
- [OPTIONAL: see iSNS note above] Set the polling interval if needed.
Packit Service 646995
	iscsiadm -m discoverydb -t st -p 20.15.0.7:3205  -o update \
Packit Service 646995
		-n discovery.isns.discoveryd_poll_inval -v 30
Packit Service 646995
Packit Service 646995
To have the new settings take effect, restart iscsid by restarting the
Packit Service 646995
iscsi services.
Packit Service 646995
Packit Service 646995
Note:
Packit Service 646995
When iscsiadm is run with the -o new argument, it will use the
Packit Service 646995
discovery.isns.use_discoveryd and discovery.isns.discoveryd_poll_inval
Packit Service 646995
settings in iscsid.conf for the record's initial settings. So if those
Packit Service 646995
are set in iscsid.conf, then you can skip the iscsiadm -o update
Packit Service 646995
commands.
Packit Service 646995
Packit Service 646995
Packit Service 646995
8. Advanced Configuration
Packit Service 646995
=========================
Packit Service 646995
Packit Service 646995
8.1 iSCSI settings for dm-multipath
Packit Service 646995
===================================
Packit Service 646995
Packit Service 646995
When using dm-multipath, the iSCSI timers should be set so that commands
Packit Service 646995
are quickly failed to the dm-multipath layer. For dm-multipath you should
Packit Service 646995
then set values like queue if no path, so that IO errors are retried and
Packit Service 646995
queued if all paths are failed in the multipath layer.
Packit Service 646995
Packit Service 646995
Packit Service 646995
8.1.1 iSCSI ping/Nop-Out settings
Packit Service 646995
=================================
Packit Service 646995
To quickly detect problems in the network, the iSCSI layer will send iSCSI
Packit Service 646995
pings (iSCSI NOP-Out requests) to the target. If a NOP-Out times out, the
Packit Service 646995
iSCSI layer will respond by failing running commands and asking the SCSI
Packit Service 646995
layer to requeue them if possible (SCSI disk commands get 5 retries if not
Packit Service 646995
using multipath). If dm-multipath is being used the SCSI layer will fail
Packit Service 646995
the command to the multipath layer instead of retrying. The multipath layer
Packit Service 646995
will then retry the command on another path.
Packit Service 646995
Packit Service 646995
To control how often a NOP-Out is sent, the following value can be set:
Packit Service 646995
	node.conn[0].timeo.noop_out_interval = X
Packit Service 646995
Packit Service 646995
Where X is in seconds and the default is 10 seconds. To control the
Packit Service 646995
timeout for the NOP-Out the noop_out_timeout value can be used:
Packit Service 646995
	node.conn[0].timeo.noop_out_timeout = X
Packit Service 646995
Packit Service 646995
Again X is in seconds and the default is 15 seconds.
Packit Service 646995
Packit Service 646995
Normally for these values you can use:
Packit Service 646995
Packit Service 646995
	node.conn[0].timeo.noop_out_interval = 5
Packit Service 646995
	node.conn[0].timeo.noop_out_timeout = 10
Packit Service 646995
Packit Service 646995
If there are a lot of IO error messages, then the above values may be too
Packit Service 646995
aggressive and you may need to increase the values for your network conditions
Packit Service 646995
and workload, or you may need to check your network for possible problems.
Packit Service 646995
Packit Service 646995
Packit Service 646995
8.1.2 replacement_timeout
Packit Service 646995
=========================
Packit Service 646995
Packit Service 646995
The next iSCSI timer that will need to be tweaked is:
Packit Service 646995
Packit Service 646995
node.session.timeo.replacement_timeout = X
Packit Service 646995
Packit Service 646995
Here X is in seconds.
Packit Service 646995
Packit Service 646995
replacement_timeout will control how long to wait for session re-establishment
Packit Service 646995
before failing pending SCSI commands and commands that are being operated on by
Packit Service 646995
the SCSI layer's error handler up to a higher level like multipath or to
Packit Service 646995
an application if multipath is not being used.
Packit Service 646995
Packit Service 646995
Packit Service 646995
8.1.2.1 Running Commands, the SCSI Error Handler, and replacement_timeout
Packit Service 646995
=========================================================================
Packit Service 646995
Packit Service 646995
Remember from the Nop-out discussion that if a network problem is detected,
Packit Service 646995
the running commands are failed immediately. There is one exception to this,
Packit Service 646995
and that is when the SCSI layer's error handler is running. To check if
Packit Service 646995
the SCSI error handler is running, iscsiadm can be run as:
Packit Service 646995
	iscsiadm -m session -P 3
Packit Service 646995
Packit Service 646995
You will then see:
Packit Service 646995
	Host Number: X State: Recovery
Packit Service 646995
Packit Service 646995
When the SCSI EH is running, commands will not be failed until
Packit Service 646995
node.session.timeo.replacement_timeout seconds.
Packit Service 646995
Packit Service 646995
To modify the timer that starts the SCSI EH, you can either write
Packit Service 646995
directly to the device's sysfs file:
Packit Service 646995
	echo X > /sys/block/sdX/device/timeout
Packit Service 646995
Packit Service 646995
where X is in seconds.
Packit Service 646995
Alternatively, on most distros you can modify the udev rule.
Packit Service 646995
Packit Service 646995
To modify the udev rule open /etc/udev/rules.d/50-udev.rules, and find the
Packit Service 646995
following lines:
Packit Service 646995
Packit Service 646995
	ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="0|7|14", \
Packit Service 646995
		RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'"
Packit Service 646995
Packit Service 646995
And change the "echo 60" part of the line to the value that you want.
Packit Service 646995
Packit Service 646995
The default timeout for normal File System commands is 30 seconds when udev
Packit Service 646995
is not being used. If udev is used the default is the above value which
Packit Service 646995
is normally 60 seconds.
Packit Service 646995
Packit Service 646995
Packit Service 646995
8.1.2.2 Pending Commands and replacement_timeout
Packit Service 646995
================================================
Packit Service 646995
Packit Service 646995
Commonly, the SCSI/BLOCK layer will queue 256 commands, but the path can
Packit Service 646995
only take 32. When a network problem is detected, the 32 commands
Packit Service 646995
in flight will be sent back to the SCSI layer immediately and because
Packit Service 646995
multipath is being used, this will cause the commands to be sent to the multipath
Packit Service 646995
layer for execution on another path. However, the other 96 commands that were
Packit Service 646995
still in the SCSI/BLOCK queue will remain there until the session is
Packit Service 646995
re-established or until node.session.timeo.replacement_timeout seconds has
Packit Service 646995
gone by. After replacement_timeout seconds, the pending commands will be
Packit Service 646995
failed to the multipath layer, and all new incoming commands will be
Packit Service 646995
immediately failed back to the multipath layer. If a session is later
Packit Service 646995
re-established, then new commands will be queued and executed. Normally,
Packit Service 646995
multipathd's path tester mechanism will detect that the session has been
Packit Service 646995
re-established and the path is accessible again, and it will inform
Packit Service 646995
dm-multipath.
Packit Service 646995
Packit Service 646995
Packit Service 646995
8.1.3 Optimal replacement_timeout Value
Packit Service 646995
=======================================
Packit Service 646995
Packit Service 646995
The default value for replacement_timeout is 120 seconds, but because
Packit Service 646995
multipath's queue_if_no_path and no_path_retry setting can prevent IO errors
Packit Service 646995
from being propagated to the application, replacement_timeout can be set to a
Packit Service 646995
shorter value like 5 to 15 seconds. By setting it lower, pending IO is quickly
Packit Service 646995
sent to a new path and executed while the iSCSI layer attempts
Packit Service 646995
re-establishment of the session. If all paths end up being failed, then the
Packit Service 646995
multipath and device mapper layer will internally queue IO based on the
Packit Service 646995
multipath.conf settings, instead of the iSCSI layer.
Packit Service 646995
Packit Service 646995
Packit Service 646995
8.2 iSCSI settings for iSCSI root
Packit Service 646995
=================================
Packit Service 646995
Packit Service 646995
When accessing the root partition directly through an iSCSI disk, the
Packit Service 646995
iSCSI timers should be set so that iSCSI layer has several chances to try to
Packit Service 646995
re-establish a session and so that commands are not quickly requeued to
Packit Service 646995
the SCSI layer. Basically you want the opposite of when using dm-multipath.
Packit Service 646995
Packit Service 646995
For this setup, you can turn off iSCSI pings by setting:
Packit Service 646995
Packit Service 646995
	node.conn[0].timeo.noop_out_interval = 0
Packit Service 646995
	node.conn[0].timeo.noop_out_timeout = 0
Packit Service 646995
Packit Service 646995
And you can turn the replacement_timer to a very long value:
Packit Service 646995
	node.session.timeo.replacement_timeout = 86400
Packit Service 646995
Packit Service 646995
Packit Service 646995
9. iSCSI System Info
Packit Service 646995
====================
Packit Service 646995
Packit Service 646995
To get information about the running sessions: including the session and
Packit Service 646995
device state, session ids (sid) for session mode, and some of the
Packit Service 646995
negotiated parameters, run:
Packit Service 646995
	iscsiadm -m session -P 2
Packit Service 646995
Packit Service 646995
If you are looking for something shorter, like just the sid to node mapping,
Packit Service 646995
run:
Packit Service 646995
	iscsiadm -m session [-P 0]
Packit Service 646995
Packit Service 646995
This will print the list of running sessions with the format:
Packit Service 646995
	driver [sid] ip:port,target_portal_group_tag targetname
Packit Service 646995
Packit Service 646995
Example output of "iscsiadm -m session":
Packit Service 646995
Packit Service 646995
	tcp [2] 10.15.84.19:3260,2 iqn.1992-08.com.netapp:sn.33615311
Packit Service 646995
	tcp [3] 10.15.85.19:3260,3 iqn.1992-08.com.netapp:sn.33615311
Packit Service 646995
Packit Service 646995
To print the hw address info use the -P option with "1":
Packit Service 646995
	iscsiadm -m session -P 1
Packit Service 646995
Packit Service 646995
This will print the sessions with the following format:
Packit Service 646995
Target: targetname
Packit Service 646995
	Current Portal: portal currently logged into
Packit Service 646995
	Persistent Portal: portal we would fall back to if we had got
Packit Service 646995
			   redirected during login
Packit Service 646995
		Iface Transport: driver/transport_name
Packit Service 646995
		Iface IPaddress: IP address of iface being used
Packit Service 646995
		Iface HWaddress: HW address used to bind session
Packit Service 646995
		Iface Netdev: netdev value used to bind session
Packit Service 646995
		SID: iscsi sysfs session id
Packit Service 646995
		iSCSI Connection State: iscsi state
Packit Service 646995
Packit Service 646995
Note: if an older kernel is being used or if the session is not bound,
Packit Service 646995
then the keyword "default" is printed to indicate that the default
Packit Service 646995
network behavior is being used.
Packit Service 646995
Packit Service 646995
Example output of "iscsiadm -m session -P 1":
Packit Service 646995
	Target: iqn.1992-08.com.netapp:sn.33615311
Packit Service 646995
		Current Portal: 10.15.85.19:3260,3
Packit Service 646995
		Persistent Portal: 10.15.85.19:3260,3
Packit Service 646995
			Iface Transport: tcp
Packit Service 646995
			Iface IPaddress: 10.11.14.37
Packit Service 646995
			Iface HWaddress: default
Packit Service 646995
			Iface Netdev: default
Packit Service 646995
			SID: 7
Packit Service 646995
			iSCSI Connection State: LOGGED IN
Packit Service 646995
			Internal iscsid Session State: NO CHANGE
Packit Service 646995
Packit Service 646995
The connection state is currently not available for qla4xxx.
Packit Service 646995
Packit Service 646995
To get a HBA/Host view of the session, there is the host mode:
Packit Service 646995
	iscsiadm -m host
Packit Service 646995
Packit Service 646995
This prints the list of iSCSI hosts in the system with the format:
Packit Service 646995
	driver [hostno] ipaddress,[hwaddress],net_ifacename,initiatorname
Packit Service 646995
Packit Service 646995
Example output:
Packit Service 646995
	cxgb3i: [7] 10.10.15.51,[00:07:43:05:97:07],eth3 <empty>
Packit Service 646995
Packit Service 646995
To print this info in a more user friendly way, the -P argument can be used:
Packit Service 646995
	iscsiadm -m host -P 1
Packit Service 646995
Packit Service 646995
Example output:
Packit Service 646995
	Host Number: 7
Packit Service 646995
		State: running
Packit Service 646995
		Transport: cxgb3i
Packit Service 646995
		Initiatorname: <empty>
Packit Service 646995
		IPaddress: 10.10.15.51
Packit Service 646995
		HWaddress: 00:07:43:05:97:07
Packit Service 646995
		Netdev: eth3
Packit Service 646995
Packit Service 646995
Here, you can also see the state of the host.
Packit Service 646995
Packit Service 646995
You can also pass in any value from 1 - 4 to print more info, like the
Packit Service 646995
sessions running through the host, what ifaces are being used and what
Packit Service 646995
devices are accessed through it.
Packit Service 646995
Packit Service 646995
To print the info for a specific host, you can pass in the -H argument
Packit Service 646995
with the host number:
Packit Service 646995
	iscsiadm -m host -P 1 -H 7