How to Set Up an Automatic Backup System on Linux with Dropbox

Have you ever wanted to set up a backup system on your Linux desktop but don’t know where to start? Not to worry, it is easier than you think! The Linux desktop is compatible with Dropbox, making way for a straightforward, cross-platform backup system. With this backup tool, it is very easy to configure manual backups and schedule them, too.

In this article we’ll go over the details to configure Dropbox to handle automatic backups. Along with all of this, we’ll discuss why you’d want a backup system on your Linux desktop and go over a few other solutions for those not interested in “the cloud.” Let’s get started!

For backing up, we won’t be using the official sync client. Instead, we’ll be using Dropbox Uploader. It is a fairly complex bash script that allows for automating backups directly to Dropbox. Start by opening a terminal and getting the code via git.

Note: you will need to install the package “git” on your system, or this command will not work.

git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
cd Dropbox-Uploader
sudo chmod +x *.sh
./dropbox_uploader.sh

When these four commands are entered, a screen will appear and prompt the user. Log into Dropbox and head over to this page. In order for this script to work, an access token needs to be created. Go here and click “create.” On the next page fill out all of the information to create your app. When prompted, click “Dropbox API.”

automatic-backup-create-dropbox-app

When all the information is filled out, you will have created your Dropbox app. The next step is to generate your access token. Look for it on the page, click the “Generate token,” and copy it to your clipboard.

automatic-backup-uploader-sh

Take the token and paste it into the terminal where the script prompts “access token.” With the access token added, make the backup directory:

./dropbox_uploader.sh mkdir Linux-Backups

Setting the automated backup system is done with Cron. Cron is a system that allows users to schedule different types of commands. Open a terminal and edit the default crontab.

Cron may not be installed. Search your Linux package manager for cron, cronie or something similar and install it.

nano crontab -e

Paste the following into the crontab once you’ve edited it to fit your needs:

04 07 * * 6 tar -zcvf backup-$(date +%Y-%m-%d).tar.gz /home/username/files-or-folders-to-back-up/;/home/username/Dropbox-Uploader/dropbox_uploader.sh upload /home/username/files-or-folders-to-back-up/backup-$(date +%Y-%m-%d).tar.gz Linux-Backup

This cron command will automatically run the backup (You can change the file or folders that you want to back up.) on every Saturday and upload it to Dropbox at 7:04am. With the code pasted, press “Ctrl + o” to write out the file.

Note: If you’re only backing up small files, the free storage Dropbox offers will be more than enough. If you need more storage, you will have to upgrade your account to a premium plan. In addition, the above code only compresses your backup files. It doesn’t encrypt your data. You might want to consider encrypting it before syncing to Dropbox.

Dropbox on Linux is perhaps one of the most commonly used cloud storage solutions out there. They provide a desktop client for Linux (unlike Drive or OneDrive). Using this service, users will actually get to sync data with a desktop client instead of uploading files through a web interface.

Another reason why Dropbox should seriously be considered as a backup solution is the fact that it is cross-platform. Your data backups can be accessed and even modified from your Android or iPhone along with your Windows or Mac. Solutions using Rsync are nice but not good enough in this respect.

The automated Dropbox backup system is neat, and most users will find it useful that their file backups automatically show up inside their Dropbox account. However, Dropbox isn’t for everyone. Let’s briefly go over three good alternatives for creating backups on Linux.

1. Back in Time

backintime-mainscreen

Back in Time is a schedule-able backup solution for Linux that works based on snapshots. Install it on Ubuntu with:

sudo add-apt-repository ppa:bit-team/stable
sudo apt update
sudo apt install backintime-gnome

or

sudo apt install backintime-kde

Back in Time is a good solution for those looking to create quick snapshots of directories and keep incremental backups of data. Learn more here.

2. Deja Dup

dejadup-overview

A good backup system for those not looking to follow the Dropbox method is Deja Dup. It, too, can do automated backups on Linux and works on a very easy programmable schedule. Want to learn how to set it up? Go to this article and learn more about it!

3. Gnome Disks

backup-hard-drive-gnome-disk-utility-create-image

Gnome Disks handles backup a little differently than the other solutions on this list. For starters, Gnome Disks doesn’t do automated backups. Instead, users can manually take complete snapshots of partitions and hard drives for storage later. Though this sounds like a bit much, it’s actually a really elegant solution. With this tool, you can even back up your existing Linux installation or media collection and keep it exactly the way it is.

If you’re reading through this guide and want manual backups of your data instead, this solution is for you.

Learn all about backing up with this solution here.

Though many people do not bother with this on Linux, having a good backup system means that your data will always be safe and secure. Whether it be making a disk image or keeping critical files in cloud storage, snapshots or incremental backups, protecting your data is important. Hopefully, with this article, those putting off setting up a backup solution for their Linux desktop will realize how important this is and take steps to protect critical data.

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.