Debug School

Cover image for iSCSI Commands on Linux
Suyash Sambhare
Suyash Sambhare

Posted on • Updated on

iSCSI Commands on Linux

Internet Small Computer Systems Interface or iSCSI is an Internet Protocol-based storage networking standard for linking data storage facilities. iSCSI provides block-level access to storage devices by carrying SCSI commands over a TCP/IP network. iSCSI facilitates data transfers over intranets and to manage storage over long distances. It can be used to transmit data over local area networks (LANs), wide area networks (WANs), or the Internet and can enable location-independent data storage and retrieval.

iSCSI Initiator on Windows

Below is the list of useful ISCSI Commands

Discover targets from a discovery portal:
iscsiadm -m discovery -t sendtargets -p <ipaddress>

Login to all targets:
iscsiadm -m node -l

Login to a specific target:
iscsiadm -m node -T targetname -p <ipaddress> -l

Logout of all the targets:
iscsiadm -m node -u

Logout of a specific target:
iscsiadm -m node -T targetname -p <ipaddress> -u

Show information about a target:
iscsiadm -m node -T targetname -p <ipaddress>

Show statistics of a target:
iscsiadm -m node -s -T targetname -p <ipaddress>

Show a list of all current sessions logged in:
iscsiadm -m session

Show iSCSI database regarding discovery:
iscsiadm -m discovery -o show

Show iSCSI database regarding targets to login to:
iscsiadm -m node -o show

Show iSCSI database regarding sessions logged in to:
iscsiadm -m session -o show

Search the newly created device name, using the iscsiadm command.
iscsiadm -m session -P3

When you expand the volume or disk, you might need to rescan:
iscsiadm -m node -p <ipaddress> --rescan

There is also a script to rescan all devices:
rescan-scsi-bus.sh

You can list all the disk by this command:
ls -lr /dev/disk/by-pathm

Ref: https://support.citrix.com/article/CTX140118/helpful-iscsi-commands

Top comments (0)