How do I preview a server-to-server file copy with rsync?
Use rsync’s dry-run mode to inspect a proposed copy before transferring data. Run it on the Linux source server with an authorised SSH path to the destination. Native Windows OpenSSH does not itself include rsync.
Before you start
- rsync is installed on both Linux servers.
- An authorised verified SSH connection from the source server to the destination.
Instructions
1. Confirm both endpoints and source scope
Both Linux endpoints need rsync installed, and the destination account must be allowed to write the target directory. Use a verified SSH identity and avoid copying credentials or changing live data during the copy.
2. Preview the exact transfer
This example copies the contents of the source uploads directory into the destination uploads directory.
rsync -avhn --itemize-changes "$HOME/uploads/" adminuser@198.51.100.20:/home/adminuser/uploads/-n makes this a dry run, -i shows proposed changes, and the source trailing slash means its contents. No --delete option is used.
3. Proceed only after reviewing the itemised scope
If the destination and proposed overwrites are correct, the corresponding transfer omits -n. Keep any exclusions and SSH options identical, then rerun the preview to check remaining differences. A live database directory should use its database-aware migration process instead of this generic file copy.
Check the result
- The preview names only the intended source contents and destination paths.
- After an authorised transfer, a new preview shows no unexpected remaining differences.
Troubleshooting
- rsync is missing remotely
- Use that server’s approved package process before trying the copy.
- The preview includes too much
- Correct the source path, slash semantics or exclusions before running a real transfer.
Official references
Use the documentation for your installed version when a flag, service name or platform feature differs.
