As far as I know, in order to securely delete the hard drive's contents, one should fill it with zeroes or, for added security and harder recoverability, random data first and then all zeroes.

In order to get rid of all the data wouldn't be simpler to fill it with all ones, thus minimizing the wear of repeated writes and being sure that all bits on the drive are now uniform and old data couldn't possibly be recovered in this state?

marked as duplicate by Gilles, Stephane, WhiteWinterWolf, Neil Smithline, Ohnana Dec 16 '15 at 16:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 16
    What's your basis for claiming that writing all ones is more beneficial? – Boann May 24 '15 at 20:44
  • 6
    I thought it was because you can do dd if=/dev/zero but not dd if=/dev/one. – Matt Nordhoff May 24 '15 at 20:52
  • Writing zeros or writing ones still entails writing the full sectors back to the disk. The operative being that you are creating a Manchester encoded ECC data stream that is being written to the hard drive surface, not just attempting to demagnetize it. – Fiasco Labs May 24 '15 at 21:03
  • 26
    As usual, an ounce of prevention is worth a pound of cure: if you encrypted the drive before use, all you'd need do is throw away the key, rendering the drive unreadable. – Clockwork-Muse May 24 '15 at 22:10
  • @Clockwork-Muse I would upvote that if I could. – Steve DL May 24 '15 at 22:17
up vote 18 down vote accepted

The reason you write '0' instead of '1' has to do with the way magnetic storage encodes the 0 and the 1. a long explanation of it can be found on Wikipedia under Run-length_limited. In short RLL is the methodology used to store the '1' and '0' and it is more complex than just to store the bit values themselves.

On a side note to make the drive more like it was when it came out of the factory we need to have it store only 0's. (factory default state)

So to securely erase anything on a magnetic storage device you first need to change the magnetic encoded values to a 'stable' state, (that means as many '0' as possible). This makes it harder for anyone to retrieve what was there, and almost impossible for the build-in magnetic Reading head. (only specialist equipment can still reliably retrieve it) To combat 'magnetic memory' you can than write a random pattern to the same location, followed by a zeroing pass, this makes it nigh impossible for software to retrieve the values that were there.

Finally you leave the disc in a state that closely resembles the factory state.

Most of this does not apply to CMOS or SSD technology as long as they do not use magnetism to store the values. There are other techniques to securely erase a CMOS / SSD but that involves overpowering the 'memory' cell to erase all values inside it. (also known as a reset).

Most of the time you do not care about the wear and tear when 'securely' erasing the disk because you simply do not do it that often. and the benefits of the erase outweigh the cost of having to replace your drive a little sooner.

  • 4
    Your claim about combating "magnetic memory" would seem to go counter to the (cited) claims on Wikipedia (and in e.g. NIST 800-88) that with modern magnetic media, more than a single overwrite pass provides no additional protection against data recovery. Can you back up your claim with some sort of authoritative reference? – a CVn May 25 '15 at 7:59
  • 3
    Ah, the 1996 Secure Deletion of Data from Magnetic and Solid-State Memory paper by Peter Gutmann. Did you take the epilogues into account as well? Notice that "at the time the Usenix article was written MFM and RLL was the standard hard drive encoding technique for the installed technology base" and "emergence of PRML and EPRML drives was why ... the rules for the older drives didn't apply any more for the newer technology". – a CVn May 25 '15 at 8:41
  • 1
    Yes, but not from this source. I got that from talking to a HDD Data recovery Expert so I have no link to share of that. The guy told me that when you use a hyper sensitive Magnetic Electron head you can read the individual magnetic state of the atoms in the area, As long as not all of them change when a new write happens, the data can be recoverable (especially true for data that has been stored for a longer time). It is the type of equipment they use to measure quantum magnetism effects, so its in the range of universities and big corporations and governments. I never claimed it is easy. – LvB May 25 '15 at 8:54
  • 1
    Not to mention how hard it is to figure out if the data you read out makes sense - one thing is knowing what you're looking for in advance and interpreting the results of the scans in light of that, another to do a blind study. How would you know which anomalies correspond to older data, which are just random noise, and which are there from 3 erases ago? – Luaan May 25 '15 at 12:38
  • 1
    @LvB Please see the references in the answer quoted by MK below. Your answer appears to be quite a bit out of date, and needs to be corrected. In addition, answers backed by "I was told by an expert" aren't verifiable, and don't really belong here. – Steve Sether Jun 25 '15 at 20:53

If you're talking about modern hard disks (spinning platters, magnetic data), then it doesn't matter what is written as long as something is written. The NIST Special Publication 800-88 Rev 1 contains the relevant guidelines. It's updated and talks about different types of media. Now they do say that the overwrite should be verified (because maybe something didn't work and the overwrite didn't actually completely occur so data recovery is still possible).

"2.4 Trends in Sanitization For storage devices containing magnetic media, a single overwrite pass with a fixed pattern such as binary zeros typically hinders recovery of data even if state of the art laboratory techniques are applied to attempt to retrieve the data..."

From the 2006 version:
"Advancing technology has created a situation that has altered previously held best practices regarding magnetic disk type storage media. Basically the change in track density and the related changes in the storage medium have created a situation where the acts of clearing and purging the media have converged. That is, for ATA disk drives manufactured after 2001 (over 15 GB) clearing by overwriting the media once is adequate to protect the media from both keyboard and laboratory attack." In the revision this whole section was rewritten, but the background hasn't changed.

Here is more reasoning behind it-
"Older disk drives left some space between tracks; data written to a track could occassionally be recovered from this inter-track region using special instruments. Today’s disk drives have a write head that is significantly larger than the read head: tracks are thus overlapping, and there is no longer any recoverable data ‘between’ the tracks."
"Remembrance of Data Passed: A Study of Disk Sanitization Practices" Simson Garfinkel, Abhi Shelat of MIT

Due to the microscopic nature of current HDD internals this may no longer be possible...

I once witnessed an 8" 12MB HDD having most of its data recovered after being "security wiped" with several passes of 0's, then 1's bit patterns. This may have been pre-RLL or RLE.

I do not remember if the method employed had a name, which makes it difficult for me to quote a source until the "major search engine HQ'd in Mountain View, CA" has a direct connection to my failing memory! They are probably working on that, just don't tell the tin-foil hat people that they were right all along OK?... shhhhh lol. [*]

"data recovery by adjusting head alignment" found seven million results, the first few were ads for Data Recovery services. The next few pages I looked at did not match what I had witnessed all those years ago.

As I understood it, the physical track on the cylinder surface was not fully covered by the recording head. This left a residual magnetic trace of 0's and 1's at the 'edges' of each track. So after the "erasure", the engineer slightly changed the head alignment until signals could be viewed on an oscilloscope. At that point a good percentage of the "security erased" data was recovered.

The date was not April 1st, and the engineer, a colleague, had nothing to gain, so if it was a hoax then it was a fairly elaborate one with zero payback.

I am not a hardware 'engineer' so I hope that describes the principle well enough. I am guessing that by using a more random pattern during the erase cycles, that would sufficiently 'garble' the edge of track data to make the method unviable.

I'm afraid the best tool for HDD or SSD data destruction does not run on Windoze, or any OS, not even Linux (gasp!) - First take a 20lb hammer, apply protective goggles and other safety equipment to yourself... then beat the living daylights out of it until it is dust. Then burn the dust. That method also has a side effect; it is said to be great stress reliever!

Just my two cents (two old British 'Pennies' even)


[*] MartinRH's first law of security:-

"A diagnosis of Paranoia is an essential asset... for a security Professional".

  • 8" 12MB HDD? That dates this to at least before 1980 or so, possibly earlier, and makes it comparable to the IBM 353 (2^21 64-bit words = 16 MiB). – a CVn May 24 '15 at 20:22
  • 2
    I would add one further part: use a large magnet or electromagnet (even homemade) to properly wipe it, once the whole hdd is magnetised you can probably discount anyone from being able to extract data. I have in the past seen data retrieved from physically smashed drives by reassembling platters like a jigsaw in a cleanroom and then to then read data from the reconstructed disk, so mag-wiping is always a safe bet. Belt, braces and then dynamite... just to be sure. – GMasucci May 24 '15 at 20:56
  • 2
    ...this may no longer be possible... In general, it isn't. HDD tolerances in the past 15 years or so have become too fine. – user2338816 May 25 '15 at 5:02
  • 1
    @GMasucci I'd add disolving the whole thing in acid, just to be sure. I'd like to see someone solving that jigsaw puzzle :)) – Luaan May 25 '15 at 12:41
  • 2
    Please stop spreading this myth. A 12 MB HD from the 1980s is a completely different animal than a modern HD. – Steve Sether Jun 25 '15 at 20:47

Drives, especially flash based ones like SSDs, thumb drives and flash cards don't write single bits, they write whole blocks of a larger number of bytes. You'd have to rewrite all blocks not containing only zeros anyway, or might ending up rewriting a block multiple times, once for each "one" in there.

Worse, because of wear leveling techniques you can't even be sure a block actually was overwritten, writing everything at least increases chances. Read "Is it enough to only wipe a flash drive once?" for a more detailed discussion.

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