Move / merge Dovcot

Discussion in 'HOWTO-Related Questions' started by Entangled, Mar 6, 2019.

  1. Entangled

    Entangled Member


    Does anybody have any tricks to move and merge dovecot accounts?

    When the old mail server had issues starting on Friday, I brought up a new postfix / dovecot server in another location and started using it. Now that the old mail server is back online, I need to get the emails from the old server into the new server.

    Any ideas on how to do this without the need of the email account passwords because they are encrypted within dbispconfg?

    Thanks in advance,

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Just copy the whole folders in /var/vmail/.... over to the other server. I assume you are using ISPconfig 3 which means that dovecot uses maildir format and in that format, each mail is in a separate file, so they won't collide. Dovecot will complain about broken indexes in the log, but that's uncritical, they will get repaired automatically. test this with one mailbox, if it works, copy the other ones over too.
  3. Entangled

    Entangled Member

    Thanks Till, but, I rsynced one mailbox last night, got into Roundcube, and only the new mail was there.

    I installed and ran imapsync ... this worked, but, it was rather slow, and I think it needs to used the mailbox password, which I did ... have not tried without the password, but, I think passwords are needed. I think the same is true for doveadm, which I have not attempted using yet.
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Did you check the copied files were in the correct directory with correct owner and permissions? This copying of e-mail files should just work.
    till likes this.
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Copying of files definitely works, used it many times in the past to merge and migrate servers. Regarding rsync, using rsync works as well for this job, just ensure that you don't tell rsync to delete files on the target system which are not on the sourec as this would delete all old emails.
  6. Entangled

    Entangled Member

    I take that back ... hmmm ...

    Got into RoundCube on new server for another Mailbox: 25 mails

    Then did:

    1) last night, I rsync-ed to /var/vmail2
    2) mv /var/vmail/mailbox/Maildir /var/vmail/mailbox/Maildir.NEW
    3) cp -Rp /var/vmail2/mailbox/Maildir / var/vmail/mailbox/.
    4) service dovecot stop
    5) service dovecot start

    Got into Roundcube ... there be the mail from the old server ... some 2500+.

    Know any tricks to get User settings from old Roundcube to new?
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    RoundCube user/account settings are in the RoundCube database, but it's probably not easy to merge them.
  8. Entangled

    Entangled Member

    Don't need to merge the Roundcube User settings, need to copy them from old to new.
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Then you should be able to export the database on the old system and import it on the new one, at least when the RoundCube versions are the same, if not, then you might need to upgrade the database structure.

Share This Page