--delete removes files at the destination that no longer exist at the source. Combined with a reversed path, it wipes production. Always dry-run first and read every line of output.
What you will achieve
Preview an rsync backup job with --dry-run and --itemize-changes so you know exactly what would transfer, update, or delete before touching live data.
1) Basic dry-run
rsync -av --dry-run /etc/ /backup/etc-test/
-a archive mode preserves permissions and timestamps. -v verbose. Nothing is written — rsync only prints what it would do.
2) Itemize changes for clarity
rsync -av --dry-run --itemize-changes /var/www/ backup@host:/srv/mirror/www/
Each line starts with a change code. Key codes: >f+++++++ new file, >f.st.... size/time change, *deleting would remove at destination (with --delete).
3) Mirror with delete — dry-run mandatory
rsync -aHAX --delete --dry-run --itemize-changes \
/home/ /backup/home/
-H hard links, -A ACLs, -X extended attributes — common on full system backups. Never run --delete on production mirror without dry-run review.
4) Remote over SSH dry-run
rsync -av --dry-run -e ssh /etc/ admin@backup.example.com:/srv/backups/$(hostname)/etc/
Network dry-runs still enumerate local files — useful for estimating transfer size:
rsync -av --dry-run --stats /var/lib/ remote:/path/ 2>&1 | tail -5
5) Compare two trees without syncing
rsync -avnc --delete /live/ /backup/live/
-c checksum comparison — slower but catches same-size edits. -n is shorthand for --dry-run.
6) Log dry-run for approval
rsync -av --delete --dry-run --itemize-changes \
/data/ /backup/data/ | tee /tmp/rsync-dryrun-$(date +%F).log
Share the log with a colleague before the real run — change control for the sensible admin.
7) Run the real job after review
rsync -aHAX --delete /home/ /backup/home/
Remove --dry-run only when output matches expectations. First real run takes longer; subsequent runs are incremental.
8) Bandwidth-limited dry-run on WAN
rsync -av --dry-run --bwlimit=1000 -e ssh /data/ remote:/backup/
Dry-run skips transfer but still walks the file list — useful to estimate change volume before a slow uplink sync window.
Verify
rsync -avnc /home/ /backup/home/ | grep -c '^>'
du -sh /backup/home/
Post-run checksum dry-run should show minimal or zero changes immediately after a successful sync.