From ArchWiki
(Redirected from ISCSI Initiator)
Jump to navigation Jump to search

This article describes how to access an iSCSI target with the Open-iSCSI initiator.


Install the open-iscsi package from the official repositories.

Note: An older initiator, Linux-iSCSI, was merged with Open-iSCSI in April 2005. This should not be confused with, the website for the LIO target.


The following diagram shows how the Components work together. A more detailed version can be found here: Open-iSCSI modules (Outdated)

 | Targets & Sessions configuration files and directories |             
 +--------------------------+     +----------------------------------+ 
 | iscsiadm                 |     | iscsid: iSCSI daemon             | 
 |                          |     |                                  | 
 |  * Command line tool     |<--->|  * Implements Session management | 
 |  * Manages database of   |     |  * Communicates with iscsiadm    | 
 |    sessions and targets  |     |    and iscsi kernel modules      | 
 +--------------------------+     +---------------+------------------+ 
 User space                                       |                    
- - - - - - - - - - - - - - - - - - - - - - - - - | - - - - - - - - - -
 Kernel                                           v                    
         | kernel modules: scsi_transport_iscsi, iscsi_tcp, libiscsi | 

From the Open-iSCSI README:

Persistent configuration is implemented as a tree of files and directories, which are contained in two directories:

  • Discovery table (/etc/iscsi/send_targets) which has directories named after target addresses.
  • Node table (/etc/iscsi/nodes) which has directories named after IQN (ISCSI Unique Name) of particular device.


Start the Service

iscsid is managed by a systemd Unit.

Start iscsid.service or iscsid.socket.

If the SCSI target requires authentication by the initiator, the configuration file /etc/iscsi/iscsid.conf may need to be updated.

The following parameters are used for authenticating a login session of an initiator to a target and for the target to establish a session back to the initiator

node.session.auth.authmethod = CHAP
node.session.auth.username = <username in target>
node.session.auth.password = <password in target>
node.session.auth.username_in = <username in initiator>
node.session.auth.password_in = <password in initiator>

The following parameters are used for authenticating a discovery session of an initiator to a target and for the target to establish a session back to the initiator.

discovery.sendtargets.auth.authmethod = CHAP
discovery.sendtargets.auth.username = <username in target>
discovery.sendtargets.auth.password = <password in target>
discovery.sendtargets.auth.username_in = <username in initiator>
discovery.sendtargets.auth.password_in = <password in initiator>
Warning: No two passwords may be the same. This means that you need four unique passwords in the configuration above.

Target discovery

# iscsiadm -m discovery -t sendtargets -p <portalip>

Delete obsolete targets

# iscsiadm -m discovery -p <portalip> -o delete

Login to available targets

# iscsiadm -m node -L all

or login to specific target

# iscsiadm -m node --targetname=<targetname> --login


# iscsiadm -m node -U all


For running session

# iscsiadm -m session -P 3

The last line of the above command will show the name of the attached dev e.g

Attached scsi disk sdd State: running

For the known nodes

# iscsiadm -m node

Online resize of volumes

If the iscsi blockdevice contains a partitiontable, you will not be able to do an online resize. In this case you have to unmount the filesystem and alter the size of the affected partition.

  1. Rescan active nodes in current session
    # iscsiadm -m node -R
  2. If you use multipath, you also have to rescan multipath volume information.
    # multipathd -k"resize map sdx"
  3. Finally resize the filesystem.
    # resize2fs /dev/sdx

Tips & Troubleshooting

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Nonstandard section, see Help:Style#Standard sections. Create proper #Tips and tricks and #Troubleshooting sections and place each issue in a separate subsection. (Discuss in Talk:Open-iSCSI#)

You can also check where the attached iSCSI devices are located in the /dev tree with ls -lh /dev/disk/by-path/* .

At the server (target) you might need to include the client iqn from /etc/iscsi/initiatorname.iscsi in the acl configuration.

Many of the iscsiadm operations require that the iSCSI daemon iscsid is running. To verify that this is the case, check the status of the iscsid.service.

To run the iSCSI daemon in debug mode (make sure you stopped iscsid.service before)

# iscsid -d 8 -c /etc/iscsi/iscsid.conf -i /etc/iscsi/initiatorname.iscsi -f