[Dovecot] Migration from courier to dovecot

Kim Johansen maia at weiser.dk
Fri Apr 12 23:26:14 EEST 2013


Hey,

I am working on doing this migration myself. I have migrated some test 
users. And I have build this script to help me, maybe you can use it for 
inspiration(It is on your own risk to use it!):

#!/bin/sh
#Source="/var/vpopmail/"
Destination="/var/mail/vmail/"
i=0
for line in $(cat mailboxs.txt)
do
         if [ -d $Source$line.maildir ]
         then
                 # Create destination
                 echo "--Creating $Destination$line"
                 mkdir -p $Destination$line

                 # Load new data from backup
                 echo "--Copy from $Source$line to $Destination$line"
                 cp -a $Source$line.maildir $Destination$line

                 #If they exist mv trash, send and draft to .INBOX.XXXX
                 echo "--If exist then, mv trash send and draft to 
.INBOX.XXX in $Destination$line"
                 if [ -d $Destination$line/.maildir/.Drafts ]; then
                         mv $Destination$line/.maildir/.Drafts 
$Destination$line/.maildir/.INBOX.Drafts
                 fi
                 if [ -d $Destination$line/.maildir/.Trash ]; then
                         mv $Destination$line/.maildir/.Trash 
$Destination$line/.maildir/.INBOX.Trash
                 fi
                 if [ -d $Destination$line/.maildir/.Sent ]; then
                         mv $Destination$line/.maildir/.Sent 
$Destination$line/.maildir/.INBOX.Sent
                 fi

                 # Change the file right to the new system incl hidden files
                 echo "--Changes owner to vmail:vmail on 
$Destination$line recursive"
                chown -R vmail:vmail $Destination$line $Destination$line.*

                 # Run converter script if et reports an error we stop 
the whole script
                 echo "--Calling courier-dovecot-migrate.pl"
                 /home/weiser/courier-dovecot-migrate.pl --to-dovecot 
--convert $Destination$line.maildir
                 current=$?
                 if [ $current -ne "0" ]; then
                         echo "$current"
                        exit
                 fi

                 # move data from .maildir to ..
                 echo "--Moving data from ./.maildir to ."
                 mv $Destination$line.maildir/* $Destination$line
                 mv $Destination$line.maildir/.* $Destination$line

                 # remove old unused .maildir
                 echo "--Remove old courierfiles and folder and .maildir"
                 rmdir $Destination$line.maildir
                 /usr/bin/find $Destination$line -name 
courierimapsubscribed -exec rm {} \;
                 /usr/bin/find $Destination$line -name courierimapuiddb 
-exec rm {} \;
                 /usr/bin/find $Destination$line -name 
courierpop3dsizelist -exec rm {} \;
                 /usr/bin/find $Destination$line -name courierimapacl 
-exec rm {} \;
                 /usr/bin/find $Destination$line -name 
courierimapkeywords -exec rm -f -R {} \;
                 i=$(( i + 1 ))
         else
         echo "$Source$line.maildir folder not found"
         fi
done;
echo "$i mailbox mirgrated"



it needs to external files to work:

mailboxs.txt, which have a path to each mail folder:
domain1/user1/
domain1/user2/
domain2/user1/

and the courier-dovecot-migrate.pl which you can find more information 
about here:
http://wiki2.dovecot.org/Migration/Courier

good luck.

-- 
Kim Johansen


On 2013-04-12 11:34, ChandranManikandan wrote:
> Hi,
> I am using Courier imap+Qmail+Vpopmail.
> My IMAP having slow issues on our email client while download message as
> well switch to another folder. I would request you to give me the procedure
> for migration as well let me know if anything going wrong after migrate. We
> have 100 mailboxes and some email box more than 25 GB. I want to access
> email fast in oulook client 2010 as well squirrelmail. Kindly guide me . Am
> waiting for your reply asap.
>



More information about the dovecot mailing list