Moving dovecot mail server from one server to another

So, I’ve decided I need to move from one server to another. The site has been moved already, but now it’s time to move the mail server. It’s been a while since I set it up, so I’ve probably forgotten a bit how it was set up in the first place.

First I’ll start with backing up the vmail folder on the old server.

Then I’m copying this over to the new server, extracting it on the same location on the new server.

That’s the data. But we need the database controlling it all aswell. So we’ll export the sql data.

To import it I first had to create the database on the new server. First login on the mysql server, then:

And the import command:



Now, on the new server I still haven’t installed any mail software. Since I was using postfix/dovecot on the old server, I’ll go for the same on the new one.

There, now I’ve installed the software, all I need to do is to set it up.

First of all I want to try to just copying the config files from the old server over to the new one. Hopefully that will work.

From the postfix configuration directory (/etc/postfix) I copy In this directory I’ve also created a directory named virtual where I store my sql commands for the virtual mailboxes. So I copy this directory over aswell.

As far as I can remember that’s  all the configuration I did with postfix. Now for dovecot.

In /etc/dovecot/ I’m copying dovecot.conf and dovecot-sql.conf over to the new server.

On my old server I was using Roundcube as a web mail solution, so I’ll go for the same on the new server.

I won’t bother to reuse the configuration on this, so I’m just plainly installing it with:


After setting that up, now I’ve changed the MX-records on the DNS, and I’ll just have to wait for it to update to check if everything’s working like it should.

3 Comments on Moving dovecot mail server from one server to another

Leave a Reply