Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to remove a file that is corrupted?

In Linux (Fedora based), when I type: ls -l I get

drwxr-xr-x.  2 dmiller3 dmiller3     4096 Jul 26 13:57 SomeFile
??????????   ? ? ?                   4096 Jul 26 13:57 CorruptedFile  

I can't do anything with this CorruptedFile. I can't use it in delete or anything. It's the only file in the entire system that is like this. What causes this, and how can I remove it?

File system is ext2.

share|improve this question
I removed the 'Fedora' tag because this isn't really specific to your distro – xenoterracide Sep 2 '10 at 17:43
Have you tried running fsck on the unmounted partition? – starblue Sep 2 '10 at 21:14
up vote 7 down vote accepted

you could have been writing to a file during a hard reset, or your hard drive could have problems. a fsck should fix it (you will have to umount the fs to do this). I'd check dmesg and smartctl -a /dev/hdx (latter is part of smartmontools ) to see if your HD is reporting any errors. I'd also run a non-destructive badblocks on the partition.

You should also ask yourself why you are running ext2, because journaling tends to help with these kinds of problems.

share|improve this answer
Thanks. Reason why we use ext2 is because it came from the vendor this way. It's a custom distro based on Fedora for embedded systems. You solution worked. – Dennis Miller Sep 2 '10 at 18:25

Some entertaining problems with filesystems I've seen were:

  • A file that only shows up when asked for specifically: "ls file" shows it, but a plain "ls" doesn't. What happened is that the next file had the escape sequence for "Go up a line" in its name
  • Files with impossible permissions/type: Fixed by a fsck(8), or just blowing the file away with rm(1)
  • Very deep directory tree, created by a miscreant creating directories and cd'ing into them in a loop: Had to write a program that went down to the end, and then backed up deleting a directory in a loop.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.