DEV Community

Cover image for Creating a Usable Backup Setup for Linux (ElementaryOS 5)
Nathan Bland
Nathan Bland

Posted on

Creating a Usable Backup Setup for Linux (ElementaryOS 5)

Creating a Usable Backup Setup for Linux (ElementaryOS 5)

Creating a backup solution is something most of us don't think about until we need it.

This is a guide that is meant to be a step by step solution to that problem before it happens.

Note: This is made for elementaryOS, but should work on any Debian based Linux distro, however YMMV if you are using something else.

Step 1: Backup Media Device

Before we even begin with some backup software, we need to have something to back it up to. This can be a network location like a samba share, a secondary disk in the system itself, or a removable disk like an external hard drive.

In my case, I'm using a 4Tb Western Digital Passport drive.

Step 2: Install The Software

There are a ton of backup solutions in terms of software for Linux, most being based on either rsync, or duplicity. For this guide, we are going to be using a tool called Déjà Dup Backup Tool. It's based on duplicity, which means we can back up to any kind of file store (even NTFS) and retain permissions, take snapshot backups, and keep file history, which is a very good thing for us. In my case, it allows me to make backups from both my windows install, and Linux install to the save drive, without needing different partitions. An honorable mention goes to Timeshift, which I would have used if it provided any kind of support for NTFS drives

Getting this installed in Elementary is straight forward. First, we need to open up the AppCenter, either by finding it on the dock, or by going to the applications tab and typing in the name.

Once we've got that open, we are going to type in Backup in the search bar in the top right of the AppCenter. This will provide a list of many, many apps, most of which are "Non-Curated". Déjà Dup falls into this category as well, and for me was the 5th listing from the top.

After locating the listing, click on the Free button on the far right, this will prompt you for your administrator (sudo) credentials to install the software. Enter them and hit Authenticate.

You you will be shown a progress bar for downloading, and then installing. Once the install is complete, you can close the AppCenter.

Step 3: Configuring Backup

Now that we have our backup tool installed, we need to open it. Click the Applications menu button in the top left, and look for Backups or type it in to search.

We are greeted by an interface that has only two visible buttons, and several menu items. The buttons, Restore... and Back Up Now... provide quick ways to get started.

Before we click through one of these, let's check our our menu items:

  • Overview - where we are now
  • Folders to save - The things we want backed up, by default, this only backs up your home folder.
  • Folders to ignore - Things you don't want included in your backup.
  • Storage location - Where your backups will live.
  • Scheduling - How often you want the system to backup

3.1: Scheduling

Let's start with that last menu item, and work our way up. First, turn Automatic backup on. Now, how often we want this to run can vary.

This will depend on your needs, and available storage. If you have more storage you may be able to do daily backups and keep them forever, or if you have much less you may only do weekly, and only keep a few

A lot of this depends on what you feel is appropriate for your data. How often do you change files on your computer? Is that data saved somewhere else like google docs or GitHub?

Personally, most of the work I do in Linux is code, and I use git for that. However, I do still have a lot of personalization that would take a lot of effort to get back, so for me, I'm going to set mine to backup every Week and keep for At least six months. This gives me a reasonable amount of data, without going too far for what I do. Remember that this software uses snapshot backups, so they won't take as much storage as you probably think.

3.2: Storage Location

A cool feature of Déjà Dup is that you can backup to a cloud account (Google Drive or Next cloud) if you desire. I'm just going to do a local backup, but feel free to use one of those options if you want. Keep in mind that backups to a remote server will probably be much slower.

At this point of Déjà Dup we have two options, Storage location and Folder. You should adjust at least your storage location to point to your external drive.

In my case the Storage location is set to my Passport external drive, and folder is just my computer name, nathan-Z170XP-SLI. You can change that folder name to whatever you want.

3.3: Folders to ignore

This menu is slightly deceiving. Anyone who has dealt with Linux backups before will know there are some system folders you should definitely ignore if you want a system backup to be successful. Fortunately, Déjà Dup provides are larger list, that is always ignored. You can view this list by clicking the top right icon, selecting help, and browsing to Settings. The help guide is generally useful and well written, I would recommend it if you have any other questions.

I'm going to add one additional entry by hitting the plus, /media, as I'm going to include my entire system, and I don't want to backup the drive I'm backing up to.

3.4: Folders to save

By default, Déjà Dup only backs up your home directory. I want more than this included in my backup, so I'm going to hit the plus icon near the bottom of the interface, and add an entry for root /.

This is going to tell it to backup everything - excluding the folders on the ignore list - on the system, so you may not want to set a backup to this level.

3.5: Backup.

Clicking back to the Overview section, we can now run our backup. Click Back Up Now..., you will be informed that the system requires duplicity with an option to install it in the top right, click Install. Just like before you will be prompted for your administrator credentials, and be greeted by a progress bar.

Once this install finishes you will be asked if you want to require a password for your backup. Depending on the nature of your work, and your tendency to remember or forget passwords, I would recommend password protecting this. If you don't use a password manager, you should start. However, if you don't feel you either need, or would remember a password, then select Allow restoring without a password.

In my case, I gave a password. Once you have an option selected, and a password given, the Forward button becomes active, click it.

This will start the backup itself. Depending on how much data you have, and which storage location you selected, this will take a long time.

You can expand the details if you want to view exactly what it is doing.

Step 4: Testing The Restore

Do not test this on the original source drive

This may not be a practical use for everyone, as not everyone has extra drives laying around to try a backup with. If at all possible you should try restoring the system with your backup to know that it works. This particular solution requires you install an operating system first, and then restore your backup. From there you can choose a full system restore, or cherry pick individual files to restore instead.

Please, try it. Not only does this give you experience with using the restore function so you know how should the time actually arise when you need to. It will let you walk through any issues you encounter knowing your data is actually still safe on the original drive. This let's you create an action plan - even if it's just in a google keep note, or dropbox - for when you need to do a real restore, and can help reduce stress significantly during that time.

Conclusion

We've made it, and you can now sleep a little easier knowing if your hard drive (or ssd) decides not to wake up tomorrow, you have a place to rescue your data from.

I hope this guide was useful for you, I'm by no means an expert in the backup space, this is just a solution I use and is simple enough to run without getting in the way. If you have suggestions/corrections/comments please feel free to let me know below!

Thanks for reading.

Photo by Chris Yates on Unsplash

Top comments (0)