Orphaned VMDK and zombie files on datastore - VMware vSphere
search cancel

Orphaned VMDK and zombie files on datastore - VMware vSphere

book

Article ID: 404094

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

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.

Symptoms

  • Datastore usage grows despite VM deletions.
  • RVTools identifies "Zombie vmdks" or "Zombie VMs".
  • Large numbers of -rdm.vmdk or -rdmp.vmdk files exist in directories with no registered VM.

Environment

  • VMware vSphere ESXi 7.x, 8.x
  • VMware vCenter Server 7.x, 8.x
  • VMFS and NFS Datastores

Cause

Orphaned files typically result from:

  • VMs being Removed from Inventory instead of Deleted from Disk.
  • RDM LUNs being unmapped or removed at the storage array level before the pointer file is detached from the VM.
  • Failed snapshot consolidation leaving residual delta files.
  • Interrupted Storage vMotion or VM deletion tasks.

Resolution

Follow these steps to validate and remove orphaned files. Verify the file is not locked before deletion.

Note: These steps can be performed while virtual machines are running, provided you verify the file is not currently locked.

1. List All Files and Directories on the Datastore

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 -k

Replace <datastore_name> with your actual datastore name or its UUID path.

2. Check for VM Directories Not Registered in vCenter

ls /vmfs/volumes/<datastore_name>/ > vmfs-folders.txt

Compare this list with the registered VMs.

3. Identify Orphaned .vmdk Files

Run this to find .vmdk files not referenced by any registered VM:

find /vmfs/volumes/<datastore_name>/ -name "*.vmdk" > /tmp/vmdk-list.txt

Then check for registered VMs that use them:

grep -i "$(basename <file>.vmdk)" /etc/vmware/hostd/vmInventory.xml

If a .vmdk is not listed anywhere, it is likely orphaned.

4. Check for Old Snapshots

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.

5. Check the .vmdk Files to See if They Are Orphaned

vmkfstools -i /vmfs/volumes/<datastore>/vm-folder/yourdisk.vmdk -d zeroedthick /tmp/test.vmdk

If it errors out or shows corruption, it is likely orphaned.

IMPORTANT: Never delete files unless you are 100% sure they are not in use.

You can perform the following actions before deletion:

  • Rename suspected orphaned files (e.g., add .old) and observe.
  • Use vCenter > VM > Edit Settings to see which disks are attached.
  • Monitor the environment for 24–48 hours. If no production impact occurs, proceed to cleanup.

To Delete Leftovers (When Confirmed)

rm -i /vmfs/volumes/<datastore>/vm-folder/*.vmdk

Or remove entire orphan folders:

rm -r /vmfs/volumes/<datastore>/orphan-folder

Additional Information