Markus Michalski FAQ

restic-backup-suite: Usage

Commands of restic-backup-suite: restic-backup with dry run and dump-only, restic-inspect snapshot browser, install.sh options, shell aliases and Makefile targets.

Deutsche Version

Back to overview


Usage

After installation three commands are available. All of them must run as root.

Command Script Purpose
restic-backup backup.sh Backup with database dumps, retention and verification
restic-restore restore.sh Interactive restore, see Restore
restic-inspect inspect.sh Look at snapshots without restoring anything

All three accept --config <file> and -h/--help. With TRACE=1 in the environment they enable set -o xtrace.

restic-backup

sudo restic-backup [--config FILE] [--dry-run] [--dump-only]
Option Effect
--config FILE Use a different configuration file
--dry-run Lists the backup paths without running restic backup
--dump-only Runs only the database dumps

Without options the full backup runs. The sequence is described on the Technical details page.

--dry-run is not a pure dry run. It only skips restic backup and stopping Docker services. Everything else runs: writing the SSH configuration, initialising the repository if needed, stopping systemd services, creating database dumps, then restic forget --prune with your retention and restic check. The marker file is not written.

Dump only

sudo restic-backup --dump-only

Creates all configured database dumps in a temporary directory, lists the files with their sizes and exits with code 0 or 1. It writes no SSH configuration, does not touch the repository and stops no services. The temporary directory is removed on exit. Use it to test new container entries.

restic-inspect

sudo restic-inspect [--config FILE] [--snapshot ID | ID]

Without a snapshot argument the script lists the snapshots and asks for an ID (Enter selects latest). You can also pass an ID or latest directly as an argument. Then the menu appears:

Choice Function
1 Snapshot details (restic snapshots <ID> --verbose)
2 Restore-size statistics (restic stats --mode restore-size)
3 List files, optionally with a path prefix (restic ls --long); long output goes to less
4 Search file paths by substring (case-insensitive)
5 Diff against another snapshot (restic diff)
6 Show the snapshot's database dumps
s Select a different snapshot
q Quit

restic-inspect does not restore anything.

Shell aliases

The installer creates /etc/profile.d/restic-aliases.sh. The aliases are available after the next login or after source /etc/profile.d/restic-aliases.sh. Each alias first reads /etc/restic/config.sh.

Alias Equivalent
restic-snapshots restic snapshots
restic-stats restic stats --mode restore-size
restic-check restic check --read-data-subset=5% (fixed 5 %, independent of REPO_CHECK_SUBSET)
restic-ls restic ls latest
restic-mount restic mount (needs FUSE), for example restic-mount /mnt/restic
restic-unlock restic unlock
restic-rawstats restic stats --mode raw-data latest

The aliases read only /etc/restic/config.sh, not a file in the clone directory.

Installer options

sudo ./install.sh [--cron] [--uninstall] [-h]
Option Effect
--cron Also installs the cron job. On an already installed system the option only creates the cron job
--uninstall Removes symlinks, aliases and cron job, asks before deleting /etc/restic

Makefile

The clone directory contains a Makefile with shortcuts.

Target Effect
make install install.sh
make install-cron install.sh --cron
make uninstall install.sh --uninstall
make lint / make check ShellCheck on all scripts (needs shellcheck)