PowerCLI

 View Only
  • 1.  Find the Device name which is backing the Datastore

    Posted Aug 27, 2021 10:16 AM
     Hi All
     
     I need to find out the Device name which is backing the Datastore. In my Company we have HPE 3PAR and Dell EMC Storage. I was able to get the Information using the webclient by Going to the Datastore -- Configure --Device Backing which shows me the Device name and the LUN ID as well. I tried using the below Script but it showed me only the ID's not the name.
     
     (Get-Datastore -Name "Datastore Name").ExtensionData.Info.Vmfs.Extent 
     
    I am looking for a script which shows the Device name which is 3PAR or EMC and the LUN ID like how it shows in the Webclient.
     
    Can someone help me in this request?


  • 2.  RE: Find the Device name which is backing the Datastore

    Posted Aug 27, 2021 10:41 AM

    Does esxcli storage vmfs extent list (which you can do via Get-EsxCli) return the required info?

    If not, then I'm afraid you will have to look in the HPE forums for an answer concerning the 3PAR LUNs.



  • 3.  RE: Find the Device name which is backing the Datastore

    Posted Aug 27, 2021 10:55 AM
      |   view attached

    Thank you so much for your reply LUCD. I tried running the esxcli storage vmfs extent list command in the esxi host but It doesn't showed me the Information which I am looking for. But I can see the information from the webclient, is it possible to use the webclient API and retrieve the information which I am looking for as its visible in the webclient.  

    I had attached an image from webclient which has the information I am looking for. I need to retrieve the same using powerCLI



  • 4.  RE: Find the Device name which is backing the Datastore

    Posted Aug 27, 2021 11:15 AM

    The method you tried earlier and the esxcli command are using the vSphere API, but these 3e party vendors apparently do not provide that info via the regular API.
    I suspect the Web Client might be using an extension provided by these vendors, but I have no knowledge if there is a public API.

    For 3PAR there is a PowerShell module provided by HPE that gives access.
    See HPE Storage PowerShell Toolkit

    EMC also provides PS modules



  • 5.  RE: Find the Device name which is backing the Datastore

    Posted Aug 27, 2021 11:41 AM

    Thank you LucD 



  • 6.  RE: Find the Device name which is backing the Datastore

    Posted Nov 21, 2022 06:33 PM

    You can use this command 

    Replace 'naa.60060e8007*' with the naa.ID for the storage array or the beginning 

    Get-Datastore | select Name,CapacityGB,FreeSpaceGB,@{n='DiskName';e={$_.ExtensionData.Info.Vmfs.Extent.Diskname}},@{n='Hosts';e={[string]::Join(',', (Get-VMHost -Datastore $_.Name | select -ExpandProperty Name))}} | where DiskName -like 'naa.60060e8007*' | sort DiskName | ft -AutoSize

    This will provide additional details like ESXi Hosts to which the DS/volume is mounted. 



  • 7.  RE: Find the Device name which is backing the Datastore

    Posted 14 hours ago

    @vakkilsrijith  - Thanks for the nicely organized query.   I just shorted the naa.ID to naa.600* (where DiskName -like 'naa.600*') and replace ft -auto with Out-GridView to get my entire inventory for asset management. 

    Get-Datastore | select Name,CapacityGB,FreeSpaceGB,@{n='DiskName';e={$_.ExtensionData.Info.Vmfs.Extent.Diskname}},@{n='Hosts';e={[string]::Join(',', (Get-VMHost -Datastore $_.Name | select -ExpandProperty Name))}} | where DiskName -like 'naa.600*' | sort DiskName | Out-Gridview -T "Data Center Data Storage"

    Thank you. 



    ------------------------------
    VMSysAdmin
    ------------------------------



  • 8.  RE: Find the Device name which is backing the Datastore

    Posted Mar 02, 2023 07:40 PM

    Hi mrtgokul, did you ever find a solution to this?

     

    I have the exact same problem: I can see the SAN vendor name in "Device Backing" in the vCenter GUI, but I can't extract that information using PowerCLI. It's not in the 'Get-Datastore' object. I thought maybe there's a way to do a lookup based on the datastore ID ("naa.[bunch of numbers]"), but thus far I haven't been able to figure out how to do that.

     

    Unfortunately, the other suggestions in this thread haven't worked for me.



  • 9.  RE: Find the Device name which is backing the Datastore

    Posted Mar 02, 2023 10:49 PM

    Table at the bottom of the page might help you 

    World Wide Name - Wikipedia

    60060e8007567

    This is starting of WWID for a LUN from Hitachi, portion underlined is identifier for Hitachi as per the list in URL.

    600a098038313 - This one is for NetApp 

     



  • 10.  RE: Find the Device name which is backing the Datastore

    Posted Mar 03, 2023 01:17 AM

    Thanks, that works...sort of!

     

    We have EMC, NetApp and Nimble SANs (mostly Fibre Channel LUNs). Datastores on EMC and NetApp have "naa.[string]" IDs and the 2nd through the 7th characters are consistent and match up with the vendor table at that Wiki link. The Nimble, however, has "eui.[string]" IDs and for those, the 2nd through the 7th characters are different for each datastore. It looks like the 17th through 22nd characters are the ones to look for there (in this case, "6c9ce9").

     

    I'm wondering if that's consistent for all vendors, i.e. if "naa", then characters 2 through 7; if "eui" then characters 17 through 22. If so, then I can script against that.