Grant Edwards <[EMAIL PROTECTED]> writes:

> $ dd if=/dev/zero of=zeros bs=64k count=1024
> 1024+0 records in
> 1024+0 records out
> $ ls -l zeros
> -rw-r--r--  1 grante users 67108864 Jan 28 14:49 zeros
> $ du -h zeros
> 65M     zeros

> In my book that's 64MB not 65MB, but that's an argument for
> another day.

You should be aware that the size that 'du' and 'ls -s' reports,
include any indirect blocks needed to keep track of the data
blocks of the file.  Thus, you get the amount of space that the
file actually uses in the file system, and would become free if
you removed it.  That's why it is larger than 64 Mbyte.  And 'du'
(at least GNU du) rounds upwards when you use -h.

Try for instance:

    $ dd if=/dev/zero of=zeros bs=4k count=16367
    16367+0 records in
    16367+0 records out
    $ ls -ls zeros
    65536 -rw-rw-r--  1 bellman bellman 67039232 Jan 29 13:57 zeros
    $ du -h zeros
    64M     zeros

    $ dd if=/dev/zero of=zeros bs=4k count=16368
    16368+0 records in
    16368+0 records out
    $ ls -ls zeros
    65540 -rw-rw-r--  1 bellman bellman 67043328 Jan 29 13:58 zeros
    $ du -h zeros
    65M     zeros

(You can infer from the above that my file system has a block
size of 4 Kbyte.)


-- 
Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
"There are many causes worth dying for, but  !  bellman @ lysator.liu.se
 none worth killing for."         -- Gandhi  !  Make Love -- Nicht Wahr!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to