bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: command "du" reports wrong size ?


From: Steven
Subject: Re: command "du" reports wrong size ?
Date: Mon, 03 Oct 2005 11:41:32 +0800
User-agent: Mozilla Thunderbird 1.0 (X11/20050215)

Hi Bob:
Thanks for your fast response.

Bob Proulx wrote:

Steven wrote:
I got a strange problem. i.e. "du" command reports wrong size in FC3/4,
dd --version
dd (coreutils) 5.2.1
du --version
du (coreutils) 5.2.1

Thank you for your report and for including the respective version
numbers and such.

[fc3]~/tmp>dd if=/dev/zero of=dd.128 bs=1M count=128
128+0 records in
128+0 records out
[fc3]~/tmp>du -B 1M dd.128
129 dd.128

129 != 128

The 'du' command reports the amount of disk blocks used.  This is not
quite the same thing as the size of the file.  You have created a file
that is of a certain size.  But the filesystem may use more blocks to
store it.  Because you are working on differnet machines I am guessing
that the filesystems are different.

What is the output of this command?

 ls -ls dd.128

What is the type of the filesystems involved?  You can use 'df -T' for
this information.

 df -T .

[fc3]~/tmp>dd if=/dev/zero of=dd.128 bs=1M count=128
128+0 records in
128+0 records out
[fc3]~/tmp>ls -ls dd.128
131200 -rw-r--r--  1 steven steven 134217728 Oct  3 05:31 dd.128
[fc3]~/tmp>df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/hda1 reiserfs     2441712   2167580    274132  89% /
none         tmpfs       97464         0     97464   0% /dev/shm
/dev/hda3 reiserfs     1501836   1135296    366540  76% /home

However, if I use the dd and du in RedHat 9:
[rh9]~/tmp>dd --version
dd (coreutils) 4.5.3
[rh9]~/tmp>du --version
du (coreutils) 4.5.3

[rh9]~/tmp>dd if=/dev/zero of=dd.128 bs=1M count=128
128+0 records in
128+0 records out
[rh9]~/tmp>du -B 1M dd.128
128 dd.128

Same thing here.  What is the output here?

 ls -ls dd.128
 df -T .

[rh9]~/tmp>dd if=/dev/zero of=dd.128 bs=1M count=128
128+0 records in
128+0 records out

[rh9]~/tmp>ls -ls dd.128
131072 -rw-r--r--    1 steven   steven   134217728 Oct  3 10:06 dd.128

[rh9]~/tmp>df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/hda1 reiserfs    14658828   9925296   4733532  68% /
/dev/hda4 reiserfs    96178212  65544612  30633600  69% /home
none         tmpfs      451128         0    451128   0% /dev/shm

That's correct in RH9. Is that a bug of du in the coreutils 5.2.1 ? Or
where am I wrong ?

Need more information to decide.  Types of filesystem and the sizes of
the files.

Bob
Now I realized it's some overhead in the filesystem. Thanks again.

Steven.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]