Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 want to erase my HDD quickly with dd, so If I only "zeroify" the partition headers , like destroy the inode table, block size etc.

But is that safe?


I have some partition not encrypted (all ext4) , by "safe" I mean there should be no possibility of data recovery

share|improve this question
This is a new definition of the word safe with which I'm not acquainted. – Fiasco Labs Apr 3 '12 at 4:39
You mean that if it is safe, then it must allow data recovery or that it is safe if it does not allow data recovery? This is a really ambiguous use of "safe" that is the issue in this question. We can answer, but we can't answer the "is it safe?" question because what you mean by "safe" sounds ambiguous. – njsg Apr 3 '12 at 6:38
up vote 0 down vote accepted

There's no mystery: the only way to make data recovery impossible is to overwrite everything. If you only overwrite part of the disk, then anyone who then gets access to the disk can recover those parts you didn't overwrite. It may be more or less difficult to find out how those parts are organized, but files do tend to be in continuous chunks (filesystems tend to try not to fragment files too much, because consecutive reads are faster), and most file formats contain recognizable structures.

If you encrypt the data, then it's enough to overwrite the key. In that case the attacker would only get hold of some unexploitable encrypted data. This is why some mobile devices encrypt their storage with a key that isn't difficult to extract: it makes it more likely that remotely wiping a stolen device will succeed (it only takes one slip from the thief to let the device connect to the network and receive the self-destruct order).

Overwriting the data with zeroes is safe. You'll find a lot of recommendations to overwrite multiple times and with random patterns (“Gutmann wipe”), but this is mostly a legend, stemming from a time when drives were simpler and data could be recovered (with a low success rate) in an electronics lab; see How can I reliably erase all information on a hard drive? and Why is writing zeros (or random data) over a hard drive multiple times better than just doing it once?. On flash drives, this is more complex; see Is it enough to only wipe a flash drive once? and Can wiped SSD data be recovered?

share|improve this answer

Safe? Sure. Especially if you do it to the first megabyte of each partition in turn so that you don't have loose metadata that can be picked up after repartitioning.

Secure? Definitely not.

share|improve this answer

If you don't overwrite data, data will remain there, and people won't need to master any ancient art to read that data. Sure, overwriting filesystem metadata will make it harder to get there, but it is still there, as always.

This is security by obscurity.

share|improve this answer

What do you mean by "safe"?

If you mean that you will be able to read/write from the HDD. Yes. Once you repartition and reformat it.

However if you read How are files laid out in ext2/ext3/ext4? you will see that even if all metadata is wiped files can still be recovered.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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