VMware ESXi – Cannot delete file from datastore
When you try and delete an orphaned VM or your old VM you get the error:
/vmfs/volumes/57b321fa-349912dc-bc05-90b11c3dbf06/AD_replica # rm AD-flat.vmdk rm: can't remove 'AD-flat.vmdk': Device or resource busy
so let’s try to delete from command line (from ESXi host) but got the error message:“can’t remove ‚AD-flat.vmdk‘: Device or resource busy“ because the file is still locked by ESX
# vmkfstools -L release /vmfs/volumes/IFT_Replica/AD_replica/AD-flat.vmdk Command release failed Error: Inappropriate ioctl for device
you can use the „vmkfstools“ for release locked file… but in my case its not possible „release failed“
Migrate off the VMs from the host and place it into maintenance mode and reboot it. After reboot try delete file, that was locked by ESXi host. For delete whole folder i used rm -rf command on the ESXi host.
(Visited 24 057 times, 7 visits today)
Standard and good solution. Thanks.
you are welcome 🙂