Today, I walked into an issue about deleting a vmdk file from the datastore of Vmware ESX4.1.
“Cannot delete file [DATASTORE] myfile.vmdk”
I got to times this issue due i tried to convert a mechanical machine into a virtual one.
To solve this issue i found out that you have to kill the process of the converted file. You have to use the following commands. This command you need to use SSH enabled otherwise you have to reboot your ESX server to release the processes. An SSH program you can use Putty or equal.
lsof | grep <startfilename>
< you get a result with the file name in it and it has also the PID of the locked file>
Use the follow command to view the processes.
Now you can see that locks the file. with the follow command you can release the file again.
After this you can. go to the store of the file.
cd .\vmfs\volume\<store id / name >
Once you have done this you can restart you conversion.. but i noticed the server which i converted. had many defragmentation needed and also some chkdsk warnings. So as a TIP look first for this issues before migrating to a virtual machine