[Techtalk] finding bad files

Akkana Peck akkana at shallowsky.com
Mon Apr 13 16:53:07 UTC 2015

Miriam English writes:
> My next thought was that I could do a fake copy of the files on the drive
> out to /dev/null and log the standard output and standard error streams but
> /dev/null can't handle writing directories.

It's only files, not directories, that are showing up as corrupt,
right? In that case you could use find to operate only on files.
Something like this:

find [root_dir] -type f -exec cp "{}" /dev/null \; | tee badfiles.txt 2>&1

Then collect the error messages in badfiles.txt.

I'd worry about the disk, though, in a situation like this.
I assume you've been checking dmesg regularly, to see if there
are any I/O errors showing up there? A lot of files that give errors
on reading sounds like a disk that's on the verge of dying, so I'd
suggest doing very frequent backups if you continue to use the disk.
Or back up everything then reformat and restore: I've had I/O error
problems that mysteriously went away on reformatting.


More information about the Techtalk mailing list