Cleaning up legacy storage and vSphere environments is always fun, especially when you think you have everything moved off an old array, only to find that your production database goes offline when that array is unplugged -totally made up scenario, did not happen to me 🙂
The slow way to approach this would be to go through every VM, one by one, and check the disks associated with the VM, and then reference LUN numbers on the SAN, etc. OR, you could use PowerCLI and find that info in a snap.
For instructions on how to install PowerCLI, see my previous post here
- Connect to you vCenter Server through PowerCLI by using the following command and entering appropriate vSphere Credentials
connect-viserver YOUR IP ADDRESS
If you see the following error, you will need to set PowerCLI to disregard Self-Signed Certs
Set-PowerCLIConfiguration -InvalidCertificateAction ignore -confirm:$false
2. Run the following command to produce a list of VMs with RDMs
Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select Parent,Name,DiskType,ScsiCanonicalName,DeviceName | fl
The output will look similar to this (sorry, I didnt have any additional RDMs when making this tutorial for a real screenshot)
3. Finally, if you would like to save the output to a file, use the following command
Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select Parent,Name,DiskType,ScsiCanonicalName,DeviceName | fl | Out-File –FilePath RDM-list.txt