Deleting the undeletable datastore: The resource is in use; Call “HostDatastoreSystem.RemoveDatastore” for object datastoresystem on ESXi failed

While trying to delete a datastore I receive the error “The resource ‘[VMFS Volume ID]’ is in use”.

After checking the datastore I found a vmware.log file. The contents of this file pointed me to the VM that was using a hardcoded path to the datastore as log.filename parameter in it’s .vmx. Shutting down the VM, editing it’s .vmx with vi quickly fixed this problem.

After this, however, I was still receiving the same error. I decided to try to force the deletion of the datastore. After  browsing through several KB articles (KB2008021, KB1003344, KB1004230) and even trying partedUtil (KB1036609)

and dd (KB1008886)

without success, I was left baffled and empty handed. I decided to sleep on it for 1 night because there was probably something I did wrong or something I overlooked.

The next day brought me the OBVIOUS solution. Because we consolidated our log files a few weeks earlier onto a dedicated LUN, I was pretty sure those settings where correct. I executed the PowerCLI command

Get-VMHost | Get-VMHostAdvancedConfiguration -Name “ScratchConfig.ConfiguredScratchLocation”

to make sure. And indeed, everything seemed OK.

It wasn’t until I executed the command

Get-VMHost | Get-VMHostAdvancedConfiguration -Name “Syslog.Local.DatastorePath”

that I was presented with the obvious truth

A simple

Get-VMHost | Set-VMHostAdvancedConfiguration -Name “Syslog.Local.DatastorePath” -Value “[] /scratch/log/messages”

fixed this config error and after this I had no problem to delete the datastore.

What this experience really thought me is that if VMware says the resource is in use, IT ACTUALLY IS IN USE. This blogpost is a reminder to myself that sometimes taking a step back is better then to dive straight into the problem.

Oh yeah, and of course to READ the error.

Advertisements

About Yuri de Jager
Technology Addict

5 Responses to Deleting the undeletable datastore: The resource is in use; Call “HostDatastoreSystem.RemoveDatastore” for object datastoresystem on ESXi failed

  1. vtote says:

    Great post… some commands in there that will come in really handy.,.. thanks

  2. Alain Cote says:

    I disabled HA on all my clusters to delete the datastore. It was locked because of HA datastore heartbeat.

  3. pureargenis says:

    Used this today, thank you

  4. Tracy V says:

    what command will work in ESXi 5.5?

    Get-VMHost | Get-VMHostAdvancedConfiguration -Name “Syslog.Local.DatastorePath”

    the above command does not work in ESXi 5.5.

  5. engineer says:

    I got the same error, powered off, deleted and removed the vms resided on DS from inventory and DS disappeared.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: