DEV Community

Wesley
Wesley

Posted on

"fixing" physical "free space" on Windows

I don't know if this is just my computer or my hard drive or something stupid, but here I am to write about it:

Notice anything unnatural about large files you have? For example, this (NTFS compressed) video that's 500 MB.
Victim #1
On the disk, it should physically take up 500 MB, right?
Free space before deleting it
APPARENTLY NOT.
Free space after deleting it
(it takes up 600 MB at the start of copying, and then spends the rest of the 400MB while the progress bar loads... !?!?!?!?!?!?!)

Maybe because I have it compressed. That makes no sense, but I wonder what happens if that's turned off.
Attributes
Before uncompressing
Attributes
After uncompressing
Huh? I gained space?? What if I recompress it?
After recompressing, showing attributes
?????
(this apparently doesn't happen on my SSD)

Copying the uncompressed file in a folder that does not have compression turned on makes it not take up more space than it really does. !?!?!?!?!?!?!?!?!?!?!?!

To investigate further, I made a little shell script (with Cygwin) (a little broken, though) that takes files/folders as arguments, and for each individual file, read the total amount of free space of the disk the file is on before and after running Windows' COMPACT command, and if space was taken up after uncompressing it or decompressing it (depending on the attribute it started off with), revert the change.
However, the above example proved this to be made slightly useless because only a select few files actually took more space due to being compressed, which was the motive for making this script.
In most of my use cases involving hundreds of files, it gradually is able to free little amounts of space. I've tested this on other big video files and a few gigabytes were freed up.
Shell script
Download script
(requires Cygwin, should work on a POSIX shell like dash)

Download Real Time Disk Size Monitor

Compressing a folder of music:
example 2 (1/2)
example 2 (2/2)

example 3

I've held off publishing this for about a week now probably because I don't know a conclusion for this article, but I can just say ALL OF THIS MAKES NO SENSE!!!!!!!!

Top comments (1)

Collapse
 
donnaken15 profile image
Wesley

just now, I found more video files that take double the size that they're supposed to, even a 800 KB video