Back To Basics

Linux – Configure iSCSI Initiator

This blog is not to explain what is iSCSI but rather a reference to steps which an administrator should follow for configuring iSCSI on their Linux host (CentOS in my case)


  1. Make sure Linux host has IP connectivity to storage appliance which is acting as iSCSI target
  2. Storage appliance has iSCSI configured and service is running


Install iSCSI initiator on Linux host. Below is the example

# yum install iscsi-initiator-utils
Loaded plugins: ulninfo
Resolving Dependencies
--> Running transaction check
---> Package iscsi-initiator-utils.x86_64 0: will be installed
--> Processing Dependency: iscsi-initiator-utils-iscsiuio >= for package: iscsi-initiator-utils-
--> Running transaction check
---> Package iscsi-initiator-utils-iscsiuio.x86_64 0: will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                                          Arch                     Version                                  Repository                    Size
 iscsi-initiator-utils                            x86_64                              ol7_latest                   428 k
Installing for dependencies:
 iscsi-initiator-utils-iscsiuio                   x86_64                              ol7_latest                    93 k

Transaction Summary
Install  1 Package (+1 Dependent package)

Total download size: 521 k
Installed size: 2.6 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): iscsi-initiator-utils-                                                                    | 428 kB  00:00:00
(2/2): iscsi-initiator-utils-iscsiuio-                                                           |  93 kB  00:00:00
Total                                                                                                                  1.1 MB/s | 521 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : iscsi-initiator-utils-iscsiuio-                                                                          1/2
  Installing : iscsi-initiator-utils-                                                                                   2/2
  Verifying  : iscsi-initiator-utils-                                                                                   1/2
  Verifying  : iscsi-initiator-utils-iscsiuio-                                                                          2/2

  iscsi-initiator-utils.x86_64 0:

Dependency Installed:
  iscsi-initiator-utils-iscsiuio.x86_64 0:


Once iSCSI package is installed then edit the iSCSI configuration file and enable node.startup = automatic. You will need to find node.startup in the config file and remove the # from start of the line. This will make sure that iSCSI is logging to target automatically on startup

vi /etc/iscsi/iscsid.conf

node.startup = automatic

Now configure the iSCSI service to start automatically. Run below command

# systemctl enable iscsid
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/iscsid.service.

Start iSCSI service

# systemctl start iscsid

Now at this point you’ve iSCSI enabled on your Linux server. If you want to view iSCSI initiator name of your server then run below command. Note that in most cases iSCSI initiator name will reflect into logged in initiators on your storage appliance in some cases you’ll need to provide the initiator name.

# cat /etc/iscsi/initiatorname.iscsi

Now let’s discover iSCSI target nodes using your storage system iSCSI IP address.

# iscsiadm -m discovery -t st -p,2,1

You can run below commands to list discovered iSCSI nodes

# iscsiadm -m node,2,1


# ls /var/lib/iscsi/send_targets,3260

# ls /var/lib/iscsi/nodes

Once iSCSI nodes are discovered you can run below command to login into iSCSI target

# iscsiadm -m node --targetname "" --portal "" --login
Logging in to [iface: default, target:, portal:,3260] (multiple)
Login to [iface: default, target:, portal:,3260] successful.

# iscsiadm -m node --targetname "" --portal "" --login
Logging in to [iface: default, target:, portal:,3260] (multiple)
Login to [iface: default, target:, portal:,3260] successful.

At this stage you’ve Linux host configured as iSCSI initiator and logged in successfully to target storage. Now you can ask storage admin to create LUNs and assign to Linux host.

Once LUNs are assigned to Linux host you can run below command to scan new devices

# iscsiadm -m session --rescan
Rescanning session [sid: 1, target:, portal:,3260]
Rescanning session [sid: 2, target:, portal:,3260]

You can view new devices using fdisk -l or multipath -l command

Categories: Back To Basics

Tagged as: , ,

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s