how much space does hard-linking save? (a script for your boss!)

Per Steinar Iversen PerSteinar.Iversen at adm.hio.no
Wed Jun 11 12:15:22 EDT 2003


On Wed, 11 Jun 2003, Matt Bernstein wrote:

> I was wondering how much space Cyrus' hard-linking tricks saved us.. as an
> academic department (with about 800 users) a lot of e-mail goes out to
> student lists, for example. So.. while waiting for an fsck after a major
> power cut I wrote this natty little perl script:
> 
> #!/usr/bin/perl -w
> 
> use strict; $|=1; print "   net G  gross G avgLinks\n";
> my @x;  our($n1, $n2, $n3, $n4, $y, $gig) = (0, 0, 0, 0, 1, 1024**3);
> sub splat { printf "%8.3f%8.3f%8.3f\r", $n1/$gig, $n2/$gig, $n3/$n4 }
> 
> open(M, 'find /var/spool/cyrus/mail/user -type f -name "*."|')
>         or die "fork: $!";
> 
> while (<M>) {
>         chomp;
>         @x = stat;
>         $n1 += $x[7], $n2 += $x[3] * $x[7], $n3 += $x[3], $n4++;
>         $y = 100, splat unless $y--
> }
> 
> splat, close M, print "\n\n"
> 
> 
> I was quite surprised at the results:
> 
>    net G  gross G avgLinks
>   15.666 130.019  47.589
> 
> ..so, having thought an 80G volume for the mailstore wasn't overly 
> generous, now I can up everyone's quota for the next academic year :)
> 
> Thanks! (and remember to configure your MTA to batch it all together..)

There are a number of programs for creating hard-links between identical
files, for example:

http://www.stearns.org/freedups/

Anyone tried something like this for creating hard-linked files?

I will soon import a lot of messages into Cyrus through imap, these new
messages might well contain a lot of duplicates between users. Something
like freedups could possibly save a lot of diskplace, so I am interested
if anyone have tried this.

-psi





More information about the Info-cyrus mailing list