9 Replies Latest reply on Dec 8, 2017 4:01 AM by colinbonner

    Unable to delete file

    mclark Expert

      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.

        • 1. Re: Unable to delete file
          tomtom901 Expert
          vExpert

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

          • 2. Re: Unable to delete file
            mclark Expert

            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

            • 3. Re: Unable to delete file
              tomtom901 Expert
              vExpert

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

              • 4. Re: Unable to delete file
                mclark Expert

                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

                • 5. Re: Unable to delete file
                  tomtom901 Expert
                  vExpert

                  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,

                  • 6. Re: Unable to delete file
                    mclark Expert

                    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.

                    • 7. Re: Unable to delete file
                      john23 Expert

                      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

                      • 8. Re: Unable to delete file
                        mclark Expert

                        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

                        • 9. Re: Unable to delete file
                          colinbonner Lurker

                          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.