How to Backup Ubuntu Files and Folders

Keep your files safe and secure on Ubuntu

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." It's a simple utility that lets you create backups of your files on demand or schedule automatic backups to run regularly on your system. Deja Dup also gives you access to cloud backups, to store your files somewhere else securely.

No backup tool is complete without the ability to restore files to their previous location, and Deja Dup can handle that too. Since Ubuntu comes with the tool, it's a breeze to set up a new Ubuntu PC by restoring a backup from a previous one.

How to Set Up Your Ubuntu Backups

  1. Press the Show Applications icon in the lower left of your Ubuntu desktop.

    Ubuntu show applications
  2. When the application browser opens, use the search at the top of the screen to look for "Backups."

    Ubuntu search for backups
  3. Deja Dup, Ubuntu's default backup utility should be the only result, unless you've installed something else. It's listed as "Backups" with a safe icon. Press it to launch the backup app.

  4. When Deja Dup backup opens, you'll be presented with the Overview tab. It provides the key controls to create backups and restore a backup you've already made. Right now, though, there's nothing to do here. Select the Folders to save tab to the left.

    Ubuntu backups overview
  5. Here, you can choose which folders you want Ubuntu to automatically back up. By default, your "home" folder is already added, and this means that all files and folders under the home directory will be backed up.

    Ubuntu backups select folders

    In Linux systems, like Ubuntu, your "Home" folder is an equivalent to the "My Documents" folder in Windows 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. 

  6. Next, select the Folders to ignore tab from the left menu to choose the folders you want your backups to exclude from within your home and any other folders you selected to back up.

  7. By default, the Trash and Downloads folders are already set up to be ignored.

    Ubuntu bacups select folders to ignore

    To omit further folders press the plus sign( + ) 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, select its name in the box and press the minus sign( - ).

  8. Now, select Storage location from the left menu.

  9. 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.

    Ubuntu backup location

    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. The cloud is probably the best option, since the backups are stored at a different location. Deja Dup supports both Google Drive and Nextcloud out of the box.

    Ubuntu backup networked server

    Whichever option you choose, make sure you've configured everything that way you need it. The utility won't ask again before making a backup.

  10. Finally, choose Scheduling to set up automatic backups.

  11. 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.

    Ubuntu schedule backups

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

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.

Make a Backup in Ubuntu

  1. With Deja Dup still open, return to the Overview tab.

  2. Press Back Up Now... to get started.

    Ubuntu backups overview
  3. There are a couple of additional software packages that you may need to run your backup. If you receive a message asking you to install them, press Install in the upper right. You'll be asked for your password to complete the process.

    Ubuntu backup install dependencies
  4. The Ubuntu backup will kick off, preparing your files. This will probably take a few minutes, depending on your system and the amount of files you have.

    Ubuntu backing up files
  5. Then, the utility will ask you if you want to secure your backup with a password. That choice is entirely yours. Whichever you pick, press Forward to finish the backup.

    Ubuntu backup set password
  6. The backup will run for a few more minutes. When it's done, the backup window will close, returning you to the Overview tab.

How to Restore Ubuntu Backups

  1. To restore a backup, select Overview tab, and press Restore.

    Ubuntu backups overview
  2. 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. Press Forward to continue.

    Ubuntu restore backup choose folder
  3. When you arrive, 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. Choose a date, and press Forward to keep moving.

    Ubuntu restore backup choose date
  4. Next, you can choose where to restore the files to. The options are to restore to the original location or to restore to another folder.

    Ubutnu restore backup choose destination

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

    Press Forward again.

  5. To finish, you will be presented with a summary screen showing the backup location, the restore date, and the restore location.

    Ubuntu restore backup summary

If you are happy with the summary, press 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.