Skip to content
Gareth edited this page Feb 20, 2024 · 9 revisions

Adding a Repository

A backrest repository maps to the concept of a restic repository (and is indeed a restic repo under-the-hood). A repository is a location where backrest will store your backups.

To add a repository, click the "Add Repository" button on the side nav. You will be prompted to enter a name for the repository and a path to the repository. The path can be a local path or a remote path (e.g. an S3 bucket). See the restic docs for more details on the types of repositories that restic supports. Backrest allows you to configure environment variables which should be used to pass additional credentials for remote repositories. For example, if you are using an S3 bucket, you can configure the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables to pass your AWS credentials to restic.

Repository Options

Repo Name the repository name is immutable after creation, choose carefully. Organizationally, it can help to choose a name that conveys the storage type and the semantics of the storage. E.g. a bucket named "foo" on backblaze might lend itself to a repo named "b2-foo".

Repo URI identifies the location where the repo's data is stored. This corresponds to the URI used by restic. See the restic docs for more repo types. For common storage providers this looks like:

  • Backblaze: b2:yourbucket or b2:yourbucket/pathprefix
  • AWS S3 (or S3 compatible storage): s3:yourbucket or s3:yourbucket/pathprefix
  • Local path: /mnt/backupdisk/repo1.

Environment Variables environment variables provide additional configuration to restic (typically related to credentials for the storage provider). Common examples are

  • For S3 storage set: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  • For B2 storage set: B2_ACCOUNT_ID and B2_ACCOUNT_KEY

Flags additional flags to provide to restic. At the moment only presence flags are supported. Common usage might include:

  • --force will force rereading all files on each backup rather than relying on metadata (e.g. last modified time). This can be much slower.
  • --one-file-system will prevent restic crossing filesystem boundaries.

Prune Policy specifies how often prune operations run on the repository. For more details about prune operations see the restic docs. The prune policy configures a shortest time between consecutive prunes in days (checked each time a forget operation runs) and a max unused percentage which specifies how much data can be unused in a pack file before it is "repacked". Setting lower values reduces dead space in the repository at the cost of downloading / reuploading pack files. Low values may be good for local storage but overly aggressive values may incur additional fees for providers that charge for egress bandwidth.

Hooks hooks are actions that can be configured in response to backup lifecycle events. See the hooks page of the wiki for more details.

Adding a Plan

A plan is a new concept introduced by backrest. A plan is a set of rules for backing up data. A plan can be configured to backup one or more directories to a single repository. Each plan has it's own schedule and retention policy controlling when backups are run and how long backups are kept.

To add a plan, click the "Add Plan" button on the side nav. You will be prompted to enter a name for the plan and select a repository to backup to. You will then be prompted to select one or more directories to backup. A default retention policy is given but you can also pick between time based retention or keeping a configurable number of snapshots.

Plan Options

Plan Name the plan name is immutable after creation, choose carefully. Organizationally it can help to choose a name that includes the type of storage or a short form of the name of the repo that will be used. E.g. to backup "Documents" directory to "b2storage" you might create a plan named "b2-documents" or similar.

Repository the repository that this plan will operate on. This is immutable after creation.

Paths a list of paths to include in backups.

Excludes a list of paths to exclude from backup operations. These can be fully qualified paths (e.g. /foo/bar/baz) or wildcard paths (e.g. *node_modules*). See the restic docs on excluding files for more details. Files listed in excludes map to restic's --excludes flag.

Schedule the schedule on which backups will run. This is expressed in cron format (configurable visually in the webui).

Retention Policy the duration that snapshots are retained for. This is enforced by running restic forget after each backup operation if a retention policy is specified. This can be set to none for append only repos or if you'd like to manage your own retention (e.g. run forget manually). Setting some retention policy is recommended to avoid the snapshot history growing without bound. Retention may be configured either based on count or bucketed by time period. See the restic docs to understand more about these policy options.

Hooks hooks are actions that can be configured in response to backup lifecycle events. See the hooks page of the wiki for more details.

Running a Backup

Backups are run automatically based on the scheduled specified in your plan. You may additionally click the "Backup Now" button on the plan page to run a backup immediately. You can additionally trigger an immediate "Prune Now" or "Unlock Now" operation from the plan page, these operations are also run automatically in the course of a backup cycle but can be run manually if needed.

Best Practices

  • Configure a reasonable retention policy for each plan. Backrest performs well up to a history of ~1000s of snapshots but too many may eventually slow performance.
  • Backup your configuration (e.g. $BACKREST_CONFIG or $HOME/.config/backrest/config.json by default on Linux/MacOS)
    • Your configuration contains the encryption keys for your repositories. If you loose this file you will not be able to restore your backups.
    • You may alternatively backup your encryption keys individually in which case you will be able to use restic directly to restore your backups.
Clone this wiki locally