Search code examples
vmwarevirtualizationnfsesx

VM files still in NFS Storage after deleting VM from VC


I have a NFS Storage which I use for deploying VMs on my ESX.

I have been creating/deleting vms for a couple of years now on this storage.

But lately I noticed the free space is pretty low. Upon investiging, I found that older vm files( Vms which I deleted more than an year ago).

Any Ideas why the files are not removed from NFS? Or how can I find out which vms are not being used by any esx, so that I can delete them manually.


Solution

  • There's two main ways to remove a VM from your vCenter inventory. The methods being used are UnregisterVM() and Destroy_Task().

    Based on your discovery, I'm assuming you've been unregistering your VMs from inventory.

    If you're ok with PowerShell, there's a pretty straight forward way to remedy this using a community resource: http://www.lucd.info/2016/09/13/orphaned-files-revisited/

    LucD mainly uses the underlying API methods, so if you prefer another language... a majority of the discovery is done for you.