User Tools

Site Tools


backup

Encrypted backups

The 3-2-1 rule

It is generally recommended to try to follow the 3-2-1 rule: at least 3 copies, on at least 2 devices, with at least one off-site copies.

For example: 1) your computer 2) a local backup on an external disk 3) a cloud to store another backup

It requires sometimes complex setups, but it is a good practice. However, what this rule does not say, but is very important (actually more important), is that your backups should ABSOLUTELY be encrypted. Otherwise any attempt to implement full disk encryption will be useless, since anyone could just grab the entirety of your data by just accessing your backups.

In this page we are reviewing several tools used to make backups.

  1. Some of them should be implemented before a dramatic configuration change to be sure that you can switch back to a working setup in case of a dramatic incident. Clonezilla is an open source project that allows to do this. It is cross platform except that M1 silicon Macs (basically any recent Mac laptops) cannot use it. Mac has a build in proprietary alternative called Time Machine. It is rather easy to use.
  2. Some of them should be implemented on your “regular” folders (i.e. not your programs) quite often. I will propose to use restic for this. It is open source and cross platform.

Clonezilla (to use before a dramatic change to your config)

you should ABSOLUTELY do it before any operation on your disks or partitions (such as the one presented here for instance) : there is a significant risk to destroy ALL your data.

Clonezilla is a free, open source software that allows to make a disk image and save it in a compressed encrypted file to be stored on an external drive. With this, you will be able to restore your whole disk in its current state where it works fine.

For this, you will need:

  1. An external hard drive to store the backup. I suggest using an external SSD with a capacity a bit bigger than your whole drive capacity. You do not need to encrypt this disk, as the backups themselves will be encrypted.
  2. An external USB stick to install CloneZilla. It should be at least 1GB and be used only for CloneZilla

STEP 1: prepare the CloneZilla USB stick

First, download the file as an iso.

optional but very good practice: verify your download

This step requires that you have installed GPG. If you did not, please find the instructions here.

Then, verify the download, using the following commands:

wget https://clonezilla.org//downloads/stable/data/CHECKSUMS.TXT
wget https://clonezilla.org//downloads/stable/data/CHECKSUMS.TXT.gpg
gpg --keyserver hkp://keys.openpgp.org --recv-key 667857D045599AFD
gpg --verify CHECKSUMS.TXT.gpg CHECKSUMS.TXT

The output should show the line:

gpg: Good signature from "DRBL Project (Diskless Remote Boot in Linux) <drbl@clonezilla.org>" [unknown]

You then have verified that the file CHECKSUM.TXT has been encrypted by the owner of the private key of the clonezilla project. You can then compare the checksum of your file with the content of CHECKSUMS.TXT:

sha256sum clonezilla-live-3.2.1-9-amd64.iso

Replace the filename with the actual file you downloaded if it is another version. Check that the output of this command is part of the output of:

cat CHECKSUMS.TXT

If so, you are sure to have the right file. You can then proceed to flash you USB key. I recommend using Balena Etcher, which is Open Source, user friendly and cross platform.

STEP 2: do the actual backup

you can then follow the clonezilla guide to backup your whole image to an encrypted image stored in your unencrypted disk. Do not forget to tick the “encrypt your image” option, and secure it with a strong passphrase that you will remember.

Restic (to use regularly to make encrypted snapshots of your folders (ie: not your programs))

This second backup tool is to be used regularly to backup your Home directory (for example the /C/Users/YourUsername directory in windows, or the /home/yourusername on linux), as well as any file folder that is not your installed programs (like an extra disk used only to store files, videos, etc.), and can also be used to backups smaller folders.

It is called Restic. Contrary to CloneZilla, you do not need to turn off the computer to make the backup, which makes CloneZilla a bit cumbersome to use on a daily basis, and also impossible to use for recent MacOS laptops. It is also incremental: if you make several snapshots, only the difference since the last snapshot will actually be saved. This makes it extremely lightweight and fast (once a snapshot already exists).

Installation

you can follow the instructions here for installing it on your favourite OS.

Case of a Debian based Linux OS

Open a terminal and enter:

apt-get install restic

Case of MacOS

you can install it using brew. If brew is not installed on your computer, open a terminal and enter:

 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 

when this is installed, you can simply enter:

 brew install restic 

Case of Windows

open a powershell terminal, then enter:

 winget install --exact --id restic.restic --scope Machine 

Initialisation of the backup folder

More detailed infos can be fond here.

Make a directory for the backup location. The open a terminal and enter:

 restic init --repo /path/to/your/backup/directory 

You will be asked a password. You should choose a strong password, either directly generated from the diceware method or randomly generated by a password manager that is locked by a password generated by the diceware method.

Do the actual backup

open a terminal and enter:

 restic -r /path/to/your/backup/directory --verbose backup /path/to/the/folder/you/want/to/backup 

you will be asked for your password and informed about the process. If it is the first snapshot of a big folder, it can take a bit of time.

If you need to restore a snapshot

More infos can be found here.

First, you can see the existing snapshots in your backup folder by entering:

 restic -r /path/to/your/backup/folder snapshots 

which will give the following output:

enter password for repository: 
repository 7d765fa4 opened (repository version 2) successfully, password is correct
ID        Time                 Host             Tags        Paths
——————————————————————————————
9e4398a4  2026-06-19 10:15:59  your-computer-name              /path/to/the/folder/you/backuped
——————————————————————————————
1 snapshots

Note that you need to know your password to do this, as all backups made by restic are encrypted. Pick up the ID of the snapshot you want to restore, for example in our case 9e4398a4

To see all files in this snapshot, enter:

 restic -r /path/to/your/backup/folder ls snapshot_id 

which will give the following output:

restic -r testdir ls 9e4398a4
enter password for repository: 
repository 7d767fa4 opened (repository version 2) successfully, password is correct
snapshot 9e4398a4 of [/path/to/the/folder/you/backuped] filtered by [] at 2026-06-19 10:15:59.284838644 +0200 CEST):
/testdir2
/testdir2/hi

if you would like to restore the whole snapshot to a specific directory, enter:

restic -r /srv/restic-repo restore 9e4398a4 --target /path-to-the/place/you/want/to/restore/to 

enter password for repository:
restoring snapshot of [/home/user/work] at 2015-05-08 21:40:19.884408621 +0200 CEST to /tmp/restore

It is possible to restore only a folder or file by changing snapshot_id to snapshot_id:/path/to/folder/or/file in the above expression

backup.txt · Last modified: by usera