Cannot delete corrupt file lacking inode on USB drive

I get the following error message when running ls -il on a folder on a USB drive:

ls: cannot access 'ofCpp.h': Bad message
total 0
? -????????? ? ? ? ?            ? ofCpp.h

As you can see there is no inode number or anything else but a filename. It seems the file has been corrupted. Can I delete this file or do I need to format the drive? The following didn't work:

[me@mycomputer src]$ sudo find . -name ofCpp.h -delete 
find: cannot delete ‘./ofCpp.h’: Bad message
[me@mycomputer src]$ sudo rm ofCpp.h 
rm: cannot remove 'ofCpp.h': Bad message

OP in this thread had the same issue but it seem he didn't manage solve it.

what file-system is this? and normal rm -rf don't work?

Backup the files on the usb and reformat

It's ext4

It's done. Do you know what the deal was with this file though? It's somewhat annoying that a single file would cause this much trouble.

do you use file system check when you boot? you my need to check hardware disk drivers for errors.

This is a USB drive so it's mounted after boot.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by