[Dovecot] Migrate from Maildir to mdbox
sf.rique at gmail.com
Fri Dec 24 19:11:05 EET 2010
To do without any down time, i start to use mail_location from the sql.
Like, regular user still using mail_location from 10-mail.
Lets give an example:
User1 at domain1.com
user1 at domain2.com
User2 at domain1.com
User2 at domail2.com
All them have mail_location in 10-mail
Gona firt migrate User1 at domain1.com
# chmod a-w /path/to/thatuserhome/
Now, dovecot can not write any emails there. Will will result in temporary
failure, at least in my conf it does.
So now, User1 at domain1 can not receie any email only ready it.
now gona migrate!
# dsync -v -u user1 at domain1.com backup mdbox:~/mdbox
Alright see if it doe snot have any erros.
So now you have 2 options, or you get each user a nemsapce or you select
mail_location from mysql. I use mysql.
First have to set it up
In user query, i supose you already have it. add an collum in or mysql setup
called mailbox and anothe rone called home
you can call it whatever you want, but in user query you have to use some
thing like this
user_query = SELECT home AS home, mailbox AS mail
I uses home as home in case you change the table name! In mailbox collum
you have the mail_location path! Each user can have it owns! And home, you
have the home path. I use diferens home path cause have many storages and
So, once you have mail_location coming from mysql, all you need to do after
convertion is change in mysql the path of mailbox table that now will be for
user1 at domain1.com mdbox: ~/mdbox same you use in the comand above!
Don't forget to give the right permissions so dovecot can write in it before
you change in mysql.
Now user1 at domain1.com is working with mdbox and others are working with
After you migreate all, if you want to you can change the mail_location in
10-mail to mdbox:~/mdbox or keep using mysql.
When you select mailbox and it comes back as null, it will use the conf from
Sorry about my english.
If you have any questions i would be glad to help!
Just to be sure, after migrate each user, make sure to kill all imap process
that they are loggin on. ( i did not, but the wiki says you should )
About the mirror problems. I was using mbox, some boxes were broken, and
when dsync crash, this messy up both sides. Using backup you can only messy
up the second argument. So this will not give you any problems. Mirror can
edit the source email.
On Fri, Dec 24, 2010 at 1:55 PM, Odhiambo Washington <odhiambo at gmail.com>wrote:
> On Fri, Dec 24, 2010 at 5:56 PM, Henrique Fernandes <sf.rique at gmail.com>wrote:
>> Yeah, i guess the right ocmando would be dsync
>> dsync get the user from mysql, with user query. I guess.
>> Are you looking to do it without any downtime ?
> Yes. It's a server with a few hundred users and some of them have mail on
> the server, to the tune of 2GB..
>> Are you getting the mail_location from mysql or in conf file ?
> mail_location is from 10-mail.conf
>> I would use dsync backup. I had some trouble using mirror when a box was
>> corrupted, it messed up both sides.
> Kindly provide more details on what you did. Maybe a good headstart,
> Best regards,
> Odhiambo WASHINGTON,
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
More information about the dovecot