Fast and easy backups with Restic and Jarg
Simplicity
![](/var/linux_magazin/storage/images/issues/2023/267/restic-jarg/267_123rf_108946447_data-center_timofeevvladimir_resized.png/816142-1-eng-US/267_123RF_108946447_Data-Center_TimofeevVladimir_resized.png_medium.png)
Restic and the Jarg front end appeal to users who want to see quick results without too much overhead.
Restic [1] is a cross-platform backup tool that is simple, quick, and easy to learn. Versions of Restic run on macOS, Windows, and BSD, as well as Linux. A graphical front end called Jarg [2] extends Restic to users who are more comfortable in a GUI.
Restic focuses on flexibility and ease of handling. Instead of entering long lines of cryptic parameters, you can save data with just a few simple commands. But the tool still keeps all options open for you. You can preserve your data in the cloud and also on local media. If you need to, you can use SFTP to control a file server on the LAN as a storage location. Because Restic is implemented as a command-line tool, you can include it in scripts and time-control jobs with cron.
Restic automatically encrypts the backups in line with the AES-256 standard. It can handle incremental backups where it will only save the changed data after an initial full backup. Restic also offers a deduplication feature to avoid redundant data. The ability to verify backups helps users check that the data is backed up without error.
Restic is available in the software archives of all major Linux distributions. You can pick up the software for other architectures and operating systems from the project's GitHub page.
Ready to Start
Restic relies on repositories. Two commands are all it takes to back up data to your local media. The first command (Listing 1, line 2) creates the repository for the backup. Restic automatically generates the matching directory and prompts you for a password to encrypt and decrypt the backups. The second command (line 3) pushes a backup of the specified folder, including all subdirectories, into the new repository. Restic also prompts you for a password before proceeding to create the backup (Figure 1).
If necessary, you can extend the command line to include additional parameters. For example, --verbose
outputs various detailed messages during the backup. To back up multiple directories to different paths in a single pass, you need to enter the paths as a space-separated list. The --exclude
and --iexclude
parameters exclude individual directories or entire paths from the backup.
For repetitive, larger backup tasks, you can enter the list of directories or files you wish to include or exclude in a text file. To back up to a server on the LAN, you just enter the same commands as for a local backup, but add the prefixed computer name and the protocol used to the target path (Listing 1, lines 5 and 6).
Listing 1
Backing Up with Restic
01 ### local 02 $ restic init -r /path_to_repository 03 $ restic -r /path_to_repository backup /path_to_data 04 ### remote 05 $ restic init -r sftp:User@Host:/path_to_repository. 06 $ restic -r sftp:User@Host:/path_to_repository. backup /path_to_backup_data.
The --keep
and --keep-last
parameters let you define how many of the last backups are kept. Additional parameters for automated removal of backups are listed in the Restic documentation [3].
Detailed
For encrypted backups, you can't view the data inside the destination folder directly. To look inside, you need to mount the repository like a normal drive. First create a separate mount folder, and then run the command from the line 2 of Listing 2.
Listing 2
Checking Backups
01 ### Mount repository 02 $ restic -r /path_to_repository mount /path_to_mount_point 03 ### Check and compare repositories 04 $ restic -r /path_to_repository check --read-data 05 $ restic -r /path_to_repository snapshots 06 $ restic -r /path_to_repository diff Snapshot1_ID Snapshot2_ID ...
Enter the password at the prompt for Restic to mount the backup repository and decrypt the data files in the target directory. You can now view the data in the snapshots/
subdirectory of the mount folder, but editing is not allowed. Restic remains active in the terminal. The keyboard shortcut Ctrl+C lets you unmount the drive again, and the data will disappear from the target folder.
Comparing
You can also use Restic to compare data sets or check the integrity of the folders. Use the diff
and check
parameters. check
is used to check the index and contents of the specified repository (Listing 2, line 4).
To compare two or more snapshots, you need their identification numbers, which you can discover with the command from line 5 of Listing 2. The ID numbers appear in a table below each other, along with the timestamp of the backup (Figure 2). You can now identify the snapshots and compare them directly (line 6).
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
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](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.