skip to content

Setting up backups with Restic

/ 3 min read

Restic logo

We all know that data protection is a crucial aspect of our daily work. The ability to recover from data loss or hardware failures is a must-have for any serious software development project.

For me, one of the best ways to ensure data protection is by using backup software like Restic. Restic is my preferred tool and my way of proceeding in these cases, so I am going to show you how to set up backups with it, and why I think it’s a great choice for my data protection needs.

What is Restic?

Restic is a command-line (although you can probably find more than one GUI for it) backup program that is designed to be fast, efficient, and easy to use. It is written in Go (like Hugo!) and it’s completely open-source.

Some of the main features of Restic include:

  • Deduplication: it uses a content-defined chunking algorithm to split files into chunks, and it only stores unique chunks, this allows you to save a lot of storage space.

  • Encryption: Restic obviously supports encryption, which allows you to protect your data from unauthorized access.

  • Compression: it uses the lz4 compression algorithm to compress data before storing it.

  • Multiple Backends: it can be used with various storage backends such as local, S3, and SFTP.

Restic has been audited by a Google employee

Restic has been audited by Filippo Valsorda, a Google cryptography engineer, you can read more about it in his personal blog. The auditing process focused on the core functionality of Restic and its cryptographic implementation, and it found that Restic is secure and well-designed.

Setting up Backups with Restic

So, let’s get to work! In this case, it is assumed that the system already has Restic installed since in each system it is done in a different way, in case you do not know how to do it, you can check the official documentation.

In addition, the example considers a local copy, however Restic stands out for its great compatibility with other cloud systems such as AWS, Azure or GCP. Again, consult the documentation!

  1. Once you have Restic installed, you will need to create a new repository for your backups. This can be done by running the following command:
Terminal window
restic init --repo /path/to/repo
  1. After creating your repository, you can create a backup of a folder by running the following command:
Terminal window
restic backup /path/to/folder --repo /path/to/repo
  1. I fyou want to check and view the list of backups in your repository, you can use the following command:
Terminal window
restic snapshots --repo
  1. And finally, to restore a specific backup, you can use the following command:
Terminal window
restic restore ID --target /path/to/restore --repo /path/to/repo

That’s the basics of Restic, if you want to know more… you know where to go, right?