Unable to Delete or Unmount Datastore | The Resource Is in Use

When migrating virtual machine files from an old datastore to a new datastore, you may come across an error message in VMware vSphere which shows that the datastore is still in use / busy. Based on the error, this article will offer solution to fix it securely.

By @Crystal Last Updated March 8, 2023

Why cannot delete datastore in use

When migrating virtual machines files from old datastore to a new datastore and trying to unmount the useless VMFS Datastore from ESXi hosts, you may face the error message as shown below:

You may be wondering "why cannot delete datastore in use?" This error occurs if the datastore is being actively used or referenced by the VMware ESXi host, This could be caused by either:

  • The Datastore is referencing an ISO image (or in case of older VMs Floppy image).
  • The Datastore still has active VM/VM Template references.

In this article, I will explain/troubleshoot the two questions and describe how to fix VMware datastore in use cannot be deleted.

Tips: Before migrating VMware VM, you should backup VMware datastore in case of data loss.

Prerequisites of unmounting VMware datastore

Before removing a datastore, you should ensure that:

  • Unregister all the virtual machine or templates on that datastore.
  • Unmap any ISOs or floppy disks that are stored on the datastore.
  • Remove the datastore from the highest point on the Inventory (In the vCenter Server Datastores view)
  • Verify that the hosts do not display the datastore. If they do display the datastore, click Refresh in the host's Storage section.
  • To identify open files on the datastore that are supposed to be deleted, but appear as open, run this command:
vmkvsitools lsof

Tips: If your datastore is running out of space, you can create a new datastore in VMware or expand vmfs datastore to increase capacity.

How to fix VMware datastore in use cannot delete

To solve the problem of not being able to delete VMware datastore in use, I will perform troubleshooting.

Case 1. The Datastore is referencing an ISO image

This issue of VMware datastore cannot be deleted occurs if the datastore is hosting an ISO that is mapped to a virtual machine on a VMware ESXi host on which this datastore is mounted. Even if you delete the ISO file from the datastore, the ISO link to the virtual machine is not broken. If you try to delete this datastore, you see the error 'Device or Resource Busy'.

First, you should determine if this is the cause, then try to unmap the ISO.

1. Navigate to vCenter Server datastore Inventory.\

2. Select the datastore you want to delete, then choose Virtual Machine in the right pane. The virtual machines to which the ISO from this datastore is linked will be listed now.

3. Right-click the virtual machine and select Edit Settings.

4. Select Hardware >> CD/DVD Drive. Then in the right pane, deselect the Datastore ISO file.

5. Click OK.

Case 2. The Datastore still has active VM/VM Template references

1. Access to Datastore Inventory on the vCenter Server.

2. Navigate to VMs tab. Then select VM Templates in Folders.

3. Right-click the VM template and select Remove from Inventory.

Once the above steps are completed successfully, there should be no more active references to the datastore and you should be able to delete the datastore (or the datastore entry would automatically be taken off the inventory).

During deleting VMware datastore, you should backup VMware VMs first before migrating VMs or removing a VMFS datastore. In order to protect virtual machine data from disaster, you may choose from a variety of virtual machine backup solutions, following 3-2-1 backup rule.

Important: Backup VMware VM files before deleting datastore

VMware built-in features are commonly used for VM backup, in these ways you can manually backup multiple one by one. However, enterprise requires a more efficient and convenient way to centrally backup multiple VMware ESXi virtual machines. For example, a free VMware backup tool – AOMEI Cyber Backup offers centralized VM backup for VMware VMs, which saves you a lot of time and reduces business downtime.

With the reliable backup solution, you can enjoy the following features:

Perpetual Free: you can use AOMEI Cyber Backup Free Edition with no time limit. Support Free ESXi: support both paid and free versions of VMware ESXi. Easy-to-use: backup and restore multiple virtual machines via central console without complicated configuration and reinstallation. Automated VM Backup: schedule flexible backup strategies to automate backups daily, weekly, monthly. Role Assignment: allows one administrator to create sub-accounts with limited privileges. Instant Restore: restore immediately available VMs from any selected restore points.

Please hit the button below to download and use AOMEI Cyber Backup for free:

Download FreewareVMware ESXi & Hyper-V
Secure Download

*You can choose to install this VM backup software on either Windows or Linux system.

1. Bind Devices: Access to AOMEI Cyber Backup web client, navigate to Source Device >> VMware >> Add VMware Device to add vCenter Server or standalone ESXi host. And then click … > Bind Device.

2. Create Backup Task: Navigate to Backup Task > > Create New Task, and then configure Device TypeDeviceTarget, and Schedule.

✢ Device: select VMs on the host within one backup task.

✢ Target: select to back up to a local path, or to a network path.

✢ Schedule: choose to perform full, differential or incremental backup, and automate execution according to the frequency you specified.

3. Run Backup: Click Start Backup and select Add the schedule and start backup now, or Add the schedule only.

✍ While the Free Edition covers most of the VM backup needs, you can also upgrade to enjoy: Batch VM backup & restore: batch backup and restore large numbers of VMs managed by vCenter Server or on standalone ESXi hosts. ✦ Backup Cleanup: Configure retention policy to auto delete the old backup files and save storage space. ✦ Restore to new location: Easily make a clone of a virtual machine in the same or another datastore/host, without reinstalling or configuring a new VM.

Conclusion

After you migrate a VM to another datastore, you are going to remove an empty VMFS Datastore in VMWare vSphere, which may trigger an error “unable to unmount/delete vmfs datastore: the resource is in use”.

To fix the error of VMware datastore in use cannot be deleted, this article describes the possible causes and its solutions. It is possible to be result from the datastore ISO file or active VM/VM Template references.