iSCSI Storage Setup with ESXCLI
You can set up iSCSI storage using the vSphere Client, commands in the esxcli iscsi namespace, or vicfg-iscsi commands (see iSCSI Storage Setup with vicfg-iscsi).
Setting Up Software iSCSI with ESXCLI
Software iSCSI setup requires several tasks. For each task, see the discussion of the corresponding command in this chapter or the reference information available from esxcli iscsi --help and the VMware Documentation Center. Specify one of the options listed in Connection Options in place of <conn_options>
1
esxcli <conn_options> iscsi software set --enabled=true
2
esxcli <conn_options> iscsi adapter list
3
esxcli <conn_options> iscsi networkportal add -n <portal_name> -A <vmhba>
4
esxcli <conn_options> iscsi software get
The system prints true if software iSCSI is enabled, or false if it is not enabled.
5
esxcli <conn_options> iscsi adapter set --adapter=<iscsi adapter> --name=<name>
esxcli <conn_options> iscsi adapter set --adapter=<iscsi adapter> --alias=<alias>
6
The two types of target differ as follows:
esxcli <conn_options> iscsi adapter discovery sendtarget add --address=<ip/dns[:port]> --adapter=<adapter_name>
esxcli <conn_options> iscsi adapter discovery statictarget add --address=<ip/dns[:port]>
--adapter=<adapter_name> --name=<target_name>
When you later remove a discovery address, it might still be displayed as the parent of a static target. You can add the discovery address and rescan to display the correct parent for the static targets.
7
(Optional) Set the authentication information for CHAP (see Setting iSCSI CHAP and Enabling iSCSI Authentication). You can set per-target CHAP for static targets, per-adapter CHAP, or apply the command to the discovery address.
Supported Levels for CHAP lists what each supported level does.
For example:
esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=preferred --secret=uni_secret --adapter=vmhba33
8
(Optional) Set the authentication information for mutual CHAP by running esxcli iscsi adapter auth chap set again with --direction set to mutual and a different authentication user name and secret.
9
See Listing and Setting iSCSI Parameters
10
esxcli <conn_options> iscsi adapter discovery rediscover
esxcli <conn_options> storage core adapter rescan --adapter=vmhba36
11
a
Run esxcli iscsi session remove to log out.
b
Run esxcli iscsi session add or rescan the adapter to add the session back.
Setting Up Dependent Hardware iSCSI with ESXCLI
Dependent hardware iSCSI setup requires several high-level tasks. For each task, see the discussion of the corresponding command in this chapter or the reference information available from esxcli iscsi --help and the VMware Documentation Center. Specify one of the options listed in Connection Options in place of <conn_options>.
1
esxcli <conn_options> iscsi adapter list
2
esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --name=<name>
esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --alias=<alias>
3
a
esxcli <conn_options> iscsi logicalnetworkportal list --adapter=<adapter_name>
b
esxcli <conn_options> iscsi networkportal add --nic=<bound_vmknic> --adapter=<iscsi_adapter>
c
esxcli <conn_options> iscsi physicalnetworkportal list --adapter=<adapter_name>
4
The two types of target differ as follows:
esxcli <conn_options> iscsi adapter discovery sendtarget add --address=<ip/dns[:port]> --adapter=<adapter_name>
esxcli <conn_options> iscsi adapter discovery statictarget add --address=<ip/dns[:port]>
--adapter=<adapter_name> --name=<target_name>
When you later remove a discovery address, it might still be displayed as the parent of a static target. You can add the discovery address and rescan to display the correct parent for the static targets.
5
(Optional) Set the authentication information for CHAP (see Setting iSCSI CHAP and Enabling iSCSI Authentication). You can set per-target CHAP for static targets, per-adapter CHAP, or apply the command to the discovery address.
Supported Levels for CHAP lists what each supported level does.
For example:
esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=preferred --secret=uni_secret --adapter=vmhba33
6
(Optional) Set the authentication information for mutual CHAP by running esxcli iscsi adapter auth chap set again with --direction set to mutual and a different authentication user name and secret.
7
See Listing and Setting iSCSI Parameters
8
esxcli <conn_options> iscsi adapter discovery rediscover
esxcli <conn_options> storage core adapter rescan --adapter=vmhba36
9
a
Run esxcli iscsi session remove to log out.
b
Run esxcli iscsi session add or rescan the adapter to add the session back.
Setting Up Independent Hardware iSCSI with ESXCLI
With independent hardware-based iSCSI storage, you use a specialized third-party adapter capable of accessing iSCSI storage over TCP/IP. This iSCSI initiator handles all iSCSI and network processing and management for your ESXi system.
You must install and configure the independent hardware iSCSI adapter for your host before you can access the iSCSI storage device. For installation information, see vendor documentation.
Hardware iSCSI setup requires a number of high-level tasks. For each task, see the discussion of the corresponding command-line option in this chapter or the reference information. Specify one of the options listed in Connection Options in place of <conn_options>.
1
esxcli <conn_options> iscsi adapter list
2
Configure the hardware initiator (HBA) by running esxcli iscsi networkportal ipconfig with one or more of the following options.
3
esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --name=<name>
esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --alias=<alias>
4
The two types of target differ as follows:
esxcli <conn_options> iscsi adapter discovery sendtarget add --address=<ip/dns[:port]> --adapter=<adapter_name>
esxcli <conn_options> iscsi adapter discovery statictarget add --address=<ip/dns[:port]>
5
(Optional) Set the authentication information for CHAP (see Setting iSCSI CHAP and Enabling iSCSI Authentication). You can set per-target CHAP for static targets, per-adapter CHAP, or apply the command to the discovery address.
Supported Levels for CHAP lists what each supported level does.
For example:
esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=preferred --secret=uni_secret --adapter=vmhba33
Mutual CHAP is not supported for independent hardware iSCSI storage.
6
See Listing and Setting iSCSI Parameters
7
After setup is complete, run esxcli storage core adapter rescan --adapter=<iscsi_adapter> to rescan all storage devices.
8
esxcli <conn_options> iscsi adapter discovery rediscover
esxcli <conn_options> storage core adapter rescan --adapter=vmhba36