Search shell script to detect unused LUNs


I search a shell script to identifty unused LUNs on my ESX servers. I have 150 LUNs (small LUNs) on each farm and some LUNs are used in RDM mode.

I would like to send the result every day to a capacity planning application.

Thanks in advance.

0 Kudos
2 Replies


I do not think anything like this currently exists.

Best regards,

Edward L. Haletky VMware Communities User Moderator, VMware vExpert 2009, Virtualization Practice Analyst[/url]
Now Available: 'VMware vSphere(TM) and Virtual Infrastructure Security: Securing the Virtual Environment'[/url]
Also available 'VMWare ESX Server in the Enterprise'[/url]
[url=http://www.astroarch.com/wiki/index.php/Blog_Roll]SearchVMware Pro[/url]|Blue Gears[/url]|Top Virtualization Security Links[/url]|Virtualization Security Round Table Podcast[/url]

Edward L. Haletky
vExpert XIV: 2009-2022,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
0 Kudos
Community Manager
Community Manager

I agree with Edward, I don't believe such a script exists today. You could do a few things to retrieve this information by either looking at the vdf -h and correlating between the % free or you could locate all VM(s) and figure out which LUNs do not host any VMs. You also have the option of using the VI API to do something similar and generate a report and it may be easier with the API when dealing with RDMs.

Here's a report I've written in the past that uses the VI API, perhaps it might give you an idea or direction on this report:


William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

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

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

0 Kudos