How To Backup Ubuntu Files And Folders And Restore

What is a Backup

In information technology, a backup, or the process of backing up, refers to the copying and archiving of computer data so it may be used to restore the original after a data loss event. Going through with this tutorial we will learn, how to backup Ubuntu files and folders and restore them back for further use.

Lets begin!

If you know then 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 type “Deja” into the search bar. A small black icon with an image of a safe will appear.

When you click on the icon the backup tool will open.

The interface is fairly straight forward with a list of options down the left and the content for the options on the right.Backup Ubuntu

The options are as follows:

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

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 and T at the same time
  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

Select Ubuntu Backup Files And Folders

To select the folders you wish to backup click on the “Folders To Save” option.

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

With the Windows operating system you should really only have to backup 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 with in the first place. If you lose the disk you can simply download Ubuntu from another computer and  create a bootable Ubuntu stick.Backup Ubuntu

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 backup the “Home” folder. However, you know that there are files in other folders you wish to backup then click on 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.

How To Prevent Folders From Being Backup Up

You may decide that there are certain folders that you don’t wish to backup.

To omit folders click on the “Folders To Ignore” option.

By default the “rubbish bin” and “Downloads” folders are already set up to be ignored.Backup Ubuntu

To omit further folders click on 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 be click on it’s name in the box and press the “-“ button.

Choose Where To Save The Ubuntu Backup

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 gets fail or you had a partitioning disaster then you may lose the backups and well as the original files.

It is a good idea therefore to backup 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 synchronised to the cloud.Backup Ubuntu

To choose the storage location click on 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.

Scheduling Ubuntu Backup

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 on 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
  • ForeverBackup Ubuntu

Note: There is bold text under the “Keep” option which says, Old backups will be deleted earlier if the storage location is low on space.

Create A Ubuntu Backup

To create a backup click on the “Overview” option.

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

To make a one off backup click on the “Backup Now” button.

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.

How To Restore Ubuntu Backup

To restore a backup click on 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”.Backup Ubuntu

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 on the “Restore to specific folder” option and select 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 everything looks as you expected with the summary click on “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.

 

Leave a Comment