Unable to delete the datastore.
Remove datastore fails with error : Cannot remove datastore local swap is enabled on it". Correct the problem and retry the operation
.
var/log/vmware/vpxd/vpxd.log
file, similar entries are seen:--> message = "Cannot remove datastore '<Datastore name>' because local swap is enabled on it. Correct the problem and retry the operation."
VMware vSphere ESXi 6.x
VMware vSphere ESXi 7.x
VMware vSphere ESXi 8.x
Local swap was enabled on the affected datastore "<Datastore name>" preventing datastore deletion.
var/log/vmware/vpxd/vpxd.log
file, similar entries are seen:YYYY-MM-DDTHH:MM.SSSZ error vpxd[2226909] [Originator@6876 sub=Default opID=m5uzjs0y-2285623-auto-1czlm-h5:70132331-3e] [VpxLRO] -- ERROR task-53704 -- 526443f5-5370-e5c5-6cf1-0661ec62694c(52148094-c8cf-d620-cd6a-d83864fd96a3) -- data
storeSystem-37137 -- vim.host.DatastoreSystem.removeDatastore: :vim.fault.ResourceInUse
--> Result:
--> (vim.fault.ResourceInUse) {
--> faultCause = (vmodl.MethodFault) null,
--> faultMessage = (vmodl.LocalizableMessage) [
--> (vmodl.LocalizableMessage) {
--> key = "com.vmware.vim.datastore.error.removeDatastoreFailed",
--> arg = (vmodl.KeyAnyValue) [
--> (vmodl.KeyAnyValue) {
--> key = "name",
--> value = "<Datastore name>"
--> },
--> (vmodl.KeyAnyValue) {
--> key = "reason",
--> value = "localSwapEnabled"
--> }
--> ],
--> message = "Cannot remove datastore '<Datastore name>' because local swap is enabled on it. Correct the problem and retry the operation."
--> }
--> ],
--> type = ,
--> name = "<Datastore name>"
--> msg = "Received SOAP response fault from [<, <UNIX '/var/run/envoy-hgw/hgw-pipe'>>, /hgw/host-37137/vpxa>]: removeDatastore
--> Received SOAP response fault from [<, <TCP 'xxx.x.x.x : xxxx'>>, /sdk>]: removeDatastore
--> The resource '<Datastore name>' is in use."
--> }
--> Args:
-->
--> Arg datastore:
Cluster > configure > configuration > General
. Change the swap file location from 'Virtual machine directory' to "Datastore Specified by Host".host > configure > Virtual Machines > Swap File Location
. Modify the Default swap file location to other datastore.Cluster > configure > configuration > General
. Change the swap file location back to 'Virtual machine directory'