2014-01-04

How to Securely Delete a Harddisk

File systems usually do not really delete data on the hard disk if a file is being deleted by the operating system. Instead, the sectors that were used by the file are marked as no longer in use but the data stays on the disk and can be recovered. Physical deletion requires the sectors to be overwritten.

But even if sectors were overwritten there may still be chances to extract old data. That may be a expensive process which requires a professional lab but some data is worth the effort.

Therefore, secure data deletion requires more than just overwrite data once. It requires the sectors to be overwritten multiple times and best with special data patterns.

A Linux tool that can achieve that is scrub. Scrub overwrites hard disks, files, and other devices with special data patterns to make data recovery more difficult or maybe even impossible. Therefore, it can overwrite the disk with different patterns, e.g., according to U.S. NNSA Policy Letter NAP-14.1-C, U.S. DoD 5220.22-M, Roy Pfitzner's 7-random-pass method, or the pattern defined by the German Center of Security in Information Technologies (Bundesamt für Sicherheit in der Informationstechnik, BSI).

Install Scrub on Debian Linux:

sudo apt-get install scrub

Erasing Disks With Scrub

Scrub requires a file or device name and optionally the parameter -p (pattern) to select a certain pattern algorithm. In the example below, the hard disk /dev/sdc is overwritten with patterns defined by DoD 5220.22-M.

sudo scrub -p dod /dev/sdc

As you can see, secure data deletion is an easy task. The only drawback is the large amount of time required for overwriting a disk multiple times.

Further reading:

[1] Peter Gutmann, Secure Deletion of Data from Magnetic and Solid-State Memory
[2] scrub(1) - Linux man page