VMware Cloud Community
TedH256
Expert
Expert

vmkfstools –q to Figure out RDM to LUN mappings

I need to figure out which LUNs are no longer needed (so that I can delete them of course) because they are no longer used to back RDMs. In order to do that, I need to create a map, that shows


rdm ---> LUN


for each of the active RDMs that are in use. I know how to find the RDMs that are defined- simple. But how do I figure out which LUN each RDM points to?


I've found this blog post:
http://www.gamescheat.ca/2010/08/creating-rdm-to-lun-san-mapping-on-vmware-esx-4-vcenter/
And this KB:
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=100256...


The KB describes using vmkfstools -q against the rdm vmdk name, to find the LUN that an RDM maps to:


# vmkfstools -q /vmfs/volumes/46fcea8f-77873c31-e474-001aa01e7ce5/solaris10/solaris10.vmdk
Disk /vmfs/volumes/46fcea8f-77873c31-e474-001aa01e7ce5/solaris10/solaris10.vmdk is a Passthrough Raw Device Mapping
Disk Id: vml.02000000060050768019002077000000000000005323134352020
Maps to: vmhba1:0:0:0
This output clearly shows solaris10.vmdk is mapped to LUN vmhba1:0:0:0.


But when I do this command, I only get:


[root@esx01 OESCluster]# vmkfstools -q RP-GWPO1.vmdk
Disk RP-GWPO1.vmdk is a Passthrough Raw Device Mapping
Maps to: vml.0200110000600508b400089f080000700000610000485356333030

What else do I need to do, to get the LUN ID that backs a particular RDM?

Reply
0 Kudos
1 Reply
MartinAmaro
Expert
Expert

the only way I can think of doing this is via powercli+Get-StorageInfo

$LUNCollection | Where{$_.Datastore -eq $null} | Group-Object LUNID #Shows LUN IDs that have no datastore name (e.g. RDMs or unused LUNs)

Get the script here

http://communities.vmware.com/docs/DOC-6991

You will need powershell and powercli

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful.
Reply
0 Kudos