[Dirvish] Utility to show incremental usage per image within a vault

Matthew Pressly mpressly at claborn.net
Fri May 5 21:20:48 UTC 2006


On Fri, May 05, 2006 at 03:46:29PM -0500, Richard Geoffrion wrote:
> Matthew Pressly wrote:
> 
> >I've looked for something to do this, but have not been able to find
> >anything.  Is there a utility that will run on linux that
> >can be used to determine the incremental disk usage of all images
> >within a vault, starting with the most recent image and going back
> >in time, counting each file's size only once, regardless of the
> >number of hard links to it?
> >
[...]
> Well, one COULD make a utility called /usr/local/sbin/dirvish-imagesizes 
> and put in something like...
> 
> -----------------------
> #!/bin/bash
> FILE=/tmp/imagesize
> echo > $FILE
> KEEP=0
> for INSTANCE in * ; do
> echo "$INSTANCE - `zcat $INSTANCE/log.gz | grep \"Total bytes 
> written:\" | cut  -d : -f2`"
> done
> 
> smtp=smtp cat $FILE | mail -s "File sizes for image `pwd`" 
> adminuser at example.com
> 
> -----------------------
> 
> Realizing of course that this only gives the size of the transfers..and 
> not the base size.  I'd have to modify it to do a 'du' of the last 
> image... and of course one would have to run this FROM the actual vault 
> itself...
> 
> -- 
> Richard

The rsync transfer statistics are useful, but they give the amount of 
data transferred at the time of the transfer.  As new images snapshots
are made and old ones are expired, the file sharing between images changes.
So the amount of data needed to create an image snapshot is not equal
to the amount of data needed to keep/maintain that snapshot (i.e., the
space that would be freed up if that snapshot were deleted) some days
later, in general.

That is why I am looking for something that is based on actual disk usage
rather than transfer statistics.

I think it could be done in a perl script using 'stat' calls, which
will return the file size and inode number (which could be used to avoid
counting multiple hard links to a file more than once across the vaults),
but I think it would be slow, and I would like to avoid re-inventing that
wheel, if it already exists.

-- 
Matthew



More information about the Dirvish mailing list