There are several ways to get HBA WWNs on VMware vSphere ESX/ESXi host:

  1. vSphere Client;

  2. Using ESXi Shell;

  3. Using Powershell / PowerCLI script.

1. Connect to a server or vCenter, open server Configuration tab, under Hardware select Storage Adapters:

You can also copy WWNN (World Wide Node Name) and WWPN (World Wide Port Name)

2. How to find HBA WWN via ESXi Shell / CLI:

VMware vSphere ESXi 5.0+:

~ # esxcli storage core adapter listHBA Name  Driver        Link State  UID                                   Description
--------  ------------  ----------  ------------------------------------  ------------------------------------------------------------
vmhba0    megaraid_sas  link-n/a    unknown.vmhba0                        (0:1:0.0) LSI / Symbios Logic MegaRAID SAS SKINNY Controller
vmhba1    fnic          link-up     fc.20000025b5020110:20000025b502a121  (0:8:0.0) Cisco Systems Inc Cisco VIC FCoE HBA Driver
vmhba2    fnic          link-up     fc.20000025b5020110:20000025b502a120  (0:9:0.0) Cisco Systems Inc Cisco VIC FCoE HBA Driver

VMware ESX/ESXi 2.1.0 – 4.1.x:

~ # esxcfg-scsidevs -avmhba0  megaraid_sas      link-n/a  unknown.vmhba0                          (0:1:0.0) LSI / Symbios Logic MegaRAID SAS SKINNY Controller
vmhba1  fnic              link-up   fc.20000025b5020110:20000025b502a121    (0:8:0.0) Cisco Systems Inc Cisco VIC FCoE HBA Driver
vmhba2  fnic              link-up   fc.20000025b5020110:20000025b502a120    (0:9:0.0) Cisco Systems Inc Cisco VIC FCoE HBA Driver

OR

  • Connect to ESXi shell either via putty/SSH or DCUI (Direct Console User Interface) / server console

  • Run ‘ls /proc/scsi/‘ and check the folder names:

    ?

    1
    2
    ~ # ls /proc/scsi/
      mptsas   qla2xxx
  • Look for a folder like ‘qla2xxx‘ – QLogic HBA, ‘lpfc820‘ – Emulex HBA, ‘bnx2i” – Brocade HBA;

  • Run ‘ls /proc/scsi/qla2xxx’. You will get a list of files, named by a number. Each file contains information about one HBA;

    ?

    1
    2
    ~ # ls /proc/scsi/qla2xxx/
    6  7
  • Now run ‘cat /proc/scsi/qla2xxx/6‘ to get full info on the HBA. Alternatively, run the following commands:

    • Run ” cat /proc/scsi/qla2xxx/6 | grep -A3 ‘SCSI Device Information:’  ” to get WWNN and WWPNs:

      ?

      1
      2
      3
      4
      ~ # cat /proc/scsi/qla2xxx/6 | grep -A3 'SCSI Device Information:'
      SCSI Device Information:
      scsi-qla0-adapter-node=20000024ff31f0c8:000000:0;
      scsi-qla0-adapter-port=21000024ff31f0c8:000000:0;
    • Run ” cat /proc/scsi/qla2xxx/6 | grep ‘Host Device Name’ ” to get vmhba number:

      ?

      1
      2
      ~ # cat /proc/scsi/qla2xxx/6 | grep 'Host Device Name'
      Host Device Name vmhba3

3. Powershell script to list host name, vmhba number, HBA model / driver and World Wide Port Name (WWN):

?

1
2
3
4
5
6
7
8
9
$scope = Get-VMHost     # All hosts connected in vCenter
#$scope = Get-Cluster -Name 'MyCluster' | Get-VMHost # All hosts in a specific cluster
foreach ( $esx in $scope ){
Write-Host "Host:" , $esx
$hbas = Get-VMHostHba -VMHost $esx -Type FibreChannel
foreach ( $hba in $hbas ){
$wwpn = "{0:x}" -f $hba .PortWorldWideName
Write-Host `t $hba .Device, "|" , $hba .model, "|" , "World Wide Port Name:" $wwpn
}}

Result:

?

1
2
3
Host: ESXi5-001.vstrong.info
vmhba1 | Cisco VIC FCoE HBA Driver | World Wide Port Name: 20000025b502a101
vmhba2 | Cisco VIC FCoE HBA Driver | World Wide Port Name: 20000025b502a100


转自: http://www.vstrong.info/2012/09/21/how-to-find-hba-wwn-number-on-vmware-esx-server/