Configure iSCSI Initiator (client) in CentOS / RHEL 6

To use RHEL/CentOS 6 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

Install the package if its not already available on your system using yum.

# yum install iscsi-initiator-utils

Start the iscsi demaon and use chkconfig to enable it to start after reboot as well.

# service iscsi start
# chkconfig iscsi on

Once you have installed the required package and started the service you can start discovering the available targets. To 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,1

Here, – is the target_iqn_name.

You can view more information on the target using the below command.

# iscsiadm -m node -T [target_iqn_name] -p [target_ipaddress]

The next step is to login to the discovered target.

# iscsiadm -m node -T -p -l
Logging in to [iface: default, target:, portal:,3260]
Login to [iface: default, target:, portal:,3260]: successful

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

# iscsiadm -m discovery -t st -l

The iscsi initiator has it’s own database to save the target/node information and configuration. This is located in “/var/lib/iscsi” directory.

You can view the newly attached iSCSI storage using fdisk command.

# fdisk -l

To disconnect an existing iSCSI storage, you will have to first log out of the target.

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

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

If you have multiple targets that you have logged into, you can log out of all targets by running:

# iscsiadm -m node -U all

Trouble Shooting

To get target list, run:

# iscsiadm -m discovery

To get the node list, run:

# iscsiadm -m node

The iscsid daemon opens a TCP session with the target. To check the open session, run:

# iscsiadm -m session
# netstat -tpan | grep iscsid

You can also check for the file /sys/class/iscsi_session to find open sessions.

Find which session a disk belongs to:

# iscsiadm -m session

The output will include active sessions and attached scsi disks.

For ZTE KU Storage integraion:

For ISCSI Discovery

# iscsiadm -m discovery -t sendtargets -p
# iscsiadm -m discovery -t sendtargets -p

( **this ip is the port IP where the optical fiber is connected)

To get the iqn number from blade: (need to enter in KU5200)

#yum install iscsi-initiator-utils

Next command is

# cat /etc/iscsi/initiatorname.iscsi

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.