Does anyone have a script to map a list of datastores from a host or cluster along with the the NAA ID's? I have found scripts that gather various types of information on the LUN's on hosts and clusters but don't associate a datastore to a LUN (or extents). The reason behind this is that I am trying to find a way to create a list of datastores and be able to identify their associated LUN's on the disk array. Perhaps a different method would work better? In the case of the NAA ID this includes the WWN of the disk as part of the structure (at least for EMC devices) so it can be used to identify the LUN in the array. Right now, the method I am using to identify the disks is to run two commands at the console:
esxcfg-scsidevs -m
Which identifies the datastore name and corresponding mount point in the console (for example /dev/sdz), and
INQ -sym_wwn (Linux utility)
to match up the mount point with the device ID. From what I understand this won't work in ESXi 4 or ESXi 5.
Like this?:
Like this?:
That script will show the information you are after.
A slightly different approach which shows all visible LUNs in a cluster, including RDM and free LUNs, can be found in my LUN report – datastore, RDM and node visibility post.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you for this nice script, it has been of great use today!
I use the following oneliner...
Get-Cluster "ClusterName" | Get-VMHost | Get-Datastore | Where {$_.Name -notmatch "-Local" -and $_.Name -notmatch "NFS"} | Select Name,@{N="DiskName";E={$_.ExtensionData.Info.Vmfs.Extent.DiskName}}
It doesn't need the Where statement but I use it to exclude local and nfs datastores by leveraging good naming conventions.
Hope that helps...