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.
Open-iSCSI persistent configuration is implemented as a database, which consists of a hierarchy of files and directories in the /var/lib/iscsi/ directory:
# ls -l /var/lib/iscsi total 0 drwxr-xr-x. 2 root root 6 Jun 27 2017 ifaces drwxr-xr-x. 2 root root 6 Jun 27 2017 isns drwxr-xr-x. 2 root root 6 Jun 27 2017 nodes drwxr-xr-x. 2 root root 6 Jun 27 2017 send_targets drwxr-xr-x. 2 root root 6 Jun 27 2017 slp drwxr-xr-x. 2 root root 6 Jun 27 2017 static
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