Moving cyrus from one machine to another

Andy Saxena andyML at nyc.rr.com
Sun Sep 15 22:56:01 EDT 2002


On Sun, Sep 15, 2002 at 06:50:21PM -0400, Scott Russell wrote:
| Old Box
| 1) stop smtp, cyrus, etc. don't let new mail into the system
| 2) shutdown cyrus
| 3) tar /var/spool/imap, /var/imap, and /usr/sieve
| 4) dump /var/imap/mailboxes.db to a text file (mailboxes.txt)
| 5) scp tgz files and mailboxes.txt to new box.
| 
| New Box
| 1) expand tgz files into /var/tmp or other temp location
| 2) mv /var/spool/imap /var/spool/imap.orig
| 3) cp -a /var/tmp/var/spool/imap /var/spool/ (wait long time)
| 4) use cvt_cyrusdb to migrate user_acct.seen and user_acct.sub files
|    from /var/tmp/imap/user/* to /var/imap/user/*
| 5) use ctl_mboxlist to import mailboxes.txt into the current
|    mailboxes.db
| 6) cp -a /var/tmp/usr/sieve /usr/sieve
| 7) run quota -f to fix up user quotas
| 
| Give cyrus a start. Make sure you are using the cyrus UID for moving
| files around and what not. It's very bad to mess up the permissions
| and owners.
| 
| I ended up making a _basic_ shell script to handle the user seen and
| sub databases. In my case the sub database needed no conversion but
| the seen database changed from flat to skiplist. The shell script just
| 
| Here's the gist. Edit as needed and test before using.
| 
| #!/bin/bash
| 
| DBCONV="/usr/cyrus/bin/cvt_cyrusdb";
| 
| for NAME in /var/tmp/var/spool/imap/user/*; do
|   ACCT=basename $NAME;
|   DIRHASH=echo $ACCT | cut -c-1;
| 
|   #convert the seen db
|   $DBCONV /var/tmp/var/imap/user/$DIRHASH/$ACCT.seen flat \
|   /var/imap/user/$DIRHASH/$ACCT.seen skiplist;
| 
|   #move the sub database over
|   cp /var/tmp/var/imap/user/$DIRHASH/$ACCT.sub /var/imap/user/$DIRHASH/;
| 
| done

Thanks, I tarred and moved /var/lib/cyrus and /var/spool/cyrus.
Everything's working just fine. I should've mentioned I have a single
user system, and both my machines are Debians. It's a lot simpler if you
don't have only one user :-}.

-Andy




More information about the Info-cyrus mailing list