Richard Ems wrote: > If I do a "du -s * ." and right afterwards "du -s ." I get different > values for the actual directory ".".
Note that 'du -s * .' will stat every file twice because effectively it was listed twice in the command line argument list. > This is on Linux, openSUSE 10.3, coreutils-6.9-43, xfs filesystem. > > Example: > > # du -s * . | grep "\.$" ; du -s . > 23227004 . > 25251176 . > > Is this correct "du" behavior ? I can't reproduce your problem. Here is what I tried using the current stable du release 6.10: mkdir testdir cd testdir dd if=/dev/zero of=a count=19 dd if=/dev/zero of=b count=23 dd if=/dev/zero of=c count=29 $ ls -ldog . drwxrwxr-x 2 4096 2008-02-20 16:04 ./ $ ls -ldog --block-size=1024 . drwxrwxr-x 2 4 2008-02-20 16:04 ./ $ du -s * 12 a 12 b 16 c $ echo $((12+12+16+4)) 44 $ du -s * . 12 a 12 b 16 c 44 . $ du -s . 44 . As you can see here the sizes always add up to 44 for me. As others have suggested hidden files, files matching options, activity in the directory tree at that time the behavior doesn't seem unreasonable. You don't know until you know. I would strace both runs of du and then look at the data from the lstat calls and see if the data is changing for any of the runs. $ strace -v -e trace=file du -s * Directory ordering may cause du to traverse in a different order than sorted order such as in the above. But the st_blocks should be the same between runs. If not then the difference is because those files changed size. This following might help to pull out the st_blocks values and sum them. strace -v -e trace=file du -s * 2>&1 \ | awk '/st_blocks=/{sub(/.*st_blocks=/,"");sub(/,.*/,"");t+=$0}END{print t}' Bob _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils