Question: I have just purchased a new CF card for my DSLR. I tested it using Xbench (Mac OS X) and it performs as expected. However, I'd like to do a "surface scan" (moving platter term) to check for "bad sectors" (moving platter term). I could bash script a processes using dd, but I get the feeling that there is a better way out there. My goal is to conclusively know that a memory card (CF, SD, etc.) is safe to use on a photo shoot, and that is doesn't need to be returned before the 30 day vendor policy window expires.

I definitely want Mac solutions given here. I would also like to get a few Linux suggestions. Let's even throw a bone to the windows users just so that this one question can meet everyone's needs.

Answer: 
Reading your comment below the question, I believe [F3](https://github.com/AltraMayor/f3) does exactly what you want. It compiles on Linux/Mac OS X and is also available via Homebrew.
I found this on google, I'm not using sd cards for cameras' storage but instead I got my class 10 32 gigs sdhc sandisk completely corrupted after less then 2 years of use on my samsung galaxy S2.

I am using badblocks to see where the first badblocks start and then I will make partitions around that area if possible. this is my current, very very bad solution :/