Use ESXi CLI to configure iscsi

This tutorial shows how to use the command line in ESXi 5.5 to mount iSCSI LUNs from a Linux server.


Using an Arch Linux box that's already configured as an iSCSI server and has a few LUNs mapped.

The process on the ESXi is:
- start iscsi
- discover targets
- mount LUNS

Starting software iscsi on ESXi:

~ # esxcfg-swiscsi --enable
Enabling software iSCSI...
~ #

To check the status of the iSCSI adapter:

~ # esxcli iscsi adapter list
Adapter Driver State UID Description
------- --------- ------ ------------- ----------------------
vmhba33 iscsi_vmk online iscsi.vmhba33 iSCSI Software Adapter
~ #

There is a dinamic way to perform iscsi discovery (All available targets) or static (specify target name to be discovered).

I am using static discovery:

~ # esxcli iscsi adapter discovery sendtarget add -a 172.16.41.132 -A vmhba33

I need to rescan the adapter(s). In this example I rescan all adapters.

~ # esxcli storage core adapter rescan –all

I can also rescan the iscsi adapter only:

~ # esxcli storage core adapter rescan --adapter vmhba33

My initiator has now an iqn assigned to it.

~ # esxcli iscsi adapter list
Adapter Driver State UID Description
------- --------- ------ -------------------------------------------------------------------- ----------------------
vmhba33 iscsi_vmk online iqn.1998-01.com.vmware:53cbcc01-808e-9762-88c3-000c298ee185-2071c9b6 iSCSI Software Adapter

I should be able to see now all the paths to the LUNs

~ # esxcfg-mpath -l

The output is a long list of LUNs and their available paths. The status should be active.
I can also use esxcli for this info.

~ # esxcli storage core path list



The next steps are to use partedUtil and vmkfstools to format and create the new datastores, or vShpere Client.

See this post.