Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Don't worry, this isn't typical "du vs. df" question. :-) I mounted a squashfs image (via loop) and used du to reported the size: du --apparent-size -lsh image1/ which reported 215M. Then I used rsync ("rsync -aS") to copy all files to a real partition (ext4). To my surprise du reports for this directory now: 302M. Where do the additional 87MB come from? Without --apparent-size the values are 242M and 676M, respectively.

share|improve this question
    
Run du -ab | sort -k2 on both sides and see what files' sizes differ. –  Gilles Mar 1 '12 at 1:35
    
Maybe hard links get expanded, that is each hard link is copied as file. Try the -H option in rsync. –  vasquez Mar 1 '12 at 6:19
    
@vasquez The -l option for du should have taken care of that but thanks for the suggestion. –  antje-m Mar 7 '12 at 6:53
add comment

1 Answer

up vote 0 down vote accepted

Gilles had the right idea. Comparing the two outputs showed that squashfs reported different sizes for the directories than ext4 which (probably) explains the difference. Thanks to all who responded.

share|improve this answer
    
So is there actually a nice way to compare disk usage without being confused by the different directory sizes? –  drfrogsplat Nov 19 '12 at 1:15
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.