Quick Question: File Deletion

5uperMario

Distinguished
Jun 13, 2009
43
0
18,530
Really quick question on my mind.

I was reading up on how HDD works and the way they delete files.

Well the way they do is no really delete the file but delete the index so the OS forgets about it.

So for example, I have a 6GB iso game on my HDD. I decide to delete it and remove it from the trash can.

So the way it works, all the OS did was forget where its stored, and move on?
And I magically gain 6GB back into my HDD?

Doesn't make sense.

Then there are those programs that find deleted files.
If all this is true, then aren't Hard Drives larger then what they say?

Like mines 160Gb
I had ALOT of stuff on it, deleted. More stuff. deleted etc..

So really I have over 700GB of files still wondering around my HDD but the OS simply forgot about it?

or it goes to infinite.

(New HDD! Infinite Space! Deleting the files still keeps them and makes your HD think it has X amount of space!)


That part confuses me.

Thanks
 
Solution
Let's say you buy a brand new hard drive that holds 500GB of information. You've never copied any files onto it. When you look at it in Explorer it says "0GB used".

It's still a 500GB hard drive, right?

So you put 200GB of files onto it. Now it says "200GB used".

The hard drive hasn't changed - it still can hold 500GB.

Now you delete 100GB, and even go so far as to remove them from the recycle bin. When you look at Windows Explorer, it says "100GB" used. But it's still actually a 500GB drive, right?

The space that held the 100GB of files that you deleted - it's still there on the disk. It hasn't vanished. And when you deleted the files that space didn't get overwritten (notice that you can delete a 10GB file...
Let's say you buy a brand new hard drive that holds 500GB of information. You've never copied any files onto it. When you look at it in Explorer it says "0GB used".

It's still a 500GB hard drive, right?

So you put 200GB of files onto it. Now it says "200GB used".

The hard drive hasn't changed - it still can hold 500GB.

Now you delete 100GB, and even go so far as to remove them from the recycle bin. When you look at Windows Explorer, it says "100GB" used. But it's still actually a 500GB drive, right?

The space that held the 100GB of files that you deleted - it's still there on the disk. It hasn't vanished. And when you deleted the files that space didn't get overwritten (notice that you can delete a 10GB file instantly).

So what you've really got is 100GB of files (that you didn't delete), 100GB of files (that you did delete), and 300GB of space that you've never, ever used yet.

But the space that was used the deleted files is up for grabs - when you put more files onto the drive they MAY go into the space that was never used or they MAY go into the space that your old files used. If they go into the old file's space, then the data for those old files will be done - there won't be any way of getting it back.

So if you put 100GB of files on the drive, then delete it all, then put it on again and delete it and keep doing that over and over again, you're going to be reusing much of the same space on the drive. It doesn't magically grow, it just uses the same space over and over again. It's only if you're lucky and the space for old deleted files hasn't been reused yet that you can get the old files back.
 
Solution
The OS maintains a catalog or index to all files.

When you create a new file, it's location is stored in the catalog.

When you move the file, the catalog is updated with the new location, but the data on the hard drive is not moved. That is why you can move a large file instantly.

When you delete a file, the catalog changes the pointer to the recycle bin, just as though it was moving it.

When you have added enough files to fill up the drive, you will run out of space to add any more. If you delete a file to make room, you still will not have room because the recycle bin simply became larger. Only when you remove files by emptying the recycle bin will you actually reclaim space so you can create new files.

Forensic programs can read all of the data sectors on a hard drive, and possibly reconstruct files that were both deleted and emptied from the recycle bin. Very smart forensic programs can even reconstruct files which have been written over. It takes multiple passes of overwriting with random data to securely erase the contents of a hard drive.