Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am about to sell my old desktop PC and I am cautious about some of my sensitive information being available to the purchaser, even after reformatting the hard-drive, using data recovery software.

How can I securely wipe the hard drive so that the data on it cannot be recovered?

Although I specifically want help with my Windows PC, it wouldn't hurt if there were suggestions for Macs as well.

share|improve this question
Note that a reformat is indeed absolutely trivial to recover data from. You should definitely run some kind of wipe utility (that I'm sure other answerers will suggest :) – Blorgbeard Jul 16 '09 at 6:07
Hence why I asked the question – Josh Hunt Jul 16 '09 at 6:08
Sorry, I thought your wording might have implied you weren't sure. I mostly wanted to make it nice and clear for anyone else reading :) – Blorgbeard Aug 2 '09 at 11:14
Here is a recipe for the Macintosh that doesn't involve destroying, or even formatting your hard drive: – Jamie Cox Jan 20 '11 at 14:49
Here is a post on IT Security talking about that:… – Shadok Mar 21 '12 at 9:42

10 Answers 10

up vote 59 down vote accepted

Look into Darik's Boot and Nuke. It's a bootable CD which lets you securely erase your hard drives.

share|improve this answer
Good old 'DBAN' as they call it. Great to have around. – John T Jul 16 '09 at 7:39
It says "DBAN will automatically and completely delete the contents of any hard disk that it can detect." Maybe the wording is just confusing: can I pick a single drive for it to erase? (I want to wipe an external drive, not trash my whole computer.) – Nathan Long Apr 25 '10 at 2:55
I like the DOD options for the paranoid but prepare to just waste a day letting the computer do its work... – wag2639 Jun 22 '10 at 8:30
@GorrillaSandwich: DBAN, as I remember it, is meant for you to erase internal hard drives and it runs from the CD as a boot option. You may need to ask your case as a separate question – wag2639 Jun 22 '10 at 8:32
@GorrillaSandwich: DBAN lets you select which drive to wipe on startup. There is an option to just wipe everything, but AFAIR it's not on by default. – sleske Jun 22 '10 at 10:46

Windows7 has a tool called cipher.exe, which can wipe the disk:

The command is simply cipher /w:x:\folder where you would substitute
x:\folder for the location you want wiped, for instance your D:\ 
drive or your C:\Users\Mike Halsey\Music folder.
share|improve this answer
I tried 2 other solutions and this one (so far) is the simplest and good-enough-est. – jcollum Dec 14 '10 at 7:10
As mentioned in a comment to the article, and in the documentation of cipher, the tool itself does not delete anything. You have to delete all data first, and then cipher will overwrite all available space with zeros and ones. – Björn Pollex Aug 26 '11 at 18:12
if cipher overwrites stuff ... then deleting it first is the wrong approach. just point cipher to the folder / files, it overwrites the used space (which is known since the files are still connected to the directory) with random noise ... and after cipher is done you would just delete the (now filled with random noise) file. deleting them first is wrong imho. – akira Aug 27 '11 at 12:26
@akira: It overwrites blocks marked as free by the filesystem (but which might still contain traces of deleted files, swapfile content, etc.). Deleting the files first would be correct. – Ben Voigt Oct 17 '11 at 15:22
@BenVoigt: essentially it does not matter: if you overwrite a known file (by name) sdelete knows the blocks to overwrite. if you want to clear the "free space" then sdelete first tries to allocate a huge file, which occopies all available, remaining blocks, fills them with garbage ... and free the garbage file again. – akira Oct 17 '11 at 16:09

Well, using tools such as DBAN or the like is considered to be mostly pointless and also very time consuming. Generally, you do not need to do anything, but fill the drive with 0x00 (zero bytes / NUL) only once these days, in order to securely prevent the recovery of former data. Doing multiple passes is excessive and mostly useless, let alone filling the drive with random data. The only way you can try to restore anything, after such an operation took place, is with an atomic-force microscope - this is, obviously, an extreme procedure, that will take months for even the smallest JPG file and the error rate (false-positives) is going to be immense (in other words - you won't get anything meaningful out of it). This is even more true for higher capacity models (higher density platters). However, one can only speculate what tech might be in the hands of, say, the NSA, so judge the provided information with that in mind.

So, one of the ultimate software ways (fast, reliable & secure), is a single run (zero-fill) of dd:

dd if=/dev/zero of=/dev/sdX bs=1M

or, if you want to measure progress:

pv < /dev/zero > /dev/sdX

However, there is something called secure erase. This is an established ATA standard. This functionality is integrated into the drive itself. Not only is it even faster than a run of dd (as it's already hardware based and hardware > software, speed wise), it is also more secure, due to the ability of purging original bad sectors that have been reallocated! There are 2 versions: the vanilla (2001 and onwards) and the enhanced one (post 2004). So, if your drive was manufactured roughly 10 years ago - it is already very likely to support this feature.

hdparm --security-set-pass NULL /dev/sdX

hdparm --security-erase NULL /dev/sdX
hdparm --security-erase-enhanced NULL /dev/sdX

Erase away!

share|improve this answer
Just to complete the answer: To run the dd command just boot any Linux distribution from a cd or usb-stick. I can suggest Knoppix, Knoppix-based distributions and grml. – jofel Feb 23 '12 at 9:06
Most people don't realise this. The old guttmann paper most modern wipe software reference assumed you did not know the drive type, and much bigger domains. – Journeyman Geek Feb 23 '12 at 10:05
+1 For mentioning hdparm --security-erase – migu Sep 3 '12 at 9:50
Latter part of comment can be more fully understood by the posting at – jhstuckey Sep 27 '12 at 4:36
Although the dd commentary is dubious without citing references, your remark on DBAN is spot-on, and ATA Secure Erase should be the top-voted answer. – rob Nov 15 '13 at 23:16

As a side note on scenarios when you cannot always format and wipe the disk and have to relinquish ownership of a computer with OS intact (like resigning a job and returning the laptop), Scott Hanselman has noted down a checklist on activities to carry out before giving it up forever.

share|improve this answer
Although your answer may have some merit, it doesn't addresses the original question and would have been more appropriate as a comment. Someone could simply run a file recovery program to recover the files from your "cleared" browser cache, etc. If you want to go this route, you need to do a lot more: do everything in the checklist, image the drive (NOT at the block level, but instead compressing fee space), run ATA Secure Erase, then restore the image back onto the drive. – rob Nov 15 '13 at 23:11

Rather than worry about securely deleting data, an alternative might be to buy a new hard drive and do a clean install of the OS on that.

You can then keep the old hard drive for a while in case you forgot to back something up and eventually recycle it as a second (or third!) drive in your new machine.

share|improve this answer
This answer doesn't really address the "securely erase" part of the question. It would be more appropriate as a comment. – landroni Aug 29 '14 at 12:34
@landroni - indeed, but it's an alternative solution that keeps any potentially sensitive data in the hands of its owner rather than someone else. It was also added back in 2009 when things were a little different (and there may not have even been the ability to add comments back then). – ChrisF Aug 29 '14 at 12:36

The US National Institute of Standards and Technology has some Guidelines for Media Sanitization (PDF). There is a section about purging hard disks:

Purge using Secure Erase. The Secure Erase software can be download from the University of California, San Diego (UCSD) CMRR site.

share|improve this answer
Tried it. Problematic. – jcollum Dec 14 '10 at 6:39

Another suggestion, for Macs, is to use Apple's Disk Utility program. It's included on the OS X install disc, so if you boot from that, you can open Disk Utility, select your drive, and erase it (there are some options for how many times to write over data and such).

share|improve this answer
I think this falls under the "even after reformatting" part of the OP's question. That is, it's not secure enough. – Telemachus Jul 16 '09 at 10:35
The "options for how many times to write over data" actually let you securely erase a drive. You can choose between "overwrite with zeros" (unsecure), "overwrite 7 times" (DoD 5220.22-M-Standard) and "overwrite 35 times" (DoD 5220.22-M-Standard * 5?). – lajuette Jun 22 '10 at 7:48
Overwriting once is plenty, as long as it is really overwritten. That's why the NIST paper says the overwrite should be verified. – MK Jul 15 '15 at 15:01

If you REALLY want to be sure, run the disk through a bansaw. :-)

share|improve this answer
Then you couldn't sell it. – D'Arvit Jun 22 '10 at 8:58
@D'Arvit: if you package it nicely ... :) – akira Dec 14 '10 at 12:39
Yeah, not trying to fun my $150 SSD through a band saw :) – Chris Dutrow Feb 15 '12 at 17:13
This is not really an answer, but more of a funny comment. – p.campbell Oct 15 '13 at 18:21

If you have access to (or are willing to buy) the proper equipment, you may want to consider degaussing the drive. Some organizations require this before machines can be re-used, sold, or given away.

You should be aware that this is likely to render the drive unusable.

share|improve this answer
In the article you linked, you forgot to read the section titled, "Irreversible damage to some media types." ;) – rob Nov 15 '13 at 23:21
@rob: Unless I'm mistaken, the history of the article shows that the section you refer to was added after this answer was entered. Also, damaging the media may not be that bad if you want to be sure the data isn't retrievable. In that case, the seller might have to provide a new drive or take a price hit to sell the system. – GreenMatt Mar 30 '14 at 0:01
I interpreted the question as implying that the drive should be usable after permanently wiping the data. In any case, the section on irreversible damage to some media types has been present in the article at least as far back as 2008 (before the question was posted).… – rob Mar 30 '14 at 5:57
@rob: Well, perhaps I misread the wikipedia article's history. As for keeping the drive operational, there are other answers - most with mor upvotes than mine - which suggest destroying the drive and one which simply suggests replacing it. – GreenMatt Mar 31 '14 at 13:35
Let's be clear: you are only talking about 3 other answers. Of those, the one that does not render the drive inoperable is voted the highest. The 3 lowest-voted answers to this question are the 3 answers that render the drive unusable. It seems you did not realize your solution would make the drive unusable at the time you posted your answer, but it would be nice to update your answer to note the consequences of degaussing a hard drive. That exact drive will never work for you again but perhaps the manufacturer will replace it under warranty--assuming the warranty hasn't expired. – rob Mar 31 '14 at 21:14

Also, if you happen to have lots of important data, the easiest and fastest way can be to physically destroy the medium. A sledgehammer blow is much simpler than overwriting 1TB disk 15 times with random binary patterns.

share|improve this answer
And so much more fun :p – Svish Jul 16 '09 at 7:49
i don't think he'll be able to sell that as 2nd-hand goods if he takes your advice. – icelava Jul 16 '09 at 7:58
"Complete PC for sale. Except hard disk gone." does not sound like a wholesome deal ;-) – icelava Jul 16 '09 at 10:31
"hard drives slightly used". There. – Manu Jul 29 '09 at 23:34
@brice - if there are people who are able and willing to reconstruct your hard drive after you've physically shredded it in order to get your info, then you shouldn't be asking questions like this on a public site, or going outside where the satellites can see you, either. But yes, by all means, soak the platter in acid, then shred it, then burn the shreds, then grind the ashes into powder, then sugar-coat the powder and feed it to insects. – Nathan Long Apr 25 '10 at 2:51

You must log in to answer this question.

protected by nhinkle Apr 21 '11 at 5:22

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .