How is it possible to "undelete" computer files?
Dear Straight Dope:
If I delete files from my hard drive, how am I able to "undelete" them? Shouldn't they be gone?
Deleting files is sort of like losing your car keys, they're not gone, just lost. A file on your hard drive is more than just a spot on the drive where the data is stored. The computer must also keep track of just where it put the file. It does this by recording the location of the file in the directory that contains the file. When you delete a file, the record of its location is removed from the directory, but nothing really happens to the spot on the drive where the data in the file is actually stored. It's just marked as "free space." If you make another file and use up some of that "free space" that made up the old file, well, you can't get the old file back. But until that point, the original data is still sitting on the drive and and the appropriate piece of magic software can link up all the pieces and recreate the original file.
Some file systems (methods of keeping track of files and directories) even have built-in support for "undeleting," a special operation must be performed before deleted file's space is actually reused. Likewise, there can be file system support for keeping multiple versions of files. Or, contrarywise, high security file systems will take the time to write over the actual data of a file upon deletion so that it can't be "undeleted."
It turns out that faint magnetic traces of the original data can still linger on the spots where a file lives even after the original file has been overwritten multiple times. Someone willing to pay enough money can recover data from a drive that's been not only wiped blank but also subsequently written over, so don't let the CIA get a hold of your old computer. The truly paranoid will use an encrypted filesystem, one that ensures any data written to the disk is scrambled.