<p>Erasing programs such as Eraser recommend overwriting data maybe 36 times.</p>

<p>As I understand it all data is stored on a hard drive as 1s or 0s.</p>

<p>If an overwrite of random 1s and 0s is carried out once over the whole file then why isn't that enough to remove all traces of the original file?</p>

[{'answer_id': 59668, 'author': 'Scott Dorman', 'author_id': 1559, 'author_profile': 'https://Stackoverflow.com/users/1559', 'pm_score': 0, 'selected': False, 'text': '<p>There are "disk repair" type applications and services that can still read data off a hard drive even after it\'s been formatted, so simply overwriting with random 1s and 0s one time isn\'t sufficient if you really need to securely erase something.</p>\n\n<p>I would say that for the average user, this is more than sufficient, but if you are in a high-security environment (government, military, etc.) then you need a much higher level of "delete" that can pretty effectively guarantee that no data will be recoverable from the drive.</p>\n'}, {'answer_id': 59669, 'author': 'DGentry', 'author_id': 4761, 'author_profile': 'https://Stackoverflow.com/users/4761', 'pm_score': 6, 'selected': True, 'text': '<p>A hard drive bit which used to be a 0, and is then changed to a \'1\', has a slightly weaker magnetic field than one which used to be a 1 and was then written to 1 again. With sensitive equipment the previous contents of each bit can be discerned with a reasonable degree of accuracy, by measuring the slight variances in strength. The result won\'t be exactly correct and there will be errors, but a good portion of the previous contents can be retrieved.</p>\n\n<p>By the time you\'ve scribbled over the bits 35 times, it is effectively impossible to discern what used to be there.</p>\n\n<p><b>Edit:</b> <a href="http://www.h-online.com/news/Secure-deletion-a-single-overwrite-will-do-it--/112432" rel="noreferrer">A modern analysis</a> shows that a single overwritten bit can be recovered with only 56% accuracy. Trying to recover an entire byte is only accurate 0.97% of the time. So I was just repeating an urban legend. Overwriting multiple times might have been necessary when working with floppy disks or some other medium, but hard disks do not need it.</p>\n'}, {'answer_id': 59692, 'author': 'dotmad', 'author_id': 6060, 'author_profile': 'https://Stackoverflow.com/users/6060', 'pm_score': 2, 'selected': False, 'text': '<p>In conventional terms, when a one is written to disk the media records a one, and when a zero is written the media records a zero. However the actual effect is closer to obtaining a 0.95 when a zero is overwritten with a one, and a 1.05 when a one is overwritten with a one. Normal disk circuitry is set up so that both these values are read as ones, but using specialised circuitry it is possible to work out what previous "layers" contained. The recovery of at least one or two layers of overwritten data isn\'t too hard to perform by reading the signal from the analog head electronics with a high-quality digital sampling oscilloscope, downloading the sampled waveform to a PC, and analysing it in software to recover the previously recorded signal. What the software does is generate an "ideal" read signal and subtract it from what was actually read, leaving as the difference the remnant of the previous signal. Since the analog circuitry in a commercial hard drive is nowhere near the quality of the circuitry in the oscilloscope used to sample the signal, the ability exists to recover a lot of extra information which isn\'t exploited by the hard drive electronics (although with newer channel coding techniques such as PRML (explained further on) which require extensive amounts of signal processing, the use of simple tools such as an oscilloscope to directly recover the data is no longer possible)</p>\n\n<p><a href="http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html" rel="nofollow noreferrer">http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html</a></p>\n'}, {'answer_id': 59694, 'author': 'Bruce the Hoon', 'author_id': 172, 'author_profile': 'https://Stackoverflow.com/users/172', 'pm_score': 1, 'selected': False, 'text': '<p>What we\'re looking at here is called "data remanence." In fact, most of the technologies that overwrite repeatedly are (harmlessly) doing more than what\'s actually necessary.  There have been attempts to recover data from disks that have had data overwritten and with the exception of a few lab cases, there are really no examples of such a technique being successful.  </p>\n\n<p>When we talk about recovery methods, primarily you will see magnetic force microscopy as the silver bullet to get around a casual overwrite but even this has no recorded successes and can be quashed in any case by writing a good pattern of binary data across the region on your magnetic media (as opposed to simple 0000000000s).</p>\n\n<p>Lastly, the 36 (actually 35) overwrites that you are referring to are recognized as dated and unnecessary today as the technique (known as the Gutmann method) was designed to accommodate the various - and usually unknown to the user - encoding methods used in technologies like RLL and MFM which you\'re not likely to run into anyhow.  Even the US government guidelines state the one overwrite is sufficient to delete data, though for administrative purposes they do not consider this acceptable for "sanitization". The suggested reason for this disparity is that "bad" sectors can be marked bad by the disk hardware and not properly overwritten when the time comes to do the overwrite, therefore leaving the possibility open that visual inspection of the disk will be able to recover these regions.</p>\n\n<p>In the end - writing with a 1010101010101010 or fairly random pattern is enough to erase data to the point that known techniques cannot recover it.</p>\n'}, {'answer_id': 59704, 'author': 'Liudvikas Bukys', 'author_id': 5845, 'author_profile': 'https://Stackoverflow.com/users/5845', 'pm_score': 1, 'selected': False, 'text': '<p>"Data Remanence"\nThere\'s a pretty good set of references regarding possible attacks and their actual feasibility on <a href="http://en.wikipedia.org/wiki/Data_remanence" rel="nofollow noreferrer">Wikipedia.</a>\nThere are DoD and NIST standards and recommendations cited there too.\nBottom line, it\'s possible but becoming ever-harder to recover overwritten data from magnetic media.  Nonetheless, some (US-government) standards still require at least multiple overwrites.  Meanwhile, device internals continue to become more complex, and, even after overwriting, a drive or solid-state device may have copies in unexpected (think about bad block handling or flash wear leveling (<a href="http://www.cypherpunks.to/~peter/usenix01_slides.pdf" rel="nofollow noreferrer">see Peter Gutmann</a>).  So the truly worried still destroy drives.</p>\n'}, {'answer_id': 59713, 'author': 'Astra', 'author_id': 5862, 'author_profile': 'https://Stackoverflow.com/users/5862', 'pm_score': 0, 'selected': False, 'text': '<p>The United States has requirements put out regarding the erasure of sensitive information (i.e. Top Secret info) is to destroy the drive.  Basically the drives were put into a machine with a huge magnet and would also physically destroy the drive for disposal.  This is because there is a possibility of reading information on a drive, even being overwritten many times.</p>\n'}, {'answer_id': 60112, 'author': 'Sam Hasler', 'author_id': 2541, 'author_profile': 'https://Stackoverflow.com/users/2541', 'pm_score': 1, 'selected': False, 'text': "<p>I've always wondered why the possibility that the file was previously stored in a different physical location on the disk isn't considered.</p>\n\n<p>For example, if a defrag has just occurred there could easily be a copy of the file that's easily recoverable somewhere else on the disk.</p>\n"}, {'answer_id': 60133, 'author': 'Wedge', 'author_id': 332, 'author_profile': 'https://Stackoverflow.com/users/332', 'pm_score': 2, 'selected': False, 'text': "<p>Imagine a sector of data on the physical disk. Within this sector is a magnetic pattern (a strip) which encodes the bits of data stored in the sector. This pattern is written by a write head which is more or less stationary while the disk rotates beneath it. Now, in order for your hard drive to function properly as a data storage device each time a new magnetic pattern strip is written to a sector it has to reset the magnetic pattern in that sector enough to be readable later. However, it doesn't have to completely erase all evidence of the previous magnetic pattern, it just has to be good enough (and with the amount of error correction used today good enough doesn't have to be all that good). Consider that the write head will not always take the same track as the previous pass over a given sector (it could be skewed a little to the left or the right, it could pass over the sector at a slight angle one way or the other due to vibration, etc.)</p>\n\n<p>What you get is a series of layers of magnetic patterns, with the strongest pattern corresponding to the last data write. With the right instrumentation it may be possible to read this layering of patterns with enough detail to be able to determine some of the data in older layers.</p>\n\n<p>It helps that the data is digital, because once you have extracted the data for a given layer you can determine exactly the magnetic pattern that would have been used to write it to disk and subtract that from the readings (and then do so on the next layer, and the next).</p>\n"}, {'answer_id': 60193, 'author': 'Jesse C. Slicer', 'author_id': 3312, 'author_profile': 'https://Stackoverflow.com/users/3312', 'pm_score': 1, 'selected': False, 'text': "<p>Here's a Gutmann erasing implementation I put together.  It uses the cryptographic random number generator to produce a strong block of random data.</p>\n\n<pre><code>public static void DeleteGutmann(string fileName)\n{\n    var fi = new FileInfo(fileName);\n\n    if (!fi.Exists)\n    {\n        return;\n    }\n\n    const int GutmannPasses = 35;\n    var gutmanns = new byte[GutmannPasses][];\n\n    for (var i = 0; i &lt; gutmanns.Length; i++)\n    {\n        if ((i == 14) || (i == 19) || (i == 25) || (i == 26) || (i == 27))\n        {\n            continue;\n        }\n\n        gutmanns[i] = new byte[fi.Length];\n    }\n\n    using (var rnd = new RNGCryptoServiceProvider())\n    {\n        for (var i = 0L; i &lt; 4; i++)\n        {\n            rnd.GetBytes(gutmanns[i]);\n            rnd.GetBytes(gutmanns[31 + i]);\n        }\n    }\n\n    for (var i = 0L; i &lt; fi.Length;)\n    {\n        gutmanns[4][i] = 0x55;\n        gutmanns[5][i] = 0xAA;\n        gutmanns[6][i] = 0x92;\n        gutmanns[7][i] = 0x49;\n        gutmanns[8][i] = 0x24;\n        gutmanns[10][i] = 0x11;\n        gutmanns[11][i] = 0x22;\n        gutmanns[12][i] = 0x33;\n        gutmanns[13][i] = 0x44;\n        gutmanns[15][i] = 0x66;\n        gutmanns[16][i] = 0x77;\n        gutmanns[17][i] = 0x88;\n        gutmanns[18][i] = 0x99;\n        gutmanns[20][i] = 0xBB;\n        gutmanns[21][i] = 0xCC;\n        gutmanns[22][i] = 0xDD;\n        gutmanns[23][i] = 0xEE;\n        gutmanns[24][i] = 0xFF;\n        gutmanns[28][i] = 0x6D;\n        gutmanns[29][i] = 0xB6;\n        gutmanns[30][i++] = 0xDB;\n        if (i &gt;= fi.Length)\n        {\n            continue;\n        }\n\n        gutmanns[4][i] = 0x55;\n        gutmanns[5][i] = 0xAA;\n        gutmanns[6][i] = 0x49;\n        gutmanns[7][i] = 0x24;\n        gutmanns[8][i] = 0x92;\n        gutmanns[10][i] = 0x11;\n        gutmanns[11][i] = 0x22;\n        gutmanns[12][i] = 0x33;\n        gutmanns[13][i] = 0x44;\n        gutmanns[15][i] = 0x66;\n        gutmanns[16][i] = 0x77;\n        gutmanns[17][i] = 0x88;\n        gutmanns[18][i] = 0x99;\n        gutmanns[20][i] = 0xBB;\n        gutmanns[21][i] = 0xCC;\n        gutmanns[22][i] = 0xDD;\n        gutmanns[23][i] = 0xEE;\n        gutmanns[24][i] = 0xFF;\n        gutmanns[28][i] = 0xB6;\n        gutmanns[29][i] = 0xDB;\n        gutmanns[30][i++] = 0x6D;\n        if (i &gt;= fi.Length)\n        {\n            continue;\n        }\n\n        gutmanns[4][i] = 0x55;\n        gutmanns[5][i] = 0xAA;\n        gutmanns[6][i] = 0x24;\n        gutmanns[7][i] = 0x92;\n        gutmanns[8][i] = 0x49;\n        gutmanns[10][i] = 0x11;\n        gutmanns[11][i] = 0x22;\n        gutmanns[12][i] = 0x33;\n        gutmanns[13][i] = 0x44;\n        gutmanns[15][i] = 0x66;\n        gutmanns[16][i] = 0x77;\n        gutmanns[17][i] = 0x88;\n        gutmanns[18][i] = 0x99;\n        gutmanns[20][i] = 0xBB;\n        gutmanns[21][i] = 0xCC;\n        gutmanns[22][i] = 0xDD;\n        gutmanns[23][i] = 0xEE;\n        gutmanns[24][i] = 0xFF;\n        gutmanns[28][i] = 0xDB;\n        gutmanns[29][i] = 0x6D;\n        gutmanns[30][i++] = 0xB6;\n    }\n\n    gutmanns[14] = gutmanns[4];\n    gutmanns[19] = gutmanns[5];\n    gutmanns[25] = gutmanns[6];\n    gutmanns[26] = gutmanns[7];\n    gutmanns[27] = gutmanns[8];\n\n    Stream s;\n\n    try\n    {\n        s = new FileStream(\n            fi.FullName,\n            FileMode.Open,\n            FileAccess.Write,\n            FileShare.None,\n            (int)fi.Length,\n            FileOptions.DeleteOnClose | FileOptions.RandomAccess | FileOptions.WriteThrough);\n    }\n    catch (UnauthorizedAccessException)\n    {\n        return;\n    }\n    catch (IOException)\n    {\n        return;\n    }\n\n    using (s)\n    {\n        if (!s.CanSeek || !s.CanWrite)\n        {\n            return;\n        }\n\n        for (var i = 0L; i &lt; gutmanns.Length; i++)\n        {\n            s.Seek(0, SeekOrigin.Begin);\n            s.Write(gutmanns[i], 0, gutmanns[i].Length);\n            s.Flush();\n        }\n    }\n}\n</code></pre>\n"}, {'answer_id': 60201, 'author': 'Will M', 'author_id': 4089, 'author_profile': 'https://Stackoverflow.com/users/4089', 'pm_score': 0, 'selected': False, 'text': '<p>See this:  <a href="http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html" rel="nofollow noreferrer">Guttman\'s paper</a></p>\n'}, {'answer_id': 67080, 'author': 'Ron', 'author_id': 838924, 'author_profile': 'https://Stackoverflow.com/users/838924', 'pm_score': 2, 'selected': False, 'text': '<p>Daniel Feenberg (an economist at the private National Bureau of Economic Research) claims that the chances of overwritten data being recovered from a modern hard drive amount to "urban legend":  </p>\n\n<p><a href="http://www.nber.org/sys-admin/overwritten-data-guttman.html" rel="nofollow noreferrer">Can Intelligence Agencies Read Overwritten Data?</a></p>\n\n<p>So theoretically overwriting the file once with zeroes would be sufficent.</p>\n'}, {'answer_id': 634273, 'author': 'MSalters', 'author_id': 15416, 'author_profile': 'https://Stackoverflow.com/users/15416', 'pm_score': 2, 'selected': False, 'text': '<p>The reason why you want this is <em>not</em> harddisks, but <strong>SSDs</strong>. They remap clusters without telling the OS or filesystem drivers. This is done for wear-leveling purposes. So, the chances are quite high that the 0 bit written goes to a different place than the previous 1. Removing the SSD controller and reading the raw flash chips is well within the reach of even corporate espionage. But with 36 full disk overwrites, the wear leveling will likely have cycled through all spare blocks a few times.</p>\n'}, {'answer_id': 26194269, 'author': 'Jim Mulder', 'author_id': 4108761, 'author_profile': 'https://Stackoverflow.com/users/4108761', 'pm_score': 0, 'selected': False, 'text': "<p>Just invert the bits so that 1's are written to all 0's and 0's are written to all 1's then zero it all out that should get rid of any variable in the magnetic field and only takes 2 passes. </p>\n"}]
['https://Stackoverflow.com/questions/59656', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6164/']