Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Email server migration best practice?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Email server migration best practice?

torrboxtorrbox Member

I have a postfix+dovecot+mysql email server and would like to transfer it to a different VPS. What is the best way of doing this?

My plan is to simply transfer the installation and change the DNS records, but I am concerned about emails that are sent to the old server, for example if the sender caches DNS. Can I just use rsync on the email folder, or does dovecot need some internal magic to recognize new emails?

How would/do you do it?

Comments

  • wavecomaswavecomas Member, Host Rep

    if you dont have large amount of boxes just use imapsync https://imapsync.lamiral.info/
    most of webhosters are using it in case of customer migration.

    Thanked by 1torrbox
  • sleddogsleddog Member

    Lower the TTL of hosted email domains to 600 24 hours before migration.

    Then update DNS records to point to the new server.

    Then shutdown postfix on the old server.

  • @sleddog said:
    Lower the TTL of hosted email domains to 600 24 hours before migration.

    Then update DNS records to point to the new server.

    Then shutdown postfix on the old server.

    Don't forget to migrate the mails in between 1 and 2. :)

    Thanked by 2yomero torrbox
  • Once the MX record is pointed to the new server, the emails automatically route to the new server. The best advice would be to transfer the server at weekends or when there is a less traffic.

  • Just run imapsync at intervals during the "migration"

    Thanked by 1torrbox
  • jackbjackb Member, Host Rep
    edited May 2018

    @hostechsupport said:
    Once the MX record is pointed to the new server, the emails automatically route to the new server. The best advice would be to transfer the server at weekends or when there is a less traffic.

    That's wrong. Any DNS resolver could be caching the old record. It is absolutely imperative that you shut down the old mail server before setting the new DNS record - or handle it some other way, e.g.:

    • DNAT on the old host (as a guess - not tried this)
    • merge old => new at a later date
    • don't care about data consistency

    Same goes for any migration where you're relying on DNS. Don't blindly trust resolvers you don't control to respect your records or your TTL.

    Thanked by 1torrbox
  • jaejae Member

    If you have maildir storage

    • Lower the TTL for hosted domain, at least 1 days before migration process
    • stop postfix/dovecot old server
    • stop postfix/dovecot new server
    • Create new mail user @new server, if you have large number of user, use mysqldump and mysqlimport
    • rsync mail folder to new server
    • point mx record to new server, and all necessary record
    • start postfix new server
    • configure old server as backup mx (optional)
    • start postfix/dovecot old server (optional)
    • Block pop3/imap port old server (optional)

    keep old server running for 2 days

    Thanked by 1torrbox
Sign In or Register to comment.