Migrating from one IP and server to a new one

What is the preferred way of migrating from one server to a new one with a different IP?

I would like to preserve accounts and emails.

Create a user-data user on the new machine (adduser user-data I think), copy /home/user-data over from the old machine (e.g. rsync -avz ... ...), then install Mail-in-a-Box as usual.

I haven’t actually tested this, but it’s designed to work this way, and I think someone has reported that it worked.

If you could take notes on what you do and/or submit a pull request to the setup guide, that’d be really helpful.

Thanks Josh,

Is there a way to make sure mail doesn’t get lost or delivered to the old server when migrating?

I’ve already moved the DNS entries to an external box and reduced the TTLs.

I guess I would shut down the old server. Mail normally will get queued by the sender in that case, and then will get delivered once the DNS updates and the new server is in place.

I am eager to know if this worked as intended? Would like to do this myself as well, but not sure if it worked out the way it should for OP :slight_smile:
Thanks

The migration was surprisingly smooth. I can’t comment on importing the Mailinabox data to a new server because I left Linux for FreeBSD and had to leave it behind unfortunately.

Anyhow, no emails were lost in the process. For the curious, I used imapsync to transfer mail from a handful of accounts and didn’t encounter any problems.

Make sure you’ve got a backup, just in case.

Thanks! I just finished migrating to another server and it went silky smooth.
Just like Joshua mentioned:

  • adduser user-data on new machine
  • sudo service dovecot stop on old one
  • rsync -avz /home/user-data user-data@newbox:/home/user-data
  • run mailinabox setup on new box
  • ensure everything works
  • be thankful to Josh and other mailinabox contributors for the solid work :slight_smile:
2 Likes

I have a new install only since yesterday working OK.

Can I run the rsync command with the source not a MIAB install but a standalone postfix/dovecot install?

rsync -avz /home/auser/Maildir user-data@datamaskinaggie.xyz:/home/user-data

Then rerun ./mailinabox ?

@pimpedoutgeek Maybe, but the destination directory isn’t right (you’ll need to figure it out).

After doing some research on this I realize we should be using a different storage format (sdbox), so the answer may be “no” in the future.

I followed these instructions and had some real issues with the new box getting configured correctly. I would like to add a caveat to your instructions. the rsync command should be:
‘rsync -avz /home/user-data/mail/mailboxes user-data@newbox:/home/user-data/mail’

Only syncing the mailboxes will prevent issues with configuration on the new box, but will still preserve all the existing mail on the old box.