Skip to content
Menu

How do you migrate a server to a new VPS?

Checked by the BuyMoneroVPS deskLast updated on 6 min read

Straight answer

To migrate a server to a new VPS, install the same software on the new machine, copy the files with rsync over SSH, move each database as a dump, run a second rsync to catch late changes, then point DNS to the new IP. A BuyMoneroVPS server paid in Monero is ready within 1 hour.

In brief
  • rsync -a copies files with their permissions, times and owners; add -H, -A and -X for hard links, ACLs and extended attributes.
  • A trailing slash on the source copies the folder's content, not the folder itself.
  • Databases move as dump files: mariadb-dump --single-transaction gives a consistent copy of InnoDB tables without blocking them.
  • Keep the old server running until the new one has served traffic for a few days.

What should you prepare before copying anything?

A list of what runs on the old server, a new VPS with the same system, and SSH access from one to the other. Write down the services (web server, database, mail, cron jobs), their configuration folders, the data folders and the domains that point to the server. Then order the new VPS with the same distribution and release where possible; Debian 12 to Debian 12 avoids surprises with package versions.

On the new server, install the same packages first, and secure it before it holds any data: key-only SSH, updates, a firewall. Securing a new Linux VPS covers those steps. Finally, lower the DNS TTL of your domains a day ahead, so the switch at the end spreads in minutes rather than hours.

What are the migration steps, in order?

  1. Let the old server reach the new one

    Add the old server's public key to the new server's authorized_keys, or push the files from your own computer, which already holds a key for both.

  2. Do a dry run

    Run rsync with -n (--dry-run) to see which files would move. Check the paths, especially the trailing slashes.

  3. Copy the files a first time

    Run rsync -aHAX --numeric-ids over SSH for each data folder, for example /var/www and /etc/nginx. The site stays online during this copy.

  4. Dump and import the databases

    Export with mariadb-dump --single-transaction (or pg_dump for PostgreSQL), copy the file across and import it with the mariadb client.

  5. Stop writes and sync again

    Put the site in maintenance or stop the application, take a fresh dump, and rerun rsync with --delete so the new copy matches exactly.

  6. Test, then switch DNS

    Test the new server through its IP or a hosts-file entry. When it works, change the DNS records to the new IP.

  7. Keep the old server a few days

    Watch the logs of both machines until traffic has moved. Then cancel the old server.

Files: dry run, first copy, final copy (run on the old server)
# see what would be copied
rsync -aHAXn --numeric-ids -e ssh /var/www/ [email protected]:/var/www/

# first copy, site still online
rsync -aHAXz --numeric-ids --progress -e ssh /var/www/ [email protected]:/var/www/
rsync -aHAX --numeric-ids -e ssh /etc/nginx/ [email protected]:/etc/nginx/

# final copy after stopping writes: also delete files removed since
rsync -aHAX --numeric-ids --delete -e ssh /var/www/ [email protected]:/var/www/
Databases: MariaDB or MySQL
# old server
mariadb-dump --all-databases --single-transaction > all.sql
scp all.sql [email protected]:/root/

# new server
mariadb < /root/all.sql

What does each rsync option do?

rsync options used in this guide, from the rsync manual, 30 November 2026
OptionMeaningWhy it matters here
-aArchive: recursive, keeps links, permissions, times, owner, group, devicesThe base of any server copy
-HKeep hard linksNot included in -a
-A / -XKeep ACLs / extended attributesNot included in -a
--numeric-idsKeep user and group numbers instead of mapping namesUsers may not share IDs on both servers
-nDry run: show, change nothingChecks paths before the real copy
-zCompress data during the transferSaves time on text-heavy sites
--deleteRemove files on the target that no longer exist on the sourceFinal sync only
-e sshUse SSH as the remote shellEncrypted copy between servers

Why do the trailing slash and --numeric-ids matter?

One decides where the files land; the other decides who owns them. The rsync manual explains that a trailing slash on the source avoids creating an extra directory level at the destination. So /var/www/ to /var/www/ copies the content into the existing folder, while /var/www to /var/www/ would create /var/www/www. A dry run shows the mistake before it happens.

--numeric-ids keeps the user and group numbers as they are, instead of matching them by name. On two fresh installs of the same system the numbers usually agree for system users, but an application user created by hand may have another number on each side. If the numbers differ, create the users on the new server with the same IDs before the copy, or fix ownership afterwards with chown.

Databases are the exception to copying files: a live database folder copied by rsync can be inconsistent. A dump avoids it. MariaDB's documentation notes that --single-transaction gives an online backup for InnoDB tables, so reads and writes continue during the dump.

Can BuyMoneroVPS do the migration for you?

Yes, as a paid option: "Assisted migration" costs $35 once, and support moves one site or app from your old server to the new VPS. You add it at checkout with the new server. It suits a single website or application when you would rather not handle rsync and dumps yourself.

For everything else, the steps above take one to three hours for a typical site, most of it waiting for copies. According to BuyMoneroVPS's survey of 30 November 2026, Hub 8 (4 vCPU / 8 GB / 160 GB) costs $21.22, 42% below the $36.50 mean for that size, which often pays for a month of overlap. The self-hosted apps use case helps pick the size, the pricing page lists all plans, and hosting a website on a VPS covers nginx and HTTPS on the new machine.

Frequently asked questions

Can I copy the whole disk instead of folders?

Not safely between two running systems: the new server has its own kernel, network settings and SSH host keys. Move data and configuration folders, and reinstall packages on the new system.

How do I avoid losing orders or comments during the switch?

Stop writes before the final sync: maintenance mode, or stop the application. Take a fresh dump, run rsync with --delete, import, then switch DNS. The window lasts minutes.

What about PostgreSQL?

Use pg_dump for one database, or pg_dumpall for the whole cluster with its roles, then restore with psql (or pg_restore for a custom-format dump). PostgreSQL's manual says a pg_dump is a consistent snapshot and does not block other work.

Do I keep my IP address?

No. The new VPS has its own dedicated IPv4 and /64 of IPv6. Update DNS records, firewall allow-lists and any service that pins the old IP.

Verdict
  • rsync twice, dump once before each sync, then switch DNS: that sequence keeps downtime to minutes.
  • Always do a dry run and check trailing slashes first.
  • Choose Assisted migration when one site or app is all you need moved.
Sources (3)
  1. rsync(1) manual page — rsync project (Samba) (read 2026-11-30)
  2. mariadb-dump — MariaDB documentation (read 2026-11-30)
  3. SQL Dump — PostgreSQL documentation (read 2026-11-30)

Move to a server paid in Monero

Hub 8: 4 vCPU · 8 GB memory · 160 GB NVMe disk · 12 TB monthly transfer in London, Frankfurt, Amsterdam, New York, Dallas or Los Angeles.

Deploy a Monero VPS from $3.78/mo