Error: "Device or Resource Busy" while attempting to delete a Datastore.
book
Article ID: 311779
calendar_today
Updated On:
Products
VMware vCenter ServerVMware 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.
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.)
The Datastore is part of the Heartbeat selection in HA configuration.
The Datastore is being used as the "persistent scratch location" for logging.
The Datastore is being used as a location for VCLS vms.
The Datastore is configured for SIOC.
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:
Browse to the vCenter Server datastore Inventory.
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:
Right-click the virtual machine and choose Edit Settings.
On the Hardware tab, click the CD/DVD Drive.
In the right pane, de-select the Datastore ISO file.
The Datastore still has active VM/VM Template references
Browse to the Datastore Inventory on the vCenter Server.
Navigate to the VMs option.
Select the VM Templates in Folders option.
Right click on the VM template and select the Remove from Inventory option.
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:
Determine if any virtual machines that have previously resided, or had disks reside on, this datastore are currently running on snapshots.
Browse to the vCenter Server datastore Inventory.
Select the datastore from the left pane, then click the Virtual Machines tab in the right pane.
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
Check for Replication Files:
Verify if the replication files (hbr.xxxxx) are present in the Datastore.
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
Reconfigure VM Storage:
If the VM is confirmed to be in replication, reconfigure the VM to use a different datastore.
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.
The Datastore is part of the Heartbeat selection in HA configuration
How to disable Datastore Heartbeating
Right click Cluster object.
Click “Edit Settings”
Click “Datastore Heartbeating”
Click "Use datastores only from the specified list"
Do not select any datastores.
The Datastore is being used as "persistent scratch location"
From the vSphere Client, connect to the vCenter Server.
Select the host in the inventory.
Click the Configure tab.
Select System.
Select Advanced System Settings.
The setting ScratchConfig.CurrentScratchLocation shows the current location of the scratch partition.
In the ScratchConfig.ConfiguredScratchLocation text box, enter a new directory path that is unique for this host.
For example, /vmfs/volumes/DatastoreUUID/DatastoreFolder.
Reboot the host for the changes to take effect.
The Datastore is being used as a location for VCLS VMs
The Datastore is being used as a location for VCLS vms.