How to exercise a new hard drive by erasing multiple times with Disk Utility app

disk-utilityhard drivesecure-erase

In El Capitan, in the Disk Utility app, I cannot find the option to rewrite bogus data (zeros or ones) across the entire drive multiple times.

I am using a spinning rust platter disk, not an SSD.

Some googling talks about doing this via command-line tools, and imply the feature has been removed from the Disk Utility app.

But the Disk Utility Help window includes step # 4 on the Erase a volume:

To prevent the erased files from being recovered, click Security Options, use the slider to choose how many times to write over the erased data, then click OK.

Where can I find that slider?

Best Answer

The secure erase feature indeed seems to be gone (or it's a bug).

Open Terminal and enter diskutil list to see a list of your attached drives. In the following example, notice a pair of drives are identified: /dev/disk0 (internal) and /dev/disk2 (external) - disk1 is related with the Apple CoreStorage partition disk0s2.

your_prompt_here% diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Mars                    999.7 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Mars                   +999.3 GB   disk1
                                 Logical Volume on disk0s2
                                 E98790BC-D2CA-4FA8-AE28-9DB646C790E0
                                 Unencrypted
/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                  Apple_HFS parallels_bu            999.9 GB   disk2s2

Unmount the disk you want to erase with (below I assume the disk idenitifer is disk2:

diskutil umountDisk /dev/disk2

Then erase the disk with:

diskutil secureErase level /dev/disk2

…where you replace that word level with one of the following:

0 - Single-pass zeros.  
1 - Single-pass random numbers.  
2 - US DoD 7-pass secure erase.  
3 - Gutmann algorithm 35-pass secure erase.  
4 - US DoE 3-pass secure erase.  

Level 0 should be sufficient to rewrite bogus data or map out bad blocks.

If you want to erase the free space on a volume use:

diskutil secureErase freespace level /dev/diskXsY

Ceterum autem censeo Disk Utility 15 esse delendam.