Mailcow-dockerized: Tool to migrate from old, non-dockerized to dockerized mailcow?

Created on 11 Mar 2017  路  6Comments  路  Source: mailcow/mailcow-dockerized

I have a server on Mailcow 0.13.1 (yes, I know that's old :/) that I would like to migrate to mailcow-dockerized, is there some kind of tool or script to do it?

Most helpful comment

I have it done.

First of all you need to backup the sql tables.
Make an backup and use this command to access the MySQL server:
https://andryyy.github.io/mailcow-dockerized/u_and_e/#connect

source mailcow.conf
docker-compose exec mysql-mailcow mysql -u${DBUSER} -p${DBPASS} ${DBNAME}

There you can copy / paste your insert commands.

Now backup your vmail dir
tar cvfz backup_vmail.tar.gz /var/vmail

And restore it:
https://andryyy.github.io/mailcow-dockerized/u_and_e/#restore

cd /path/to/mailcow-dockerized
source mailcow.conf
DATE=$(date +"%Y%m%d_%H%M%S")
docker run --rm -it -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker-compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:jessie tar xvfz /backup/backup_vmail.tar.gz

Customize ${PWD} to the path where the backup_vmail.tar.gz is stored.

All 6 comments

I have the same problem...
But I have only one question unanswered... How do I get the mails stored in the 0.13.1 installation into the new vmail-volumes...
For the rest I don't care because I will make a fresh install on an new installed server...

Hey @jhartlep,

I'm not 100% sure but you could manually tar your vmail folder on the old installation and restore your mails like descibed in https://andryyy.github.io/mailcow-dockerized/u_and_e/#backup-and-restore-maildir-simple-tar-file

I have it done.

First of all you need to backup the sql tables.
Make an backup and use this command to access the MySQL server:
https://andryyy.github.io/mailcow-dockerized/u_and_e/#connect

source mailcow.conf
docker-compose exec mysql-mailcow mysql -u${DBUSER} -p${DBPASS} ${DBNAME}

There you can copy / paste your insert commands.

Now backup your vmail dir
tar cvfz backup_vmail.tar.gz /var/vmail

And restore it:
https://andryyy.github.io/mailcow-dockerized/u_and_e/#restore

cd /path/to/mailcow-dockerized
source mailcow.conf
DATE=$(date +"%Y%m%d_%H%M%S")
docker run --rm -it -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker-compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:jessie tar xvfz /backup/backup_vmail.tar.gz

Customize ${PWD} to the path where the backup_vmail.tar.gz is stored.

Please check the guide in our documentation and try to improve it if necessary. Every PR is welcome!

I'm closing this issue for now. Please feel free to open a new Issue in the repository of our documentation if needed.

Instructions doesn't work:

tar (child): /backup/backup_vmail.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

And yes there is file in /backup/backup_vmail.tar.gz

Docmentations about maildir backup ant restore is only for new dokerized version!

@RomkaLTU Better off opening up a new issue, but, if you're trying to go from non-docker to docker version, then the simplest way would be to rsync the old vmail to the new vmail + chown it. SQL tables should just be a regular backup and restore, or directory sync.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

poldixd picture poldixd  路  3Comments

bonanza123 picture bonanza123  路  3Comments

GalacticLion7 picture GalacticLion7  路  3Comments

damdinsharav picture damdinsharav  路  3Comments

K2rool picture K2rool  路  3Comments