3

Ls -l Commanded on to the directory with IO porblems

So, Basically when I open my media drive, I get an annoying error message from nautilus 'IO Error Can't read 2 files (songs actually)' and same goes with the ls -l command. I believe the file ain't there but somehow it's index is. I have Root access so there is no privilege problem here. Can somebody help me?

Byte Commander
  • 107,489

1 Answers1

4

The simplest way to correct this error is to delete the files -- if they're damaged and unreadable, you lose nothing that's not already gone. This will remove the directory entries so Nautilus won't try to read the files when it opens the folder.

However: the damaged files may indicate problems developing with the storage hardware (hard disk or SSD), or other corruption of the file system on that volume (can be caused by unscheduled shutdown of the computer, especially while files are open). I'd recommend that you use a disk checking utility to verify that the filesystem is otherwise okay, as well as a S.M.A.R.T. reader to check that the hardware isn't failing. If the hardware is going, you stand to lose everything stored on it...

One other recommendation, from comments, is that if the filesystem in question here is NTFS, use only Windows tools to repair it -- even if that means connecting the storage medium to a Windows computer because you won't have Windows on your Ubuntu machine.

Zeiss Ikon
  • 5,128
  • 1
    Great answer. I would only emphasize that logical errors are always more likely with new or old drives so troubleshooting should start with error correction tool and, as commented above by @Rinzwind, If NTFS (...) should use windows tools to fix this. –  Jan 31 '17 at 15:02
  • I won't argue. In fact, I'm going to edit that suggestion into my answer. – Zeiss Ikon Jan 31 '17 at 15:09
  • Actually, i had dual boot but I really forgot about it, Yeah the file system is NTFS and going to the problem from windows solved the problem easily. Thank you Very much for your support guys! – Ubdus Samad Jan 31 '17 at 15:34
  • You can not delete a file with i/o error. – Sergio Abreu Oct 12 '23 at 12:30
  • @SergioAbreu I don't know the nuts and bolts of NTFS, but in FAT based systems, you most certainly can; all you're doing is removing the directory entry and marking the blocks as "empty" in the FAT. If you can't get rid of corrupted files in other systems, the entire drive becomes problematic as soon as a file gets damaged -- so I think there is some way to do it. – Zeiss Ikon Oct 12 '23 at 13:23