Device or resource busy when trying to delete vmdk on vmfs

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.

Tagged ,

6 thoughts on “Device or resource busy when trying to delete vmdk on vmfs

  1. Semyon says:

    Great info – thank you. Just helped me to avoid rebooting all hosts in my cluster

  2. Anonymous says:

    Hi guys, you can also check out Powergui.
    This will also show you orphaned files. Another thing to check is if any snapshots are preventing you to delete this file.

    And it has loads of pre-built scripts built in so that you don’t have to write your own PowerCLI scripts.

    Have a look. Very helpful to me.

  3. Anonymous says:

    try: touch filename.vmdx
    This works for me!!!

  4. GabrielNar says:

    I had the similar problem and tried Long Path Tool, available at It helped me to solve this problem easily.
    Try it, and you will definitely love this tool. Its free.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: