Mailcow-dockerized: How to migrate mails /var/mail to dockerized ?

Created on 12 Jan 2018  路  11Comments  路  Source: mailcow/mailcow-dockerized

Hi guys,
with info from manual I can't migrate mail from old 0.14 !

Mysql works I can see mail accounts and domain but I don't have mail !

I make backup /var/mail folder from old server and restore on same location on new.
Owneship is 5000:5000, also I can see same content in
/var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data

what is good, but I don't see mails in mailboxes.
What I need to do ?

All 11 comments

If you still have your backup, try deleting the Dovecot files present in the mailbox area:

docker-compose stop dovecot-mailcow
find /var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data -type f -name "*dovecot*" -delete
docker-compose start dovecot-mailcow

@hachre
What I need to do if I want to use /var/vmail on separate block disk device or lvm disk.

On old version I had /var/vmail as mount point on separate lvm partition and I can to enlarge if I need.
Thank you !

You can do the same thing here.

docker-compose down
mount /dev/something /var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data
-or-
mount --bind /some/path /var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data
docker-compose up -d

Just make sure you keep the 5000:5000 ownership on the files and mountpoint. I use it this way myself.

@hachre
Thank you very much on answer.
Do you have some another advice :) because I don't see mail-s again !

I was restored whole /var/vmail folder from mailcow 0.14 onto new instance in same folder /var/vmail

I mounted this folders and I can see now same content from /var/vmail in /var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data

Ownership is ok, I'm checked, but I can't see again mail.
Do you have some more advice for me.

Thank's in advance !

Make sure the _data folder still has 5000:5000. After you mount it, it might no longer have it! If that doesn't help I think you'll need to show logs, for example:

docker-compose logs --tail=1000 dovecot-mailcow

@hachre
I'm again do chown on whole _data folder and I restarted dovecot-mailcow

Logs here:

2018-01-15 09:30:51,857 WARN received SIGTERM indicating exit request dovecot-mailcow_1 | 2018-01-15 09:30:51,862 INFO waiting for cron, dovecot, syslog-ng to die dovecot-mailcow_1 | Jan 15 09:30:51 mail syslog-ng[38]: syslog-ng shutting down; version='3.8.1' dovecot-mailcow_1 | 2018-01-15 09:30:52,000 INFO stopped: syslog-ng (exit status 0) dovecot-mailcow_1 | 2018-01-15 09:30:52,031 INFO stopped: dovecot (exit status 0) dovecot-mailcow_1 | 2018-01-15 09:30:52,031 INFO reaped unknown pid 42 dovecot-mailcow_1 | 2018-01-15 09:30:52,032 INFO reaped unknown pid 47 dovecot-mailcow_1 | 2018-01-15 09:30:52,034 INFO stopped: cron (terminated by SIGTERM) dovecot-mailcow_1 | 2018-01-15 09:30:59,194 CRIT Set uid to user 0 dovecot-mailcow_1 | 2018-01-15 09:30:59,201 INFO supervisord started with pid 1 dovecot-mailcow_1 | 2018-01-15 09:31:00,208 INFO spawned: 'cron' with pid 37 dovecot-mailcow_1 | 2018-01-15 09:31:00,215 INFO spawned: 'dovecot' with pid 38 dovecot-mailcow_1 | 2018-01-15 09:31:00,222 INFO spawned: 'syslog-ng' with pid 39 dovecot-mailcow_1 | Jan 15 09:31:00 mail syslog-ng[39]: syslog-ng starting up; version='3.8.1' dovecot-mailcow_1 | 2018-01-15 09:31:01,441 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) dovecot-mailcow_1 | 2018-01-15 09:31:01,441 INFO success: dovecot entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) dovecot-mailcow_1 | 2018-01-15 09:31:01,441 INFO success: syslog-ng entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Try to access the mails and show what's in the log then :)

@hachre
My mistake ! All mail was there ! Thank you.

My problem is now because I don't see in Admin area, numbers of mails, and percent in user quota ! Do you maybe know what can be problem in that.

Thank you friend !

This should fix itself after a day or so! It is because you copied the mails in like that. There's a cronjob that will run which will fix it! Just keep the server running :) You're welcome!

Awesome friend ! Thank you very much on help !

Sorry for hijacking this issue, but I have a related problem. I created a backup of my non-docker mails via tar -zcf /var/vmail backup.tar and then followed the instructions here:
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:stretch-slim tar xvfz /backup/backup.tar

and then issues the cron jobs inside mailcowdockerized_dovecot-mailcow_1 via:
docker exec -it mailcowdockerized_dovecot-mailcow_1 /bin/bash and then issues the scripts mentioned in /etc/cron.d/ but still the mails don't show up. What am I doing wrong?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Braintelligence picture Braintelligence  路  3Comments

schoebelh picture schoebelh  路  3Comments

zkryakgul picture zkryakgul  路  3Comments

patrick7 picture patrick7  路  3Comments

bonanza123 picture bonanza123  路  3Comments