# How do you migrate a server to a new VPS?

> How to migrate a server to a new VPS: copy files with rsync over SSH, move databases as dumps, sync a 2nd time, then switch DNS once it all works.

- URL: https://buymonerovps.com/guides/how-to-migrate-a-server-to-a-new-vps/
- Last updated: 2026-11-30
- Publisher: BuyMoneroVPS (https://buymonerovps.com)

**Quick 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](https://buymonerovps.com/guides/how-to-secure-a-new-linux-vps/ "How to secure 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)*

```bash
# see what would be copied
rsync -aHAXn --numeric-ids -e ssh /var/www/ root@203.0.113.10:/var/www/

# first copy, site still online
rsync -aHAXz --numeric-ids --progress -e ssh /var/www/ root@203.0.113.10:/var/www/
rsync -aHAX --numeric-ids -e ssh /etc/nginx/ root@203.0.113.10:/etc/nginx/

# final copy after stopping writes: also delete files removed since
rsync -aHAX --numeric-ids --delete -e ssh /var/www/ root@203.0.113.10:/var/www/
```

*Databases: MariaDB or MySQL*

```bash
# old server
mariadb-dump --all-databases --single-transaction > all.sql
scp all.sql root@203.0.113.10:/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*

| Option | Meaning | Why it matters here |
| --- | --- | --- |
| -a | Archive: recursive, keeps links, permissions, times, owner, group, devices | The base of any server copy |
| -H | Keep hard links | Not included in -a |
| -A / -X | Keep ACLs / extended attributes | Not included in -a |
| --numeric-ids | Keep user and group numbers instead of mapping names | Users may not share IDs on both servers |
| -n | Dry run: show, change nothing | Checks paths before the real copy |
| -z | Compress data during the transfer | Saves time on text-heavy sites |
| --delete | Remove files on the target that no longer exist on the source | Final sync only |
| -e ssh | Use SSH as the remote shell | Encrypted 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](https://buymonerovps.com/use-cases/self-hosted-apps/ "Self-hosted apps on a Monero VPS") helps pick the size, the [pricing page](https://buymonerovps.com/pricing/ "Monero VPS pricing") lists all plans, and [hosting a website on a VPS](https://buymonerovps.com/guides/how-to-host-a-website-on-a-vps/ "How to host 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

1. [rsync(1) manual page](https://download.samba.org/pub/rsync/rsync.1) — rsync project (Samba) (read 2026-11-30)
2. [mariadb-dump](https://mariadb.com/docs/server/clients-and-utilities/backup-restore-and-import-clients/mariadb-dump) — MariaDB documentation (read 2026-11-30)
3. [SQL Dump](https://www.postgresql.org/docs/current/backup-dump.html) — 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 Hub 8 for $21.22](https://buymonerovps.com/app/checkout/?plan=hub-8&term=1m&from=guides-how-to-migrate-a-server-to-a-new-vps&lang=en)
- [Compare all plans](https://buymonerovps.com/pricing/ "BuyMoneroVPS pricing: what does a Monero VPS cost?")

---

BuyMoneroVPS: BuyMoneroVPS sells Linux KVM virtual servers paid in Monero first, and also in Bitcoin, Litecoin, Solana, Ether, USDC and USDT, with no ID check and no email required. Servers run in Amsterdam, Reykjavik, Zurich, Bucharest, New York, Dallas, Los Angeles, London, Frankfurt, from $3.78 a month. BuyMoneroVPS LLC, a New Mexico company, runs the service.
