VMware Cloud Community
kevinjj
Contributor
Contributor

report available LUN's

Is there a way to report  LUN's that are connected/visible to ESX hosts, but are not used by any datastores? meaning that those LUN's can be used to create new datastores in the future. Thanks.

Reply
0 Kudos
7 Replies
LucD
Leadership
Leadership

Have a look at my LUN report – datastore, RDM and node visibility  post


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

kevinjj
Contributor
Contributor

Luc,

I ran the script with the error below.

Cannot index into a null array.
At C:\storagereport.ps1:52 char:19
+             $scsiTab[$key][ <<<< 1] = $vm.Name + "/" + $_.DeviceInfo.Label
    + CategoryInfo          : InvalidOperation: (1:Int32) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Reply
0 Kudos
kevinjj
Contributor
Contributor

ESX version is 3.5. Powercli version is 4.1 U1 build 332441. I ran the script again with no errors. It returned only one entry.CanonicalName is vmhba0:0:0, used by none datastore, visible on all ESX hosts. I don't see this LUN in any of available LUN's within the cluster.

Reply
0 Kudos
LucD
Leadership
Leadership

Does

Get-VMHost <YourEsx> | Get-ScsiLun

return all the LUNs connected to your ESX server ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
kevinjj
Contributor
Contributor

yes, get-vmhost hostname | get-scsilun can return all the LUN's connected to the host. the script doesn't show the LUN's that use "MostRecentlyUsed" policy? as said earlier, there is only one LUN in the report, which uses "fixed" policy.

Reply
0 Kudos
LucD
Leadership
Leadership

Or could it be the Where-clause in the script.

Try changing line 26

$esxImpl | Get-ScsiLun | where {$_.LunType -eq "Disk"} | %{

into this

$esxImpl | Get-ScsiLun | %{

Sorry to bother you with this but I don't have an ESX 3.5 to test myself.

My script doesn't test on the failover policy of the LUN.

So I don't see why MRU would show and Fixed wouldn't


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
kevinjj
Contributor
Contributor

It returned samething. Only 1 LUN, and no errors.

Reply
0 Kudos