VMware Cloud Community
mclark
Expert
Expert
Jump to solution

Unable to delete file

I have a .vswp file from a long-dead View desktop that I am unable to delete through the datastore browser. All ESXi servers hosting View have been rebooted at least once. The View desktop that the vswp file belonged to does not exist any more. I am able to rename the file and/or move it to another directory but it refuses to let me delete it. When I try to delete it, I get the following error:

"Cannot delete file [datastore] Bad_vswp/Old.vswp"

Any ideas? I thought if there were a lock on it, it would not let me rename or move, but it does. I simply can't delete it.

Reply
0 Kudos
1 Solution

Accepted Solutions
mclark
Expert
Expert
Jump to solution

Got help on this from VMware. The solution is to do "rm -i <file>". For some reason the interactive prompt caused it to work.Here is the site he pointed me to:

https://access.redhat.com/site/discussions/461023

View solution in original post

Reply
0 Kudos
9 Replies
tomtom901
Commander
Commander
Jump to solution

What if you do it via SSH, using rm -f?

Reply
0 Kudos
mclark
Expert
Expert
Jump to solution

Via WinSCP I get:

Command 'rm -f -r "Old.vswp"'

failed with return code 1 and error message

rm: cannot remove 'Old.vswp': No such file or directory.

Via PuTTy I get:

rm: cannot remove 'Old.vswp': No such file or directory

Reply
0 Kudos
tomtom901
Commander
Commander
Jump to solution

Can you do an ls -allh via PuTTY in the datastore directory?

Reply
0 Kudos
mclark
Expert
Expert
Jump to solution

Returns the following:

/vmfs/volumes/VolGUID/Bad_vswp # ls -allh

drwxr-xr-x    1 root     root          420 Dec 23 19:16 .

drwxr-xr-t    1 root     root         5.1k Dec 23 19:16 ..

-rw-------    1 root     root         2.0G May 31  2013 Old.vswp

Reply
0 Kudos
tomtom901
Commander
Commander
Jump to solution

rm -rf Old.vswp should remove the file. Otherwise, I could help you via some kind of remote session, since further troubleshooting is needed.

Hope this helps,

Reply
0 Kudos
mclark
Expert
Expert
Jump to solution

rm -rf Old.vswp gives the same error: "rm: cannot remove 'Old.vswp': No such file or directory"

Thanks for your assistance thus far. I am going to poke around a bit more and will get back with you after the beginning of the year as we will be out for a few days.

Reply
0 Kudos
john23
Commander
Commander
Jump to solution

Just a guess try it out...

dd if=/dev/zero of=Old.vswp bs=1M count=2048 conv=notrunc

After this try to delete it.

-A

Thanks -A Read my blogs: www.openwriteup.com
Reply
0 Kudos
mclark
Expert
Expert
Jump to solution

Got help on this from VMware. The solution is to do "rm -i <file>". For some reason the interactive prompt caused it to work.Here is the site he pointed me to:

https://access.redhat.com/site/discussions/461023

Reply
0 Kudos
colinbonner
Contributor
Contributor
Jump to solution

Just to bump this thread.

I had a nightmare with metadata and datastore corruption warnings, vm's would not start, iso's would sometimes not mount, could not delete datastore, could not delete partitions.  It was on an HPE Proliant G9 server, flattened the RAID array and rebuilt it, re-installed ESXi (6.5) to the USB stick and the datastore was still there!  Performed a delete on the disks from the HP IP utility, reinstalled ESXi again and the datastore was still there!  Booted from a Linux live usb (gparted) and it showed no partitions (perhaps cannot see vmfs).

So it would seem that rebuilding an array and deleting the disks on HPE servers does not get rid of the datastore.

Anyway, I traced the issue to an iso and a vmdk that would not delete. Tried every method mentioned here to no avail.  What eventually worked was to move the files to a newly mounted NFS datastore.  The files actually remained on the original datastore but a rm 'file.ext' deleted them.

Reply
0 Kudos