When you try and delete an orphaned vmdk file you get the error:
rm: cannot remove `xxxxxxx-flat.vmdk': Device or resource busy
Cannot delete file [xxxxxx] xxxx/xxxx-flat.vmdk
This may be because
- The file is being used and locked open by a running VM
- The file is an orphan but is still locked by ESX
To check if the file is an orphan (zombie) download RVtools from
and click on the vHealth tab. All files that are potentially orphans are listed here.
If the vmdk is an orphan then one of the ESX hosts will be locking the file. Most likely you’ll have quite a few ESX hosts and rebooting each one until the file unlocks would be painful. Instead you can make use of vmkfstools:
SSH to each ESX host in turn and run the following command:
vmkfstools -L release /vmfs/volumes/xxxxxxxx/xxxxxxx/xxxxxx-flat.vmdk
There are two potential errors:
Could not open /vmfs/volumes/xxxxxxxx/xxxxxxx/xxxxxx-flat.vmdk Command release failed Error: Device or resource busy
Command release failed Error: Inappropriate ioctl for device
The host that gives you this second error is the one that has locked the file.
Migrate off the VMs from the host and place it into maintenance mode and reboot it. Now try and delete the file that was locked. You should find that the file can now be deleted.