Re: 'batch move' of a few thousand mailboxes to different partitions

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

 



On Wed, 18 Apr 2007, Eric Luyten wrote:

Cyrus 2.2.13 on a Solaris 9 server
4 Cyrus spool partitions, 350 GB each, nearing 80% occupation
(Hashing performed on first letter basis of account name)

I have two extra 350 GB partitions ready and 'partition' lines
already added to /etc/imapd.conf


To spread out the mail data over six partitions I would need
to move about 350 GB of mail.

Two scenarios :

 a) use rename_mailbox in cyradm

      pro  : mail server can keep on running
      cons : filesystem metadata changes
             no 'batching' method available  (suggestions, anyone ?)
             slow

 b) use 'cp -p -r', update a text dump of mailboxes.db and regenerate

      pros : filesystem metadata does not change
             easily batchable
             significantly faster than method a)
      con  : mail server must be halted for (at least) several hours


Am I overlooking important issues here ?

I would use method "a". You can easily do the moves in batch using a perl script. Here is a simple perl function we use to move users between murder backends:

----------------------------------------------------------------
##########################
# Move a mailbox between backends
##########################
sub move_backend {
        my ($server, $authuser, $authpw, $mailbox, $newbe) = @_;

        use Mail::IMAPClient;

        # Connect to Cyrus
        my $imap = Mail::IMAPClient->new(
                        Server => $server,
                        User => $authuser,
                        Password => $authpw
                        );

        if (! $imap) {
                return "Cannot connect to mail server '$server' - $!";
        }

        # Make sure the mailbox exists
        if (! $imap->list($mailbox)) {
                return "Error: Mailbox '$mailbox' not found.";
        }

        my @results = $imap->tag_and_run(qq/RENAME $mailbox $mailbox $newbe/);

        $imap->logout;

        foreach my $r (@results) {
                $r =~ s/\r//g;
                $r =~ s/\n//g;
                if ($r =~ / NO (.*)/) {
return "Error: Rename of mailbox '$mailbox' failed - $1";
                }
        }

        return "Success";
}
----------------------------------------------------------------

In a non-Murder environment, the third argument ($newbe) would be the partition instead.


Also, what does "cons : filesystem metadata changes" mean?

	Andy
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux