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.
root@host:/var/log/apache2# du access.log -bh
753M    access.log
root@host:/var/log/apache2# du access.log -h
1.2G    access.log

Why is there such a huge difference in size for the same file?

share|improve this question
    
As for my current version of linux, -b and -h options conflicts. Please add details a bout your OS flavor. (kernel type, version, distribution, cure-utils, etc.) –  Kwaio Aug 30 '13 at 13:49
    
without -h the values are in bytes thats it. The difference still remain the same. OS: Ubuntu precise x86_64 $uname -a Linux host 3.2.0-38-virtual #60-Ubuntu SMP Wed Feb 13 13:42:54 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux coreustils installed version 8.13-3ubuntu3.2 –  Abdul Karim Memon Aug 30 '13 at 14:08
    
The version was here important. in my version of coreutils, "-b" meant just "bytes" just like "-k" is "kilobytes" and so on... which conflicts with "-h" ;) –  Kwaio Aug 30 '13 at 14:17
add comment

1 Answer

up vote 2 down vote accepted

There you go. from Precise Ubuntu Mangages :

       --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

       -B, --block-size=SIZE
              scale  sizes  by  SIZE before printing them.  E.g., `-BM' prints
              sizes in units of 1,048,576 bytes.  See SIZE format below.

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

So not only do you have count in MiB/GiB on the first side, but you may have a "sparse file" in front of you.

(I'm assuming here that you are using coreutil's duand not POSIX's)

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.