Git-based backups with Kup
Get Back
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).
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.
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.
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.
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.
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.
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.
Infos
- Etckeeper: http://etckeeper.branchable.com/
- Xdelta: http://en.wikipedia.org/wiki/Xdelta
- Bup: https://github.com/bup/bup
- Rsync: https://en.wikipedia.org/wiki/Rsync
- Deduplication: https://en.wikipedia.org/wiki/Data_deduplication
- Git pack file: https://schacon.github.io/gitbook/7_the_packfile.html
- Bup design: https://github.com/apenwarr/bup/blob/89ac418d84e29ba482bbd21ebc1172c2d1ff5507/DESIGN
- Kup: http://kde-apps.org/content/show.php/Kup+Backup+System?content=147465
- KIO: https://en.wikipedia.org/wiki/KIO
- Par2: https://en.wikipedia.org/wiki/Parchive
- Lucky backup: http://luckybackup.sourceforge.net
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.
News
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.