Why does the Finder show a file as "129,900 bytes (131 KB on disk)"?
129900 bytes = 126.86 KB
If you round it off to the nearest 4k boundary the size cannot be 131kb. I am confused, can anyone help?
Why does the Finder show a file as "129,900 bytes (131 KB on disk)"?
129900 bytes = 126.86 KB
If you round it off to the nearest 4k boundary the size cannot be 131kb. I am confused, can anyone help?
Apple chose to stop using Kibi/Mebi/GibiBytes (1,024's, 1,048,576's, and 1,073,741,824's of bytes) in displaying file sizes in recent versions of Mac OS X. As of Lion and possibly Snow Leopard, it reports things in true kilo/mega/gigaBytes (1,000's, 1,000,000's, and 1,000,000,000's of bytes)
You're right that HFS+ typically uses 4096 byte blocks nowadays. So if your file is a little over 126,976 bytes in length, it won't fit in 31 blocks, so it'll use part of a 32nd block, so in some cases where just the blocks used are counted instead of the exact size of file, it may be listed as being 131,072 (rounded to 131KB) in length.
31 4KiB clusters is 126,976 bytes. Not enough to hold the 129,900 bytes. 32 4KiB clusters is 131,072 bytes. That's enough to hold the 129,900 bytes. So it's using 32 4KiB clusters, or 128KiB which is 131,072 bytes or about 131KB.
macOS displays KB (1024's of bytes) when it's actually kB (1000s of bytes). This is seemingly a bad terminology in macOS itself.
The issue is obscured by the fact that the number in parenthesis is a combination of two things:
But if you use ls
with the right flags in Terminal, you can see that what Finder is displaying is actually kilobytes (kB) not KibiBytes (KB or KiB).
The size of the file is 129900 bytes = 126.86 KB
. The amount of space it is using on your hard drive is 131KB. To put it in simple terms.. This happens because your file system on the hard drive has several clusters. Each cluster may be only a few kilobytes. However, when the file is written to the hard drive, it may not use up a full cluster. Even if it did not use up a full cluster, that memory is essentially unavailable.