[Gllug] Odd (but apparently correct) behaviour from du
John Winters
john at sinodun.org.uk
Wed Jul 16 14:22:12 UTC 2008
I've just come across something slightly odd which I thought I should share.
I back up my systems using dirvish run nightly on a dedicated machine
and the other night the job took over twice as long as expected. I was
just looking into why, and to see whether the disc usage in one of my
backed up partitions had suddenly increased a lot I went to the relevant
vault and typed:
du -sk *
The results which came back were startlingly variable. Instead of a
consistent 30G or so (slowly increasing) in each snapshot I got wildly
varying values. One night's snapshot would be 31G and the next night's
apparently 2G. Looking at them manually however they all seemed to be
complete.
Worrying thoughts about a corrupt filesystem started flitting across my
mind, but a bit of research eventually gave the answer (and to me it's a
surprising answer). Quote from an online man page which I found "Files
with multiple links shall be counted and written for only one entry.
The directory entry that is selected in the report is unspecified." As
far as I can see, this information is missing from the man page provided
in Linux.
So - if you're using dirvish you have to be very careful about how you
use du. By changing my invocation to:
for $root in *; do; du -sk $root; done
I got the right answer. Now hands up all those who knew that du behaved
this way.
John
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list