Identification and safe removal of orphaned virtual disks (.vmdk), snapshot delta files, and leftover virtual machine folders. These "zombie" objects reside on the physical datastore but lack association with the vCenter Server inventory, leading to storage exhaustion and reporting discrepancies in tools like RVTools.
-rdm.vmdk or -rdmp.vmdk files exist in directories with no registered VM.Orphaned files typically result from:
Removed from Inventory instead of Deleted from Disk.Follow these steps to validate and remove orphaned files. Verify the file is not locked before deletion.
SSH into the ESXi host and list all contents:
ls -lh /vmfs/volumes/<datastore_name>/To list everything recursively and see sizes:
find /vmfs/volumes/<datastore_name>/ -type f -exec ls -lh {} \; | sort -kReplace <datastore_name> with your actual datastore name or its UUID path.
ls /vmfs/volumes/<datastore_name>/ > vmfs-folders.txtCompare this list with the registered VMs.
.vmdk FilesRun this to find .vmdk files not referenced by any registered VM:
find /vmfs/volumes/<datastore_name>/ -name "*.vmdk" > /tmp/vmdk-list.txtThen check for registered VMs that use them:
grep -i "$(basename <file>.vmdk)" /etc/vmware/hostd/vmInventory.xmlIf a .vmdk is not listed anywhere, it is likely orphaned.
Sometimes leftover snapshot delta files remain. Run this command to search for all of the virtual machine configuration files seen by the ESXi host and check if there is a file that looks like a snapshot disk:
find /vmfs/volumes/ -iname "*.vmx" -exec grep -HEie "-[0-9]{6}.vmdk" {} \;Any *-delta.vmdk not tied to a current VM should be investigated.
.vmdk Files to See if They Are Orphanedvmkfstools -i /vmfs/volumes/<datastore>/vm-folder/yourdisk.vmdk -d zeroedthick /tmp/test.vmdkIf it errors out or shows corruption, it is likely orphaned.
You can perform the following actions before deletion:
.old) and observe.rm -i /vmfs/volumes/<datastore>/vm-folder/*.vmdkOr remove entire orphan folders:
rm -r /vmfs/volumes/<datastore>/orphan-folder