dd if=/dev/zero of=/dev/sda

provides sufficient wiping for our purposes, what is the fastest way to "zero" the drive? I have heard of this "Secure Erase" feature that is built in to hard drives but disabled by the bios. Will it be the fastest way or is there another?

  • 1
    one pass wipe like zero fill is the fastest, secure wipe just means more passes which is much longer process. No one has ever recovered data after a one pass overwrite, so in a sense this is as secure as it gets, more passes is just paranoia....nber.org/sys-admin/overwritten-data-guttman.html – Moab Nov 21 '11 at 16:37

I assume, that hdparm's functionality does what you are referring to as "secure erase":

hdparm --security-erase NULL /dev/sdX

Never actually tried this (so no idea how it scales), tempted to do now though. Hopefully, someone more in the know will comment.

| improve this answer | |

Secure-Erase is a feature found mainly on SSD which may have this feature built into the controller.
On a magnetic disk many claim that if you just zero out a drive (e.g. with tools like dd), data may be recovered by the small magnetic differences between a previous zero and an overwritten one.
But if you overwrite with random data, then I think a single pass will be sufficient to prevent any decent data recovery.
That said the fastest way I found to write random data to a disk is as follows:

cryptsetup create cryptedDEV $DEVICE
# enter any passphrase, no need to remember it
DEVSIZE=$(cryptsetup status cryptedDEV | grep "size:.*sectors" | awk '{print $2*512}')
pv -s $DEVSIZE /dev/zero > /dev/mapper/cryptedDEV
cryptsetup remove cryptedDEV

The scheme is based on the idea of Eric Wheeler with the modification of Kruzi Krypr on linuxglobal.com
cryptsetup creates the random data from /dev/zero very fast.
pv copies the data to the whole disk showing the transfer rate.
I found that erasing a drive is as fast as the drive speed.
Im my case I could erase a USB3 disk with ~60MB/sec.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.