Ubuntu 20.04 System Backup and Restore

In this tutorial we will use Timeshift to create the full system backup snapshot of Ubuntu 20.04 system. Furthermore, you will learn how to restore from your previously created backup snapshot.

In this tutorial you will learn:

  • How to create full system backup snapshot
  • How to restore from backup snapshot
  • How to create and restore backup from the command line

Ubuntu 20.04 System Backup and Restore

Ubuntu 20.04 System Backup and Restore

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa
Software timeshift
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Ubuntu 20.04 System Backup and Restore step by step instructions

Using the following steps we will first create system backup of the Ubuntu 20.04 system using the Timeshift graphical user interface. Later we will restore from the previously created system backup snapshot.

First step is to install the Timeshift backup utility on your Ubuntu 20.04 System. To do this execute the following command:

$ sudo apt install timeshift

Create Backup by using the Timeshift GUI

Create system backup

  1. Open the timeshift application via top left Activities menu.
    Upon opening the timeshift application you will be greeted with a wizard to help you schedule your backups.

    Upon opening the timeshift application you will be greeted with a wizard to help you schedule your backups. Here you have two options. First is to use the rsync as a main backup tool or take an advantage of an inherent BRTFS built-in file system features. In this example we will use rsync. Select RSYNC and hit the Next button.



  2. Select backup destination

    Select backup destination. timeshift will search your system for available file-system partition and provide you with an option to where to create backup file.

  3. select snapshot levels

    Select how often you wish to perform the system backup and how many backup snapshots you wish to retrain before the first backup is overwritten.

  4. home directories are excluded by default

    As the screenshot indicates the home directories are excluded by default. Depending on you work environment select whether you wish to include home directories into the backup.



  5. This will conclude your initial backup schedule setup

    This will conclude your initial backup schedule setup. Hit the Finish button.

  6. perform the previously predefined backup now

    The backup has not been created yet. You can either wait until the timeshift automatically triggers the backup or simply hit the Create button to perform the previously predefined backup now.

  7. Wait for the backup to complete.

    Wait for the backup to complete.



  8. first system backup snapshot ready

    If all went well you should now see your first backup snapshot listed.

  9. Restore from backup

  10. At this point we will restore the system from the previously created system backup snapshot

    At this point we will restore the system from the previously created system backup snapshot. Select a backup snapshot from which you wish to restore and click on the Restore button.

  11. how to restore from your backup

    Timeshift give you an option on how to restore from your backup. Unless you know what you are doing simply hit the Next button to go with the default.



  12. list of changes it will take to restore from the backup

    The Timeshit will provide you with a list of changes it will take to restore from the backup just to make sure no data is lost in the process.

  13. system will be restored and restarted

    Once you hit the Next button the system will be restored and restarted. All done.

Create and restore backup by using the Timeshift’s command line

  1. Create a first backup simply by executing the below command:
    $ sudo timeshift --create
    First run mode (config file not found)
    Selected default snapshot type: RSYNC
    Mounted /dev/sda2 at /media/root/359151f5-efb9-483d-a738-894d57e2d8c8.
    Selected default snapshot device: /dev/sda2
    ------------------------------------------------------------------------------
    Estimating system size...
    Creating new snapshot...(RSYNC)
    Saving to device: /dev/sda2, mounted at path: /media/root/359151f5-efb9-483d-a738-894d57e2d8c8
    Synching files with rsync...
    Created control file: /media/root/359151f5-efb9-483d-a738-894d57e2d8c8/timeshift/snapshots/2020-02-19_18-32-36/info.json
    RSYNC Snapshot saved successfully (39s)
    Tagged snapshot '2020-02-19_18-32-36': ondemand
    
    

    The above command will also create a new configuration file located at the following location: /etc/timeshift.json.



  2. List all your currently created system backup screenshots:
    $ sudo timeshift --list
    Device : /dev/sda2
    UUID   : 359151f5-efb9-483d-a738-894d57e2d8c8
    Path   : /media/root/359151f5-efb9-483d-a738-894d57e2d8c8
    Mode   : RSYNC
    Device is OK
    1 snapshots, 197.7 GB free
    
    Num     Name                 Tags  Description  
    ------------------------------------------------------------------------------
    0    >  2020-02-19_18-32-36  O 
    
  3. Restore from the backup snapshot:
    $ sudo timeshift --restore --snapshot "2020-02-19_18-32-36"
    
  4. Delete selected backup snapshot:
    $ sudo timeshift --delete  --snapshot '2014-10-12_16-29-08'