Green YGreck Guides FR
🐧 LinuxIntermediate⏱ 10 min5 steps

Back up and synchronise with rsync

Copy only what changed, locally or over SSH.

  1. Dry run first (writes nothing):
    rsync -aHAXv --dry-run --delete /home/moi/Documents/ /media/disque/Documents/
  2. If the result is what you expect, run again without --dry-run:
    rsync -aHAXv --delete /home/moi/Documents/ /media/disque/Documents/
  3. To a remote server over SSH:
    rsync -aHAXvz -e ssh /home/moi/Documents/ utilisateur@serveur:/sauvegardes/documents/
  4. The trailing "/" on the source matters: with it, the folder's contents are copied; without it, the folder itself.
  5. Automate with cron and keep several versions with the --backup-dir option.
⚠️ --delete removes from the destination what no longer exists in the source: always test with --dry-run.