How To Use Timeshift To Backup And Restore Linux System?

How To Use Timeshift To Backup And Restore Linux System?

Backup and restore are important functions for any computer system. You can do this in Linux easily with the help of Timeshift.

In this article, I’ll cover how to use Timeshift for backing up and restoring your Linux. I’ll go over how to install and configure it, as well as some tips for getting the most out of it. After reading this article, you should be able to confidently use it to protect your data and restore your linux system if needed.

What Is Timeshift On Linux?

Timeshift Logo

Timeshift is a Backup utility tool for the Linux operating system. It is a free and open-source backup tool that allows users to create a system restore point by taking snapshots of their system at different points in time.

It is similar to applications like rsnapshot, BackInTime, and TimeVault but with different goals. Timeshift is designed to protect only system files and settings. User files and directories such as documents, pictures, and music are excluded by default.

This ensures that the files remain unchanged when you use it to restore a system to an earlier date. This way they can revert back to a previous version if something goes wrong.

Timeshift also includes a powerful scheduling feature, allowing users to schedule system backups at regular intervals. It is compatible with the most popular Linux distributions, including Ubuntu, Linux Mint, Zorin OS, Debian, Fedora, and Arch Linux.

Timeshift is useful for restoring your system files and settings to a known good state after making changes or updates that cause problems. It creates snapshots using RSYNC and Hard Links, and it can also be configured to use BTRFS snapshots in a BTRFS File System.

Why Do I Need To Backup My Linux?

Backing up a Linux machine is essential for any user who wants to protect their data. By creating regular backups, you can ensure that you have a secure copy of all your files, settings, and data in case something goes wrong with your system.

This could be anything from a hardware failure to accidental file deletion or corruption. With a backup, you can easily restore your system to its original state and get back up and running quickly without starting from scratch.

Additionally, regular backups are invaluable in the event of malicious software or hacker attacks as they allow you to quickly restore the system without losing any of your valuable information.

How To Install TimeShift To Backup And Restore Linux System?

Many Linux Distributions like Linux Mint, Manjaro, etc. have Timeshift installed by default. If you are using one of these distributions, look for Timeshift in the applications menu. If it is not installed, you can follow the instructions below to install it.

For Ubuntu and Ubuntu-based Distros:

If you are using Ubuntu, you can install it from the Ubuntu Repository. Ubuntu and many Ubuntu-based distributions have it in their repositories. But you may not get the latest version. So, I prefer using the PPA from the developer to get the latest version.
Use the following command to add the PPA and install Timeshift on Ubuntu.
sudo add-apt-repository -y ppa:teejee2008/timeshift
sudo apt-get update
sudo apt-get install timeshift

For Fedora and CentOS:

Fedora and CentOS use the DNF package manager. The syntax is similar to the APT package manager. You don’t need to add any repository in Fedora and CentOS. You can install it easily using the following command.
sudo dnf update
sudo dnf install timeshift

For Arch Linux and derivatives (like Manjaro):

Arch and its derivatives use Pacman package manager. The syntax looks weird and confusing but you can easily install it using the following command. Any Arch-based distros can work perfectly.
sudo pacman -S timeshift
Once the installation is complete, you can launch Timeshift from the application menu or in the terminal to do the backup and restore your Linux. It has both the GUI and CLI interface.

Timeshift Features

Feature Description
Incremental Backup: Timeshift allows users to take snapshots of the system at a specific point in time and only saves changes made since the last snapshot, thus reducing the size of the backup.
Scheduled Automatic Snapshots: You can schedule automatic snapshots at regular intervals, so you don’t have to manually create backups. Timeshift has different backup levels to ease the process of taking snapshots.
Selective Directory and File Backup: You can choose which directories and files to include or exclude from snapshots, giving you more control over your backups.
Multiple Backup Modes: It supports multiple backup modes such as “RSYNC” and “BTRFS” to suit different needs and environments.
Restore to Specific Snapshot: You can use Timeshift to restore the system to a specific snapshot or to the most recent snapshot, providing flexibility in case of system failure or errors.
Easy-to-use graphical user interface: It has a simple and user-friendly graphical user interface that makes it easy for users to navigate and perform backup operations.
Can run in CLI (Command Line Interface): Timeshift can also be run in the command-line interface, which makes it easy for users to automate backup and restore operations. You can easily run Timeshift in the TTY terminal to restore snapshots if your display server is unable to start.

Initial Setup

Setting up Timeshift is a relatively straightforward process. When you open up the Timeshift app, it will ask you for your Root password. Enter your password to continue.

Authenticate Timeshift

If you are using the ext4 file system, then RSYNC is the default choice. Or if you use the BTRFS file system, then you can choose BTRFS. BTRFS is not available in the ext4. Select your snapshot type and click on Next.

Select Snapshot Type on Timeshift

Now, select your Snapshot Location where you want to save the snapshots. My Root directory and Home directory are separated so in my case I select my Home partition. You can also use an external hard drive that has a supported Linux file system. Click on Next to continue.

Select Snapshot Location on Timeshift

Now, set up your Snapshot Levels. You can create scheduled snapshots level like Monthly, Weekly, Daily, Hourly, and Boot. Select your desired Snapshot Levels and enter how many times you want to take snapshots of your system. After that, click on Next.

Select Snapshot Levels on Timeshift

By default, Timeshift excludes User files to keep the size of the snapshots low. If you want to include user files, you can do that. But my recommendation is not to include them as it will overwrite your existing files when you restore a backup snapshot. So keep that in mind. Click on Next to continue.

User Home Directories

Your setup is completed and you are good to go. Click on Finish to close the wizard.

Complete Setup of Timeshift

Creating A Backup Using Timeshift

After finishing the initial setup process, creating a Backup snapshot is easy in Timeshift. You only need to click the Create button in the Timeshift main window. It will then create a complete snapshot of your Linux.

Create a Snapshot In Timeshift

Timeshift will take scheduled backups of your Linux. Make sure you enabled Scheduled Snapshots at the initial setup.

Restoring A Backup Using Timeshift

Restoring a snapshot in Timeshift is easy. You can use the GUI or CLI to restore the Linux system with timeshift. Open Timeshift and give Root access. Select the snapshot you want to restore. Click on the Restore button to continue.

Select a snapshot in Timeshift

Now select the target devices where you want to restore the backup files. If you are not sure what to do, do not change anything and click on Next.

Select Target Device in Timeshift

Timeshift is now comparing files with rsync to prepare the restoration process.

Timeshift is comparing files

Now, look at the list to see which files are going to be restored. If everything is ok then click the Next button and the restoration process will start.

Confirm action in Timeshift before restoration

Wait for the process to be completed. After completing the restoration process, your computer will restart and your system will be restored.

You can also use the terminal to restore your system. Run Timeshift using the following command. It will show you all the commands and the syntax.

timeshift

To restore a snapshot, use the following command. Then follow the instructions to complete the process.

sudo timeshift --restore

Conclusion

Timeshift is a powerful and easy-to-use tool that allows you to take backups and restore your Linux system. It provides a simple and intuitive interface that makes it easy to create, schedule, and manage system snapshots.

Moreover, restoring a system from a snapshot is a simple process that can be done in just a few clicks. Overall, Timeshift is an essential tool for anyone looking to protect their Linux system from data loss and system failure.

I hope this article helped you to properly take backups and restore your system. If you have any questions or issues, feel free to post a comment below. I will be very happy to reply.

Leave a Reply

Your email address will not be published. Required fields are marked *

five × three =