There are multitude of applications available to backup data in Linux and Unix operating systems. In this guide, we will see how to backup and restore files using Deja Dup in Linux.
Computer data has become one of the most valuable assets that individuals, organizations and enterprises own today. Losing your important data would be a disaster. So backups are vital!
If you are a new user who is switching from another OS to Linux, then the first thing you should consider is what backup solutions you are going to use.
There are many open-source tools available for backups. One among such tools is Deja dup, a simple backup application for GNOME systems.
What is Deja Dup?
Déjà Dup is an easy-to-use, personal backup tool for your Linux desktop systems. It is actually a backup wrapper utility that uses duplicity under the hood.
For those who don't know, duplicity is a command line backup tool that uses
rsync to generate incremental, encrypted backup volumes.
Using Deja Dup, you can easily backup and restore data via a simple graphical interface. It integrates well into your GNOME desktop, so you can use it on any Linux distribution that has GNOME DE installed.
You are allowed to set which folders to backup and which folders to ignore from backup.
The backup location can be a local or a remote directory or Google drive. As of writing this, Deja dup allows us to store backup in a remote share via SSH, Samba, WebDAV, FTP, NFS and afp (AppleTalk) protocols.
Deja Dup supports automatic, scheduled backups, so you can create daily and weekly backups. It uses a built-in program named
deja-dup-monitor to perform scheduled backups.
Please note that the backup will not start when a user is not logged in. It is one big disadvantage of Deja Dup.
By default, Déjà Dup will make a new full backup every three months. You don't need to worry about low disk space. Deja Dup lets you to delete old backups after a particular period of time.
You can set backup retention period for at least three months, six months, or a year. By default, it keeps the backups forever.
Note: The oldest backups will still be deleted earlier if the backup location is running out of space, or kept to three months longer to avoid deleting related backups.
Since Deja Dup uses duplicity as the backend, you can compress and encrypt the backup data using a password. Whenever you want to restore the data, simply provide the correct password. For those wondering, duplicity uses gpg with symmetric cipher for encryption.
Please be mindful that Deja Dup is not suitable for backing up your entire Linux system. It is a viable solution to backup a specific file or directory.
Hope you got the basic idea about Deja Dup. In the subsequent steps, we will see how to install Deja Dup and how to use Deja Dup to backup and restore files in Linux.
Install Deja Dup in Linux
Deja dup is available in the official repositories of most Linux distributions. The version may differ between different distributions. You can look at the official release page to know about the latest version.
To install Deja Dup on Alpine Linux, run:
$ sudo apk add deja-dup
On Arch Linux and its variants like EndeavourOS and Manjaro Linux, run:
$ sudo pacman -S deja-dup
On Debian, Ubuntu, Linux Mint, Pop OS:
$ sudo apt install deja-dup
On Fedora, RHEL, CentOS, AlmaLinux, Rocky Linux:
$ sudo dnf install deja-dup
$ sudo zypper install deja-dup
Like I already mentioned, the version of Deja Dup in the default might be bit old. Deja Dup latest version can be installed either from snap store or flathub.
If you prefer to use Snap version, run:
$ sudo snap install deja-dup --classic
If you do not prefer snap, you can install Deja Dup from flathub using flatpak command:
$ flatpak install flathub org.gnome.DejaDup
$ flatpak run org.gnome.DejaDup
Backup and restore files using Deja Dup in Linux
Deja Dup usage is fairly simple and straight-forward. It greatly reduces the complexity of backing up files for newbies.
First, we will see how to backup files using Deja Dup.
Backup files with Deja Dup
Launch Deja Dup from Dash or Application Menu. It may show up as simply "Backups" in menus, app launchers, and some in-app text.
The default interface of Deja Dup should look something like below:
First time backup
After launching the Deja Dup, you will see two options namely Create My First Backup and Restore From a Previous Backup.
If it is the first time you start Deja Dup for the first time, obviously there won't be any backup. So let us create one. To do so, click Create My First Backup button.
When you select "Create My First Backup" option, it will take you through a few steps. As a first step, you have to set which directory to be backed up and which one to be excluded.
Take a look at the below image. There are two sections to include and exclude directories. According to your need, add or exclude directories. After choosing the directories to backup and the directories to exclude from the backup, click Forward button:
The next step will be to choose where you want to backup your data.
Currently, Deja Dup supports local, remote, or cloud backup locations like Google Drive. You can change the backup location at any time from the Preferences window.
For demonstration purpose, I am choosing a local directory as my backup location.
In the next screen, you will be asked to set a password for the backup. You can either use a password or no password. It is optional and completely up to you to decide.
This way you can encrypt the backup data. Encryption is done using
symmetric ciphers at the backend. All you have to do is provide a password and remember the password when you restore from the backup.
Now the backup will be started. If this is the first backup, the backup time may vary depending upon the size of the data. For me, Deja Dup took nearly 5 minutes to backup 8 GB directory.
These are the sequence of steps to be followed when you first schedule the backup. Backup is stored in an opaque format.
Schedule backup with Deja Dup
Every backup utility has a feature to perform automatic incremental backups using cron job. Normally it will be done in Daily, Weekly, Monthly, and Yearly schedules.
Deja Dup uses different approach to backup though. Deja Dup schedules regular backups at specific intervals using a built-in program called "deja-dup-monitor".
You can use the following command to check the status of the
$ ps -ef | grep -i deja-dup-monitor
ostechnix 2234 1975 0 11:49 ? 00:00:00 /usr/libexec/deja-dup/deja-dup-monitor ostechnix 3696 3532 0 12:00 pts/0 00:00:00 grep --color=auto -i deja-dup-monitor
To enable automatic backups in Deja Dup, toggle the slider on under the Overview section:
There are only two backup schedules available. They are: Daily and Weekly.
To schedule backup, click the three vertical bars on the menu bar and click Preferences section.
Set backup schedule of your choice in the Automatic Backup Frequency drop-down box.
From now on, Deja Dup will automatically backup the data as per the backup frequency.
Please note that Deja Dup will initiate the backup process only when the user is logged in.
Restore files from backup with Deja Dup
Restoring data from the backup using Deja Dup is pretty easy. Deja Dup incrementally backs up, letting you restore from any particular backup at any time.
You can restore individual folders, files or entire backup. Make sure you have chosen the correct backup location in the "Storage" path from Preferences window.
To restore files, simply click the Restore button from the main interface. Deja Dup will automatically scan for the backup files and list them.
From the below image, you can see the list of files/folders available from my backup. Choose the file(s) or folders(s) you want to restore and hit the Restore button on the bottom left corner. If there are multiple backup copies you can choose from which date to restore the copy.
In this guide, we discussed what is Deja Dup and how to backup and restore files with Deja dup in Linux. Now it’s time for you to decide if this tool works for your scenario.
Deja Dup is a simple GUI application and is intended to be used on your personal system only. If you are looking for more advanced backup tools, you can tyr any one of the following tools:
Linux backup and synchronization applications:
- How To Backup Your Entire Linux System Using Rsync
- How To Backup Files And Directories Using Rsync In Linux
- How To Backup And Restore Linux System With Timeshift
- How To Setup Backup Server Using Rsnapshot
- How To Synchronize Files With Unison On Linux
- How To Synchronize Local And Remote Directories In Linux
- How To Synchronize Files And Directories Using Zaloha.sh
- CYA – System Snapshot And Restore Utility For Linux
- Restic – A Fast, Secure And Efficient Backup Application
I wanted to recover one file but after I clicked on Restore I saw a lot of file names going by and and after a bit my Ubuntu desktop toolbar changed so I aborted. I suspect it was actually restoring all files. This could be disastrous.
Yes, it could be. Make sure you’ve selected the files to restore and proceed.
I see no way to select a single file. I was testing restore a deleted file. There seem to be no menu to select a single file restore if deleted. Directions state select file you wish to restore. but i never see a full list of backup files individually. I can restore the full backup. But not files or folders. seems my version is not matching this page instructions.
I just checked it in Fedora. I can able to restore a single file. May be you should update your Deja-dup version.
I am using Ubuntu 20.04 LTR and the latest Deja-dup version available from that distro. Like Bill Sanderson, I cannot find the option to restore an individual file. Only the name of the external drive where the backup is stored appears. It is not possible to dig down into this to find individual folders or files. There are other websites suggesting that Deja-dup should work in the way the author indicates, but it looks as though something has changed since these articles were written.
I have been using Deja Dup for several months. I just checked DeJa Dup in my Fedora desktop. Nothing has changed. The interface of Deja Dup looks exactly same as in the article. I can able to restore single file without any issues. Could you please update the Deja dup and try again? If you’re already using latest version, try it in a different system.
With respect to not being able to restore single files in Ubuntu 20.04 LTS, it is possible with the Deja Dup vesrion supllied by Ubuntu (see 4th item below):
– Ubuntu lags with software versions compared to Fedora
– Ubuntu 20.04 LTR installs Deja Dup 40.7.
– The file browser in Deja Dup restore, as demonstrated above was added in Deja Dup version 41.1
– Deja Dup 40.7 does have integration with Files (the file browser aka nautilus). If you right-click on a file which has been archived you will see a menu with a menu item “Revert to Previous Version ..” , which will start the Deja Dup app .. How this works for files that were delete ? (I guess you have to revert the entire folder to the previous version…)
– Deja Dup 41.1 drops the integration with the file browser, described above, in favor of its in-app browser.