Christopher Barry on 5 Jul 2016 13:19:14 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Undeletable file, how to get rid of it?


On Tue, 5 Jul 2016 15:42:22 -0400
Greg Helledy <gregsonh@gra-inc.com> wrote:

>A user found they couldn't delete a directory on their FTP account and 
>called me for help, thinking their permissions had been changed.
>It turns out that the reason is there's a file they uploaded that the
>OS can't delete.
>The FTP server is running on linux; the user's FTP directory is stored 
>on a separate NAS device on the LAN.  It is mounted with cifs at boot.
>
>I've searched for help on this but answers provided seem to focus on
>the case where the filename has spaces or other embedded non-visible 
>characters.  In that case, using Midnight Commander or another program 
>that lets you select and delete the file, works.
>
>I cannot.  MC says "Cannot stat [filename]  No such file or directory
>(2)"
>
>If I type "rm" and the first character of the filename and hit tab,
>the system brings up the rest of the filename properly.  If I then hit 
>enter, I get:
>rm: cannot remove ‘filename’: No such file or directory
>
>This result was unexpected, I don't know what that means:
>touch: cannot touch ‘filename’: No such file or directory
>
>How do I delete a file like this, that's simultaneously there and not 
>there?  Is there any way to prevent this from recurring?
>

Greg,

if this is still unresolved, it may also be that the file is deleted
already, but another process is holding it open.

as root, try:

lsof | grep <filename>

to see.

if it is indeed open, the first column of the output is the program
name, and the second column is the pid of the process holding it open.
kill that process to close it.

It could also be the network link to the NAS went down long enough to
confuse CIFS, and an explicit umount/mount might jiggle the handle...


-- 
Regards,
Christopher
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug