Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 1st July 2008, 08:38 PM
Bassman449 Offline
Registered User
 
Join Date: Jul 2006
Posts: 30
Cannot remove file: rm file not found

I have a file on an external hard drive that appears to be corrupted. I tried deleting the file and rm returns
Code:
rm: cannot remove : No such file or directory
If I run ls on the directory I can see the file clearly and running ls --size shows it to take one block.

I need a way to delete this file if anyone has any suggestions I appreciate it.
Reply With Quote
  #2  
Old 1st July 2008, 09:59 PM
sideways's Avatar
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
you can try unlinking it (as root)
Code:
unlink <filename>
or delete it via its inode, change to the directory containing the file and type something like

Code:
find . -inum $(ls -i <filename>) -exec -rm -i {} \;
Reply With Quote
  #3  
Old 1st July 2008, 10:18 PM
Bassman449 Offline
Registered User
 
Join Date: Jul 2006
Posts: 30
I tried both suggestions but I still get the same "No such file or directory" error.
Reply With Quote
  #4  
Old 1st July 2008, 10:22 PM
sidebrnz's Avatar
sidebrnz Offline
Registered User
 
Join Date: Oct 2007
Location: Freedonia
Age: 63
Posts: 2,107
Try using emacs in dired mode. If your drive is at /media/harddrive, you'd use this command:

emacs /media/harddrive

and emacs will allow you to edit the directory itself. It may be that there's a non-printing character in the file name, and if so, simply deleting all the characters in the name and entering a new one may be all you need.
__________________
Registered Linux user #470359 and permanently recovered BOFH.

Any advice in this post is worth exactly what you paid for it.
Reply With Quote
  #5  
Old 1st July 2008, 10:27 PM
sideways's Avatar
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
does 'ls -i <filename>' return anything?

what filesystem do you have on the drive? Your file may have an unusual character in its filename, you can try grepping part of the filename eg 'rm $(ls grep <part of filename)'

or copy and paste on the whole file name, or, easiset method, have you tried deleting it from a graphical window like in nautilus (launch as root if necessary)



edit

the find command should have been
Code:
find . -inum $(ls -i <filename> | cut -d" " -f1) -exec rm -i {} \;

Last edited by sideways; 1st July 2008 at 10:32 PM.
Reply With Quote
  #6  
Old 1st July 2008, 10:39 PM
Bassman449 Offline
Registered User
 
Join Date: Jul 2006
Posts: 30
ls -i filename does return the inode number. I tried removing directly from the inode number returned by ls and received the same error. It is an ext3 filesystem with Fedora 8.

I can't delete from nautilus or anything because it is a server that doesn't have X installed. I've tried deleting the same file from Windows (it's on an external drive) and received a similar error.
Reply With Quote
  #7  
Old 1st July 2008, 10:48 PM
sideways's Avatar
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
so you're in the same directory as the file and ls -i <filename> returns the inode? Maybe try it like this
Code:
find . -maxdepth 1 -inum <inode> -exec rm -i {} \;
That'll prevent a recursive search which may be causing problems.

I didn't know about the emacs metthod, perhaps give it a shot if emacs is installed.
Reply With Quote
  #8  
Old 1st July 2008, 10:53 PM
Bassman449 Offline
Registered User
 
Join Date: Jul 2006
Posts: 30
I tried your last suggestion and the weird part is that I get the line asking for confirmation of the file and it shows the filename correctly, but when you enter 'y' then it gives "cannot remove regular file no such file or directory"

I tried installing emacs but I've never used it before so I was unsure of how to overwrite the read only in dired mode.
Reply With Quote
  #9  
Old 1st July 2008, 11:13 PM
sideways's Avatar
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
I don't know about the emacs mode, but you could just go oldschool and install midnight commander, that's a text based gui file browser, press F8 to delete a file.

Code:
yum install mc
Reply With Quote
  #10  
Old 1st July 2008, 11:28 PM
sidebrnz's Avatar
sidebrnz Offline
Registered User
 
Join Date: Oct 2007
Location: Freedonia
Age: 63
Posts: 2,107
In case you (or anybody else) needs it, here's a tutorial on file management with emacs:

http://xahlee.org/emacs/file_management.html

If you're having permissions trouble, I'd suggest doing the work as root so that you can override them.
__________________
Registered Linux user #470359 and permanently recovered BOFH.

Any advice in this post is worth exactly what you paid for it.
Reply With Quote
  #11  
Old 1st July 2008, 11:43 PM
Bassman449 Offline
Registered User
 
Join Date: Jul 2006
Posts: 30
I tried both mc and emacs and both give the same error. They show the file but if you try to perform any command on that file it gives "no such file or directory"
Reply With Quote
  #12  
Old 1st July 2008, 11:54 PM
sidebrnz's Avatar
sidebrnz Offline
Registered User
 
Join Date: Oct 2007
Location: Freedonia
Age: 63
Posts: 2,107
I gather this drive is connected to a Windows machine. If so, your best bet at this point is probably going to be done on that machine. Ask whoever administers that box to run a scandisk or equivalent on it and see if that helps.
__________________
Registered Linux user #470359 and permanently recovered BOFH.

Any advice in this post is worth exactly what you paid for it.
Reply With Quote
  #13  
Old 1st July 2008, 11:56 PM
Bassman449 Offline
Registered User
 
Join Date: Jul 2006
Posts: 30
no the drive is connected to a Fedora 8 server. It is a samba share so I have tried to delete through explorer but that fails also.
Reply With Quote
  #14  
Old 2nd July 2008, 12:08 AM
sidebrnz's Avatar
sidebrnz Offline
Registered User
 
Join Date: Oct 2007
Location: Freedonia
Age: 63
Posts: 2,107
In that case, you should be about to unmount it, run fsck to correct any corruption then remount it. It's beginning to sound like the corruption isn't in the file itself but in the directory and this might help.
__________________
Registered Linux user #470359 and permanently recovered BOFH.

Any advice in this post is worth exactly what you paid for it.
Reply With Quote
  #15  
Old 22nd June 2012, 03:29 AM
MotherDawg's Avatar
MotherDawg Offline
Registered User
 
Join Date: Sep 2010
Location: Quebec, Canada
Posts: 26
linuxfirefox
Re: Cannot remove file: rm file not found

Hi all,

I had a similar prob with a file named "X0=" created in my user tmp folder when testing one of my script that crashed...

I had tried the inode and all kinds of stuff... Sideways... when I read "mc", I went I'm DumbdumbdumbdumbDumb!

Punched mc, delete file, yes, file full of poop = gone!
Dam it !

Thanks a mill man.

*** Reality is merely an illusion, albeit a very persistent one. -- Albert Einstein
(was he talking about a file named reality ??? Probably not...)
__________________
MotherDawg
I do RPMs
I own crappy boxes
GNU/Linux 3.7.9-104.fc17.i686
Reply With Quote
Reply

Tags
file, remove

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
F7 ks file: cdrom not found alessiof Installation and Live Media 0 8th June 2007 09:26 AM
File not found ??? alpha645 Using Fedora 0 19th December 2006 03:39 PM
XP via Samba locks the file, Lin usr brakes the lock with opening file and file =RW ! marisdembovskis Servers & Networking 2 4th July 2006 09:14 AM
Can not boot new KERNEL > Error 15: File not found > but the file exist marxiano533 Using Fedora 0 22nd June 2006 05:50 PM
File not found by glob galahand Using Fedora 1 23rd May 2006 12:38 PM


Current GMT-time: 04:25 (Friday, 24-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat