Moving from a server without virtual domains to one with virtual domains.

Mikael Nehlsen joyride at sics.se
Fri Nov 17 10:27:28 EST 2006


Hi again,

I think I actually did succeed with this, it was some work but I used
some info I found on a website
(http://www.afp548.com/forum/viewtopic.php?forum=26&showtopic=9288) and
converted all my databases to skiplist in the process (don't know if it
was really needed).

I thought that I should write how I did it if someone else needs it in
the future. Since I hate those maillist threads where your question is
asked and no one ever answer. Also of course if anyone have anything to
add that I forgot they are welcome.

On the osx host I did dump the mboxlist (ctl_mboxlist -d >
mboxlist.txt), rsync -av --delete /var/spool/imap/user/
newmailserver:/var/spool/imap/domain/example.com/user/, rsync -av
--delete /var/imap/ newmailserver:/var/imap.example.com/ and don't
forget to scp over the mboxlist.txt file as well to a directory close to
you.

so now you should have all the data on the new mailserver. I then wrote
a script that converts the .seen files (which were in flat db format on
the old server and in skiplist format on the new one), adds the domain
(example.com!) to the .sub files and fixes the cyrus.header files
(adding domains at places and changing permissions).

I also did add example.com! before all users in the mboxlist.txt, an
@example.com after the username in the same file and finally changed the
permissions.

after this you just stop cyrus on the new server, delete the following
files:

/var/imap/db/__*
/var/imap/db/log*
/var/imap/db.backup?/*
/var/imap/annotations.db
/var/imap/tls_sessions.db
/var/imap/deliver.db

I don't know if I need to delete all of these but I had a lot of
problems with bdb when I kept some of them (I didn't experiment that
much with what I could have kept)

restart the server and run:

su cyrus -c "/usr/cyrus/bin/ctl_mboxlist -u < /tmp/mboxlistnew.txt"

Then you of course need to import the users in whatever you use to
authenticate them but thats another problem.

I will post my scripts here but they are very hackish and you use them
on your own risk and stuff. They are split in two since solaris find
does suck.

oldtonewserver.sh:

#!/bin/bash

echo "Fixing the userfile"
cat mboxlist.txt | awk '{FS="\t"; print "example.com!" $1 "\t" $2 "\t"
$3"@exam\
ple.com\t" $4}' | sed s/lrswipcda/lrswipkxtea/ > /tmp/mboxlistnew.txt
cd /var/spool/imap/domain/example.com/user
find . -name "cyrus.header" -exec /root/sedstuff.sh {} \;
cd /var/imap.example.com/user
for b in `find /var/imap.example.com/user -name "*.seen"`
do
  echo "converting " $b " to skiplist"
  mv $b $b.old
  su cyrus -c "/usr/cyrus/bin/cvt_cyrusdb $b.old flat $b skiplist"
  rm $b.old
done
for b in `find . -name "*.sub"`
do
  echo "fixing subsciption file" $b
  mv $b $b.old
  cat $b.old | sed 's/user./example.com!user./' > $b
  rm $b.old
done
rm -rf /var/imap/domain/e/example.com/*
su cyrus -c "cp -R /var/imap.example.com/user
/var/imap/domain/e/example.com/"
su cyrus -c "cp -R /var/imap.example.com/quota
/var/imap/domain/e/example.com/"

#commands to run manually after script is done

# svcadm disable imap
# rm /var/imap/db/__* /var/imap/db/log*
# rm /var/imap/db.backup?/*
# rm /var/imap/annotations.db
# rm /var/imap/tls_sessions.db
# rm /var/imap/deliver.db
# svcadm enable imap
# su cyrus -c "/usr/cyrus/bin/ctl_mboxlist -u < /tmp/mboxlistnew.txt"


sedstuff.sh:

#!/bin/bash
cat "$@" | gsed 's/lrswipcda/lrswipkxtea/' | gsed '6
s/\t/@example.com\t/' | gs\
ed '4 s/^/example.com!/' > /tmp/tempfile
cp /tmp/tempfile "$@"



And the answer to the bonus question is not saslauthd but:

sudo ldapsearch -LLL -H ldap://servername.example.com -b
"cn=users,dc=example,dc=com"

Since I want to dump the osx server not use the osx server as
authentication source.

/Mikael


Dmitriy Kirhlarov wrote:
> On Wed, Nov 08, 2006 at 10:08:02PM +0100, Mikael Nehlsen wrote:
> 
>> I have an old MacOS X server with cyrus 2.2.12. Now I want to move it to
>> a solaris box with cyrus 2.3.3.
>> This should be no problem I believe, but I am trying to move from a
>> server without virtual domains to one with virtual domains. I wonder if
>> there is any problems with that?
>>
>> My idea of the move is like:
>>
>> * Rsync the osx server to the solaris server /var/spool/imap/ to
>> /var/spool/imap/domain/domain.com/
> 
> You can get a problem. Different bdb versions, different OS, different
> versions of cyrus.
> Also, you want to use virtual domains. Is it mean, usernames changed
> from "user" to "user at domain.com"?
> I guess imapsync best solution in your case.
> 
>> As a bonus question I wonder how I get the users out of ldap on the osx
>> but that's for another place I guess  :) .
> 
> You can use saslauthd for this.
> 
> WBR

-------------- next part --------------
A non-text attachment was scrubbed...
Name: joyride.vcf
Type: text/x-vcard
Size: 297 bytes
Desc: not available
Url : http://lists.andrew.cmu.edu/pipermail/info-cyrus/attachments/20061117/39a7db2d/joyride-0001.vcf


More information about the Info-cyrus mailing list