How to Delete ESXi 6.5 datastore with .locker ScratchLocation


Error

When deleting the datastore with .locker directory = ScratchConfigDir, it cannot be deleted - busy

How to fix

vim-cmd hostsvc/advopt/update UserVars.SuppressShellWarning long 1
vim-cmd hostsvc/advopt/view ScratchConfig.ConfiguredScratchLocation

(vim.option.OptionValue) [
   (vim.option.OptionValue) {
      key = "ScratchConfig.ConfiguredScratchLocation", 
      value = "/vmfs/volumes/5a5d8564-a4e94afa-2926-901b0e6e4600/.locker"
   }
]
  • Now change ScratchConfig.ConfiguredScratchLocation -> /tmp
vim-cmd hostsvc/advopt/update ScratchConfig.ConfiguredScratchLocation string /tmp

cat /etc/vmware/locker.conf
/tmp/.scratch 0
  • Remove .locker
rm -rf /vmfs/volumes/5a5d8564-a4e94afa-2926-901b0e6e4600/.locker
  • Reboot

  • Remove the datastore - Done

Reference

cf. http://adis.ca/entry/2016/partition-esxi-disks-cli/