Mac Erase Free Space

Ccleaner mac erase free spaceFree

If you’re selling an old Mac, a spare hard drive, or you’re just quite paranoid about your deleted data, you’re either familiar with—or should be familiar with—the Erase Free Space button on the Erase tab in Disk Utility (found in your Applications - Utilities folder). When you click this button, you’re presented with three options. How to use Terminal to securely erase free space on a Mac’s drive MMS If you’re selling an old Mac, a spare hard drive, or you’re just quite paranoid about your deleted data, you’re either familiar with—or should be familiar with—the Erase Free Space button on the Erase tab in Disk Utility (found in your Applications - Utilities.

Free

When deleting a file, most operating systems just delete the reference to this file, not its actual content. For illustration, that’s like removing a chapter from a book’s table of contents without actually removing (and shredding) the according pages in the book.

Mac erase free space high sierra

So, in order to really (securely) delete a file on a hard disk, there are basically two methods (simplified; from a technical point of view it’s both the same):

  • Overwrite the file content (i.e. its clusters) with random data
  • Delete the file as usual, empty the trash and overwrite the whole free space on the according hard disk with random data

For the second method, here’s how to do it using Mac OS X:

Mac Disk Utility Erase Free Space

Secure erase free space mac
  1. Delete the file(s) and empty the trash
  2. Find out the device name of the according hard disk by opening a new ‘Terminal’ window and executing the “df” command. For example, for a RAID 1 disk, the path of the disk might be something like “/dev/disk2”
  3. In the opened ‘Terminal’ window, execute:
    diskutil secureErase freespace 1 /dev/disk2
    where “1” stands for “single-pass random-fill erase” and “/dev/disk2” is the disk device (adjust this to match your disk). When prompted, enter the admin’s credentials.

Mac Terminal Erase Free Space

Note that overwriting free space like this takes quite some time depending on the amount of free space there is and how many passes you need (e.g. use “2” for a US DoD 7-pass secure erase or “3” for a Gutmann 35-pass secure erase). For more information about diskutil and its options, see “man diskutils”.