In modern data centers, consolidating storage and making it available over standard IP networks can dramatically simplify infrastructure and reduce costs. The open-iscsi suite on CentOS/RHEL provides the iscsiadm command-line tool to discover, configure, and manage iSCSI connections. Rather than requiring dedicated Fibre Channel hardware, iSCSI lets you present block devices on remote hosts as if they were locally attached disks—using just Ethernet.

 

In this article, you’ll learn how to:

 

  • Discover available iSCSI targets on your network

  • Create and manage persistent node records

  • Establish and tear down sessions between initiators and targets

  • Explore the key operational modes (discoverydb, discovery, node, session, iface) and the most common options (--type, --portal, etc.)

By the end, you’ll have a clear, step-by-step understanding of how to use iscsiadm to integrate remote storage seamlessly into your CentOS/RHEL 7 or 8 server environment.

 

Open-iSCSI persistent configuration is implemented as a database, which consists of a hierarchy of files and directories in the  /var/lib/iscsi/ directory:

Use the iscsiadm utility to update, delete, insert, and query the persistent database. Also use this utility to establish a session between a target and an initiator. Several different operational modes are available for the command.

  • discoverydb: Updates or queries the Open-iSCSI database records
  • discovery: Performs a discovery operation
  • node: Performs an operation on a portal (IP:port) on an iSCSI target
  • session: Performs an operation on a TCP connection between an initiator and a target
  • iface: Performs an operation on a network interface

 

Additional options to iscsiadm include:

  • -type – Specify the discover type.
  • -portal – Specify the iSCSI target portal.

 

iscsiadm connection commands

1. Discover targets at a given IP address:

# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.1.10 --discover

 

2. Login into a iscsi target (must use a node record id found by the discovery).

# iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260 --login

 

3. Logout from a iscsi target.

# iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260 --logout

 

4. List node records:

# iscsiadm --mode node

 

5. Display all data for a given node record:

# iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260

 

Kas see vastus oli kasulik? 3 Kasutajad peavad seda kasulikuks (3 Hääled)