Deleting files in a hard disk : What happens on the inside ?

We all have gone through the process of deleting files from our computer. Whether its to free up disk space or to get rid of unused files, deleting files seems to be an easy and sure-fire way to get rid of data. Or is it? Let’s take a look at what really happens when you delete files in a hard disk. 

What does hitting the delete button do?

Usually in Windows, when we select a file/ group of files and hit the “delete” button, the files are moved to the Recycle Bin. This is a sort of safety feature. Its there to prevent the accidental permanent deletion of important files. You can easily get these files back by going into the recycle bin and restoring the file from there. If you delete it from the recycle bin, then it cannot be “restored” back. It’s equivalent to a permanent delete which cannot be undone, at least for the casual user anyway.

Despite going through all this to delete the file and despite the fact that your computers software no longer has access to the file, it’s probably still there. At least it is for a certain amount of time. So with the right set of skills and suitable software, that data can be recovered and read by others.

How do deleting files work in the PC?

Photo by rawpixel on Unsplash
(Photo by rawpixel on Unsplash)

When you permanently delete file, either by shift + delete , or by deleting from the recycling bin, the computer does not actually delete the entire file.Most hard drives inside computers are formatted in the NTFS ( New Technology File System – developed by Microsoft )file system.Under this file system, deleting a file on your computer doesn’t actually delete the file.

So what actually happens? The computer takes 2 actions.

The first one is, it deletes the “Master Reference”. The master reference tells the Operating System where files are located on the hard disk. Think of it as a map containing the address of all your files. So it deletes the address of your file. Without the address, the OS cannot find your file so, it assumes it’s not there.

The second is that it labels the physical location the file is at as empty. This tells the computer that the space there is free to add data into. In a nut shell, the data is still there on the hard disk. But the computer tells the software that the area where the deleted file is located is free and new data can be written there. It might seem a little confusing but that’s how it works.

Why?

Because of the process mentioned above, deleting a file takes only a few seconds. In contrast, when we are writing new data to the hard disk, it takes longer. If the OS tried to remove the file entirely during deletion, it will take just as long as it takes to write data into the hard disk. 

So if your computer takes a few minutes to copy a 2 GB file, it will take just as long to delete the same file. Now, think how long it will take to delete 1 TB of data. To reduce this processing time and avoid inconvenience to the user, is why deleting a file happens as we mentioned previously.

This is why deleting files can be done in a matter of seconds and copying data takes much longer.

Things to keep in mind

We now realize that “deleting” doesn’t necessarily remove everything from your hard disk. With the right set of skills and the right software, data can be recovered. This , depending on the situation, can be a good or bad thing as seen on  “levels of data recovery“. If you really want to delete files from your system with 100 % guarantee that it cannot be recovered, deleting files is not the right way to go. Consider using a file shredding software.

If you happen to sell your old hard disk, then you now understand that deleting files doesn’t mean its gone. To make sure none of your files can be recovered from it , delete all of the data on the hard drive to the best of your ability. Then rewrite over the old data with new random data over and over again. 

Related posts

Leave a Comment