Webmasters often face the error “unable to unmount/delete vmfs datastore: the resource is in use” while removing an empty VMFS Datastore in VMWare vSphere.
As a part of our Server Management Services, we help our Customers to fix VMware related errors regularly.
Let us today discuss the possible causes and fixes for this error.
What causes the error unable to unmount/delete VMFS Datastore: the resource is in use?
Often while migrating virtual machines files from old storage to a new storage system users faces the error message as shown below:
Unmount VMFS volume vmesxi2.woshub.com. The resource 'Datastore Name: MSA2000_LUN1 VMFS uuid: xxxxx--xxxxx-x-xxxxx-xxxx' is in use. Cannot unmount volume Datastore Name VMFS “file system is busy”.
This generally happens while trying to unmount the VMFS Datastore from ESXi hosts.
Based on the error, it is clear that the VMFS datastore cannot be removed since ESXi hosts or vSphere are still using storage to write some data.
According to the VMWare documentation, when removing LUN from vSphere we should check the following points:
- There are no virtual machine, template, snapshot, or ISO image files on VMFS datastore (we must migrate the VMs to another VMFS Datastore, power off and remove them, or unregister VMs in vSphere)
- Storage I/O Control is disabled for datastore
- The datastore is not a part of the Datastore Cluster
- The LUN is not used as an RDM device
- VMFS datastore is not used to store vSphere HA data, Storage DRS, logs, dumps (/vmkdump/), vSAN data (/vsantraced/), technical support data (scratch partition), or virtual machine swap files.
How to fix the error unable to unmount/delete VMFS Datastore: the resource is in use?
At times, even after moving the virtual machines to a new datastore, the VMFS data storage may still contain some other files and folders.
This may include a directory with logs(logdir), a directory with the description of SCSI devices (sdd.sf), VMFS metadata. etc.
If the ESXi host logs are still located in the VMFS datastore (Scratch Location), we may need to check out if the datastore is specified as a location of logs in the ESXi host settings.
For this, Go to Manage -> Settings -> Advanced System Settings. Find ScratchConfig.CurrentScratchLocation and Syslog.global.logDir. If it specifies the VMFS datastore in it, change the path to the logs directory.
Now, restart the ESXi host or restart the Syslog Server service on the host.
Let us try to unmount the datastore from the ESXi host again. Go to Manage -> Storage -> Storage Device. Find the corresponding LUN in the list, select it, and click Detaches the selected device from the host.
Delete partition table of VMFS datastore
At times, the unmount operation still fails even after changing the paths to the log directory.
We may need to delete the partition table of the VMFS datastore in such cases. This can be done with the steps below:
- Connect over SSH to an ESXi host that has VMFS store mounted.
- Copy the ID of your datastore in the vSphere interface, and check on the ESXi host, which device and path to the VMFS store it matches:
esxcfg-scsidevs -c | grep naa.6001438005df0dee0000700004be0000
naa.6001438005df0dee0000700004be0000 Direct-Access /vmfs/devices/disks/naa. 6001438005df0dee0000700004be0000 512000MB NMP HP Fibre Channel Disk (naa.6001438005df0dee0000700004be0000)
esxcfg-scsidevs -m | grep naa.6001438005df0dee0000700004be0000
naa.6001438005df0dee0000700004be0000:1 /vmfs/devices/disks/naa.6001438005df0dee0000700004be0000:1 570e5298-08f4c74e-ca3a-b4b52f5e2b38 0 MSA2000_LUN1
- Let us see how much space is busy on the VMFS datastore :
df -h | grep MSA2000_LUN1 VMFS-5 499.8G 1.4G 498.3G 0% /vmfs/volumes/MSA2000_LUN1
- So we have made sure that the datastore name and the store ID match the LUN that we want to remove.
- Now let us check information about the partition table on the datastore:
partedUtil getptbl /vmfs/devices/disks/naa.6001438005df0dee0000700004be0000
gpt 65270 255 63 1048576000 1 2048 1048575966 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
- In this case, the LUN has a single partition with the VMFS file system.
- Delete the VMFS partition with ID 1 from this disk (LUN).
partedUtil delete /vmfs/devices/disks/naa.6001438005df0dee0000700004be0000 1
After deleting the partition, we can unmount the LUN in vSphere. The ‘datastore is in use’ error will not appear again.
[Need any further assistance to fix unable to unmount/delete VMFS Datastore: the resource is in use? – We’re available 24*7]
Conclusion
In short, the error “unable to unmount/delete vmfs datastore: the resource is in use” triggers while removing an empty VMFS Datastore in VMWare vSphere. Today, we saw how our Support Engineers fix this error.
0 Comments