Migration with rsync (Linux)
This guide shows how to move files and complete server content from one Linux server to another with rsync over SSH – without a control panel, directly on the command line.
Prerequisites: SSH access to both servers as root. rsync must be installed on both servers — if it is missing: apt install rsync (Debian/Ubuntu) or dnf install rsync (AlmaLinux/Rocky Linux). Use the same distribution and major version on the target as on the source.
rsync flags for migration
| Flag | Purpose |
|---|---|
| -a | Archive mode — preserves permissions, ownership, symlinks, and timestamps |
| -v | Verbose — shows which files are being transferred |
| -z | Compress during transfer — saves bandwidth |
| --progress | Shows progress per file |
| --delete | Deletes files on the target that no longer exist on the source — for a clean sync |
| --exclude | Excludes directories or file patterns from the transfer |
Step 1: Set up SSH between servers
Run this on the source server — replace the IP with the target server's address:
Step 2: Run a dry run
Review the output for unexpected files or errors before starting the real transfer.
Step 3: Start the full transfer
Run the actual transfer — ideally inside a screen or tmux session so it continues if the SSH connection drops:
The excludes keep the target server's own network configuration, disk mounts (/etc/fstab) and bootloader intact. rsync cannot copy the files of a running database consistently — transfer databases separately via Database Migration.
Step 4: Delta sync before switching
Step 5: Start services & test
systemctl start nginx, systemctl start mysql, etc.)