When the file *isn’t* deleted, the computer registers it as taking up space. So, the computer won’t get rid of it. When you delete it, the data is still there, but now the computer is like, “OK, I can overwrite this with something else.” To the computer, the space is available. On the hard drive, the space is occupied… until it gets changed with something else.
Files are just a series of zeroes and ones stored in different ways depending on the media. Since there can be potentially millions of files, the computer keeps an index that tells it where to find those bits based on the name. When you delete a file, typically what happens is that only the index entry is removed. It becomes hard to find, but the bits are all still there.
There is software that can scan media and find these “orphaned” files and create an index entry for them, so make them reappear under a different name.
To really delete a file, there is software that saves all zeroes or all ones or all random bits to the same area of the media, causing the informatio to be really lost.
Deleting a file is like crossing it out on a books table of contents and saying you can rewrite on that page again. The data is still there and can now be overwritten since it’s reference is gone. Over time those pages do get used partially by other things which is why when you try to undelete stuff you sometimes get half of an image etc.
Your computer keeps track of its files via a *file system*. The exact details vary, but basically, it’s a system that keeps track of which files are where. When you want to save a new text document, the file system takes that command from your text editor and says “OK, I need to allocate 200 kB for this text document. Where’s the best place to do that?” Once it picks a place to save the file, it takes the information and puts it on the storage device (like, a tiny physical piece of the hard drive or other storage the information will reside on). It keeps a record that file <x> is located at position <y>. When you want to open that file again, your text editor tells the file system “hey, I want this text document” and the file system looks in its record book to see where that’s located, and tells the storage to return the information stored there. If you add up the sizes of all the files that are written down in that record book, that’s how much disk space you’re using.
When you delete a file through a normal way (like the OS delete interface), it doesn’t generally actually go back and erase the information stored on the physical hard drive. There’s no need to do that, and it would take time – a lot of time for big files. Instead, all it does is tell the file system to erase the record of where that file is stored. That means that in the future, the file system doesn’t know there’s information there and can pick that area to store other information – a new file. This is much faster. But it does mean that until and unless a new file is written to that physical location, the information is still there.
Think of it like a massive whiteboard with writing all over the place. People claim bits of the whiteboard and that part is protected – no one else is allowed to write on their section. When you need to write something, you just claim a bit of unclaimed space.
When someone is done with a section, they just say, “Hey, I’m not using this part of the whiteboard anymore. Anyone is free to use it.” They don’t erase what they wrote, but anyone can come along and erase/reuse that part if they need to.
That is how your harddrive works. When a file is ‘deleted’ all that is done is harddrive says that area is available to be written. The data is still there until something comes along and writes over it.
There are ways to _truly_ delete the files – you can write over that section with new data multiple times. If you do **that** the file is truly gone, and this ‘secure delete’ is used for sensitive files. Most of the time, though, it is unnecessary.
Oh boy do I love taking notes^1 . Good thing I have so many pages^2 . Look at all these lines^3 I can fill up with knowledge! But man, I’m always running out of space.
I would like to erase some of my notes^4 to make more room, but erasing takes up *so much time*. I’ll just put a special little mark^5 in the margins to remind myself that I don’t need this note any longer. If later I decide I do need it, I’ll erase the little mark^6 . This way if I ever need to write another note, I know which note I can erase^7 safely!
1. Files
1. Hard drive
1. File system
1. Deleting a file
1. Mark file as Deleted/Recycled
1. Restore file
1. Overwrite a deleted file
Files on a computer are stored on a shiny disk called the hard drive. The computer has a list of where files are stored on the hard drive so it can locate them when the user wants to access them. When you delete a file, the computer deletes it from the list but not the hard drive itself, so it still exists in the memory but cannot be located. It is ‘lost’ in a certain sense. The computer can overwrite old files when creating new files, so eventually the ‘deleted’ file might actually be deleted from the hard drive, if the computer needs the space.
Imagine a vhs tape. You put a movie on it, and you label the tape.
When you don’t need the movie anymore, you just remove the label. No one in your house think there is something in the tape, no one plays it, and you have the entire tape on which you can record something again.
But the movie is still there, until you actually record on top of it.
Well, there’s really two sides to this. There’s deleting, and overwriting.
When you delete a file typically the computer just pretends that the space where that file was is blank. This is why you can recover accidentally deleted files, because the data is still physically on the storage medium.
*Overwriting* is actually writing different data over the top of what was there. This makes it *significantly* harder to recovery as the data has been physically changed.
Theres a lot of depth to both of these topics. Typically when trying to completely delete data you’ll want to do an overwrite pass of where that data was using software. There’s a lot of options for this, CCleaner can do it, DBAN, and a bunch of others.
Some programs will let you view bit level data on a storage drive that’ll make this very easy to visualize
First, you have to understand how files are stored. People think they are stored as a single piece, like a groove on a record album. They aren’t.
They are stored in lots of little pieces all over the drive.
Each piece has a pointer that tells the computer where to find the next piece.
So you start with #1 which points to #2 which goes to #3 and so on. There could be hundreds of little pieces that make up a single file.
When you delete a file, it doesn’t ACTUALLY remove it.
It removes the first pointer, from piece #1 to #2.
After that, the file is invisible to the computer. It can’t find it. It believes the space to be empty.
BUT… The file is still there, in all the little pieces it always was, and it will stay there until the computer over writes the “empty” space with new data.
This is how undelete programs work. They restore that first pointer from piece #1 to piece #2 and the whole file comes back… assuming it wasn’t over-written.
Latest Answers