Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
Are you sure your disk is using 4KB clusters? –  techie007 Jan 28 '12 at 5:33
2  
@techie007, since he said he's on a Mac, and Macs usually use HFS+ volumes, which use 4KiB blocks nowadays, the answer is probably "yes". BTW "clusters" is a Microsoftism which applies to FAT and NTFS. HFS+ uses the term "logical block" or just "block". –  Spiff Jan 28 '12 at 6:27
add comment

4 Answers

up vote 4 down vote accepted

No, that's correct.

128KiB = 131072B = 131kB

share|improve this answer
add comment

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.

share|improve this answer
    
I believe "clusters" is a term from the FAT file system family that doesn't apply to HFS+. Of course he could be talking about a file on a FAT-formated drive, but it's not likely. –  Spiff Jan 28 '12 at 6:21
    
129,900 bytes may be 126.86KiB, but it's 129.9KB. The difference matters here because we're talking about sizes on disk. –  David Schwartz Jan 28 '12 at 7:35
add comment

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.

share|improve this answer
    
i have a small code to display the size,how would i write code –  Manish Jan 28 '12 at 6:24
    
@Manish I can't understand what you're asking with that comment. –  Spiff Jan 28 '12 at 6:30
    
sorry, it committed in middle. –  Manish Jan 28 '12 at 6:35
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.