When files/folders are deleted the information is not actually removed from your computer. The file still exists, but the space that it exists on becomes free to be written over. However, there are tools that you can use to erase this information completely so that it cannot be recovered. From what I’ve read, these tools actually just “make it harder” to recover information, and the best way to ensure that information is completely destroyed is to fry the hard drive by degaussing it or dissolving it in acid.
Normally I use a tool called shred to remove files, but it cannot remove directories. There is another tool, called scrub, which can do this. Shred and scrub work basically in the same way. They just rewrite the disk space, where the file/folder is stored, over and over again to corrupt the information stored there.
Another tool you can use is called DBAN, which is a self contained boot disk that you can use to erase an entire hard drive. It works basically the same way as shred and scrub by repeatdly rewritting then entire hard drive with random numbers. The benefit of DBAN is that it can be booted from a CD, DVD, or USB and can erase the entire hard drive. The homepage for DBAN is here.
To use shred:
- Open a terminal.
- CD to where the file is stored.
- Run the command shred -vz –remove [file_name].
The -v option is verbose so if you don’t want to see all the information shred will spit back at you the leave this option out. The -z option rewrites the space on the final time with all zeros, and the –remove option removes the file after it’s been rewritten.
Shred can be used recursively to erase a bunch of files in a folder by running find [directory] -type f | xargs shred -zu.
Recovering Lost Information
The best way to prevent loss of data is to backup your files. I do this every once in a while on a separate hard-drive to also protect myself from hard-drive crashes. In other cases, if just the operating system has crashed you can grab your files using a live-cd or live-usb. I always keep a Fedora live-cd laying around, but there are others, such as Knoppix, that you can use as well.
However, if you deleted a file/folder and didn’t repeatedly rewrite the disk space it was on, then you might be able to recover it using a program called testdisk, which I found here. It can be used to scan drives to recover information, and it works on both Windows and Linux, although I have not tried it with Windows.
Here is the tutorial I used when learning how to use testdisk.