Moving cyrus from one machine to another

Scott Russell lnxgeek at us.ibm.com
Sun Sep 15 18:50:21 EDT 2002


On Sun, Sep 15, 2002 at 06:02:45PM -0400, Andy Saxena wrote:
> Hi,
> 
> I would like to move the cyrus IMAP server from machine A to machine B.
> I am running under Debian Linux, not that it should make any difference
> to my question.
> 
> I have set up and tested the configuration on machine B. How do I move
> the email from A to B? Should I use good old tar? If so, with what
> options? What are the files and folders that need to be moved?
> 

I just did this today and am sitting here watching the logs to make
sure everything is sane. I moved from RH 6.2 & cyrus 2.0.16 to RH 7.3
& cyrus 2.1.9. 

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

-- 
  Scott Russell (lnxgeek at us.ibm.com)
  Linux Technology Center, System Admin, RHCE.
  Dial 877-735-8200 then ask for 919-543-9289 (TTY)





More information about the Info-cyrus mailing list