# iscsiadm - open-iscsi administration utility - man(8) - [phpMan]

[_ISCSIADM_(8)](https://www.chedong.com/phpMan.php/man/ISCSIADM/8/markdown)                         Linux Administrator's Manual                         [_ISCSIADM_(8)](https://www.chedong.com/phpMan.php/man/ISCSIADM/8/markdown)

## NAME
       iscsiadm - open-iscsi administration utility

## SYNOPSIS
       **iscsiadm  -m  discoverydb **[**-hV**] [**-d _**debug_level_] [**-P _**printlevel_] [**-I _**iface_ **-t _**type_ **-p _**ip:port_
       [**-lD**] ] | [ [**-p _**ip:port_ **-t _**type_] [**-o _**operation_] [**-n _**name_] [**-v _**value_] [**-lD**] ]

       **iscsiadm -m discovery **[**-hV**] [**-d  _**debug_level_]  [**-P  _**printlevel_]  [**-I  _**iface_]  [**-t  _**type_]  [**-p**
       _ip:port_] [**-l**]

       **iscsiadm -m node **[**-hV**] [**-d _**debug_level_] [**-P _**printlevel_] [**-L _**all,manual,automatic,onboot_] [**-W**]
       [**-U _**all,manual,automatic,onboot_] [**-S**] [ [**-T _**targetname_ **-p _**ip:port_ **-I _**iface_] [**-l**|**-u**|**-R**|**-s**] ] [
       [**-o _**operation_] [**-n _**name_] [**-v _**value_] [**-p _**ip:port_] ]

       **iscsiadm  -m  session  **[**-hV**]  [**-d  _**debug_level_]  [**-P  _**printlevel_] [**-r _**sessionid_|_sysfsdir_ [**-R**]
       [**-u**|**-s**|**-o _**new_] ]

       **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_]
       ]

       **iscsiadm -m fw **[**-d _**debug_level_] [**-l**] [**-W**] [**-n _**name_] [**-v _**value_]

       **iscsiadm -m host **[**-P _**printlevel_] [**-H _**hostno|MAC_] [ [**-C _**chap_ [**-x _**chap_tbl_idx_] ] | [**-C _**flashn‐_
       _ode_  [**-A  _**portal_type_]  [**-x  _**flashnode_idx_]  ]  | [**-C _**stats_] ] [ [**-o _**operation_] [**-n _**name_] [**-v**
       _value_] ]

### iscsiadm -k priority

## DESCRIPTION
       The iscsiadm utility is a command-line tool allowing discovery and login to iSCSI targets, as
       well as access and management of the open-iscsi database.

       Open-iscsi does not use the term _node_ as defined by the iSCSI RFC, where a node is  a  single
       iSCSI initiator or target. Open-iscsi uses the term _node_ to refer to a portal on a target.

       For  _session_  mode,  a session id (_sid_) is used. The _sid_ of a session can be found by running
       _iscsiadm_ _-m_ _session_ _-P_ _1_. The session id and sysfs path are not currently persistent  and  is
       partially determined by when the session is setup.

## NOTES
       Many  of the node and discovery operations require that the iSCSI daemon (iscsid) be running.
       If running on a system that uses systemd, the daemon may start up automatically, if  enabled,
       when needed.

       Open-iscsi  has  two  groups  of files it needs to store or get access to, while running: the
       **HOMEDIR **and the **DBROOT**. The following describes them:

### Home Directory
              The _home_ _directory_ for open-iscsi is /etc/iscsi. This is where it keeps it's  configu‐
              ration file (_iscsid.conf_) and it's initiator name file (_initiatorname.iscsi_).

### Database Root Directory
              The  _database_  _root_ _directory_ for open-iscsi is /etc/iscsi. This is where it keeps its
              flat database files, such as it's list of _node_s (see below).

## OPTIONS
### -a --ip=_
              _ipaddr_ can be IPv4 or IPv6.

              This option is only valid for _ping_ submode.

### -A --portal_type=_
              Specify the portal type for the new flash node entry to be created.

              This option is only valid for _flashnode_ submode of _host_ mode and only with _new_  opera‐
              tion.

### -b --packetsize=_
              Specify the ping _packetsize_.

              This option is only valid for _ping_ submode.

### -c --count=_
              _count_ specifies the number of ping iterations.

              This option is only valid for _ping_ submode.

### -C --submode=_
              Specify the submode for mode. _op_ must be name of submode.

              Currently iscsiadm supports _ping_ as a submode for _iface_. For example:

              iscsiadm -m iface -I ifacename -C ping -a ipaddr -b packetsize -c count -i interval

              For _host_, it supports _chap_, _flashnode_ and _stats_ as submodes. For example:

              iscsiadm -m host -H hostno -C chap -x chap_tbl_idx -o operation

              iscsiadm -m host -H hostno -C flashnode -x flashnode_idx -o operation

              iscsiadm -m host -H hostno -C stats

### -d --debug=_
              print debugging information. Valid values for _debug_level_ are 0 to 8.

### -h --help
              display help text and exit

### -H --host=_
              The _host_ argument specifies the SCSI host to use for the operation. It can be the scsi
              host  number  assigned to the host by the kernel's scsi layer, or the MAC address of a
              scsi host.

### -i --interval=_
              _interval_ specifies the delay between two ping iterations.

              This option is only valid for _ping_ submode.

### -I --interface=_
              The _interface_ argument specifies the iSCSI interface to use for the operation.   iSCSI
              interfaces (_iface_) are defined in /etc/iscsi/ifaces. For hardware iSCSI (e.g. qla4xxx)
              the  _iface_  configuration must have the hardware address (_iface.hwaddress_ = port's MAC
              address) and the driver/transport_name (_iface.transport_name_).  The  _iface_'s  name  is
              then the filename of the iface configuration. For software iSCSI, the iface configura‐
              tion  must  have either the hardware address (_iface.hwaddress_), or the network layer's
              interface name (_iface.net_ifacename_), and it must have the driver/transport_name.

              The available drivers/iscsi_transports are _tcp_  (software  iSCSI  over  TCP/IP),  _iser_
              (software  iSCSI  over  InfiniBand), _qla4xxx_ (Qlogic 4XXXX and 82XXX HBAs), _cxgb3i_ and
              _cxgb4i_ (Chelsio T3 and T4 adapters), _bnx2i_ (QLogic Netextreme II  adapters),  _be2iscsi_
              (Emulex 10G adapter), _qedi_ (QLogic QEDI 25/40/100Gb adapter), and _ocs_ (Emulex One Con‐
              nect  storage).   Some  of  these  are  considered experimental, as they are not fully
              tested.

              The _hwaddress_ is the MAC address or for software iSCSI it may be the special value _de‐_
              _fault_ which directs the initiator to not bind the session to a specific  hardware  re‐
              source  and  instead allow the network or InfiniBand layer to decide what to do. There
              is no need to create an iface configuration with the default behavior. If you  do  not
              specify an _iface_, then the default behavior is used.

              As  mentioned  above  there is a special iface name _default_. There are others which do
              not bind the session to a specific card, but instead bind the session  to  the  trans‐
              port: _iser_, _cxgb3i_, _cxgb4i_, and _bnx2i_.

              In _discovery_ mode multiple interfaces can be specified by passing in multiple _-I/--in‐_
              _terface_ instances. For example:

              **sh# **iscsiadm -m discoverydb -t st -p ip:port -I iface0 -I iface2 --discover

              Will direct iscsiadm to setup the node db to create records which will create sessions
              through the two interfaces passed in.

              In _node_ mode, only a single interface is supported in each call to iscsiadm.

              This option is valid for _discovery_, _node_ and _iface_ modes.

### -k --killiscsid=_
              Currently  _priority_ must be zero. This will immediately stop all iscsid operations and
              shutdown iscsid. It does not logout any sessions. Running this command is the same  as
              doing  _killall_ _iscsid_. Neither should normally be used, because if iscsid is doing er‐
              ror recovery or if there is an error while iscsid is not running, the system  may  not
              be able to recover.  This command and iscsid's SIGTERM handling are experimental.

### -D --discover
              Discover  targets using the discovery record with the _recid_ matching the the discovery
              type and portal passed in. If there is no matching record, it will  be  created  using
              the iscsid.conf discovery settings.  This must be passed in to _discoverydb_ mode to in‐
              struct iscsiadm to perform discovery.

              This option is only valid for _SendTargets_ discovery mode.

### -l --login
              For  _node_  and _fw_ modes, login to a specified record. For _discovery_ mode, login to all
              discovered targets.

              This option is only valid for _discovery_, _node_, and _fw_ modes.  For _fw_ mode  only,  _name_
              and  _value_  pairs  can  optionally be passed in, so that those values get used for the
              sessions created. In this case, no _op_ is needed, since _update_ is assumed.

### -L --loginall=_
              For _node_ mode, login to all sessions with the node or conn startup values passed in or
              all running session, except ones marked _onboot_, if _all_ is passed in.

              This option is only valid for _node_ mode (it is valid but not  functional  for  _session_
              mode).

### -W ---no_wait
              In  _node_,  _discovery_,  or _fw_ (firmware) mode, do not wait for a response from the tar‐
              get(s).  This means that success will be returned if the command is able to  send  the
              login requests, whether or not they succeed. In this case, it will be up to the caller
              to poll for success (i.e. session creation).

### -m --mode _
              specify  the  mode. _op_ must be one of _discovery_, _discoverydb_, _node_, _fw_, _host_, _iface_ or
              _session_.

              If no other options are specified: for _discovery_, _discoverydb_ and _node_  mode,  all  of
              their respective records are displayed; for _session_ mode, all active sessions and con‐
              nections  are displayed; for _fw_ mode, all boot firmware values are displayed; for _host_
              mode, all iSCSI hosts are displayed; and for  _iface_  mode,  all  interfaces  setup  in
              /etc/iscsi/ifaces are displayed.

### -n --name=_
              In  _node_  mode,  specify  a field _name_ in a record. In _flashnode_ submode of _host_ mode,
              specify name of the flash node parameter.

              For use with the _update_ operator.

### -o --op=_
              Specifies a database operator _op_. _op_ must be one of _new_, _delete_, _update_, _show_ or  _non‐_
              _persistent_.

              For _iface_ mode, _apply_ and _applyall_ are also applicable.

              For _flashnode_ submode of _host_ mode, _login_ and _logout_ are also applicable.

              This  option  is valid for all modes except _fw_. Delete should not be used on a running
              session. If it is iscsiadm will stop the session and then delete the record.

              An _op_ of _new_ creates a new database record for a given object. In _node_ mode, the _recid_
              is the target name and portal (IP:port). In _iface_ mode, the _recid_ is the  iface  name.
              In _discovery_ mode, the _recid_ is the portal and discovery type.

              In  _session_ mode, the _new_ operation logs in a new session using the same node database
              and iface information as the specified session.

              In _discovery_ mode, if the _recid_ and _new_ operation is passed in, but the _--discover_ ar‐
              gument is not passed in, then iscsiadm will only create a discovery  record  (it  will
              not  perform  discovery).  If the _--discover_ argument is passed in with the portal and
              discovery type, then iscsiadm will create the discovery record if needed, and it  will
              create  records  for  portals  returned  by  the target that do not yet have a node DB
              record.

              Setting _op_ to _delete_ deletes the specified _recid_. In _discovery_ mode,  if  iscsiadm  is
              performing discovery, it will delete records for portals that are no longer returned.

              Setting  _op_  to _update_ will update the _recid_ with _name_ to the specified _value_. In dis‐
              covery mode, if iscsiadm is performing discovery the _recid_, _name_ and  _value_  arguments
              are  not needed. The update operation will operate on the portals returned by the tar‐
              get, and will update the node records with information from the configuration file and
              command line.

              The _op_ value of _show_ is the default behaviour for _node_, _discovery_ and _iface_  mode.  It
              is  also used when there are no commands passed into _session_ mode and a running _sid_ is
              passed in.  If _name_ and _value_ are passed in, they are currently ignored in _show_ mode.

              An _op_ value of _nonpersistent_ instructs iscsiadm to not manipulate the node DB.

              An _op_ value of _apply_ will cause the network settings to take effect on  the  specified
              iface.

              An  _op_  value  of  _applyall_  will cause the network settings to take effect on all the
              ifaces whose MAC address or host number matches that of the specific host.

              An _op_ value of _login_ will log into the specified flash node entry.

              An _op_ value of _logout_ does the logout from the given flash node entry.

### -p --portal=_
              Use target portal with IP address _ip_ and port _port_. If _port_ _is_ _not_ _passed_ _in_  _the_  _de‐_
              _fault_ _value_ _of_ _3260_ _is_ _used._

              IPv6 addresses can be specified as _[ddd.ddd.ddd.ddd]:port_ _or_ _ddd.ddd.ddd.ddd_.

              Hostnames can also be used for the _ip_ _argument._

              This option is only valid for _discovery_, or for _node_ operations with the _new_ operator.

              This  should  be used along with _--target_ in _node_ mode, to specify what the open-iscsi
              documents refer to as a node or node record. Note: open-iscsi's use of the word  node,
              does not match the iSCSI RFC's iSCSI Node term.

### -P --print=_
              If  in _node_ mode print nodes in tree format. If in _session_ mode print sessions in tree
              format. If in _discovery_ mode print the nodes in tree format.

### -T --targetname=_
              Use target _targetname_.

              This should be used along with _--portal_ in _node_ mode, to specify what  the  open-iscsi
              documents  refer to as a node or node record. Note: open-iscsi's use of the word node,
              does not match the iSCSI RFC's iSCSI Node term.

### -r --sid=_
              Use session ID _sid_. The session ID of a session can be found from running iscsiadm  in
              session mode with the _--info_ argument.

              Instead of a session ID, a sysfs path containing the session can be used.  For example
              using  one of the following: /sys/devices/platform/hostH/sessionS/targetH:B:I/H:B:I:L,
              /sys/devices/platform/hostH/sessionS/targetH:B:I, or  /sys/devices/platform/hostH/ses‐
              sionS,  for  the _sysfsdir_ argument would result in the session with session ID _S_ to be
              used.

              _sid_ _|_ _sysfsdir_ is only required for _session_ mode.

### -R --rescan
              In _session_ mode, if _sid_ is also passed in, rescan the session.  If  no  _sid_  has  been
              passed in rescan all running sessions.

              In  _node_ mode, rescan a session running through the target, portal, iface tuple passed
              in.

### -s --stats
              Display session statistics.  This option when used with _host_ mode, displays host  sta‐
              tistics.

### -S --show
              When  displaying  records,  do  not hide masked values, such as the CHAP secret (pass‐
              word).

              This option is only valid for _node_ and _session_ mode.

### -t --type=_
              _type_ must be _sendtargets_ (or abbreviated as _st_), _isns_ (if enabled),  or  _fw_.  See  the
              **DISCOVERY TYPES **section.

              This option is only valid for _discovery_ mode.

### -u --logout
              Logout for the specified record.

              This option is only valid for _node_ and _session_ mode.

### -U --logoutall=_
              Logout  of  all sessions with the node or conn startup values passed in or all running
              sessions, except ones marked _onboot_, if _all_ is passed in.

              This option is only valid for _node_ mode (it is valid but not  functional  for  _session_
              mode).

### -v --value=_
              Specify a _value_ for use with the _update_ operator, or for firmware login mode.

              This option is only valid for _node_ mode and _flashnode_ submode of _host_ mode.

### -V --version
              Display version and exit.

### -x --index=_
              Specify the _index_ of the entity to operate on.

              This option is only valid for _chap_ and _flashnode_ submodes of _host_ mode.

## DISCOVERY TYPES
       iSCSI  defines  3  discovery types: _SendTargets_, _SLP_, and _iSNS_.  _SLP_ is not widely supported,
       and not supported by this pacakge.  SNS supported depends on build options, but is enabled by
       default.

       A special discovery type called _fw_ (for firmware) is also supported, for discovering firmware
       interfaces, and populating the interface database in the process.

### SendTargets
              A native iSCSI protocol which allows each iSCSI target to send  a  list  of  available
              targets to the initiator.

       **iSNS   **iSNS  (Internet Storage Name Service) records information about storage volumes within
              a larger network. To utilize iSNS, pass the address and optionally  the  port  of  the
              iSNS server to do discovery to.

       **fw     **Firmware  mode.   Several NICs and systems contain a mini iSCSI initiator which can be
              used for boot. To get the values used for boot the _fw_ option can be  used.   Doing  _fw_
              discovery  does  not store persistent records in the node or discovery DB, because the
              values are stored in the system's or NIC's resource.

              Performing _fw_ discovery will print the portals, like with other discovery methods.  To
              see  other  settings  like  CHAP values and initiator settings, like you would in _node_
              mode, run _iscsiadm_ _-m_ _fw_.

## EXIT STATUS
       On success 0 is returned. On error one of the return codes below will be returned.

       Commands that operate on multiple objects (sessions, records, etc), iscsiadm/iscsistart  will
       return  the first error that is encountered.  iscsiadm/iscsistart will attempt to execute the
       operation on the objects it can. If no objects are found ISCSI_ERR_NO_OBJS_FOUND is returned.

       **0      **ISCSI_SUCCESS - command executed successfully.

       **1      **ISCSI_ERR - generic error code.

       **2      **ISCSI_ERR_SESS_NOT_FOUND - session could not be found.

       **3      **ISCSI_ERR_NOMEM - could not allocate resource for operation.

       **4      **ISCSI_ERR_TRANS - connect problem caused operation to fail.

       **5      **ISCSI_ERR_LOGIN - generic iSCSI login failure.

       **6      **ISCSI_ERR_IDBM - error accessing/managing iSCSI DB.

       **7      **ISCSI_ERR_INVAL - invalid argument.

       **8      **ISCSI_ERR_TRANS_TIMEOUT - connection timer expired while trying to connect.

       **9      **ISCSI_ERR_INTERNAL - generic internal iscsid/kernel failure.

       **10     **ISCSI_ERR_LOGOUT - iSCSI logout failed.

       **11     **ISCSI_ERR_PDU_TIMEOUT - iSCSI PDU timed out.

       **12     **ISCSI_ERR_TRANS_NOT_FOUND - iSCSI transport module not loaded in kernel or iscsid.

       **13     **ISCSI_ERR_ACCESS - did not have proper OS permissions to access iscsid or execute isc‐
              siadm command.

       **14     **ISCSI_ERR_TRANS_CAPS - transport module did not support operation.

       **15     **ISCSI_ERR_SESS_EXISTS - session is logged in.

       **16     **ISCSI_ERR_INVALID_MGMT_REQ - invalid IPC MGMT request.

       **17     **ISCSI_ERR_ISNS_UNAVAILABLE - iSNS service is not supported.

       **18     **ISCSI_ERR_ISCSID_COMM_ERR - a read/write to iscsid failed.

       **19     **ISCSI_ERR_FATAL_LOGIN - fatal iSCSI login error.

       **20     **ISCSI_ERR_ISCSID_NOTCONN - could not connect to iscsid.

       **21     **ISCSI_ERR_NO_OBJS_FOUND - no records/targets/sessions/portals found to execute  opera‐
              tion on.

       **22     **ISCSI_ERR_SYSFS_LOOKUP - could not lookup object in sysfs.

       **23     **ISCSI_ERR_HOST_NOT_FOUND - could not lookup host.

       **24     **ISCSI_ERR_LOGIN_AUTH_FAILED - login failed due to authorization failure.

       **25     **ISCSI_ERR_ISNS_QUERY - iSNS query failure.

       **26     **ISCSI_ERR_ISNS_REG_FAILED - iSNS registration/deregistration failed.

       **27     **ISCSI_ERR_OP_NOT_SUPP - operation not support

       **28     **ISCSI_ERR_BUSY - device or resource in use

       **29     **ISCSI_ERR_AGAIN - operation failed, but retrying later may succeed

       **30     **ISCSI_ERR_UNKNOWN_DISCOVERY_TYPE - unknown discovery type

       **31     **ISCSI_ERR_CHILD_TERMINATED - child process terminated

       **32     **ISCSI_ERR_SESSION_NOT_CONNECTED - session likely not connected

## EXAMPLES
       Discover targets at a given IP address:

              **sh# **iscsiadm --mode discoverydb --type sendtargets --portal 192.168.1.10 --discover

       Login, must use a node record id found by the discovery:

              **sh#    **iscsiadm    --mode    node   --targetname   iqn.2001-05.com.doe:test   --portal
              192.168.1.1:3260 --login

       Logout:

              **sh#   **iscsiadm   --mode   node    --targetname    iqn.2001-05.com.doe:test    --portal
              192.168.1.1:3260 --logout

       List node records:

              **sh# **iscsiadm --mode node

       Display all data for a given node record:

              **sh#    **iscsiadm    --mode    node   --targetname   iqn.2001-05.com.doe:test   --portal
              192.168.1.1:3260

       List all sessions:

              **sh# **iscsiadm --mode session

       List all sessions in tree format:

              **sh# **iscsiadm --mode session  --print

## FILES
       /etc/iscsi/iscsid.conf
              The configuration file read by **iscsid **and **iscsiadm **on startup.

       /etc/iscsi/initiatorname.iscsi
              The file containing the iSCSI InitiatorName and InitiatorAlias read by **iscsid **and **isc‐**
              **siadm **on startup.

       /etc/iscsi/nodes/
              This directory contains the nodes with their targets.

       /etc/iscsi/send_targets
              This directory contains the portals.

## SEE ALSO
       [**iscsid**(8)](https://www.chedong.com/phpMan.php/man/iscsid/8/markdown)

## AUTHORS
       Open-iSCSI project <<http://www.open-iscsi.com/>>
       Alex Aizman <<itn780@yahoo.com>>
       Dmitry Yusupov <<dmitry_yus@yahoo.com>>

                                              Mar 2022                                   [_ISCSIADM_(8)](https://www.chedong.com/phpMan.php/man/ISCSIADM/8/markdown)
