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
Software Requirements and Conventions Used
| 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 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
- Open the
timeshiftapplication via top leftActivitiesmenu.π Upon opening the timeshift application you will be greeted with a wizard to help you schedule your backups.
Upon opening thetimeshiftapplication you will be greeted with a wizard to help you schedule your backups. Here you have two options. First is to use thersyncas a main backup tool or take an advantage of an inherent BRTFS built-in file system features. In this example we will usersync. SelectRSYNCand hit theNextbutton.
-
π Select backup destination
Select backup destination.timeshiftwill search your system for available file-system partition and provide you with an option to where to create backup file. -
π 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. -
π 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. -
π This will conclude your initial backup schedule setup
This will conclude your initial backup schedule setup. Hit theFinishbutton. -
π perform the previously predefined backup now
The backup has not been created yet. You can either wait until thetimeshiftautomatically triggers the backup or simply hit theCreatebutton to perform the previously predefined backup now. -
-
π first system backup snapshot ready
If all went well you should now see your first backup snapshot listed. -
π 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 theRestorebutton. -
π 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. -
π system will be restored and restarted
Once you hit theNextbutton the system will be restored and restarted. All done.
Restore from backup
π 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.Create and restore backup by using the Timeshiftβs command line
- 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. - 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
- Restore from the backup snapshot:
$ sudo timeshift --restore --snapshot "2020-02-19_18-32-36"
- Delete selected backup snapshot:
$ sudo timeshift --delete --snapshot '2014-10-12_16-29-08'
