VMware Cloud Community
hi1280
Contributor
Contributor

Script to find RDMs

This is my 1st offical communities post. Hopefully I'm following all the rules. I've followed both community posts that copied below. The rdm.sh posted by (also attached below) at is not producing accurate results for me. It does report back some of my RDM's, but not all. If it's something I'm doing wrong please don't fault lamw, it could just be my environment, please test his script as it did return some results for me. Has anyone (other then a 3rd party app) found a way to script an accurate report on all RDM's? Again below are the links that led me to the rdm.sh script. I'm running ESX 3.5 U4 on a 10 node ESX cluster over FC.

http://communities.vmware.com/thread/131228

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

0 Kudos
5 Replies
lamw
Community Manager
Community Manager

Hi,

I'm the author of rdm.sh, is there any specific correlation you can find that is producing the results of certain RDM's and not others? I've had quite a bit of people use the shell script and haven't had any issues, it could be environmental and perhaps something is throwing off my script ... I know some issues in past scripts are VMs with spaces/etc. which could mess up a grep command if not written defensively.

I also have 2 vSphere SDK for Perl Health Check scripts that has much much more info about VI environment but it also includes a section that captures RDMs:

VI 3.5:

vSphere 4.0:

I could probably whip up a quick vSphere SDK for Perl that only extracts VMs that have RDMs, but the above two scripts should work 100%. Let me know if you have more questions

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
lamw
Community Manager
Community Manager

Here is a specific script that'll locate VMs with RDMs:

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
hi1280
Contributor
Contributor

Question, and I have not tested this yet, but does the script only report RDM's on VM's (guests) hosted on that specific host? Meaning if I copy the rdm.sh to a local directory on that ESX host does it only report back VM's residing on that host with RDM's? I will test now. Thanks in advance for your quick replies and help.

0 Kudos
lamw
Community Manager
Community Manager

The shell script (rdm.sh) only reports RDMs on the ESX(i) host the script is on. The vSphere SDK for Perl script can be pointed to individual ESX(i) or vCenter server and report on the VMs it can see.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
hi1280
Contributor
Contributor

This ended up working for what I needed to do.

find /vmfs/volumes/ -type f -name *vmdk -size -1024k -exec grep -l RawDeviceMap {} \; > /tmp/rdm.csv

then I copied /tmp/rdm.csv to my laptop to view all my rdm's

0 Kudos