OS-X – secure erase free space at command line

Source: http://www.macworld.com/article/1139688/os-x/erasefreespace.html

man diskutil

Read the secureErase section:

secureErase [freespace] level device
Erase, using a secure method, either a whole-disk (including
any and all partitions), or, only the free space (not in use
for files) on a currently-mounted volume. Erasing a whole-
disk will leave it useless until it is partitioned again.
Erasing freespace on a volume will leave it exactly as it was
from an end-user perspective, with the exception that it will
not be possible to recover deleted files or data using utility
software. If you need to erase all contents of a partition
but not its hosting whole-disk, use the zeroDisk or randomDisk
verbs. Ownership of the affected disk is required.

Level should be one of the following:

o 0 – Single-pass zero-fill erase.

o 1 – Single-pass random-fill erase.

o 2 – US DoD 7-pass secure erase.

o 3 – Gutmann algorithm 35-pass secure erase.

o 4 – US DoE algorithm 3-pass secure erase.

1. Check for the volume you want to address:

1
 
diskutil list

2. secureErase /// freespace only /// mode 1 (single pass) /// device from list

1
 
 sudo diskutil secureErase freespace 1 /dev/disk1