Tutorials / Backup

Back Up and Migrate a VPS with rsync

advanced60 minLast reviewed: 2026-07-15Target OS: Ubuntu 24.04 LTS

Written by uNode Engineering; reviewed by uNode Operations.

Application-consistency warning, native database export, rsync preservation flags, staged verification, and DNS cutover sequence reviewed.

A filesystem copy is not automatically an application-consistent backup. Export databases or stop writes, copy data with ownership, restore services, and test the destination before changing DNS.

Illustration for How to Back Up and Migrate a VPS with rsync

Prerequisites

  • SSH access to source and destination.
  • A destination with enough disk.
  • Application-specific database export knowledge.
Open console server deploy

Step 1

Inventory and quiesce the application

Record packages, services, ports, environment files, scheduled jobs, and database versions. Put the application in maintenance mode or stop writes.

systemctl --type=service --state=running
ss -lntup
df -hT

Step 2

Export databases

Use the database's native logical backup and verify the output is non-empty before copying it.

mysqldump --single-transaction --all-databases | gzip > /root/mysql.sql.gz

Step 3

Copy application data

Preserve ownership, modes, links, ACLs, and extended attributes. Exclude virtual filesystems and ephemeral caches.

rsync -aHAX --numeric-ids --info=progress2 /srv/ root@<destination-ip>:/srv/

Step 4

Restore and verify

Restore the database, start services, test through a local hosts-file override, and compare checksums or application health before DNS cutover.