ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > Living Room

File Size vs. Size on Disk: Why such a difference?

<< < (3/5) > >>

Deozaan:
Ok. The drive in question is actually a 2 GiB microSD card in a USB adapter.

It's formatted as FAT with a 32 KiB cluster size (32,768 bytes in each allocation unit).

The particular folder I used in my example contains 16,047 files and 2,009 folders.

So 631,544,356 bytes divided by 16,047 files means the average file size is about 39,356 bytes. Which means a full 32 KiB per file plus 6,587 bytes "spill over" into the next 32 KiB cluster.

But actually it's worse than that, since that would still only add up to approximately 105 MB extra (size on disk) but it's actually almost 400MB extra.

So just doing a quick browse of the contents of the drive, I see lots of files that are only a few hundred bytes or just a couple KiB.

mwb1100:
Realize that each file will fill all clusters it uses except the last cluster (which might be full, but generally won't be).  If we assume that each file will use on average only half of the last cluster, we come up with the following guesstimate for 'wasted space'

    32768/2 * 16047 = 262,914,048 wasted bytes

Still not accounting for all the waste that you're apparently seeing, but I'd suspect that the true numbers skew toward more files that use far less than a cluster (I think of the files that use only a single cluster, there are far more that use less than half than those that use more than half).

Also, this doesn't account for the waste used by directories (which if I recall, are allocated clusters similarly to files except for the root directory), which would bring us up to close to about 300MB of wasted space.

This analysis hasn't account for all the waste you're seeing, but we're less than a factor of 2 away...

Stoic Joker:
If you use the Oformat utility from a Win2k/XP setup disk (should be in tools - iirc), you can format the disk as FAT/FAT32 with (almost) any cluster size you want/need.

f0dder:
32kb is a pretty large cluster size - but I guess it might have been set to the flash erase-block size?

J-Mac:
I always wondered the same thing as the original post and finally learned it here - like most of my computer education. Anyway I looked at very small files on my internal drives and also on a 1 TB external USB drive: all have "Size on Disk" of 4.00 kb, so I guess that means everything on my system is currently formatted with a cluster size of 4096 bytes. (All NTFS).

Thank you.

Jim

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version