Deleting a "lost" file name

I think I have serious disk corruption caused by my backup script. In a certain directory there is a lost file that looks like this:

rw-rw-rw- 1 root sys      593213440 Apr 27 10:21

I've tried to look at this file with FTP explorer but it doesn't show up. I've tried running fsck -s in single user mode as suggested from a support page on the Internet and it should've placed the file in the lost and found folder but did not.

First, you were misled by someone - this isn't a lost file and fsck can't fix it. There's nothing to fix as far as your disk goes - it isn't corrupt or damaged.

This is simply a large file with a name that "ls" can't show you. It HAS a file name- it probably has control characters in it that are confusing the display. Try this:

ls -b
 

That displays "unprintable" characters.

If that doesn't work, do "ls -l > /tmp/t" and then look at /tmp/t with a text editor - can you see the name now?

No? OK, "vi /tmp/t" and move to the line that it is on and type:

:l
 

That is, with your cursor on that line, type a ":" (which drops you to the bottom of the screen) and then type a lowercase "l" (ell) and press ENTER. If all else has failed, THAT will show you precisely what this file name is.

As I said, it probably contains control characters. Here's a similar file I just created on my system:

total 33352
-rw-r--r--    1 apl  apl        0 Jul 22 14:33  
-rw-r--r--    1 apl  apl      251 Jan  6  2010 2words
 

Using "ls -b" shows it's true name:

 \b\b\b
2words
 

It's a space followed by 3 backspace characters. I know the space is there because it doesn't line up with the next name.

Here's what it looks like in /tmp/t:

total 33464
-rw-r--r--    1 apl  apl        0 Jul 22 14:33  ^H^H^H
-rw-r--r--    1 apl  apl      251 Jan  6  2010 2words
 

And when using ":l" in vi

~                                                                               
~                                                                               
-rw-r--r--    1 apl  apl        0 Jul 22 14:33  ^H^H^H$
 

I assume you'd like to get rid of it? Now that you know its name and how long it is (in my example, 4 characters), that's easier.

$ rm -i " ^H^H^H"
remov?  
 

I got those backspaces in there by hitting CTRL-V and then CTRL-H. Notice that the normal "remove xyz?" got partially overwritten by the backspaces in the name.

I could have left out the "-i", of course.

Because I know the length, I could also have done:

rm -i ????
 

That might be easier.

If you can't do that, do "ls -i" to find out the inode number,reboot go to single user mode (or unmount the filesystem if possible), use clri to remove the inode, and then do a fsck.

Finally- fix whatever the heck is wrong with whatever moronic script is doing this- it's completely stupid- if you don't understand the script, post it here and we'll dissect it..


Got something to add? Send me email.





(OLDER) <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Removing an invisible or 'lost' file



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence



Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Keeping URIs so that they will still be around in 2, 20 or 200 or even 2000 years is clearly not as simple as it sounds ... However, all over the Web, webmasters are making decisions which will make it really difficult for themselves in the future. (Tim Berners-Lee)





This post tagged: