How to Backup Ubuntu Files and Folders

Illustration of a person backing up Linux on their computer

Lifewire / Derek Abella

There is a backup tool that comes pre-installed with Ubuntu called "Deja Dup." 

To run Deja Dup click the top icon on the Unity Launcher and enter Deja into the search bar. A small black icon with an image of a safe will appear.

When you click the icon the backup tool should open.

The interface is fairly straightforward with a list of options down the left and the content for the options on the right.

The options are as follows:

  • Overview
  • Folders To Save
  • Folders To Ignore
  • Storage Location
  • Scheduling
of 07

How to Set up the Ubuntu Backup Tool

Backup Ubuntu


The overview tab provides options for creating and restoring backups. If you see an "install" button under each item then do the following:

  1. Open a terminal window by pressing Ctrl+ALT+​T
  2. Enter the following command sudo apt-get install duplicity
  3. Enter the following command sudo apt-get install --reinstall python-gi
  4. Exit out of the backup tool and re-open it
of 07

Choose Ubuntu Backup Files and Folders

Choose Backup Files And Folders


To choose the folders you wish to backup click the Folders To Save option.

By default, your "home" folder is already added and this means that all files and folders under the home directory will be backed up.

With the Windows operating system you should really only have to back up your "My Documents" folder and everything underneath it but quite often in Windows, it is a good idea to create a system image which includes absolutely everything so that when you restore you can get back to the point just before disaster struck.

With Ubuntu, you can always reinstall the operating system simply by booting from the same USB drive or DVD you used to install it in the first place. If you lose the disk you can simply download Ubuntu from another computer and create another Ubuntu DVD or USB drive.

Essentially it is much easier to get Ubuntu back up and running than it is Windows.

Your "Home" folder is an equivalent to the "My Documents" folder and contains your documents, videos, music, photos, and downloads as well as any other files and folders you may have created. The "Home" folder also contains all of the local settings files for applications.

Most people will find that they just need to back up the "Home" folder. If however, you know that there are files in other folders you wish to backup then click the + button at the bottom of the screen and navigate to the folder you wish to add. You can repeat this process for every folder you wish to add. 

of 07

How to Prevent Folders From Being Backup Up

Omit Backup Folders


You may decide that there are certain folders that you don't wish to back up.

To omit folders click the Folders To Ignore option.

By default, the rubbish bin and Downloads folders are already set up to be ignored.

To omit further folders click the + button at the bottom of the screen and navigate to the folder you wish to ignore. Repeat this process for every folder that you don't want to back up.

If a folder is listed as being ignored and you don't want it to click its name in the box and press the button.

of 07

Choose Where to Put the Ubuntu Backups

Ubuntu Backup Location


An important decision to make is where you want to put the backups.

If you store the backups on the same drive as your actual files then if the hard drive was to fail or you had a partitioning disaster then you would lose the backups and well as the original files.

It is a good idea to back up the files to an external device such as an external hard drive or network attached storage (NAS) device. You might even consider installing Dropbox and storing the backups in the Dropbox folder which will then be synchronized to the cloud.

To choose the storage location click the Storage Location option.

There is an option to choose the storage location and this can be either a local folder, ftp site, ssh location, Windows share, WebDav or another custom location.

The options available now differ depending on the storage location you have chosen.

For FTP sites, SSH and WebDav you will be asked for the server, port, folder, and username.

Windows shares require the server, folder, username and domain name.

Finally, local folders simply ask you to choose the folder location. If you are storing to an external hard drive or indeed Dropbox you would choose local folders. The next step would be to click Choose folder and navigate to the relevant location.

of 07

Scheduling Ubuntu Backups

Schedule Ubuntu Backups


If you do a lot of work on your computer it is wise to schedule backups to occur fairly regularly so that you will never lose much data should the worst happen.

Click the Scheduling option.

There are three options on this page:

  • Automatic backup on or off
  • How often the backups will occur
  • How long to keep the backups

If you want to use scheduled backups place the slider into the On position.

Backups can be scheduled to take place every day or every week.

You can determine how long to keep the backups. The options are as follows:

  • At least 6 months
  • At least a year
  • Forever

Note that there is bold text under the keep option which says that old backups will be deleted sooner if your backup location is low on space.

of 07

Make a Ubuntu Backup

Make A Ubuntu Backup

To create a backup click the Overview option.

If you have scheduled a backup it will happen automatically when it is due and the overview screen will say how long it is until the next backup is taken.

To make a one-off backup click the Backup Now option.

A screen will appear with a progress bar showing the backup taking place.

It is worth making sure that the backups have really worked and they have been put in the right place.

To do this use the Nautilus file manager to navigate to your backup folder. There should be a number of files with the name "Duplicity" followed by the date and "gz" extension.

of 07

How to Restore Ubuntu Backups

Restore Ubuntu Backup


To restore a backup click the Overview option and click the Restore button.

A window will appear asking where to restore the backups from. This should default to the correct location but if not choose the backup location from the dropdown and then enter the path in the box marked Folder.

When you click Forward you are given a list of dates and times of previous backups. This allows you to restore from a certain point in time. The more regularly you backup the more choices you will be given.

Clicking Forward again takes you to a screen where you can choose where to restore the files to. The options are to restore to the original location or to restore to another folder.

If you want to restore to a different folder click the "Restore to specific folder" option and choose the location that you wish to restore to.

After you click Forward again you will be presented with a summary screen showing the backup location, the restore date, and the restore location.

If you are happy with the summary click Restore

Your files will now be restored and a progress bar will show how far through the process it is. When the files have been completely restored the words "Restore Finished" will appear and you can close the window.