In environments where shared block storage is needed but Fibre Channel infrastructure isn’t available, iSCSI offers a flexible, Ethernet-based alternative. On CentOS/RHEL 7, you use the open-iscsi suite to turn your server into an iSCSI initiator (client), allowing it to discover remote targets, establish sessions, and mount LUNs just like locally attached disks.

In this article’s introduction you’ll find:

  • A brief overview of iSCSI and its role in IP-based storage

  • Key components: initiators (clients) and targets (storage providers)

    1. Installing the iscsi-initiator-utils package

    2. Discovering available targets on your network

    3. Logging in and automatically mounting LUNs at boot

    4. Gracefully logging out and cleaning up when you no longer need a target

      The high-level steps to configure an initiator on CentOS/RHEL 7:

       

By the end, you’ll understand how to integrate remote block devices into your system’s storage stack—enabling seamless, persistent access over standard IP networks.

 

Installation

 

To use RHEL/CentOS 7 system as an iSCSI initiator or client, you must have iscsi-initiator-utils package installed. You can verify that this is installed on your system using the rpm command, as shown in the following example:

$ rpm -qa | grep iscsi-initiator-utils

 

If the package is not installed on your system, install it using yum.

# yum install iscsi-initiator-utils

 

Configuration

 

1. Discover

In Red Hat Enterprise Linux 7, the iSCSI service is lazily started by default. If root is not on an iSCSI device or there are no nodes marked with “node.startup = automatic” then the iSCSI service will not start until an iscsiadm command is run that requires iscsid or the iscsi kernel modules to be started. For example, running the discovery command:

# iscsiadm -m discovery -t st -p ip:port

 

For Example, Obtain a listing of available targets from a given host (please note that ipaddress listed below must be replaced with the resolvable hostname or ip address of the system providing the port if different than default):

# iscsiadm -m discovery -t st -p [target_ipaddress]
xxx.xxx.xxx.xxx:3260,1 iqn.2010-03.com.example:tgtd

Here,

iqn.2010-03.com.example:tgtd – is the target iqn name

xxx.xxx.xxx.xxx – is the IP address of the target (mentioning port is optional if it is running on the default port 3260)

 

2. Login

The following command will login to the discovered target.

# iscsiadm -m node -T target_iqn_name -p ipaddress -l
Logging in to [iface: default, target: iqn.2010-03.com.example:tgtd, portal: xxx.xxx.xxx.xxx,3260]
Login to [iface: default, target: iqn.2010-03.com.example:tgtd, portal: xxx.xxx.xxx.xxx,3260]: successful

 

You can also log into all the LUNs exported on the target by running:

# iscsiadm -m discovery -t st -l

 

This procedure will enable the target(or targets if you logged into all) to be accessed upon reboot. The information is stored in the node database found in /var/lib/iscsi.

 

To disconnect from iSCSI storage

 

1. Logout

If you want to disable the target, you need log out by:

# iscsiadm -m node -T target_iqn_name -p ipaddress -u

 

2. Delete the Target

To remove the target from the iscsi database so that the iscsi does not reconnect upon reboot, delete the target after logging out of it:

# iscsiadm -m node -T target_iqn_name -p ip address --op delete

 

Note, you can log out of all targets by running:

# iscsiadm -m node -U all

 

How to delete an iSCSI Target on the initiator (iSCSI client)?

Was this answer helpful? 0 Users Found This Useful (0 Votes)