Déjà Dup
Ubuntu comes pre-installed with a Backup utility, which can be found by typing “Backup” into the Gnome Shell search. However, its real name is Déjà Dup, and it is “only” a graphical front-end for the mighty command line utility Duplicity, which uses Rar und Gzip (compressed archives) as well as GnuPG (Data encryption).
This is the foundation to configure incremental, compressed and encrypted backups to local (hard disk, burned cd or dvd) or remote (FTP, SSH, Samba shares, WebDav, cloud storage) destinations. Sounds complicated, but thanks to the simplicity of Déjà Dup’s interface, it’s really easy. Following the “set and forget” priciple, you configure the directories to be backed up once – by default, Déjà Dup offers to back up the contents of your home folder – and then let Déjà Dup perform a backup run every day. This scheduling is taken care of by its own monitoring service, not Cron, as the developers assume that the PC or laptop to be backed up is not running 24 hours a day. If you don’t want that or want a more fine-grained backup plan, you have to disable the built-in scheduling altogether.
Déjà Dup does not run with root rights, but with the rights of the user, so it is not suitable for backing up system files. If a file or folder cannot be saved because the access rights are missing, then Déjà Dup reports an error message – every day, as long as you do not adjust the rights for this particluar file or exempt it from the backup. Otherwise, Déjà Dup remains completely calm and only occasionally asks for the encryption password stored in the Gnome keyring to perform a test run. One should not forget the password for God’s sake – otherwise the data is lost, since the backups are stored in encrypted archive files, which don’t even give information about the folder structure and file names they contain. Therefore, you can also back up your data in a foreign cloud with a clear conscience – with the restriction that GPG does not enable forward secrecy, so that a thief who gets hold of the data AND sooner or later also captures the key can decrypt everything if he knows the password.
Storing backups “incrementally” means that only the first run and each subsequent full backup are time-consuming. In between, only changes to the latest state are saved. This is fast, saves space and conserves bandwidth when transferring data to remote servers. However, this also means that restoring the data is more time-consuming and takes longer because of the reconstruction of the data from the backup chain, including decompression and decryption. If the chain were to break – for example, due to a defective sector on the hard disk of the backup target – then all subsequent incremental backups would be lost. Hence the test runs performed by Déjà Dup from time to time to ensure the integrity of the backup data.
How to restore backups
The menu item “Restore” allows to choose files or directories from the backup for restoration. By selecting the date, you can specifically retrieve an older version. Before version 42, Déjà Dup still had an integration for the Gnome desktop, so that you could start the restoration directly via right-click from the file manager Nautilus, which was more comfortable for Gnome users. However, the developers have removed this integration in favor of the integrated file view accessible via the menu item “Restore”, so that Déjà Dup now feels equally at home on all desktops. In newer versions of Déjà Dup, you may choose, whether a file shall be restored to its original location (be careful: this replaces the actual file with the older version from the backup) or to another location of your choice.
Once again: To restore your data, you cannot simply copy it back, but only reconstruct it using Déjà Dup. For more complicated usecases one has to turn to Duplicity on the command line. For example, if you want to delete all backup sets older than two month because your backup storage is running out of space:
duplicity remove-older-than 2M file:///full-path-to-storage
In the unlikely case of a pressure loss in the cabin … pardon: In the unlikely case that Déjà Dup can’t restore the data despite the correct password, there is an emergency solution. In short: First decrypt with GnuPG, then unpack the archives and let it restore the individual files. The long version can be found in the Gnome Wiki: When everything goes wrong.
How to install Déjà Dup
If Déjà Dup is not pre-installed in your Ubuntu flavour, it’s easy to do so:
sudo apt install deja-dup
If you use the Mate Desktop, an integration for the file manager, Caja, is available in the Universe Repository:
sudo apt install deja-dup-caja
Alternatives to Déjà Dup
Back in Time is inspired by Apple’s backup solution Time Machine. It does not use compressed archives, so that files and folders may be copied directly from the backup. Rsnapshot is a bare bones script for the command line, which performs incremental backups with the help of rsync and hardlinks.