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.

I get this output when checking the total amount of space I'm using on my Walkman.

david@Milton:/media$ du -b --max-depth=0 WALKMAN/
14823290693 WALKMAN/
david@Milton:/media$ du -k --max-depth=0 WALKMAN/
14523776    WALKMAN/

Last I checked, 14,523,776 KB * 1024 = 14,872,646,624 B, not 14,823,290,693 B. Dividing the two, their "K" unit seems to be equal to about 1020.62 rather than 1024 as advertised. This is causing some errors in the program I wrote to sync my Walkman, so it fills up faster than it claims to. Can anyone explain this discrepancy?

share|improve this question
add comment

1 Answer

du -b is described in the help documentation (du --help) as:

  -b, --bytes           equivalent to `--apparent-size --block-size=1'

where

      --apparent-size   print apparent sizes, rather than disk usage; although
                      the apparent size is usually smaller, it may be
                      larger due to holes in (`sparse') files, internal
                      fragmentation, indirect blocks, and the like

du -k, by contrast, provides

  -k                    'like --block-size=1K'

That is, du -k gives the disk usage of the file, while du -b gives the 'apparent size' of the file. The apparent size is usually (but not always) smaller.

(Source: coreutils bug report).

share|improve this answer
    
And if you’re checking the disk usage on your walkman, you almost certainly don’t want the apparent size but the actual size. –  Claudius Oct 11 '12 at 15:17
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.