Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Virtualization / VMware / Unable to Unmount/Delete VMFS Datastore: The Resource Is in Use

March 12, 2024

Unable to Unmount/Delete VMFS Datastore: The Resource Is in Use

During the migration of virtual machines files from an old HP MSA 2000 storage to a new storage system Dell EMC Unity (both connected to ESXi hosts over SAN) I have come across a problem when trying to remove an empty VMFS Datastore in VMWare vSphere. When trying to unmount the VMFS Datastore from ESXi hosts, an error message appears saying that the datastore is still in use / busy:

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”.

Cannot unmount VMFS Datastore The resource s in use

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 you should check the following points:

  • There are no virtual machine, template, snapshot or ISO image files on VMFS datastore (you must migrate your 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.

The virtual machines have already been moved to a new datastore using VMware Storage vMotion. Let’s see what other files and folders remain on the VMFS datastorage:

system files on vmfs: logdir, sdd.sf? dbsData and naa…

As you can see, there are logdir (a directory with logs), sdd.sf (a directory with the description of SCSI devices), dbsData (a directory with the data of the distributed virtual switch) and naa… (VMFS metadata) folders remained.

In my case, ESXi host logs  are still located in the VMFS datastore (Scratch Location). Check out if the datastore is specified as a location of logs in the ESXi host settings. Go to Manage -> Settings -> Advanced System Settings. Find ScratchConfig.CurrentScratchLocation and Syslog.global.logDir and if your VMFS datastore is specified in it, change the path to the logs directory.

ScratchConfig.CurrentScratchLocation and Syslog.global.logDir

Restart the ESXi host or restart the Syslog Server service on the host.

restart syslog on esxi

Let’s try to unmount the datastore from the ESXi host again. Go to Manage -> Storage -> Storage Device. Find your LUN in the list, select it and click Detaches the selected device from the host.

Detaches the selected LUN device from the vmware esxi host

In my case the error occurred again:
Detach SCSI LUN The resource is in use.

Quite for a long time I was trying to find out who uses this datastore and decided that the easiest way in my case was to delete the partition table of VMFS datastore (of course, you should do it very carefully and make sure that you are removing the right datastore).

  1. Connect over SSH to any ESXi host that has VMFS store mounted;
  2. 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
  3. Let’s see how much space is busy on the VMFS datastore (it’s almost empty): df -h | grep MSA2000_LUN1
    VMFS-5 499.8G 1.4G 498.3G 0% /vmfs/volumes/MSA2000_LUN1
     esxcfg-scsidevs 
  4. So we have made sure that the datastore name and the store ID match the LUN that we want to remove;
  5. Now let’s get check information about partition table on your datastore: partedUtil getptbl /vmfs/devices/disks/naa.6001438005df0dee0000700004be0000
    gpt
    65270 255 63 1048576000
    1 2048 1048575966 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
  6. In this case, the LUN has a single partition with the VMFS file system;
  7. Delete the VMFS partition with the ID 1 from this disk (LUN). Please, be very attentive!!!partedUtil delete /vmfs/devices/disks/naa.6001438005df0dee0000700004be0000 1 partedUtil delete vmfs partition

After deleting the partition, you can unmount the LUN in vSphere – Unmount Datastore. The ‘datastore is in use’ error won’t not appear again.

unmount datastore on vmware esxi

Select the ESXi hosts to unmount the datastore from.

select esxi host to unmount datastore

Or you can make Detach from the list of connected storage devices on the ESXi host. The connection state will then change to Detached.

detach lun on esxi host

After that you can remove the VMFS store (Delete Datastore) and it will disappear from vSphere.

Delete Datastore on vmware esxi host

1 comment
4
Facebook Twitter Google + Pinterest
VMware
previous post
Fix RDP Connection Error ‘CredSSP Encryption Oracle Remediation’
next post
How to Read Windows Update Logs on Windows 10 and 11

Related Reading

Configuring iSCSI Datastore (LUN) on VMware ESXi

March 15, 2024

Adding External USB Storage Drive to VMware ESXi

December 18, 2024

Adding a Sound Card to a Virtual Machine...

March 15, 2024

Windows Cannot Find the Microsoft Software License Terms

April 19, 2023

Match Windows Disks to VMWare VMDK Files

March 12, 2024

How to Access VMFS Datastore from Linux, Windows,...

March 11, 2024

Disable Auto Suspend of VM on VMWare Workstation/Player

August 26, 2021

VMWare: Virtual Machine Disks Consolidation is Needed

March 12, 2024

1 comment

joishw April 11, 2022 - 5:18 pm

Worked a treat for me, thank you very much!

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Invalid State of a Virtual Machine on VMWare ESXi
  • Match Windows Disks to VMWare VMDK Files
  • Configuring USB Devices Passthrough from VMWare ESXi to a Virtual Machine
  • Selecting the Number of vCPUs and Cores for a Virtual Machine
  • How to Enable and Configure SNMP on VMWare ESXi Host
  • How to Stop an Unresponsive (Stuck) Virtual Machine on VMware ESXi
  • VMWare vSphere: Managing Password Expiration Settings
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top