Help iSCSI initiator commands for linux.

May 27, 2010 at 1:53 pm (linux, TechTips, Uncategorized) ()

I’ve been doing a lot of work lately with Red Hat Enterprise Virtualization.  The hosts that I am using are currently connecting to the SAN using iSCSI.  However, in the future they will be connecting with Fiber Channel instead.

I find myself having to remember how to use the iSCSI initiator a lot.  Here are some quick notes on how to do the most common tasks.

Discover available targets from a discovery portal

iscsiadm -m discovery -t sendtargets -p ipaddress

Log into a specific target

iscsiadm -m node -T targetname -p ipaddress -l

Log out of a specific target

iscsiadm -m node -T targetname -p ipaddress -u

Display information about a target

iscsiadm -m node -T targetname -p ipaddress

Display statistics about a target

iscsiadm -m node -s -T targetname -p ipaddress

Remove the portal address to receive information or statistics about all targets.

Display list of all current sessions logged in

iscsiadm -m session

View iSCSI database regarding discovery

iscsiadm -m discovery -o show

View iSCSI database regarding targets to log into

iscsiadm -m node -o show

View iSCSI database regarding sessions logged into

iscsiadm -m session -o show

View if the targets are multipathed (MPIO)

multipath -ll

If it is multipathed, you will see output like below (this is an example of two LUNs, both multipathed).  Note that this show the MPIO mode is round-robin:

36000d77100000b117de986015d5d5746 dm-7 FALCON,IPSTOR DISK
[size=20G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 12:0:0:0 sdb 8:16  [active][ready]
 \_ 13:0:0:0 sdd 8:48  [active][ready]
36000d771000002767de9860330139e10 dm-8 FALCON,IPSTOR DISK
[size=200G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 12:0:0:1 sdc 8:32  [active][ready]
 \_ 13:0:0:1 sde 8:64  [active][ready]

Here is a very helpful article that covers similar commands, etc.
http://kbase.redhat.com/faq/docs/DOC-6388

4 Comments

  1. Rob Kinney said,

    Quite useful! Thanks.

  2. tty0 said,

    Thanks!

  3. Linux iSCSI multipath on NetApp said,

    […] iSCSI I found this site that explains the iscsiadm commands nicely. I do not want to take credit for this, I just want to […]

  4. Linux iSCSI Multipath on NetApp | ChainRingCircus said,

    […] iSCSI I found this site that explains the iscsiadm commands nicely. I do not want to take credit for this, I just want to […]

Leave a comment