ISCSIADM(8)
π iscsiadm(8) β open-iscsi administration utility π«Ά
okay so this is the iscsiadm(8) page from the Linux Administrator's Manual, and itβs literally the open-iscsi administration utility. If youβre doing iSCSI discovery, login, or touching the open-iscsi database, this is your girl. β¨
β¨ NAME β¨
iscsiadm β open-iscsi administration utility. no cap, thatβs the whole name. π
π¦ SYNOPSIS π¦
Hereβs the whole synopsis energy, copied exactly so you can trust it:
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 flashnode [-A portal_type] [-x flashnode_idx] ] |
[-C stats] ] [ [-o operation] [-n name] [-v value] ]
iscsiadm -k priority
π DESCRIPTION π
okay so the iscsiadm utility is a command-line tool that lets you do discovery and login to iSCSI targets, plus access and manage the open-iscsi database. π
Important vibe check: open-iscsi does not use the term node the way the iSCSI RFC does. In the RFC, a node is a single iSCSI initiator or target. Open-iscsi uses node to mean a portal on a target. yes bestie, terminology slay. πΈ
For session mode, a session id (sid) is used. You can find the sid of a session by running iscsiadm -m session -P 1. The session id and sysfs path are not currently persistent and are partially determined by when the session is setup. okay thatβs the tea. π
π NOTES π
Many of the node and discovery operations require that the iSCSI daemon (iscsid) be running. If youβre 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. Hereβs the breakdown:
π Home Directory π
The home directory for open-iscsi is /etc/iscsi. This is where it keeps its configuration file (iscsid.conf) and its initiator name file (initiatorname.iscsi). literally the home base. π
ποΈ Database Root Directory ποΈ
The database root directory for open-iscsi is /var/lib/iscsi. This is where it keeps its flat database files, such as its list of nodes (see below). π
π₯ OPTIONS π₯
-a,--ip=ipaddrβipaddrcan be IPv4 or IPv6. This option is only valid for ping submode. π«Ά-A,--portal_type=[ipv4|ipv6]β Specify the portal type for the new flash node entry to be created. This option is only valid forflashnodesubmode ofhostmode and only withnewoperation. β¨-b,--packetsize=packetsizeβ Specify the ping packetsize. This option is only valid for ping submode. π¦-c,--count=countβcountspecifies the number of ping iterations. This option is only valid for ping submode. π-C,--submode=opβ Specify the submode formode.opmust be name of submode. Currentlyiscsiadmsupportspingas a submode foriface. 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=debug_levelβ print debugging information. Valid values fordebug_levelare0to8. π-h,--helpβ display help text and exit. bestie behavior honestly. π«‘-H,--host=[hostno|MAC]β Thehostargument 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βintervalspecifies the delay between two ping iterations. This option is only valid for ping submode. β³-I,--interface=[iface]β The interface argument specifies the iSCSI interface to use for the operation. iSCSI interfaces (iface) are defined in/var/lib/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 configuration 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/IPiserβ software iSCSI over InfiniBandqla4xxxβ Qlogic 4XXXX and 82XXX HBAscxgb3iandcxgb4iβ Chelsio T3 and T4 adaptersbnx2iβ QLogic Netextreme II adaptersbe2iscsiβ Emulex 10G adapterqediβ QLogic QEDI 25/40/100Gb adapterocsβ Emulex One Connect 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 default which directs the initiator to not bind the session to a specific hardware resource 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 transport: iser, cxgb3i, cxgb4i, and bnx2i.
In discovery mode multiple interfaces can be specified by passing in multiple -I/--interface 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=[priority]β Currentlyprioritymust 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 doingkillall iscsid. Neither should normally be used, because if iscsid is doing error recovery or if there is an error while iscsid is not running, the system may not be able to recover. This command and iscsidβsSIGTERMhandling 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 theiscsid.confdiscovery settings. This must be passed in todiscoverydbmode to instructiscsiadmto perform discovery. This option is only valid for SendTargets discovery mode. π-l,--loginβ Fornodeandfwmodes, login to a specified record. For discovery mode, login to all discovered targets. This option is only valid fordiscovery,node, andfwmodes. Forfwmode only, name and value pairs can optionally be passed in, so that those values get used for the sessions created. In this case, noopis needed, since update is assumed. πͺβ¨-L,--loginall=[all|manual|automatic|onboot]β For node mode, login to all sessions with the node or conn startup values passed in or all running session, except ones markedonboot, ifallis passed in. This option is only valid for node mode (it is valid but not functional for session mode). π-W,---no_waitβ Innode,discovery, orfw(firmware) mode, do not wait for a response from the target(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 opβ specify the mode.opmust be one ofdiscovery,discoverydb,node,fw,host,ifaceorsession. If no other options are specified: fordiscovery,discoverydbandnodemode, all of their respective records are displayed; forsessionmode, all active sessions and connections are displayed; forfwmode, all boot firmware values are displayed; forhostmode, all iSCSI hosts are displayed; and forifacemode, all interfaces setup in/var/lib/iscsi/ifacesare displayed. ποΈ-n,--name=nameβ In node mode, specify a field name in a record. Inflashnodesubmode ofhostmode, specify name of the flash node parameter. For use with the update operator. π·οΈ-o,--op=opβ Specifies a database operatorop.opmust be one ofnew,delete,update,showornonpersistent. Forifacemode,applyandapplyallare also applicable. Forflashnodesubmode ofhostmode,loginandlogoutare also applicable. This option is valid for all modes exceptfw.Deleteshould not be used on a running session. If it isiscsiadmwill stop the session and then delete the record. An op ofnewcreates a new database record for a given object. In node mode, the recid is the target name and portal (IP:port). Inifacemode, the recid is the iface name. In discovery mode, the recid is the portal and discovery type. In session mode, thenewoperation logs in a new session using the same node database and iface information as the specified session. In discovery mode, if the recid andnewoperation is passed in, but the--discoverargument is not passed in, theniscsiadmwill only create a discovery record (it will not perform discovery). If the--discoverargument is passed in with the portal and discovery type, theniscsiadmwill 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 doing discovery, it deletes records for portals that are no longer returned. π
Setting op to update updates 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 just operates on the portals returned by the target, and updates the node records with info from the config file and command line. β¨
The op value of show is the default behaviour for node, discovery and iface mode. It's also what gets used when no commands are 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 (yeah, iykyk, it just do be like that π).
An op value of nonpersistent tells iscsiadm to not touch the node DB.
An op value of apply makes the network settings actually take effect on the specified iface. π«Ά
An op value of applyall makes the network settings take effect on all the ifaces whose MAC address or host number matches that of the specific host.
An op value of login logs into the specified flash node entry.
An op value of logout does the logout from the given flash node entry.
-p,--portal=ip[:port]β use target portal with IP address ip and port port. No port? Default3260steps in, no cap. IPv6 addresses can be written as[ddd.ddd.ddd.ddd]:portorddd.ddd.ddd.ddd. Hostnames work for the ip argument too. This option is only valid for discovery, or for node operations with thenewoperator. Use it alongside--targetin node mode to specify what the open-iscsi docs call a node or node record. β οΈ Note: open-iscsi's use of the word node does not match the iSCSI RFC's iSCSI Node term β don't get it twisted bestie.-P,--print=printlevelβ if you're in node mode, print nodes in tree format π³. In session mode, print sessions in tree format. In discovery mode, print the nodes in tree format. Tree format everywhere, honestly iconic.-T,--targetname=targetnameβ use target targetname. Use this alongside--portalin node mode to specify what the open-iscsi docs call a node or node record. β οΈ Again: open-iscsi's node β the iSCSI RFC's iSCSI Node term.-r,--sid=sid | sysfsdirβ use session ID sid. You can find a session's ID by runningiscsiadmin session mode. Instead of a session ID you can hand over a sysfs path containing the session β for example using one of these as the sysfsdir argument:
/sys/devices/platform/hostH/sessionS/targetH:B:I/H:B:I:L
/sys/devices/platform/hostH/sessionS/targetH:B:I
/sys/devices/platform/hostH/sessionS
would result in the session with session ID S being used. sid | sysfsdir is only required for session mode.
-R,--rescanβ in session mode, ifsidis also passed in, rescan that session. Nosid? It rescans all running sessions π. In node mode, it rescans a session running through thetarget,portal,ifacetuple you passed in.-s,--statsβ display session statistics. Used with host mode, it displays host statistics instead. π-S,--showβ when displaying records, don't hide masked values like the CHAP secret (password). π Only valid for node and session mode.-t,--type=typeβ type must besendtargets(or the abbreviationst),isns(if enabled), orfw. See the DISCOVERY TYPES section. Only valid for discovery mode.-u,--logoutβ logout for the specified record. Only valid for node and session mode.-U,--logoutall=[all,manual,automatic|onboot]β logout of all sessions with the node or conn startup values passed in, or all running sessions β except the ones markedonboot, ifallis passed in. Only valid for node mode (it's valid but not functional for session mode, so likeβ¦ don't π).-v,--value=valueβ specify a value for use with theupdateoperator, or for firmware login mode. Only valid for node mode and theflashnodesubmode of host mode.-V,--versionβ display version and exit. Short and sweet, we stan.-x,--index=indexβ specify the index of the entity to operate on. Only valid for thechapandflashnodesubmodes of host mode.
π¦ DISCOVERY TYPES π¦
iSCSI defines 3 discovery types: SendTargets, SLP, and iSNS. SLP is not widely supported, and isn't supported by this package (rip, not invited to the party π). iSNS support depends on build options, but it's enabled by default. β¨
There's also a special discovery type called fw (for firmware), which discovers firmware interfaces and populates the interface database in the process. Main character energy.
SendTargets
A native iSCSI protocol which lets each iSCSI target 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 use 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 that 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 live in the system's or NIC's resource. π₯
Performing fw discovery prints the portals, just 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 is returned.
Commands that operate on multiple objects (sessions, records, etc): iscsiadm/iscsistart returns the first error it encounters. 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. slay!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 internaliscsid/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 oriscsid.13βISCSI_ERR_ACCESSβ did not have proper OS permissions to accessiscsidor execute theiscsiadmcommand.14βISCSI_ERR_TRANS_CAPSβ transport module did not support the 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 toiscsidfailed.19βISCSI_ERR_FATAL_LOGINβ fatal iSCSI login error.20βISCSI_ERR_ISCSID_NOTCONNβ could not connect toiscsid.21βISCSI_ERR_NO_OBJS_FOUNDβ no records/targets/sessions/portals found to execute operation 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 support28βISCSI_ERR_BUSYβ device or resource in use29βISCSI_ERR_AGAINβ operation failed, but retrying later may succeed30βISCSI_ERR_UNKNOWN_DISCOVERY_TYPEβ unknown discovery type31βISCSI_ERR_CHILD_TERMINATEDβ child process terminated32β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 β you 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 byiscsidandiscsiadmon startup./etc/iscsi/initiatorname.iscsiβ the file containing the iSCSIInitiatorNameandInitiatorAlias, read byiscsidandiscsiadmon startup./var/lib/iscsi/nodes/β this directory contains the nodes with their targets./var/lib/iscsi/send_targetsβ this directory contains the portals.
π SEE ALSO π
π AUTHORS π
- Open-iSCSI project
<http://www.open-iscsi.com/> - Alex Aizman
<itn780@yahoo.com> - Dmitry Yusupov
<dmitry_yus@yahoo.com>
And that's the whole page bestie, you ate it up π
β¨ This little masterpiece is the ISCSIADM(8) man page, dated Mar 2022 β go forth and discover targets, and remember: not all nodes are iSCSI Nodes ππ¦π
π¦ where this page comes from
- alpine 3.24: open-iscsi-doc 2.1.12-r0 Β· GPL-2.0-only
- arch rolling: open-iscsi 2.1.13-1 Β· GPL
- opensuse-leap 16.0: open-iscsi 2.1.12-160000.4.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: open-iscsi 2.1.12-160000.4.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: open-iscsi 2.1.12-160000.4.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: open-iscsi 2.1.12-160000.4.1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms