# phpman > man > iscsiadm(8)

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

       **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.

       Note that many of the node and discovery operations require that the iSCSI daemon (iscsid) be
       running.

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

              This option is only valid for ping submode.

### -A --portal
              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_ specify 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 support ping as 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_ specify 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 (qla4xxx) the
              iface config 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 file‐
              name of the iface config. For software iSCSI, the iface config 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 config 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 intefaces 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 mode.

### -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 _discoverydb_ mode to in‐
              struct iscsiadm to perform discovery.

              This option is only valid for SendTargets discovery mode.

### -l --login
              For node and fw mode, login to a specified record. For discovery mode,  login  to  all
              discovered targets.

              This option is only valid for discovery and node modes.

### -L --loginall=
              For  node  mode,  login 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
              In  node,  discovery,  or  firmware mode, do not wait for a response from the targets.
              This means that success will be returned if the command is able to send the login  re‐
              quests, 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_, all of their
              respective records are displayed; for _session_, all active sessions and connections are
              displayed;  for  _fw_, all boot firmware values are displayed; for _host_, all iSCSI hosts
              are displayed; and for _iface_, all ifaces 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.

              _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  dis‐
              covery 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, 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.

              _delete_ deletes a specified _recid_. In discovery mode, if iscsiadm is performing discov‐
              ery it will delete records for portals that are no longer returned.

              _update_  will  update the _recid_ with _name_ to the specified _value_. In discovery 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 target, and will up‐
              date the node records with info from the config file and command line.

              _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.  _name_
              and _value_ are currently ignored when used with _show_.

              _nonpersistent_ instructs iscsiadm to not manipulate the node DB.

              _apply_ will cause the network settings to take effect on the specified iface.

              _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.

              _login_ will log into the specified flash node entry.

              _logout_ does the logout from the given flash node entry.

### -p --portal=
              Use  target  portal  with ip-address _ip_ and _port_. If port is not passed in the default
              _port_ value is 3260.

              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
              docs  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
              docs 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 sid of a session can be found from running iscsiadm in session
              mode with the --info argument.

              Instead of sid, 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 sid 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_), _slp_, _isns_ or _fw_. Currently only send‐
              targets, fw, and iSNS is supported, see the DISCOVERY TYPES section.

              This option is only valid for discovery mode.

### -u --logout
              logout for a specified record.

              This option is only valid for node and session mode.

### -U --logoutall=
              logout all sessions with the node or conn startup values passed in or all running ses‐
              sion, 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.

              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.

       A special discovery type called  _fw_  (for  firmware)  is  also  supported,  for  discoverying
       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.

       **SLP**    Optionally an iSCSI target can use the Service Location Protocol (SLP) to announce the
              available  targets. The initiator can either implement SLP queries directly or can use
              a separate tool to acquire the information about available targets.

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

       Note that the SLP implementation is under development and currently is not supported.

## 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 exired 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 timedout.

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

## 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>>



                                              Nov 2020                                   [ISCSIADM(8)](https://www.chedong.com/phpMan.php/man/ISCSIADM/8/markdown)
