scs3
Contributor
Contributor

ESXCLI Command to List 'Not Consumed' Devices

Can anyone help with an esxcli command to list 'not consumed' devices by Device ID (.naa*), LUN and Capacity?

If I can even get a partial, then I can manually get the rest from the GUI.  

Tags (3)
0 Kudos
2 Replies
scott28tt
VMware Employee
VMware Employee

I’ve reported your thread so moderators know it should be moved to the correct area for ESXi.

 


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

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
StephenMoll
Expert
Expert

I tried this this but couldn't make it work:

$AllDisks = get-vmhost | Get-ScsiLun | select CanonicalName | where {$_.CanonicalName -like "naa.*"}

$DataStoreDisks = Get-Datastore | select @{N='DiskName'; E={$_.ExtensionData.Info.VMFS.extent.diskname}} | where {$_.DiskName -like "naa.*"}

$NotConsumed = $AllDisks | Where-Object { $_ -notin $DataStoreDisks }

The -notin comparison operator does not work for some reason.

 

I found this though which looks like it might get you close to what you want:

PowerCLI Script that outputs a list of all LUN paths for all ESXi hosts · GitHub

This produces output like:

1 host(s) needs to be processed. Please wait...

Hostname  Datastore    CanonicalName                        # of Paths Path State
--------  ---------    -------------                        ---------- ----------
10.0.1.22 MY_LUN_NR_01 naa.1234a5678901b2000000000000000003          2 {Active, Active}
10.0.1.22              naa.1234a5678901b2000000000000000005          2 {Active, Active}
10.0.1.22              naa.1234a5678901b2000000000000000021          2 {Active, Active}
10.0.1.22              mpx.vmhba32:C0:T0:L0                          1 Active
10.0.1.22              naa.1234a5678901b701000000000000010d          2 {Active, Active}
10.0.1.22              naa.1234a5678901b701000000000000010e          2 {Active, Active}
10.0.1.22              naa.1234a5678901b2010000000000000013          2 {Active, Active}
10.0.1.22 MY_LUN_NR_02 naa.1234a5678901b7000000000000000508          2 {Active, Active}
10.0.1.22              naa.1234a5678901b2010000000000000014          2 {Active, Active}
10.0.1.22 MY_LUN       naa.1234a5678901b70000000000000004ac          4 {Active, Active, Active, Active}

 

In this example all entries without a Datastore name are "not consumed".

0 Kudos