[Storage] Restic backup data encrypted and safely

Restic

Restic is a modern backup program that can back up your files encrypted and safely:

  • from Linux, BSD, Mac and Windows

  • to many different storage types, including self-hosted and online services

  • easily, being a single executable that you can run without a server or complex setup

  • effectively, only transferring the parts that actually changed in the files you back up

  • securely, by careful use of cryptography in every part of the process

  • verifiably, enabling you to make sure that your files can be restored when needed

  • freely - restic is entirely free to use and completely open source

Installation

If you are using macOS, you can install restic using the homebrew package manager:

1
2
3
4
5
# macOS
$ brew install restic

# Install osxfuse to mount for File system integration. See [osxfuse — Homebrew Formulae - https://formulae.brew.sh/cask/osxfuse](https://formulae.brew.sh/cask/osxfuse)
$ brew install --cask osxfuse

You can learn how to install Restic from Installation — restic 0.12.0 documentation - https://restic.readthedocs.io/en/stable/020_installation.html.

Usage

Initialize

First initialize the repository.

1
$ restic -r <Your repository> init

Backup

Backup your local folder to the repository.

1
$ restic backup <Your Local Folder>

Snapshot

Show snapshot list.

1
$ restic snapshots

Show content within the special snapshot.

1
$ restic ls <Your Snapshot ID>

Mount

Mount the repository into you local mounting folder.

1
$ restic mount <Your Local Mounting Folder>

Mounting repositories via FUSE is only possible on Linux, macOS and FreeBSD. On Linux, the fuse kernel module needs to be loaded and the fusermount command needs to be in the PATH. On macOS, you need FUSE for macOS Home - macFUSE - https://osxfuse.github.io/. On FreeBSD, you may need to install FUSE and load the kernel module (kldload fuse).

Restoring from backup

Restoring from a snapshot

Restoring a snapshot is as easy as it sounds, just use the following command to restore the contents of the latest snapshot to :

1
$ restic restore <Your Snapshot ID> --target <Your Local Restoring Folder>

Restore using mount

See above Mount

Removing backup snapshots

In order to remove the snapshot of repository, use the forget command and specify the snapshot ID on the command line:

1
$ restic forget <Your Snapshot ID>

But the data that was referenced by files in this snapshot is still stored in the repository. To cleanup unreferenced data, the prune command must be run:

1
$ restic prune

You can automate this two-step process by using the --prune switch to forget:

1
$ restic forget --keep-last 1 --prune

Encryption

The key command allows you to set multiple access keys or passwords per repository. In fact, you can use the list, add, remove, and passwd (changes a password) sub-commands to manage these keys very precisely:

1
2
3
4
5
6
7
$ restic key list

$ restic key add

$ restic key remove

$ restic key passwd

References

[1] restic · Backups done right! - https://restic.net/

[2] Home - macFUSE - https://osxfuse.github.io/

[3] osxfuse — Homebrew Formulae - https://formulae.brew.sh/cask/osxfuse

[4] The Missing Package Manager for macOS (or Linux) — Homebrew - https://brew.sh/