Last updated

Mailcow

Mailcow Server Migration

Migrate a Mailcow mail server to a new host with minimal downtime.

Contents

  1. Step 1: Back Up the Source Server
  2. Step 2: Set Up the New Server
  3. Step 3: Transfer Data
  4. Step 4: Start Mailcow on New Server
  5. Step 5: Cut Over DNS

Migrate your Mailcow instance to a new server with minimal downtime.

Step 1: Back Up the Source Server

cd /opt/mailcow-dockerized
sudo docker compose down
sudo tar -czf /tmp/mailcow-backup.tar.gz   mailcow.conf docker-compose.yml data/assets/ssl   data/conf data/index /var/lib/docker/volumes

Step 2: Set Up the New Server

# On the new server, install Docker and clone Mailcow
cd /opt
sudo git clone https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized
sudo ./generate_config.sh

Step 3: Transfer Data

# Copy backup to new server
scp /tmp/mailcow-backup.tar.gz user@new-server:/tmp/

# On new server, extract and overwrite
cd /opt/mailcow-dockerized
sudo tar -xzf /tmp/mailcow-backup.tar.gz --strip-components=2

Step 4: Start Mailcow on New Server

sudo docker compose pull
sudo docker compose up -d

Step 5: Cut Over DNS

Update your MX and A records to point to the new server IP. Use a low TTL (300s) before the migration so DNS propagates quickly. Keep the old server running for 24–48 hours to catch any stragglers.

FAQ

How do I move Mailcow to a new server?

Back up with Mailcow's helper script, restore on the new host, then switch DNS. Lower the DNS TTL a day before.

Will I lose mail during the move?

Not if you sync mail again after the final backup and switch MX quickly. Sending servers retry for days.