>_ IzzyLab

Hands-on task

This task is step 13 of the course “Running a server”

Mirror backup with rsync

medium~5 min

rsync is already installed. Make /backup/data an exact mirror of the /srv/data directory: all contents match, and extra files that aren't in the source are deleted from the mirror.

What you'll practise:
  • rsync
  • mirroring
  • apt
  • trailing slash
  • backups

Topic breakdown

rsync synchronizes directories by copying only the differences and can make an exact mirror — but a mirror requires that extra destination files, which aren't in the source, be deleted, otherwise there won't be a full match. The trickiest detail is the trailing slash on the source path: with a slash it means "the directory's contents", without — "the directory itself", and this critically affects the nesting level; the result is checked with a recursive diff -r.

What's checked

  1. rsync is installed
  2. /backup/data is an exact mirror of /srv/data

What it looks like