/var/run/log/Datastorex/vm folder/TestVM may report "Input/output error""vmkfstools -V" may not help.
Device or resource busy" and "Input/output error" under /var/run/log.vmkernel.log<timestamp> In(166) Hostd[2099331]: [Originator@6876 sub=Libs opID=esxui-####-#### sid=52bfe141 user=root] DictionaryLoad: Cannot open file "/vmfs/volumes/########-########e-####-###############/***VM/***VM.vmx": Device or resource busy.<timestamp> In(166) Hostd[2099331]: [Originator@6876 sub=Libs opID=esxui-####-#### sid=52bfe141 user=root] FILE:open error on /vmfs/volumes/########-########e-####-###############/***VM/***VM.vmdk: Input/output error<timestamp> In(166) Hostd[2099331]: [Originator@6876 sub=Libs opID=esxui-####-#### sid=52bfe141 user=root] OBJLIB-FILEBE : FileBEOpen: can't open '/vmfs/volumes/########-########e-####-###############/***VM/***VM-flat.vmdk' : Input/output error (327684).2.Deleting file from folder or accessing under /var/run/log/Datastorex/vm folder/TestVM may report "Input/output error" and ": Device or resource busy"
[root@Hostname:/vmfs/volumes//########-########e-####-###############/***VM/***VM/temp] rm -rf ***VM.vmx.lckrm: can't remove '***VM.vmx.lck': Input/output error[root@Hostname/vmfs/volumes//########-########e-####-###############/***mu] less *.vmx|grep vmdk****VM.vmx: Device or resource busy[root@Hostname:/] vmfsfilelockinfo -p /vmfs/volumes########-########e-####-###############/VMname/VMname-flat.vmdkvmfsfilelockinfo Version 2.0Looking for lock owners on "****VM-flat.vmdk""*****VM-flat.vmdk" is locked in Exclusive mode by host having mac address [##:##:##:##:##:##:##']Trying to use information from VMFS HeartbeatHost owning the lock on file is ##:###:##.##, lockMode : ExclusiveTotal time taken : 4.371340672019869 seconds.
This issue is caused due to the file lock. There could be an outdated lock action which is leading to the file or folder deletion task failure.
These files can be locked because the virtual machines are still powered on or because one particular host has a stale lock on the file and/or directory
/var/run/log/vmkernel.log reports Exclusive locks<timestamp> In(182) vmkernel: cpu23:2099451 opID=###)DLX: 2670: vol 'LM Class 2 Prod', lock at 171589632: Lock type: 10C00001. Exclusive Lock(s) held on a file on volume ########-########-####-###############. numHolders:0 gblNumHolders:0, volume state 10,$2. You may observe "Lost previously held disk lock messages" under /var/run/log/vmkernel.log.<timestamp> Wa(180) vmkwarning: cpu24:2099880 opID=###)WARNING: HBX: 5596: Replay of journal <type 6 addr 25165831> on vol 'Datastore#' failed: Lost previously held disk lock<timestamp> Wa(180) vmkwarning: cpu46:2099271 opID=###)WARNING: HBX: 5596: Replay of journal <type 6 addr 25165831> on vol 'Datastore#' failed: Lost previously held disk lock1.Migrate the virtual machines residing on the datastore were files or folders need to be deleted using storage vmotion. Make sure the datastore is free with no VM or VM templates.
2.You may run VOMA using below commands after unmounting the datastores to release the lock.
voma -m vmfs -d /vmfs/devices/disks/naa.00000000000000000000000000:1 -s /tmp/analysis.txt
voma -m vmfs -f fix -d /vmfs/devices/disks/naa.naa.00000000000000000000000000:1 -s /tmp/analysis_fix.txt
Please refer to Using vSphere On-disk Metadata Analyzer (VOMA) to check VMFS metadata consistency
OR
Delete the datastore and recreate with new one. This option is feasible when workload is less and there are less number of Virtual machines to unregister for unmounting the datastore for running the VOMA. See Create a VMFS Datastore