Migration to a new server

I have a MIAB on a Contabo server and want to migrate to a new server. Backup and restore is too slow. Is it possible to copy everything to the new server with rsync. Then disable all mail services (SMTP and MIAB) on the old server, make a last diff sync and change mx record to the new server.

Is it enough to copy the folder /home/user-data?

Is that a good way for migration?

Or change your MIAB to local backups, force a backup, and rsync /home/user-data/backup/ (plus the secret_key file) to your new box. Then it’s just a local restore on the new box. That way your main backup (you do have one!?) isn’t disturbed and available if needed.

1 Like

Hi, I am facing the same.
Since I am a newbie on Mail in a Box my setup failed due to a hardware issue.
Now i need to move the entire system to a new platform.
My idea is to setup a fresh new Mail in a Box server and than rsync /home/user-data
Does this work?

I’m struggling with moving to the new machine. First, I installed a fresh MIAB and then I rsynced /home/user_data the the new server, but when I run

mailinabox/management/status_checks.py

then I get the following errors:

✓  IP address is not blacklisted by zen.spamhaus.org.
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/root/mailinabox/management/status_checks.py", line 398, in run_domain_checks_on_domain
    check_dns_zone_suggestions(domain, env, output, dns_zonefiles, domains_with_a_records)
  File "/root/mailinabox/management/status_checks.py", line 579, in check_dns_zone_suggestions
    check_dnssec(domain, env, output, dns_zonefiles)
  File "/root/mailinabox/management/status_checks.py", line 603, in check_dnssec
    dnssec_keys = load_env_vars_from_file(os.path.join(env['STORAGE_ROOT'], 'dns/dnssec/%s.conf' % alg_name_map[ds_alg]))
  File "/root/mailinabox/management/utils.py", line 17, in load_env_vars_from_file
    with open(fn, 'r')  as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/user-data/dns/dnssec/ECDSAP256SHA256.conf'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/mailinabox/management/status_checks.py", line 1114, in <module>
    run_checks(False, env, ConsoleOutput(), pool)
  File "/root/mailinabox/management/status_checks.py", line 67, in run_checks
    run_domain_checks(rounded_values, env, output, pool, domains_to_check=domains_to_check)
  File "/root/mailinabox/management/status_checks.py", line 360, in run_domain_checks
    ret = pool.starmap(run_domain_checks_on_domain, args, chunksize=1)
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 375, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
FileNotFoundError: [Errno 2] No such file or directory: '/home/user-data/dns/dnssec/ECDSAP256SHA256.conf'

My next approach was a local backup. It took almost 5 hours (backup size 25 GB). Now I rsync the backup files to the new server (will take also time because I only have 100 MBit bandwith to my old VPS). Then I will restore the backup and hope the errors are gone. I will post my results here.

dnssec files needs to be regenerat by “sudo tools/dns_update --force” but move the old one first to an other safe location for just in case backup

1 Like

Thank you, now the status check works perfectly.

I finally migrate with rsync, actually very easy, here is my howto:

the scenario: old MIAB running on old system (with broken hardware) on ip aa.bb.cc.dd
install a fresh MIAB on new hardware from scratch in ip aa.bb.cc.ee
new server has same domainname as the old one

fix the “PIP” issue reported on Brand new Installation fails at pip upgrade
by add >>>export DEB_PYTHON_INSTALL_LAYOUT=‘deb’<<< before! running the install script
then rsync as root /home to new server
root@oldserver:~# rsync -avz /home/ root@newserver:/home/
shut down old server
then find all ip’s aa.bb.cc.ee on new server and replace with aa.bb.cc.dd to run the new server on old server’s ip by find /etc/. -type f -exec grep aa.bb.cc.ee {} ; -print
reboot new server - done

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.