Using ESXCLI to Troubleshoot iSCSI Related Issues

There are a number of iSCSI related esxcli commands, all accessed using the ‘esxcli iscsi’ namespace:


~ # esxcli iscsi
Usage: esxcli iscsi {cmd} [cmd options]

Available Namespaces:
  adapter               Operations that can be performed on iSCSI adapters
  networkportal         Operations that can be performed on iSCSI Network Portal (iSCSI vmknic)
  physicalnetworkportal Operations that can be performed on iSCSI Physical Network Portal (vmnic)
  session               Operations that can be performed on iSCSI sessions
  ibftboot              Operations that can be performed on iSCSI IBFT boot table
  logicalnetworkportal  Operations that can be performed on iSCSI Logical Network Portal (vmknic)
  plugin                Operations that can be performed on iSCSI management plugins
  software              Operations that can be performed on software iSCSI

I’ve written about iSCSI port binding previously, and included several esxcli commands related to configuring iSCSI so won’t cover that ground again here. Instead I’ll be looking at the commands I didn’t cover in that post. I’ll start by looking at the host’s iSCSI adapters:


/etc/init.d # esxcli iscsi adapter list
Adapter  Driver     State   UID                                    Description
-------  ---------  ------  -------------------------------------  ----------------------
vmhba33  iscsi_vmk  online  iqn.1998-01.com.vmware:esxi1-47be1f31  iSCSI Software Adapter

It’s clear from the output that this host is using the iSCSI Software Adapter. To display more information on a given adapter you can run:


/etc/init.d # esxcli iscsi adapter get --adapter vmhba33
vmhba33
   Name: iqn.1998-01.com.vmware:esxi1-47be1f31
   Alias:
   Vendor: VMware
   Model: iSCSI Software Adapter
   Description: iSCSI Software Adapter
   Serial Number:
   Hardware Version:
   Asic Version:
   Firmware Version:
   Option Rom Version:
   Driver Name: iscsi_vmk
   Driver Version:
   TCP Protocol Supported: false
   Bidirectional Transfers Supported: false
   Maximum Cdb Length: 64
   Can Be NIC: false
   Is NIC: false
   Is Initiator: true
   Is Target: false
   Using TCP Offload Engine: false
   Using ISCSI Offload Engine: false

As this is a software adapter, some of the fields will not display information, however, if this was a hardware adapter you would expect to see details on Firmware and Driver versions etc. You can use the ‘set’ option to change the name and alias of the adapter. For example:


# esxcli iscsi adapter set --adapter vmhba33 --alias SoftwareAdapter

There are a number of other namespaces relating to the iSCSI adapter:


/etc/init.d # esxcli iscsi adapter
Usage: esxcli iscsi adapter {cmd} [cmd options]

Available Namespaces:
  auth                  Operations that can be performed on iSCSI adapter authentications
  discovery             Operations that can be performed on iSCSI adapter discovery
  target                Operations that can be performed on iSCSI targets
  capabilities          Operations that can be performed on iSCSI adapter capabilities
  firmware              Operations that can be performed on iSCSI adapter firmware
  param                 Operations that can be performed on iSCSI adapter parameters

In relation to troubleshooting its worth paying attention to the ‘auth’, ‘discovery’ and ‘target’ namespaces in particular. You can list the chap settings with:


/etc/init.d # esxcli iscsi adapter auth chap get -A vmhba33
   Direction: uni
   Name:
   Level: prohibited

To list the configured iSCSI targets you can run:


/etc/init.d # esxcli iscsi adapter target list
Adapter  Target                                      Max Connections  Alias  Discovery Method  Last Error
-------  ------------------------------------------  ---------------  -----  ----------------  ----------
vmhba33  iqn.2006-01.com.openfiler:tsn.a75226350df7                0         SENDTARGETS       No Error

Moving away from the adapter related commands, a useful command for troubleshooting is the ‘sessions’ namespace. This will output established sessions to the host’s configured targets. For example:


/etc/init.d # esxcli iscsi session list
vmhba33,iqn.2006-01.com.openfiler:tsn.a75226350df7,00023d000001
   Adapter: vmhba33
   Target: iqn.2006-01.com.openfiler:tsn.a75226350df7
   ISID: 00023d000001
   TargetPortalGroupTag: 1
   AuthenticationMethod: none
   DataPduInOrder: true
   DataSequenceInOrder: true
   DefaultTime2Retain: 0
   DefaultTime2Wait: 2
   ErrorRecoveryLevel: 0
   FirstBurstLength: Irrelevant
   ImmediateData: false
   InitialR2T: true
   MaxBurstLength: 262144
   MaxConnections: 1
   MaxOutstandingR2T: 1
   TSIH: 2816

Finally, you can view the network settings/vmk used by iSCSI on the host by running:


/etc/init.d # esxcli iscsi networkportal list
vmhba33
   Adapter: vmhba33
   Vmknic: vmk2
   MAC Address: 00:0c:29:e8:41:0a
   MAC Address Valid: true
   IPv4: 192.168.88.140
   IPv4 Subnet Mask: 255.255.255.0
   IPv6:
   MTU: 1500
   Vlan Supported: true
   Vlan ID: 0
   Reserved Ports: 63488~65536
   TOE: false
   TSO: true
   TCP Checksum: false
   Link Up: true
   Current Speed: 1000
   Rx Packets: 52986
   Tx Packets: 17763
   NIC Driver: e1000
   NIC Driver Version: 8.0.3.1-NAPI
   NIC Firmware Version: N/A
   Compliant Status: compliant
   NonCompliant Message:
   NonCompliant Remedy:
   Vswitch: vSwitch2
   PortGroup: iSCSI-1
   VswitchUuid:
   PortGroupKey:
   PortKey:
   Duplex:
   Path Status: active

Related posts

VMware vSphere Virtual Machine Snapshots Explained

How to Enable SSH on All ESXi Hosts using PowerCLI

How to Install VMware Tools on Debian 11

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More