Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
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.) – mveroone 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" ;) – mveroone Aug 30 '13 at 14:17
up vote 2 down vote accepted

There you go. from Precise Ubuntu Mangages :

              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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .