Migrate from old to new postfix/dovecot mail server
I've migrated from a Wheezy based postfix+courier+mysql to a Stretch based one (postfix+mysql+dovecot) with slightly updated config plus a few new options on a fresh install.
The key for my migration was that the users are all virtual (via mysql tables) and all mail was stored in /home/vmail/domain/user/[various maildirs]
New system has similar structure for maildirs, just under /var/vmail/domain/user instead of /home/vmail...
Only "trick" to it was copying the files and making sure correct ownership and other permissions were applied on the new location.
The reason for me not being successful with finding a good dovecot<->dovecot copy guide was that there is an easy and more generic imap<->imap way of doing it. (For example ImapSync Thanks Sven for your comment to my question).
ImapSync: I did it this way.
- Download the code from github and build it
- use it
Necessary dependencies for the build
apt-get install makepasswd rcs perl-doc libio-tee-perl git libmail-imapclient-perl libdigest-md5-file-perl libterm-readkey-perl libfile-copy-recursive-perl build-essential make automake libunicode-string-perl libauthen-ntlm-perl libcrypt-ssleay-perl libdigest-hmac-perl libfile-copy-recursive-perl libio-compress-perl libio-socket-inet6-perl libio-socket-ssl-perl libio-tee-perl libmodule-scandeps-perl libnet-ssleay-perl libpar-packer-perl libreadonly-perl libterm-readkey-perl libtest-pod-perl libtest-simple-perl libunicode-string-perl liburi-perl cpanminus
CPAN modules (CPAN = Comprehensive Perl Archive Network)
cpanm JSON::WebToken Test::MockObject Unicode::String Data::Uniqid
Then get the imapsync code from github and build with make install
When done, using it is as easy as
imapsync \
--host1 test1.lamiral.info --user1 test1 --password1 secret1 \
--host2 test2.lamiral.info --user2 test2 --password2 secret2
More details here
you COULD use imapsync actually… but it failed me with some obscure error.
rsync is NOT a good idea… because dovecot/thunderbird/icedove does not rebuild index files/folder structure.
the solution is actually simple: use thunderbird/icedove your mail client!
- create same mail account on new server as on old server
- add old and new account inside thunderbird (you can use IP addresses if the domain is already pointing to the new server)
- drag and drop the old mails-folders from your old account to your new account wait… all mails get downloaded locally from your old account and then uploaded to your new account.
PS: Thanks for voting down on my last improvement post and removing "hooray". this platform sucks. i really think about a boycott.