How to clean up server's hard disks before giving it away?

I am going to sell a Linux server to a random person. For obvious reasons I want to clean up the hard disks so that the current data on the disk can never be retrieved. What is the safest way to do so? OS re-install? rm -rf *? or something else?

The server is colocated and I don't have physical access.


Solution 1:

shred -z /dev/sdX

This will overwrite the hard disk three times with random data, and write zeros to the disk on a final fourth pass. You can adjust the number of passes with the -n option. man shred for more options.

Solution 2:

DBAN.

Or, if you want something a bit more simple (but theoretically less secure), fire up a livecd and do:

$ dd if=/dev/zero of=/dev/sdX