TheVMinator
Expert
Expert

Geting WWN's for all storage adapters with ESXCLI

Jump to solution

Is there an ESXcli command to get all of the WWNs on all the HBAs currently installed on an ESXi host and output it to the screen?

Thanks

0 Kudos
1 Solution

Accepted Solutions
Shrikant_Gavhan
Enthusiast
Enthusiast

Here you go,

~ # esxcli storage core adapter list | grep -i fc | awk '{print $4}'

fc.200018a99b4cXXXX:200118a99b4cXXXX

fc.200018a99b4cXXXX:200218a99b4cXXXX

Thanks and Regards,

Shrikant Gavahne

Thanks and Regards, Shrikant Gavhane

View solution in original post

0 Kudos
10 Replies
a_p_
Leadership
Leadership

Please take a look at HOW TO: Find HBA WWN number on VMware vSphere ESX server to see whether this is what you are looking for.

André

tdubb123
Expert
Expert

esxcli storage core adapter  list?

0 Kudos
jrmunday
Commander
Commander

Here is a PowerShell alternative that you can use to collect this information remotely (for multiple hosts), without having to be logged onto the individual host;

## START

Clear-Host

Connect-VIServer -Server vcenter.mydomain.com

Write-host ""

$scope = Get-Datacenter 'MyDatacenter' | Get-VMHost * | Sort-Object Name    # 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 -ForegroundColor Yellow

    $hbas = Get-VMHostHba -VMHost $esx -Type FibreChannel

  

    foreach ($hba in $hbas){

    $wwpn = "{0:x}" -f $hba.PortWorldWideName

    Write-Host `t $hba.Device, "|", $hba.Status, "|", $hba.model, "|", "WWPN:" $wwpn

    }

}

Disconnect-VIServer -Server * -Force -Confirm:$false

## END

Cheers,

Jon

vExpert 2014 - 2018 | VCP6-DCV | http://www.jonmunday.net | @JonMunday77
0 Kudos
Shrikant_Gavhan
Enthusiast
Enthusiast

Hi TheVMinator,

You can run below commnad to check all the HBA's present in the ESXi.

~ # esxcli storage core adapter list

HBA Name  Driver        Link State  UID                                   Description

--------  ------------  ----------  ------------------------------------  -------------------------------------------------------------------------

vmhba0    ahci          link-n/a    sata.vmhba0                           (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

vmhba1    megaraid_sas  link-n/a    unknown.vmhba1                        (0:3:0.0) LSI / Symbios Logic Dell PERC H710 Adapter

vmhba2    qla2xxx       link-up    fc.20000024ff4bXXXX:21000024ff4bXXXX  (0:5:0.0) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA

vmhba3    qla2xxx       link-n/a    fc.20000024ff4bXXXX:21000024ff4bXXXX  (0:5:0.1) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA

vmhba4    qla2xxx       link-up    fc.20000024ff4bXXXXX:21000024ff4bXXXX  (0:67:0.0) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA

vmhba5    qla2xxx       link-n/a    fc.20000024ff4bXXXX:21000024ff4bXXXX  (0:67:0.1) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA

vmhba32   ahci          link-n/a    sata.vmhba32                          (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

vmhba33   ahci          link-n/a    sata.vmhba33                          (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

vmhba34   ahci          link-n/a    sata.vmhba34                          (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

vmhba35   ahci          link-n/a    sata.vmhba35                          (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

vmhba36   ahci          link-n/a    sata.vmhba36                          (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

esxcfg-scsidevs -a

Here is sample output. Hilighted ones are FC HBA.

~ # esxcfg-scsidevs -a

vmhba0  ahci              link-n/a  sata.vmhba0                             (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

vmhba1  megaraid_sas      link-n/a  unknown.vmhba1                          (0:3:0.0) LSI / Symbios Logic Dell PERC H710 Adapter

vmhba2  qla2xxx           link-up   fc.20000024ff4b8XXXX:21000024ffXXXXX    (0:5:0.0) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA

vmhba3  qla2xxx           link-n/a  fc.20000024ff4bXXXX:21000024ff4XXXXX    (0:5:0.1) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA

vmhba4  qla2xxx           link-up   fc.20000024ff4bXXXX:21000024ffXXXXXX   (0:67:0.0) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA

vmhba5  qla2xxx           link-n/a  fc.20000024ff4bXXXX:21000024ffXXXXXX    (0:67:0.1) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA

vmhba32 ahci              link-n/a  sata.vmhba32                            (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

vmhba33 ahci              link-n/a  sata.vmhba33                            (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

vmhba34 ahci              link-n/a  sata.vmhba34                            (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

vmhba35 ahci              link-n/a  sata.vmhba35                            (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

vmhba36 ahci              link-n/a  sata.vmhba36                            (0:0:31.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller

Thanks and Regards,

Shrikant Gavhane.

Thanks and Regards, Shrikant Gavhane
King_Robert
Hot Shot
Hot Shot

login o the ESX host and run this command to generate the list of Storage adapters.

esxcli storage core adapter list

0 Kudos
TheVMinator
Expert
Expert

Thanks all for the input.  I'm wondering if there is a way that I can run a single command or set of commands in such a way as the ouput will be a neat presentation of only the WWNs without the preceding and trailing command output? Perhaps some linux magic to pipe to grep and select only the WWNs somehow?

0 Kudos
a_p_
Leadership
Leadership

Did you see the third sample in the link I posted. This shows a way to achieve what you are asking for.

André

0 Kudos
TheVMinator
Expert
Expert

Yes I looked at that - thanks.  The problem is that these ESXi servers are being built and are not joined to vCenter Server yet.  As a result, I can't run PowerCLI commands against them, and I'm limited to running commands in the ESXi shell - so I can't use that example.

Is there a way to do this with linux commands in the ESXi shell that lists all the WWNs on the ESXi host and only the WWNs so you can copy and paste them?

0 Kudos
Shrikant_Gavhan
Enthusiast
Enthusiast

Here you go,

~ # esxcli storage core adapter list | grep -i fc | awk '{print $4}'

fc.200018a99b4cXXXX:200118a99b4cXXXX

fc.200018a99b4cXXXX:200218a99b4cXXXX

Thanks and Regards,

Shrikant Gavahne

Thanks and Regards, Shrikant Gavhane

View solution in original post

0 Kudos
TheVMinator
Expert
Expert

OK works great thanks again

0 Kudos