This script is used to find bad blocks on all the locally
attached disks on a Linux system. It determines the default
block size used in each partition and uses this when it runs
badblocks with the -b command line option so that blocks
identified by badblocks can correctly be mapped to filesystem
blocks and hence inodes.
On my RedHat systems, I simply copy this file into
/etc/cron.weekly for it to run on a weekly basis.
This script takes a -p command line option which specifies
the number of times to scan the partitions for bad blocks,
similar to badblocks' -p command line option. However, while
badblocks will skip any previously identified bad blocks on
the current scan, find_badblocks.pl runs badblocks the
specified number of times, so all blocks will be scanned the
same number of times. This allows the user to gauge how bad
the bad blocks are if there are N scans and the same badblock
is found M (<N) times. If the filesystem is an ext2 or
ext3 filesystem, then bad blocks stored in the filesystem's
bad block inode will still be skipped.