I just found an external HDD in my shelf and want to sell it :-) Before this, I tried to delete all the files on the HDD, but the disk utility of Snow Leopard aborted with a known error "Disk Erase failed with the error: POSIX reports: The operation couldn't be completed. Cannot allocate memory". So I used the terminal (as described here) to delete the files on the HDD. Now my question is: is there a (freeware) tool to check whether the HDD works well? I don't want to (accidantely) sell a broken HDD
Why not use Disk Utility to write zeroes or if you have more time, interest in being sure it works repeatable, set it to write more passes of random data.
The drive will report IO errors in the system.log if there are hardware errors. If you have an SSD or want a tool to read back the random bits to ensure everything not only wrote properly, but can be read back with perfect fidelity, see the free tool stressdrive written by rentzsch.
You might also like to read over What is the best free hard drive diagnostics app for Mac OS X?