Logging Bad Sectors

Is there a program that will maintain a log of growing bad sectors? I want to measure the regression of my hard drive automatically as opposed to manually taking screenshots.

UPDATE: After running sudo badblocks /dev/sda | wc -l >> num_bad_blocks.log and allowing it to run over night, the file reported I have zero bad blocks. How could there be such a vast difference?


I think you might want to replace your hard drive if you have 300,000+ bad sectors.

However, you should be able to accomplish this by periodically running

sudo badblocks /dev/sda | wc -l >> num_bad_blocks.log

which should total up the number of bad blocks and append that number to a file. You could run this regularly with a cron job.