Get iSCSI iqn from the ESX Command Line

I was in my personal ESX about to upgrade to update 1. I was distracted by trying to setup iSCSI from the command line. Right before I looked to the vSphere Client to get the iqn I said, “There is surely a way for me to find this from the command line.”

Searching around I found the command vmkiscsi-tool. Really good stuff, I can complete the rest of my setup without the GUI. One thing though to list out the iqn for iscsi after you enable it you must know the device name (ie vmhba??).

Using this command: vmkiscsi-tool -I -l

I usually guess the iscsi hba is vmhba33 or 32 but how do I know for sure? Try: esxcfg-scsidevs -a esxcfg-scsidevs-a Ok great, now we know it is vmhba33 ` [root@esxhost01 sbin]# vmkiscsi-tool -I -l vmhba33 iSCSI Node Name: iqn.1998-01.com.vmware:esxhost01-35151883 [root@esxhost01 sbin]#`

Now with a few more vmkiscsi-tool commands I can finish configuring my iSCSI. Add the Ip of the SAN: [root@esxhost01 sbin]# vmkiscsi-tool -D -a 172.16.23.251 vmhba33 Now rescan: [root@esxhost01 sbin]# esxcfg-rescan -a vmhba33

Written on November 27, 2009