Git-based backups with Kup

Get Back

© Lead Image © Rommel Canlas, 123RF.com

© Lead Image © Rommel Canlas, 123RF.com

Article from Issue 178/2015
Author(s):

KDE's Kup tool uses Rsync and techniques from the Git version control environment for sophisticated backup with an easy GUI interface.

As soon as a user reports data loss, the first piece of advice is inevitably to restore from a backup. Almost as inevitably, this advice is often followed by a meek confession from the user that they do not have a bac kup and have never really thought about the concept.

As many users learn too late, backups are an essential part of the desktop computing experience. The hundreds of backup tools available today employ a wide range of strategies for preserving valuable data. An interesting approach is to use the Git version control environment for managing backups. The etckeeper [1] program, for instance, uses Git for monitoring configuration files in /etc/. One problem with this approach is that Git was developed to manage the Linux kernel, and it is designed to oversee large numbers of small files.

Virtual disks from virtual machines, however, quickly reach sizes of 10GB and more. Git uses the xdelta [2] algorithm to determine the differences between two files so that it only needs to store new data incrementally. However, xdelta performance degrades significantly with large files.

Bup [3] offers an alternative to the Git/xdelta approach that is more efficient for larger files. Bup uses rolling checksums based on the rolling checksum algorithm from Rsync [4] to determine the differences between two files; it only saves the differences. Instead of using a hash sum for each file, Bup splits large files into many small parts, each with 128 bytes, which each receive a separate checksum. This strategy lets Bup quickly identify even small differences in large files.

Unlike Rsync, Bup also uses deduplication [5], relying on SHA1 hashes to identify and remove redundant data. Bup then saves the results in the Git package format packfile [6]. The design documentation for Bup provides more technical details in a very entertaining way [7].

Bup is a formidable tool that offers the best of Git-based backup without the limitations. However, the Bup backup solution is a command-line program that might intimidate users who are more accustomed to working with a GUI. KDE's Kup [8], on the other hand, was developed as a graphic interface tool that performs full backups using Rsync and switches to Bup for incremental backups.

Kup consists of a configuration module, which is integrated in the system settings, and a daemon, which monitors when the backup destination defined in the configuration is mounted or connected in order to display an icon in the system section of the control bar. A KIO slave [9], which displays the backed-up data in the file manager, and an application for restoring individual files are also available.

In the simplest case, Kup automatically saves changes to the directories and files specified in the configuration as soon as the defined backup destination is available. The destination medium might come online when the computer starts up, or it could also happen at runtime when a USB stick is plugged in. Unlike many other backup programs, Kup directly uses an external disk with NTFS or FAT32 as a filesystem and without using hard links.

The current version 0.5.1 of Kup runs on KDE SC 4; a pre-release 0.6 version, with support for Plasma 5, is also available. Although the version for KDE SC 4 is in the archives of many distributions, you will only find Kup 0.6 for SUSE, Arch Linux, and Fedora on the kde-apps.org website. Plasma 5 packages for Debian or Ubuntu don't exist at this writing. Both versions of Kup only work in the designated version of KDE. After the installation, be sure to check whether the bup and rsync packages are installed.

Configuration

After installing Kup, you will find a new module by the name of Backups in the system settings (Figure 1). The first time you start Kup, it discloses that the existing default backup has never run (Figure 2) – you need to configure it. Clicking the corresponding button will open the window with the settings. The recommended type of backup is already enabled and uses a Git-based procedure (Figure 3).

Figure 1: The system settings with Kup in KDE Plasma 5.
Figure 2: Kup criticizes the lack of a backup plan.
Figure 3: Kup has already enabled the recommended backup type.

You can include or exclude directories and files for the source selection (Figure 4). Set the backup destination in the next tab. You have a choice between Filesystem Path and External Storage (Figure 5). The filesystem path could refer to another integrated disc or a mounted network share. Hard drives and memory sticks connected via USB or SD cards and eSATA disks count as external sources. The logic behind external sources is that Kup can automatically perform a backup on a USB storage device defined as the target when you connect it at runtime.

Figure 4: Selecting the files for backup.
Figure 5: Local, external, and network storage are possible options for the backup destination.

You can determine the schedule for your backup in the next tab. Kup provides three options: You can trigger manual activation via the Kup icon in the system section in the control bar. Data backups at fixed time intervals are defined under Time period. The last option Time elapsed performs a backup if the computer remains switched on longer than the specified time interval. Below you define whether you want Kup to prompt you before starting a backup.

The Advanced tab (Figure 6) provides an integrity check for the data you wish to back up, as well as the ability to integrate hidden files. However, the most important point is the last in the list: Kup generates restore information in order to be able to restore partially corrupted backups. To this end, Kup uses a Bup function with the Par2 [10] checksum format. Kup generates a file with restore information based on the redundancy in a file. This approach increases the size of the backup by about 10 percent and also takes a little longer.

Figure 6: You will find some very useful options in the Advanced tab.

You can maintain multiple data backup plans with different tasks, targets, and schedules side by side.

Test Run

If Kup does not show an icon in the panel's system section after you click Apply to complete the configuration, it might help to restart your computer. If you have specified an external device as the destination for your backup, the icon will only appear after the device is connected and the system mounts the device.

Clicking the icon will open the Configure Backups and Backup Plan 1 menu items, as well as other plans if they are available (Figure 7). Clicking the first item leads you back to the configuration. The second item shows the three self-explanatory sub-items Take Backup Now, Show Files, and Show Log File.

Figure 7: You can access the Kup controls via the Kup icon in the control bar.

Selecting Take Backup Now triggers a manual backup; Show Files opens a simple file manager, which displays the backed up files for viewing and restoring. The log files show the order of events in the backup and the results. The last entry for each backup should be Kup successfully completed the bup backup job.

In the first backup on the test computer, Kup could not back up all the files from the home directory specified for backup (Figure 8). The missing files were ones that Chrome had stored temporarily in /home/USER/.cache/google-chrome. The backup ran perfectly once I excluded this directory in the configuration.

Figure 8: Kup quit the first backup attempt with this error message.

The message in the log stating that Kup was unable to complete the backup proved to be exaggerated: Kup successfully completed the backup, but without backing up the Chrome temporary files (Figure 9). A backup using Rsync missed some files too. But this issue, as with the backup using Bup, involved data that could be safely excluded.

Figure 9: The Kup log shows where the backup got stuck.

Conclusions

Kup is a smart and reliable backup solution for KDE users. Once configured, Kup runs completely in the background and even initiates backups to USB memory sticks when they are connected and mounted. You can also trigger backups manually.

The Kup backup sets are around 10 to 15 percent smaller in comparison to Lucky backup [11], which is popular with many desktop users. Kup offers an integrity check of the backup data and the ability to create restore information that sometimes even lets you restore corrupt backups.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
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

News