Bobcares

Steps to fix unable to unmount/delete VMFS Datastore: the resource is in use

by | Nov 10, 2020

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.

unable to unmount delete VMFS Datastore

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.

unable to unmount/delete VMFS Datastore

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:

  1. Connect over SSH to an 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 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
  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 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
  6. In this case, the LUN has a single partition with the VMFS file system.
  7. 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.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF