User Tools

Site Tools


backup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
backup [2026/06/19 07:03] userabackup [2026/06/19 09:14] (current) usera
Line 27: Line 27:
   - An external USB stick to install CloneZilla. It should be at least 1GB and be used only for CloneZilla   - An external USB stick to install CloneZilla. It should be at least 1GB and be used only for CloneZilla
  
-==== STEP 1.1: prepare the CloneZilla USB stick ====+==== STEP 1: prepare the CloneZilla USB stick ====
  
 First, [[https://clonezilla.org/downloads/download.php?branch=stable|download]] the file as an iso. First, [[https://clonezilla.org/downloads/download.php?branch=stable|download]] the file as an iso.
Line 64: Line 64:
 If so, you are sure to have the right file. You can then proceed to flash you USB key. I recommend using [[balena-etcher|Balena Etcher]], which is Open Source, user friendly and cross platform. If so, you are sure to have the right file. You can then proceed to flash you USB key. I recommend using [[balena-etcher|Balena Etcher]], which is Open Source, user friendly and cross platform.
  
-==== STEP 1.2: do the actual backup ====+==== STEP 2: do the actual backup ====
  
 you can then follow the [[https://clonezilla.org/show-live-doc-content.php?topic=clonezilla-live/doc/01_Save_disk_image|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. you can then follow the [[https://clonezilla.org/show-live-doc-content.php?topic=clonezilla-live/doc/01_Save_disk_image|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.
  
-Once this is done, you can do another backup of your /home, which contains all your regular files. For this you can use the software backintime. You can install it with: 
-<code> 
-sudo apt install backintime-qt 
-</code> 
  
-Before launching it, we need to decrypt the encrypted disk, and mount the logical volume we intend to use: +===== Restic (to use regularly to make encrypted snapshots of your folders (ienot your programs)) =====
-<code> +
-sudo cryptsetup luksOpen /dev/sdb2 cryptsetup +
-sudo vgchange -ay +
-sudo mount /dev/mapper/vgbackup-home /mnt +
-</code>+
  
-now everything written on /mnt on your computer will be written on your disk.+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.
  
-You can then launch backintime with: +It is called [[https://restic.net/|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).
-<code> +
-sudo backintime-qt +
-</code>+
  
-you can then configure it to save things in /mnt:+==== Installation ====
  
-{{ ::backintime_1.png?600 |}}+you can follow the instructions [[https://restic.readthedocs.io/en/stable/020_installation.html|here]] for installing it on your favourite OS. 
  
 +=== Case of a Debian based Linux OS ===
  
-{{ ::backintime_2.png?600 |}}+Open a terminal and enter:
  
 +<code>apt-get install restic</code>
  
-{{ ::backintime_3.png?600 |}}+=== Case of MacOS ===
  
-And then click on "Take snapshot" and wait for it to finish:+you can install it using brew. If brew is not installed on your computer, open a terminal and enter:
  
-{{ ::backintime_4.png?600 |}}+<code> /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" </code>
  
-you can then unmount and remove your backup disk:+when this is installed, you can simply enter:
  
-<code> +<code> brew install restic </code> 
-sudo umount /mnt + 
-sudo vgchange -an vgbackup + 
-sudo cryptsetup luksClose cryptodisk +=== Case of Windows === 
-</code>+ 
 +open a powershell terminal, then enter: 
 + 
 +<code> winget install --exact --id restic.restic --scope Machine </code> 
 + 
 + 
 +==== Initialisation of the backup folder ==== 
 + 
 +More detailed infos can be fond [[https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html|here]]. 
 + 
 +Make a directory for the backup location. The open a terminal and enter: 
 + 
 +<code> restic init --repo /path/to/your/backup/directory </code> 
 + 
 +You will be asked a password. You should choose a strong password, either directly generated from [[diceware|the diceware method]] or randomly generated by a password manager that is locked by a password generated by [[diceware|the diceware method]]. 
 + 
 +==== Do the actual backup ==== 
 + 
 +open a terminal and enter: 
 + 
 +<code> restic -r /path/to/your/backup/directory --verbose backup /path/to/the/folder/you/want/to/backup </code> 
 + 
 +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 [[https://restic.readthedocs.io/en/stable/050_restore.html|here]]. 
 + 
 +First, you can see the existing snapshots in your backup folder by entering: 
 + 
 +<code> restic -r /path/to/your/backup/folder snapshots </code> 
 + 
 +which will give the following output: 
 + 
 +<pre>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 
 +</pre> 
 + 
 +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: 
 + 
 +<code> restic -r /path/to/your/backup/folder ls snapshot_id </code> 
 + 
 +which will give the following output: 
 +<pre>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</pre> 
 + 
 +if you would like to restore the whole snapshot to a specific directory, enter: 
 + 
 +<code>restic -r /srv/restic-repo restore 9e4398a4 --target /path-to-the/place/you/want/to/restore/to </code> 
 +<pre>enter password for repository: 
 +restoring snapshot of [/home/user/work] at 2015-05-08 21:40:19.884408621 +0200 CEST to /tmp/restore</pre> 
 + 
 +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.1781852632.txt.gz · Last modified: by usera