What utility, and how its uses, to check if there's bad blocks in a specific directory

1 Answer 1


I presume you're talking about bad blocks in files?

# drop FS caches to force the kernel to reread files from the disk
echo 3 | sudo tee /proc/sys/vm/drop_caches
# simply read files to RAM
find /directory -type f -exec cat '{}' >/dev/zero \;

If this command completes without showing any error messages on the screen, all the files are readable and there are no bad blocks.

However in some instances this might not be enough because blocks could be readable but not writeable in which case you will have to unmount the entire partition and run badblocks on it in RW mode.

You must log in to answer this question.