Eli5 how is data deleted


Like where does it go?

In: 3

Data is stored in databases on a server. If data is removed (for instance a user account), it means that it is deleted from that database.

In modern computers, nothing is actually “cleared” when things are deleted. Rather, the reference telling the computer *where to look for that information* is deleted.

It’s like ripping up the post-it note with your ex’s phone number or address. The phone number would still get you to them (if you knew it), and their house hasn’t disappeared. But because you don’t have the note telling you where to look, in a sense, they’re gone *(assuming you don’t memorize it / know where they live by memory)*.

Most of the time, it doesn’t go anywhere. Typically, the computer gives the data a mark that tells it two things: it shouldn’t display the data anymore, and it’s okay to write over the data with something else if it needs extra space. But other than getting that mark, nothing actually happens to the data until it actually gets written over. This is why it’s sometimes possible to un-delete data: if it hasn’t been written over yet, it’s still there.

This also marks the difference between deleting data and *wiping* data. A data wiper first deletes data in the usual way, but then it immediately goes back into the data and writes over it (usually just with a repeating pattern, but the really good ones overwrite it with random junk). That way, the data cannot be recovered easily, because it’s actually gone: something else is there now.

If you want a historical metaphor, back in the days of writing on parchment in ancient monaateries, the actual parchment was very expensive. To save on costs, monasteries got into the practice of scraping the ink off of old parchments they felt were no longer needed, then writing on the now-blank parchment again. A parchment that used to hold one document but now holds another is called a *palimpsest*, and in some ways this is like deleting old data and writing over it.

You can buy a blank book, a pencil, and an eraser. When you write in the book, you put a note in the table of contents:

p2. “Recipe for grandma’s lasagna,”
p7. “Grandma’s will,”
p. 14″Grandma’s horrible secret.”

As long as you have an item in the table of contents, you know you won’t write on that page again.

But let’s say you decide you don’t need to keep Grandma’s Will anymore. So you erase its listing on the table of contents. Now if you go back to the table of contents, you won’t see it anymore. And NEITHER WILL ANYONE ELSE. So now it might still exist, somewhere, but where? And who the hell cares? You’ve decided you don’t need it anymore. Maybe you can find that page by accident, but enh, that’s not really something to worry about unless you REALLY want to hide that page.

The next time you write in the book, you’re looking for a page you can write on. You find the page with grandma’s will on it. But it doesn’t matter, it’s not in the table of contents. So go ahead, grab that eraser, rub out the will, and write on the page.

That’s how file deleting works. You can think of a file as being a page in a book, and when the computer doesn’t need that file anymore, it erases the line in the table of contents. And if the computer wants to write over the pages (or, in this case, file sectors), if it doesn’t see an item in the table of contents protecting that file sector, it will happily write new stuff there.

EDIT to add:

Imporant to remember, though, that if the computer doesn’t write over that file sector, the contents – the words on the page – are all still there. So a determined person can certainly find Grandma’s will again. Just like in your book, until you actually erase it and write over it, it’s still there; it’s just not in the table of contents. Same with computers. The data might not be registered in the file management system, but it’s all still there until it gets overwritten by something else.

Data is hardly ever fully deleted unless you actually destroy the server/hard drive/whatever storage that it’s on, and even then it might not be, just inaccessible. Usually though data is just overwritten with more data or you tell the drive (which is binary at it’s base level) to turn all the 1’s in a sector to 0’s, which is essentially clearing it.