Skip to contentSkip to conversation

How to remove a corrupted dir in an ext4 FS?

DISCUSSION Jesus Sanchez Melendro 3 participants 3 messages Oct 24, 2010 – Oct 25, 2010

lore
Share & tools
lore
#0 lore raw

After a corruption in an ext4 filesystem, I've checked and moved to the correct position all the files and dirs in lost+found, but one of the dirs is corrupted.

The "ls -l" command says:
d????????? ? ? ? ? ? /lost+found/#90116

If I try to remove it with "rmdir" or "rm -rf" or "mv" or "unlink", all commands say:
<command used>: failed to remove `#90116': Input/output error

Running "fsck" says that the filesystem is OK.

Is there a way to remove that corrupted dir?

#1 lore raw
Quoted 7 lines · Jesus Sanchez Melendro

After a corruption in an ext4 filesystem, I've checked and moved to the correct position all the files and dirs in lost+found, but one of the dirs is corrupted.

The "ls -l" command says:
d????????? ? ? ? ? ? /lost+found/#90116

Quoted 7 lines

If I try to remove it with "rmdir" or "rm -rf" or "mv" or "unlink", all commands say:
<command used>: failed to remove `#90116': Input/output error

Running "fsck" says that the filesystem is OK.

Is there a way to remove that corrupted dir?

You can probably check "lsattr /lost+found/#90116" to see if either the "i" (immutable) or "a" (append-only) attribute is set. If yes, then running "chattr -i -a/lost+found/#90116" will remove those attributes, and it should be removable.

Cheers, Andreas

#2 lore raw
Quoted 12 lines · Andreas Dilger
Quoted 11 lines · Jesus Sanchez Melendro

After a corruption in an ext4 filesystem, I've checked and moved to the correct position all the files and dirs in lost+found, but one of the dirs is corrupted.

The "ls -l" command says:
d????????? ? ? ? ? ? /lost+found/#90116

If I try to remove it with "rmdir" or "rm -rf" or "mv" or "unlink", all commands say:
<command used>: failed to remove `#90116': Input/output error

Quoted 8 lines
Quoted 3 lines

Running "fsck" says that the filesystem is OK.

Is there a way to remove that corrupted dir?

You can probably check "lsattr /lost+found/#90116" to see if either the "i" (immutable) or "a" (append-only) attribute is set. If yes, then running "chattr -i -a/lost+found/#90116" will remove those attributes, and it should be removable.

If it was an immutable or apppend-only attribute, it should have resulted in a "Operation not permitted" error. I suspect the problem may be an underlying disk error. You might want to check "dmesg", and see if the hard drive is reporting I/O errors. It may very well be that you have problems a lot more serious than just a corrupted file system. If so, you might want to consider making an immediate backup right away, and strongly consider replacing the hard drive if you find I/O errors in your system logs.

- Ted