There's a program called 'badblocks' which tests a drive for, yes, bad blocks, and outputs a list of the blocks it finds (see man badblocks). The output from this program can be fed to mke2fs or whatever or can be output to a file.
I would personally avoid using a disk which reports bad blocks to the OS. These errors tend to get worse.
Edit: Sorry, I was a bit late in hitting submit.