To communicate with each other, iSCSI initiators on the ESXi host and targets establish iSCSI sessions. You can review and manage iSCSI sessions using vSphere CLI.

By default, software iSCSI and dependent hardware iSCSI initiators start one iSCSI session between each initiator port and each target port. If your iSCSI initiator or target has more than one port, your host can have multiple sessions established. The default number of sessions for each target equals the number of ports on the iSCSI adapter times the number of target ports.

Using vSphere CLI, you can display all current sessions to analyze and debug them. To create more paths to storage systems, you can increase the default number of sessions by duplicating existing sessions between the iSCSI adapter and target ports.

You can also establish a session to a specific target port. This capability is useful if your host connects to a single-port storage system that presents only one target port to your initiator. The system then redirects additional sessions to a different target port. Establishing a new session between your iSCSI initiator and another target port creates an additional path to the storage system.

The following considerations apply to iSCSI session management:

  • Some storage systems do not support multiple sessions from the same initiator name or endpoint. Attempts to create multiple sessions to such targets can result in an unpredictable behavior of your iSCSI environment.
  • Storage vendors can provide automatic session managers. Using the automatic session manages to add or delete sessions, does not guarantee lasting results and can interfere with the storage performance.

Review iSCSI Sessions

Use the vCLI command to display iSCSI sessions between an iSCSI adapter and a storage system.

Prerequisites

Install ESXCLI. See Getting Started with ESXCLI. For troubleshooting, run esxcli commands in the ESXi Shell.

Procedure

  • To list iSCSI sessions, run the following command:
    esxcli iscsi session list
    The command takes these options:
    Option Description
    -A|--adapter=str The iSCSI adapter name, for example, vmhba34.
    -s|--isid=str The iSCSI session identifier.
    -n|--name=str The iSCSI target name, for example, iqn.X.

Add iSCSI Sessions

Use the vCLI to add an iSCSI session for a target you specify or to duplicate an existing session. By duplicating sessions, you increase the default number of sessions and create additional paths to storage systems.

Prerequisites

Install ESXCLI. See Getting Started with ESXCLI. For troubleshooting, run esxcli commands in the ESXi Shell.

Procedure

  • To add or duplicate an iSCSI session, run the following command:
    esxcli iscsi session add
    The command takes these options:
    Option Description
    -A|--adapter=str The iSCSI adapter name, for example, vmhba34. This option is required.
    -s|--isid=str The ISID of a session to duplicate. You can find it by listing all sessions.
    -n|--name=str The iSCSI target name, for example, iqn.X.

What to do next

Rescan the iSCSI adapter.

Remove iSCSI Sessions

Use the vCLI command to remove an iSCSI session between an iSCSI adapter and a target.

Prerequisites

Install ESXCLI. See Getting Started with ESXCLI. For troubleshooting, run esxcli commands in the ESXi Shell.

Procedure

  • To remove a session, run the following command:
    esxcli iscsi session remove
    The command takes these options:
    Option Description
    -A|--adapter=str The iSCSI adapter name, for example, vmhba34. This option is required.
    -s|--isid=str The ISID of a session to remove. You can find it by listing all session.
    -n|--name=str The iSCSI target name, for example, iqn.X.

What to do next

Rescan the iSCSI adapter.