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

My question is simple: How does the operating system (Linux or Windows) delete data from my HDD?

I can imagine two ways:

  1. 'physical way': Really delete the data by putting the memory adresses of the data all to zero. For example if somewhere on my HDD the data looks like 1010...010 afterwards it will look like 0000...000

  2. Keep the data but allow to overwrite it.

share|improve this question

closed as too broad by random May 26 '14 at 21:58

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

If you're worried, you should buy one of these:… – Radu Murzea May 26 '14 at 14:39

Talking about "data" is too broad, but it's pretty obvious you are actually talking about files. You need to be aware that files are usually stored in filesystems. Although there are differences, this generally means there's a tree structure of paths, representing either files or directories, and files are assigned space on the hard disks where its contents are stored.

Commands such as rm simply remove the file, i.e. the entry in the tree: they mark the parent directory as having one less child. At the address where the file was, and where the file's contents were, nothing changes.

However, there are also commands such as shred, which actually overwrite the file's contents, so that it (ideally) can't be restored. This is actually harder than the former, because it's not guaranteed that the same sectors are used for storing the overwriting data, and because physically, the magnetic data on the disk is not simply binary. Also, such tools do not simply zero out the data but overwrite it multiple times with patterns or random data, to make it physically harder to restore.

So, there are both options you mentioned, but the everyday deletion is simply removing the pointer to the actual data.

share|improve this answer

You've pretty much answered your own question. When the OS deletes it marks the space used by the file as "re-usable". More secure "deletes" will overwrite the file blocks. This is also the same with "quick" and "full" disk formats

share|improve this answer

The second way. The filesystem on your hardrive has a master file table, this is a basically an index that tells which sector holds which file. If a file is deleted then the entry is erased from that table and the sectors can be used for new files. The old data is still there, and can be recovered unless it gets overwritten.

share|improve this answer

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