Secure erase drive in Single User Mode

Solution 1:

Normally from the command line, you would use the diskutil command with the zeroDisk, randomDisk or secureErase options to securely wipe a disk. However, I would imagine this doesn't work on the disk you've just booted from. So I suspect you'll either have to find another Mac and connect yours in target disk mode via a Firewire cable, or physically remove the drive and connect it to another Mac using a disk caddy, to wipe it the way you wish.

Solution 2:

It should be possible to boot an external drive (including the installation DVD) in single user mode:

Hold Option as you turn the power on, select the DVD/HDD with the arrow keys then press and hold Command+S+Return, holding them down until you see the now-familiar-for-you console boot: at which point it would be possible to use a whole disk shredder as mentioned by scottishwildcat.

Solution 3:

Had the same task. And finally I've found the way to do it without other mac.

  1. Boot in single user mode from external hdd / recovery. (see @Ryccardo answer). Note: you can't erase partition you booted from.
  2. Create new partition in place of one you want to erase: newfs_hfs -J 0 /dev/diskXsY Make sure to change X & Y in diskXsY to proper values.
    Note: create with journal (-J option) to override previous journal, which can make impossible to mount partition in single user mode.
  3. Mount created partition.
  4. Fill partition with (random) data. The easiest way is to create large file(s) to occupy all space. You can use openssl rand or dd of=… bs=… count=… as described in answers of this question.
  5. Optional: securely remove created file(s) with srm.

Note: maybe this method will not fully erase data such as previous files' names / dir structures, if such data stored in some system areas of fs. I'm not sure, because I don't know how HFS+ stored. But in my case it's not a problem.