2012

Data Sanitation

Forward

In the 1990s, Peter Gutman wrote a paper on drive sanitation. We think of hard drives in terms of 1s and 0s, but that's not quite how they work at the physical magnetic layer. If flipping a charge from 1 to zero, the actual magnetic value something like 0.3, although still interpreted as zero on the drive. Gutman theorized it might be possible to recover previously written data, even when over written (perhaps even more than once). He proposed a sanitation method of 35 write passes to "rake" the bits making recovery impossible.

It's unlikely this was feasible even when the paper was written, and modern drives are far more complex. Little effort is required to make data unreadable; a single zero pass is enough. Gutman later stated his paper doesn't apply to modern technology, and 4 random passes is as effective as his 35 pass method. This is what I use: 4 random passes.

It's better not to leave random data on drives, as random data is nearly indistinguishable from encrypted data. Claiming it's random garbage may not be sufficient for deniablility in this day and age. Zero the drive so it's clear there's nothing on it.

Current hard drives have "spare sectors" hidden from the PC. Historically, drives had a few sectors with defects. Instead of worrying consumers, drives silently map the data to a "spare" sector. The origonal data becomes inaccessible, but is still there. A drive overwrite does not clear these spare sectors. Modern hard drives support low level writes, where the drive itself clears information including spare sectors, and the firmware; putting the drive back to a factory state. Most recommend this method these days.

Utilities

Derik's Boot and Nuke is a well known disk utility to wipe drives. It's free and easy to use. I used it for years, but recently it's given me many problems with SATA drives, especially with errors in batch clears. I no longer use it, but it's a good choice if it works for you.

Instead of DBAN, I now use the Gentoo Linux install disk. It's small, with everything needed, without GUI crap taking forever to load.

In Linux naming conventions, hard drives are identified by /dev/sd{x} where {x} is a letter starting with 'a'.

Low Level Wipe

If your drive supports it, consider a low level data wipe. This also clears data the system cannot access. It's quick and (relatively) easy, so if you only use one sanitation method, use this one. However it's like handing the drive over to someone with a smile on their face saying sure, I'll wipe this for you. Do you trust hard drive manufacturers are doing this right? Something to consider.

The first step is to look at the hard drive information using

hdparm -I /dev/sd{x}

Security: 
       Master password revision code = 65534
               supported
       not     enabled
       not     locked
       not     frozen
       not     expired: security count
               supported: enhanced erase
       42min for SECURITY ERASE UNIT. 

Obviously look for support of enhanced erase.

Look for the "frozen" option. A drive self destruct command is EXTREMELY dangerous, thus normally locked by the computer bios. Some computers have an option to unlock it, but I've never seen such a PC. Instead you can unfreeze using hotplug support. Basically unplug the drive (both power and SATA cable while the computer is on) and plug it back in. The drive should display "not frozen".

To do an ATA Security Erase, a hard drive password must be set. Do not use this on a USB hard drive. Setting the password works, but secure delete will fail, causing the drive to brick at next reboot. After the erase, the password is unset again. To set a drive password:

hdparm --user-master u --security-set-pass Illya /dev/sd{x}

Where "Illya" is the password. The password doesn't matter since it's erased along with the drive. Issue the secure erase command:

hdparm --user-master u --security-erase Illya /dev/sd{x}

If your drive supports it, you can try --security-erase-enhanced

Secure Erase Using FreeBSD

In FreeBSD you can issue the secure erase command using camcontrol. Camcontrol also supports enhanced erase. Secure erase is defined as zeroing the drive, while enhanced erase uses bit pattern overwrites - determined and implemented by the drive manufacturer. If your drive supports it and you trust the implementation, use -h instead of -e.

   camcontrol identify ada{x}  ### look up drive info
   camcontrol security ada{x} -s Illya -e Illya

Drive Sanitation

The utility I use is GNU shred. This can sanitize data on the file system level, partition level, or system device level (not the same as hardware itself though). Shred starts and ends with random data, and uses other patterns in the middle (4 passes by default). My preference is 4 random passes, and one zero pass, so a little more work is involved.

shred -n2 -vv /dev/sd{x} && shred -n2 -z -vv /dev/sd{x}

Final Solution

All these steps aside, I also pull the drive platters out of the hard drives. If they have multiple platters, I shuffle them. It only takes about 2 minutes per drive, and the platters hardly take any space. They make pretty coasters as well.


Data Sanitation