Jump to content

Is windows' "size on disk" number wrong?

I'm trying to put a little tutorial together about allocation unit size and how it affects disk read and write speeds for different files but I just ran into a bit of an interesting roadblock. 

 

So I was changing the allocation unit size on a flash drive, then transferring over a folder with 200 5 kB files in it. In windows, you can (generally) see how much space is wasted by looking at the "Size" vs. "Size on Disk" numbers in the folder properties. So, if I set the allocation unit size very low, the size and size on disk numbers match up pretty well. If I exaggerate the allocation unit size to something huge, the numbers (should) grow further apart.  

 

The problem I'm running into is that windows doesn't seem to update the "size on disk" number often. So if I transfer the files to an exfat USB stick with an allocation file of 4 kB, the size on disk will be 8 kB for each 5 kB file. Sure, that's great. Similarly, if I set the allocation size to 1024 kB, each file will have a size on disk of 1024 kB. However, if I then reformat the drive and set the allocation size to something smaller, then transfer over the files and check the properties again, it still says the size on disk is 1024 kB, which is obviously wrong. One way to know it's wrong is that I can look at the total capacity of the drive. When I have the allocation size at 1024 kB the "Used space" is ~200 MB, which makes sense. Then if I format it with a smaller allocation size, the used size will be smaller. If the allocation size is 4 kB the "Used space" will be ~1.6 MB. (8kB * 200). That number displays correctly, but even when the "Used space" is only 1.6 MB, the "Size on disk" for the folder with 200 5kB files is STILL 200 MB, which is... impossible.

 

Anyway, see the pictures below for a better explanation. The first picture makes sense. Allocation size of 1024 kB, 200 files + folder and directory info = used space of slightly greater than 200 MB.

 

The second picture does not make sense. Allocation size of 4 kB, 200 files + folder and directory info = used space of 1.6 MB, yet the properties for the folder show the folder takes up 200 MB!!! Obviously one of the two is wrong. (Yes, I did close the property window between formatting the drive.)

 

My guess is that windows stores the information for each drive in a file somewhere, and if you don't change the name between formats, it'll continue to use the old information. So the "Size on Disk" information is calculated from the information in that file, and not the actual allocation unit size of the disk. That saves window having to query for the disk allocation size every time you click on the "properties" button. For normal usage, this works fine (who formats their disks with different allocation units often and doesn't change their name?)

 

Anyway, that's slightly annoying, guess I'll have to find better ways to get the disk allocation size and "size on disk" numbers to make this tutorial.

 

Screen Shot 2016-10-25 at 1.26.35 PM.png

Screen Shot 2016-10-25 at 1.23.46 PM.png

Link to comment
https://linustechtips.com/topic/680823-is-windows-size-on-disk-number-wrong/
Share on other sites

Link to post
Share on other sites

I gotta wonder... If your hypothesis is correct, how can Windows allow several partitions to have identical name. Or no name for that matter. What would happen if you used the Clean command in Diskpart? I'd say, if that fixes the issue, the info has to be stored somewhere on the drive itself as opposed to something like Windows registry. 

Link to post
Share on other sites

4 minutes ago, Naeaes said:

I gotta wonder... If your hypothesis is correct, how can Windows allow several partitions to have identical name. Or no name for that matter. What would happen if you used the Clean command in Diskpart? I'd say, if that fixes the issue, the info has to be stored somewhere on the drive itself as opposed to something like Windows registry. 

Well, I'd guess the file would also contain the drive's physical hardware address. (Like your mac address, but for drives.) Therefore multiple drives would be allowed to have the same "name" because their physical addresses would be different. 

Link to post
Share on other sites

Also, I can't seem to replicate the disk write speeds using any of the benchmarking software. When you have a large allocation unit size, it takes AGES to transfer a bunch of small files, but no disk benchmark software I've used yet actually displays the same results. I think most of them ignore the formatting that I've imposed upon the drive and write directly to the drive... somehow. Now, that's great for finding the IOPs of the drive, but terrible for showing you real world performance. 

 

Any advice for how I can actually test that?

Link to post
Share on other sites

  • 1 year later...

Thanks for the info, so I know I'm not alone. I fixed the issue with clean (http://knowledge.seagate.com/articles/en_US/FAQ/005929en) followed by creating a new volume with a new drive letter and new drive name using Disk Management on Windows 10. Good luck.

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

×