"device or resource busy" error when deleting a datastore
search cancel

"device or resource busy" error when deleting a datastore

book

Article ID: 311779

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

Symptoms:
  • When you browse a datastore, it does not have any files or folders.
  • There are no files or directories present under /vmfs/volumes/DATASTORE_NAME.
  • Deleting a datastore fails.
  • Deleting the partition table of this datastore does not resolve the issue.
  • While deleting or unmounting a datastore, you see these errors similar to:

    Device or Resource Busy

    Or

    The resource 'Datastore Name: Datastore VMFS uuid: <datastore UUID>' is in use. Cannot remove datastore "Datastore Name: <Datastore Name>" VMFS UUID <datastore UUID> because file system is busy. Correct the problem and retry the operation.



    Or

    The resource 'iscsi1' is in use. Cannot unmount volume '<datastore name>' because "One or more virtual machines are still registered on it. Correct the problem and retry the operation.



Environment

VMware vSphere ESXi 8.x
VMware vSphere ESXi 7.x
VMware vSphere ESXi 6.x

Cause

The issue occurs if the datastore being deleted is being actively used/referenced by the VMware ESXi host. This could be caused by some items like:

  • The Datastore is referencing an ISO image (or in case of older VMs Floppy image).
  • The Datastore still has active VM/VM Template references.
  • A Virtual Machine has a snapshot chain that references the datastore.
  • A Virtual Machine has an active Replication ongoing. (You may notice hbr.XXXX files and VM files are getting updated under the Datastore Browser. However, no VMs or Templates running on the Datastore.)

Resolution

The Datastore is referencing an ISO image (or in case of older VMs Floppy image)

This issue 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'.
 
To determine if this is the cause:
  1. Browse to the vCenter Server datastore Inventory.
  2. Select the datastore from the left pane, then click the Virtual Machines tab in the right pane.

    If you have a virtual machine to which the ISO from this datastore is linked, the virtual machine name is listed.
To unmap the ISO:
  1. Right-click the virtual machine and choose Edit Settings.
  2. On the Hardware tab, click the CD/DVD Drive.
  3. In the right pane, de-select the Datastore ISO file.

    Note: Client Device is the default option.
     
  4. Click OK.

The Datastore still has active VM/VM Template references

  1. Browse to the Datastore Inventory on the vCenter Server.
  2. Navigate to the VMs option.
  3. Select the VM Templates in Folders option. 


     
  4. Right click on the VM template and select the Remove from Inventory option.


     
  5. 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).

 

 

 

A Virtual Machine snapshot chain is referencing the Datastore

This issue occurs when a virtual machine resided on the datastore that is attempting to be removed, had a snapshot taken, and then was migrated off of the datastore.
 
To determine if this is the cause:
  1. Determine if any virtual machines that have previously resided, or had disks reside on, this datastore are currently running on snapshots.
    1. Browse to the vCenter Server datastore Inventory.
    2. Select the datastore from the left pane, then click the Virtual Machines tab in the right pane.
  2. Right-click on the Virtual Machine in question and select the Consolidation task to commit the snapshot chain and remove the dependency on the datastore you are trying to remove.

 

A Virtual Machine Replication is ongoing on the Datastore which needs to be unmounted.

Steps to Determine the Issue

  1. Check for Replication Files:

    • Verify if the replication files (hbr.xxxxx) are present in the Datastore.
  2. Validate Replication Status:

    • Access the Site Recovery plugin and open Site Recovery.
    • Navigate to the Replication Tab.
    • Check if the respective VM is listed under replication.

Resolving the Issue

  1. Reconfigure VM Storage:
    • If the VM is confirmed to be in replication, reconfigure the VM to use a different datastore.
  2. Adjust Replication Settings:
    • Alternatively, remove and then add the replication again for the respective VM with another datastore.
    • This action should release the lock on the datastore, allowing it to unmount.

Note: Reconfiguring/Removing the replication for VM on another datastore will initiate the full sync for the VM.

Additional Information

Before removing a datastore, ensure that you:
  • 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
For additional information on removing datastores from the inventory, see: