6 Apps and Tricks to Optimize Your Linux System Backups

Aaron Peters 11-04-2017

When moving to Linux you may notice your version comes with a default back up tool. But it may not be set to back up all the important parts of your system. Furthermore, using the default tool may lead to backups that are bigger and less efficient than they need to be.


Here are some alternate ways to back up your Linux system to make the best use of the storage you have available.

Make Sure You Are Backing It ALL Up

The default tool on Ubuntu desktops, dejá-dup, is only set up by default to back up your home directory. But this leaves out some important things you’ll need to easily restore your system to working order. Think of your system as the following three parts:

optimize backup table

Now, you can easily set the default tool to back up all three of the above. But this assumes you have lots of storage, or it might involve shuffling large amounts of data over the internet. The following apps and tricks can help minimize the space you need while still making sure you’re covered in the event of a meltdown.

1. Clone the Partition to Snapshot Your Home Directory

This is the data residing in your user account(s) under the /home/[username] directory. This includes your personal configurations, often stored in files or directories starting with a dot (e.g. /home/[username]/.local) as well as music, pictures, and other files and folders (like the default Documents or Download folders). It’s the data you’ll probably focus on backing up, and the one most often handled out of the box.


A great reason to keep your /home directory on a separate partition is so you can work with it separately from the main parts of your system. If you do so, you can back up your home directory by cloning the entire partition. It can then be restored precisely as you had it at the disk level.

As previously covered How to Clone Your Linux Hard Drive: 4 Methods Need to clone your Linux hard disk drive or partition? Use one of these drive cloning tools to clone your Linux disk. Read More , one option for this is dd, which will clone a disk or partition exactly (meaning your backup is the same size as the entire partition). Consider using Clonezilla. It can back up the structure of the disk/partition but omit unused disk space, so your backup is only the size of the actual data the partition contains.

2. Store Home Directory Snapshots on Multiple Machines With File Synchronizers

File synchronizers are a good option for your personal files, especially if you use more than one device. There are almost too many options to name here, but they include simple file-copying utilities such as rsync, online services such as Dropbox 5 Great Cloud Backup Tools & Services That Fully Support Linux If you ask any power user for one good piece of advice that applies to any operating system, it would be to back up your files regularly. As much as technology can be helpful, it... Read More , or local/peer-to-peer programs like Resilio Sync From Pirate Darling To Dropbox Alternative: BitTorrent Sync Lets You Keep Your Files Synchronized Across Machines Cloud-based file sync services are easy to use and work well, but your privacy may or may not be your first priority. Not to mention the fact that these services always come with a storage... Read More . Some of these will offer to track history for you, although it will be for each and every minute change, which can become unwieldy, and waste storage.

optimize backup dropbox all


3. Use Archiving Tools to Keep Historical Snapshots of System Data

Outside of your home directory, you should definitely consider the following as part of your back up:

  • /etc, which contains configurations such as /etc/apt/lists (lists describing the repositories from which your system installs new programs).
  • /var, which contains supplemental data used by applications. Examples of this include logs (e.g. /var/log/dpkg.log, where package transactions are logged on a .deb-based system), caches (such as /var/cache/dpkg, where a copy of all packages installed are kept), and /var/lib/dpkg (where the package database is stored).

Standard “archive-style” back up tools can handle these system directories as well. They will typically look at the files in the source directory(s), determine if an up-to-date backup of this file exists, and create/update if not. They can keep multiple copies (i.e. a daily one and a weekly one) and the archives are often compressed to save disk space. There are a variety of options Backup & Restore Data And Files Easily With Back In Time [Linux] Read More , including programs like dejá-dup or backintime.

You’ll need to set these back up jobs up as root, or use the built-in capabilities of the tool to run with admin privileges.

optimize backup backintime as root


Then, using these apps (backintime is shown below) you can simply add the directories you want to a new or existing back up job:

optimize backup backintime etc var

By picking and choosing which of these directories you back up, you can score some space savings compared to typical “whole system” backups. Check out this post for tips on what /var sub-directories you may want and which ones you don’t.

4. Use etckeeper to Keep Records of Config Changes

For the /etc directory specifically, the utility etckeeper uses source control to help you back up your important system configurations. Installing it in Ubuntu requires the following command:

sudo apt-get install etckeeper

As part of the installation, it will create a backup (actually, a git repository) and commit all the files under /etc into it.

optimize backup etckeeper init

You can then use any git client to take a look at the history of your system configurations. More importantly, the app also sets up a cron job to commit changes to your configs every day. But most configuration files are created in plain text, and since git (and other source control systems) work off the principle of saving changes line-by-line, the storage of multiple versions can end up being quite small.

5. Use aptik to Back Up Configs and Software Packages

The aptik program wraps up a number of back up/restore tools in a convenient GUI:

optimize backup aptik options

Its Installed Software feature will backup the packages you’ve explicitly installed by default — the image below shows that this can be a pretty short list:

optimize backup aptik software

Why is it so short? Well, it doesn’t require the base system’s packages, because in order to use this backup you’ll already need a base system installed. And if you install just these few dozen packages, the package manager will take care of installing all their dependencies for you. So your “full software backup” can consume just a few dozen megabytes of storage. Clever, yes?

6. Back Up Your Packages With a Package List

You can do even better than aptik if you’re comfortable with the command line. To make sure you can restore your system at a later time, try this: don’t back up packages at all, but rather capture a package list instead. The following command will export a list of your installed packages to a text file:

sudo dpkg --get-selections > my-packages.txt

optimize backup dpkg getselections
In addition to giving you the human-readable accounting (shown above) of the packages on your system, the following commands can reinstall them in bulk:

sudo dpkg --set-selections < my-packages.txt
sudo apt-get -u dselect-upgrade

Note that you’ll need to handle programs you’ve installed by hand (probably living in /usr/local and/or /opt) yourself. But otherwise the only difference between your previous and restored system is that everything will be at the newest versions available—probably what you want anyway. And all this for the price of a measly few thousand kilobytes.

Remember, you aren’t limited to using just one of the above. Combine as many as you need to make sure that if the worst happens, you’ll be back up and running quickly.

Do you use any of the above tools above to help with backup duties? Give us your kick-butt backup tips below in the comments!

Related topics: Data Backup, Disk Partition, Linux.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Richard Steven Hack
    April 12, 2017 at 4:09 am

    Or you can do what I do:

    1) Use fwbackups instead of all these fancy point-specific backup tools.

    2) Keep your home and data on separate partitions.

    3) Back up the partitions to an external drive, preferably separate drives for each partition. (I have four data partitions, plus home, so I have 3 backup drives, one of which houses a partition plus the home partition, since the home partition is very small.)

    4) Never archive your backups. Do you seriously want to trust some software programmer that your restore of an archived file will go well? I don't. I let fwbackups back up the files unarchived, so I can browse and restore individual files from the backup whenever I want. If you use the same size backup drives as your internal drives, you don't have to worry about saving disk space.

    5) If you are really concerned about backing up your root and boot partitions, that's easily doable as well. Either just take an image backup using a program which allows you to restore specific parts of an image, or just take an image backup, and in an emergency, restore that first, then restore your data backups.

    I tend not to bother about backing up the root partition. The odds of corrupting it so it can't be repaired are really low (it's NOT Windows, guys), and reinstalling doesn't take that long. I've never had a corrupted root partition ever over 15 years of using Linux.

    The key to backups is to Keep It Simple, Stupid. Windows is a pain to backup. Linux isn't.

    • Aaron Peters
      April 14, 2017 at 5:04 pm

      Hi Richard,

      I agree there are plenty of tools that follow the KISS principle, and fwbackups looks like another great tool to take a look at. But taking big image backups or keeping files uncompressed may not be a luxury everyone has. Maybe they don't have multiple external drives with lots of space, or are backing up over the network. I use some of these to back up around 750GB of data (around 30GB of root data and the rest home directory stuff) on a 500GB external drive using a combination of selective backing up and compression.

      Yes, it's a little more complex, but now that it's set, I forget it. But taking a look at what you want to keep and seeing if there's a better way to do it can provide benefits.

    • Hubba
      April 15, 2017 at 10:08 pm

      Agree and "dd" can do all of those things.