Archive for January, 2018

Finding which LUN a datastore is on

January 25, 2018 Leave a comment

Recently we were doing some reconfiguration of our SAN and need to consolidate our VMFS datastores.  This required us to remove some LUNs and datastores.  While I was pretty confident our naming convention was correct between VMWare and one of our SAN arrays I wanted to be extra careful when removing the LUNs.  To my surprise I could not find a way to see which LUN a datastore was on in VMWare vCenter (6.0).  I checked everywhere I could think of but could not find any mapping.

Even though this information is not exposed in vCenter you can easily find it with PowerCLI with a simple one liner.

get-datastore “Datastore Name” | Get-SCSILun | ft CanonicalName

This finds the VMFS datastore and pipes the object over to Get-SCSILun which returns the LUN it’s store on.  You can do this for all datastores but the Get-SCSILun cmdlet is very slow so if you have dozens or hundreds of datastores this can take a while to run.

Categories: Powershell, VMware
%d bloggers like this: