Back to lessons

Hosting Operations

Preview Backup Drift with rsync

You need to see source-to-backup drift without modifying the backup.

Command

rsync -ain --delete source/ backup/

What changed

Nothing changes because rsync runs with dry-run and itemized output.

Danger

safe

When to use it

Use before syncing backups, especially when --delete may remove stale files.

When not to use it

Do not remove -n until you understand every itemized change.

Undo or recovery

No undo needed because this command is a dry run.

Expected output

Itemized rsync changes that would update, create, or delete files.

demo script

Disposable terminal steps

  1. find source backup -type f | sort
  2. rsync -ain --delete source/ backup/

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ find source backup -type f | sort
backup/.snapshot
backup/app/config.yml
backup/content/index.md
backup/old-report.csv
backup/tmp/empty.cache
source/app/config.yml
source/assets/logo.svg
source/content/about.md
source/content/index.md
::exit-code::0
$ rsync -ain --delete source/ backup/
*deleting   tmp/empty.cache
*deleting   tmp/
*deleting   old-report.csv
*deleting   .snapshot
cd+++++++++ assets/
>f+++++++++ assets/logo.svg
>f+++++++++ content/about.md
>f.st...... content/index.md
::exit-code::0

YouTube Short

Preview rsync backup drift.

Use rsync dry-run with itemized output before syncing backups, especially when delete is involved.

LinkedIn hook

Rsync can tell you what would change before it changes anything.

Question: Do you read rsync itemized output before removing --dry-run?

experiments

A/B tests to run

Metric: comment_rate

A: Preview before sync.

B: Read the itemized drift.