Back up your data with BorgBackup and Vorta

Keep It Safe

Article from Issue 267/2023

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

If you want to keep your data safe, it is a good idea to think about a backup strategy and implement it in a consistent way. The more important the data, the more security you need for the backup. Experts recommend that you should back up irreplaceable data twice, with one backup location outside of your own four walls.

Linux offers a variety of backup applications – for both home and work environments. Some are limited to the desktop; others are intended for backing up data on remote servers. One solution that works well in remote backup scenarios is the powerful BorgBackup [1] or Borg for short. Borg can store backups on local drives or remote computers in a space-saving and secure way. Thanks to the intuitive Vorta graphical interface, Borg is suitable for home users as well as professionals.


Borg runs at the command line, but you can also control it using the alternative Vorta graphical front end. Written in Python 3, Borg offers features such as deduplication, compression, and authenticated encryption. The data compression supports the LZ4, LZMA, Zlib, and Zstd standards. When it comes to deduplication, it is worth pausing to consider what the term actually means in Borg speak.

Deduplication is generally understood as a space-saving technique that breaks data down into blocks of the same size (which Borg refers to as "chunks") and computes a checksum for each block. If a new file has a known checksum, this means an identical version of the file already exists. At this point, the software compares the file contents to make sure they are identical. The app is not restricted to the file level, but it can also save minor changes to large files as chunks, which makes for very effective deduplication. The program even recognizes files if they have been moved or renamed.

Borg is available from the repositories of most mainstream Linux distributions; the package is called either borg or borgbackup. If you want to set up Borg for client-server operation, you need to install the software on all of the computers involved in the operation. If the Borg version packaged by your choice distribution is too old, you can also install from the source code, use a binary, or fire up pip or git. The Borg documentation describes the installation procedure in detail [2].


Comparing checksums, which is the preferred method for duplication, saves time over comparing the file contents in each block. The checksum method also has lower memory requirements because, if two identical blocks occur, it deletes the second block, replacing it with a pointer to the identical first block. This approach makes Borg a good candidate for use cases where working directories are constantly changing – you can back up every hour without generating large volumes of data.

Repositories and Archives

You can back up the directories on a laptop to an external hard disk or, alternatively, transfer the backup to a remote computer using SSH (Figure 1). Borg stores the backups it creates in repositories, and repositories are stored in folders (which Borg refers to as archives). So, you need to create and initialize at least one repository on the target computer or an external hard disk (Figure 2). The first three lines in Listing 1 create the repository.

Figure 1: When using servers connected via SSH, you need to be sure Borg is running on the server as well as the client.
Figure 2: When backing up to an external disk on the home network, Borg only needs to be installed on the source computer. Initializing the repositories is the same as it is for remote machines.

Listing 1

Preparing and Installing a Repository


If you use encryption with the -e option when creating the repository, the software prompts you for a password. (Initially, it is useful to use the -v option for verbose output.) Borg is then ready for a first backup (Listing 1, line 4). The borg create command (Figure 3) creates the backup in the specified path to the repository. The name of the archive where the app stores the backup is 1 in this example; the software automatically creates the matching folder.

Figure 3: Storing an archive of a folder called Pictures with the borg create command. The --stats option specifies verbose output.

The next command lists the folders to be backed up. The --stats option takes care of outputting statistics for the newly created archive, such as the volume of data, the deduplication level, and the number of chunks. The command in line 5 of Listing 1 displays all of the archives in the repository (Figure 4).

Figure 4: Adding an archive named ~/Documents to the existing archive with the ~/Pictures directory. Below that, the list option shows the created archives.

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

comments powered by Disqus