Backup with restic

Data Safe

Article from Issue 227/2019

Many users still find it difficult to regularly back up their data. Thanks to restic, and its graphical front end, Restatic, a backup is quite easy to manage – even for a beginner.

Creating data backups for emergencies has always been one of the most unpopular tasks in the home office. The available applications mostly target enterprise use and spoil the fun with feature overkill, or they are simply too complicated to use for occasional backups. A small command-line program by the name of restic [1] proves that there is another way, and it is suitable for many different scenarios.

Restatic is a graphical user interface (GUI) for restic designed for home users who don't want to mess with a command-line interface. The Restatic front end is currently under development, and you'll need to install it separately.

Restic can store data on the local PC, as well as on a computer on the home network or in the cloud. It encrypts all the data with AES256 regardless of where they are stored, ruling out viewing by unauthorized third parties. In addition, the software is extremely fast as it eliminates any graphical overhead, and this makes it interesting for occasional users, too.

You can pick up restic either from the project's website or from the software archives of almost all the major distributions. Since the application is written in Go, you need a compiler to install it; on Debian/Ubuntu and its derivatives you will find this in the golang-go package. After the install, you call the software with the restic command at the prompt to see an overview of the available parameters.


A local backup with restic requires only two steps. First, create a repository for the datasets to be archived (Listing 1, line 1), and then save the data in the newly created archive (line 2).

Listing 1

Creating a Repository


When creating the archive, you can specify a password for the repository, which you must confirm by retyping. During the backup, restic may request the password for the newly created archive and will then start to store the specified data in the repository in an encrypted format. While doing so, the software displays the progress of the storage process as a percentage and in absolute figures (Figure 1).

Figure 1: Restic is very informative during backup.

To store the backup on a remote server, use the SFTP protocol. Instead of the local backup directory, enter the server name, including the target path to be created on it, at the command line. The further operating steps, including password entry, are like those on a local system.

For each new backup, restic creates a new backup file within the archive path below snapshots/. To display its content, use the command from line 3 of Listing 1. The corresponding table shows the ID number of the backup, as well as the host. The tool lists the backup's original path in full, so that you can quickly see which backup it is. If an archive with a directory tree of the same name contains data from different host computers, restic lists it in order, but does not display individual files in any case.

Granular Details

To view individual files and directory structures in a repository, you first need to mount the repository. This feature lets you copy individual files from a backup instead of restoring all the data. To mount a backup, it is best to use a temporary directory with an arbitrary name as the target.

If the directory does not exist, restic asks if it should create the directory when it calls the mount command (Listing 1, line 4) and mounts the target directory after you confirm. However, it mounts the temporary directories as read-only, so your options for working with the files in the directories are limited. In addition, the command for mounting the backup remains active in the terminal, so all activities performed with the files have to be carried out in a separate tab or window. After you finish this work, you need to unmount the temporary directory; restic will not quit until you do this.

Additional parameters let users perform various additional tasks with the backed up datasets. For example, you can remove individual backups from a repository using the forget option. This helps to keep the archive clean by removing obsolete individual backups, especially from scheduled backup runs.

Since restic always creates full backups, the differences between individual backups cannot be seen at first glance. The diff option helps users here; it shows differences in the data between two backups. check lets you verify the data integrity.

The exact syntax for the use of individual subcommands is revealed by entering the following command at the prompt:

restic <Command> --help

The software then displays detailed descriptions for using the option in question.


To restore a backup on demand, you will need the ID number – assuming you have several backups. To do this, first display the existing backups (Listing 1, line 3). From the full file paths that are displayed, you can see which backup has which ID number. Then specify the command from Listing 2 to restore a backup. Restic now returns the specified backup to the specified target path, automatically creating the corresponding subdirectory if it does not exist (Figure 2).

Listing 2

Restoring a Backup


Figure 2: Saving the data with restic just requires a little typing.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Restic/Jarg

    Restic and the Jarg front end appeal to users who want to see quick results without too much overhead.

  • BorgBackup

    BorgBackup and the Vorta graphical front end take the stress out of creating backups.

  • At the Touch of a Button

    Duplicati lets you create backups of your data in next to no time – both locally and in the cloud.

  • Back In Time

    Despite the importance of backups, many users still view the process as too complicated and too inconvenient. Back In Time makes the unloved backup less terrifying.

  • Areca Backup

    Sometimes you just need to back up a few directories on a computer, not administer a distributed installation or an array of disks. Areca Backup gives you hassle-free backups of individual hard drives.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More