'batch move' of a few thousand mailboxes to different partitions
Andrew Morgan
morgan at orst.edu
Wed Apr 18 12:36:55 EDT 2007
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
More information about the Info-cyrus
mailing list