Home > Powershell, VMware > Finding which LUN a datastore is on

Finding which LUN a datastore is on

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.

Advertisements
Categories: Powershell, VMware
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: