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

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

During the migration of digital machines information from an previous HP MSA 2000 storage to a brand new storage system Dell EMC Unity (each related to ESXi hosts over SAN) I’ve come throughout an issue when attempting to take away an empty VMFS Datastore in VMWare vSphere. When attempting to unmount the VMFS Datastore from ESXi hosts, an error message seems saying that the datastore remains to be in use / busy:

Unmount VMFS quantity vmesxi2.woshub.com. The useful resource 'Datastore Name: MSA2000_LUN1 VMFS uuid: xxxxx--xxxxx-x-xxxxx-xxxx' is in use. Cannot unmount quantity Datastore Name VMFS “file system is busy”.

Cannot unmount VMFS Datastore The resource s in use

Based on the error, it’s clear that the VMFS datastore can’t be eliminated since ESXi hosts or vSphere are nonetheless utilizing storage to write some knowledge. According to the VMWare documentation, when eradicating LUN from vSphere it is best to examine the next factors:

  • There aren’t any digital machine, template, snapshot or ISO picture information on VMFS datastore (you will need to migrate your VMs to one other VMFS Datastore, energy off and take away them, or unregister VMs in vSphere);
  • Storage I/O Control is disabled for datastore;
  • The datastore just isn’t part of the Datastore Cluster;
  • The LUN just isn’t used as an RDM system;
  • VMFS datastore just isn’t used to retailer vSphere HA knowledge, Storage DRS, logs, dumps (/vmkdump/), knowledge (/vsantraced/), technical assist knowledge (scratch partition), or digital machine swap information.

The digital machines have already been moved to a brand new datastore utilizing Storage vMotion. Let’s see what different information and folders stay on the VMFS datastorage:

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

As you’ll be able to see, there are logdir (a listing with logs), sdd.sf (a listing with the outline of SCSI gadgets), dbsData (a listing with the info of the distributed digital swap) and naa… (VMFS metadata) folders remained.

In my case, ESXi host logs  are nonetheless situated 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.PresentScratchLocation and Syslog.international.logDir and in case your VMFS datastore is specified in it, change the trail to the logs listing.

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 strive to unmount the datastore from the ESXi host once more. Go to Manage -> Storage -> Storage Device. Find your LUN in the listing, choose it and click on Detaches the chosen system from the host.

Detaches the selected LUN device from the vmware esxi host

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

Quite for a very long time I used to be attempting to discover out who makes use of this datastore and determined that the best method in my case was to delete the partition desk of VMFS datastore (in fact, it is best to do it very rigorously and just remember to are eradicating the best datastore).

 

  1. Connect over SSH to any ESXi host that has VMFS retailer mounted;
  2. Copy the ID of your datastore in the vSphere interface, and examine on the ESXi host, which system and path to the VMFS retailer it matches: esxcfg-scsidevs -c | grep naa.6001438005df0dee0000700004be0000
    naa.6001438005df0dee0000700004be0000 Direct-Access /vmfs/gadgets/disks/naa. 6001438005df0dee0000700004be0000 512000MB NMP HP Fibre Channel Disk (naa.6001438005df0dee0000700004be0000)
    esxcfg-scsidevs -m | grep naa.6001438005df0dee0000700004be0000
    naa.6001438005df0dee0000700004be0000:1 /vmfs/gadgets/disks/naa.6001438005df0dee0000700004be0000:1 570e5298-08f4c74e-ca3a-b4b52f5e2b38 zero MSA2000_LUN1
  3. Let’s see how a lot area is busy on the VMFS datastore (it’s nearly empty): df -h | grep MSA2000_LUN1
    VMFS-5 499.8G 1.4G 498.3G zero% /vmfs/volumes/MSA2000_LUN1
     esxcfg-scsidevs 
  4. So we now have made positive that the datastore title and the shop ID match the LUN that we would like to take away;
  5. Now let’s get examine details about partition desk in your datastore: partedUtil getptbl /vmfs/gadgets/disks/naa.6001438005df0dee0000700004be0000
    gpt
    65270 255 63 1048576000
    1 2048 1048575966 AA31E02A400F11DB9590000C2911D1B8 vmfs zero
  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/gadgets/disks/naa.6001438005df0dee0000700004be0000 1 partedUtil delete vmfs partition

After deleting the partition, you’ll be able to unmount the LUN in vSphere – Unmount Datastore. The ‘datastore is in use’ error gained’t not seem once more.

unmount datastore on vmware esxi

Select the ESXi hosts to unmount the datastore from.

select esxi host to unmount datastore

Or you may make Detach from the listing of related storage gadgets on the ESXi host. The connection state will then change to Detached.

detach lun on esxi host

After which you can take away the VMFS retailer (Delete Datastore) and it’ll disappear from vSphere.

Delete Datastore on vmware esxi host

Check Also

Wi-Fi Network Disappears After Sleep/Wake/Hibernate in Windows 10

I’ve seen an odd factor that my model new Lenovo laptop computer loses Internet connection …

Leave a Reply

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