• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to configure iSCSI Initiator (client) in CentOS / RHEL 7

by admin

Internet Small Computer System Interface (iSCSI) is an IP-based standard for connecting storage devices. iSCSI uses IP networks to encapsulate SCSI commands, allowing data to be transferred over long distances. iSCSI provides shared storage among a number of client systems. Storage devices are attached to servers (targets). Client systems (initiators) access the remote storage devices over IP networks. To the client systems, the storage devices appear to be locally attached. iSCSI uses the existing IP infrastructure and does not require any additional cabling, as is the case with Fibre Channel (FC) storage area 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 configure iSCSI Initiator (client) in CentOS / RHEL 6

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. Linux OS Service ‘syslog’
  2. Linux OS Service ‘microcode_ctl’
  3. How to resize (extend) a partition-based file system in Linux
  4. How to burn an ISO to CD or DVD using Wodim
  5. CentOS / RHEL 7 : How to configure Network Bonding or NIC teaming
  6. img2txt Command Examples in Linux
  7. Maintaining Linux filesystems using “fsck” and “tune2fs”
  8. How to install and configure sosreport under CentOS / RHEL
  9. Understanding linux fdisk utility
  10. CentOS / RHEL : How to get the date and time of executed command in the history command output

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright