Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I was having a look at the size of libBLAS.dylib at some location in my Mac and du showed it's file size as 572K while the allocated file size (showed by Finder) was 1.4MB. I've read that the lack of sparse files on HFS+ can cause this discrepancy.

My question is that why would a compiled shared library need to be sparse - after all, it's not like anything is going to be modifying it.

share|improve this question
    
Wonder if it could be that du counts files in 512-byte blocks, while the Finder counts them in 4096-byte blocks due to HFS+? –  gosmond Feb 25 '13 at 8:49
1  
Then the difference should be 4K at most, not more than 0.8MB –  Opt Feb 25 '13 at 9:12
    
Is your question why there is a difference in the reported size, or why this file needs to be a sparse file? –  Gerry Feb 25 '13 at 9:30
    
The former but I'm guessing that's going to involve some explanation of the latter? –  Opt Feb 25 '13 at 19:00

1 Answer 1

Difference is in units they use.

du uses BLOCKSIZE=4096 bytes by default (rounded if Human Readable format option -h i.e. df -h) Finder uses BLOCKSIZE=1000 by default

$du -h /usr/lib/libblas.dylib 
4.0K    /usr/lib/libblas.dylib

and same in Finder.

share|improve this answer
1  
Can you describe how this explains the "factor 2" difference in size reported by the asker? –  patrix Mar 7 '13 at 8:21
    
df -h and df -k gives same results –  Eir Nym Mar 7 '13 at 8:32
1  
I hope they do! But how do you explain the difference to the size reported by Finder? –  patrix Mar 7 '13 at 8:43
    
I've explained how Finder says same as du –  Eir Nym Mar 7 '13 at 8:46

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.