1. Home
  2. Linux
  3. Back up your dropbox sync folder linux

How to back up the Dropbox sync folder on Linux

Dropbox is a stellar backup system. It’s one of the few major cloud sync providers that offer up mainstream support for Linux (albeit limited in recent updates). Still, the Dropbox syncing system isn’t perfect on Linux, or any platform for that matter. The fact is, things can break, syncing can fail, and it puts your data at risk.

A great way to ensure that the data in your Dropbox folder is always safe is to create a local backup. On Linux, there are many different ways to create backups, so we’ll be exploring a couple of ways to back up the Dropbox sync folder, with minimal effort on the user’s part.

Method 1 – Tar

The fastest way to create a back up of the Dropbox sync folder is to use the Tar tool to create a TarGZ archive, for easy storage. The benefit of going this way is that there is no additional software to install; compress and go.

Tar in terminal

Creating a Tar backup of the Dropbox sync folder in the terminal is probably the easiest way to do, as you need to run a command. To create a new backup of your sync folder, follow the step-by-step instructions.

Step 1: Go to the system tray on your Linux desktop and locate the Dropbox icon. Once found, right-click on it with the mouse to reveal its context menu.

Step 2: In the context menu, locate the “Exit” button and click it to close the Dropbox sync client.

Step 3: Open up a terminal window and use the tar command to create a new TarGZ archive of your Dropbox sync folder (~/Dropbox)

tar -czvf dropbox-backup.tar.gz ~/Dropbox

Step 4: Let the Tar program archive scan through all of the files in your Dropbox sync folder and add them to the new dropbox-backup.tar.gz folder.

Step 5: When the archiving process is complete, copy dropbox-backup.tar.gz to an external hard drive, home server, etc.

Encrypt backup

Many Dropbox sync folders contain sensitive data. Things like tax documents, personal family photos, etc. For this reason, you may want to encrypt your backup. That is if you want to prevent unwanted people from accessing the backup file.

To encrypt the Dropbox backup, you’ll need to use the GnuPG tool.

Note: need to install GnuPG? Check out Pkgs.org for more info.

In the terminal, run the gpg command with the “c” command-line switch to encrypt the newly created dropbox-backup.tar.gz file.

gpg -c dropbox-backup.tar.gz

After entering the gpg command, the terminal will ask you to enter a passphrase. Enter something memorable and secure. Alternatively, generate a password with the Strongpasswordgenerator.com tool.

Following adding the password to the file, Gpg will finish the encryption process and output dropbox-backup.tar.gz.gpg. Next, you must delete the original dropbox-backup.tar.gz file, as it is not encrypted.

rm dropbox-backup.tar.gz

Finally, copy the dropbox-backup.tar.gz.gpg file to an external HDD, home server, or somewhere else safe.

Restore backup

To restore a Dropbox backup made in Tar, do the following.

Step 1: Move dropbox-backup.tar.gz or dropbox-backup.tar.gz.gpg (if you chose to encrypt your backup) to the home folder using your Linux PC’s file manager.

Step 2: Turn off the Dropbox sync app.

Step 3: Delete the original Dropbox sync folder.

rm -rf ~/Dropbox

Step 4: Extract the backup and restore it to its original location.

gpg dropbox-backup.tar.gz.gpg 

mkdir -p ~/Dropbox

tar dropbox-backup.tar.gz -C ~/Dropbox

Method 2 – Deja Dup

Want a more turn-key backup solution for your Dropbox sync folder? Consider using the Deja Dup tool. It can automatically archive and encrypt your Dropbox files with minimal effort.

To gain access to Deja Dup, install the app.

Ubuntu

sudo apt install deja-dup

Debian

sudo apt-get install deja-dup

Arch Linux

sudo pacman -S deja-dup

Fedora

sudo dnf install deja-dup

OpenSUSE

sudo zypper install deja-dup

Open up the Deja Dup application on your Linux desktop. Then, inside of the app, find the “Folders to save” option and click on it.

Click the “+” button to open up the file browser, and use it to add your Dropbox sync folder to the “Folders to save” list.

Next, click on your home directory in “Folders to save” and remove it from the list, so that Deja Dup only backs up your Dropbox sync directory.

After adding the Dropbox folder to Deja Dup, click on “Storage Location”. Then, set Deja Dup to save your backup to an external hard drive, local drive, server, or whatever other location you choose.

Click on “Overview”, then “Back Up Now” to create the new backup. Be sure to check the box that enables encryption, if you want to keep your files safe.

Restore backup

To restore your Dropbox backup made with Deja Dup, do the following.

Step 1: Open up the Linux file manager on your computer.

Step 2: Shut off the Dropbox sync client.

Step 3: Find the Dropbox sync folder, right-click on it with the mouse and delete it from the computer.

Step 4: Open up Deja Dup and click “Restore.” Be sure to select “Restore files to original location”.

Comments are closed.