Jump to content

17GB file size is 325MB on disk?

Thorimus
Go to solution Solved by mariushm,

They're called sparse files.

 

An application can tell the operating system that it's planning to write 17 GB to disk and the operating system will try to find the largest continuous chunks of empty space and mark them as reserved for that file, without a single byte being written to them.

As the app writes data to those chunks of empty space, the OS further splits those chunks into smaller pieces as needed.

 

Meanwhile, if another application asks the OS for disk space, if it has to the OS takes back one of those chunks of empty space and moves the reservation to the other app.

 

It's a bit technical but you can learn more about sparse files and ntfs compression here: https://en.wikipedia.org/wiki/Sparse_file and here: https://blogs.msdn.microsoft.com/ntdebugging/2008/05/20/understanding-ntfs-compression/

 

ps. And yes, NTFS file system holds some information about files and folders in a couple of hidden areas (files) on the partition. Usually for each created file, 512 bytes or more are used to hold the file info (file name, which folder it belongs to, file permissions, user rights etc) .. if the file has less than around 100-150 bytes (don't know the exact value), the whole content of the file can be stored in that hidden area instead of using space somewhere outside. In such case i guess once more bytes are supposed to be written, the os finds an empty chunk of space, moves those 100-150 bytes there and writes the new bytes in continuation then updates the file metadata to keep things all correct.

 

I wanted to try out Dreadnought, so I downloaded it. wasn't for me. When I was freeing up disk space on my 500GB hard drive for a new game I checked to see how much space it took up, and saw this:

 

Size: 17.1GB

Size on disk: 325MB

 

If my understanding of how this works is correct (HDDs are separated into clusters, if the cluster size is 512 bytes and a file is 20 bytes that file will take up 512 bytes on disk) this shouldn't be possible.

So how much space does it actually take up on my drive?

“sufficiently advanced technology is indistinguishable from magic still going to require driver rollbacks when it stops working for no reason“

Link to comment
Share on other sites

Link to post
Share on other sites

They're called sparse files.

 

An application can tell the operating system that it's planning to write 17 GB to disk and the operating system will try to find the largest continuous chunks of empty space and mark them as reserved for that file, without a single byte being written to them.

As the app writes data to those chunks of empty space, the OS further splits those chunks into smaller pieces as needed.

 

Meanwhile, if another application asks the OS for disk space, if it has to the OS takes back one of those chunks of empty space and moves the reservation to the other app.

 

It's a bit technical but you can learn more about sparse files and ntfs compression here: https://en.wikipedia.org/wiki/Sparse_file and here: https://blogs.msdn.microsoft.com/ntdebugging/2008/05/20/understanding-ntfs-compression/

 

ps. And yes, NTFS file system holds some information about files and folders in a couple of hidden areas (files) on the partition. Usually for each created file, 512 bytes or more are used to hold the file info (file name, which folder it belongs to, file permissions, user rights etc) .. if the file has less than around 100-150 bytes (don't know the exact value), the whole content of the file can be stored in that hidden area instead of using space somewhere outside. In such case i guess once more bytes are supposed to be written, the os finds an empty chunk of space, moves those 100-150 bytes there and writes the new bytes in continuation then updates the file metadata to keep things all correct.

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×