A Guide to Using Timeshift for Backups on Linux

Hirusha Adikari
6 min readDec 29, 2022

--

If you’re a Linux user, you know the importance of regularly backing up your system to protect against data loss and system failures. While there are many backup solutions available for Linux, Timeshift stands out as a reliable and user-friendly option. In this guide, we will walk you through everything you need to know about using Timeshift to manage backups on your Linux system, including how to install and configure it, create and restore backups, and troubleshoot common issues. Whether you’re a beginner or an experienced Linux user, this guide will provide you with the tools and knowledge you need to effectively manage your backups with Timeshift.

Introduction to Timeshift

Timeshift is a free and open-source utility for creating and managing system backups on Linux systems. It allows users to take snapshots of their system at a specific point in time, and easily restore the system to that state if necessary. Timeshift uses rsync and BTRFS snapshot technology to create backups that are efficient and easy to manage. It is available for a wide range of Linux distributions, including Ubuntu, Linux Mint, and Fedora

Installing Timeshift

To install Timeshift on your Linux system, you will need to add the Timeshift repository to your system’s package manager. The exact steps for doing this will vary depending on your Linux distribution. For example, on Ubuntu and Linux Mint, you can use the following command to add the Timeshift repository:

sudo add-apt-repository -y ppa:teejee2008/ppa

Once the repository has been added, you can use the following command to install Timeshift:

sudo apt-get update
sudo apt-get install timeshift

On other distributions, you may need to use a different package manager or installation method. Refer to the Timeshift documentation for specific instructions.

Configuring Timeshift

Once Timeshift is installed, you will need to configure it before you can start creating backups. To do this, use the following command to launch Timeshift:

timeshift

The first time you launch Timeshift, you will be prompted to select a snapshot utility. There are three options to choose from: rsync, rsync+ssh, and BTRFS.

  • Rsync is a fast and efficient tool for creating backups, but it requires that both the source and destination locations be on the same system.
  • Rsync+ssh allows you to create backups over a network connection, but requires that you have an ssh server set up on the destination system.
  • BTRFS is a advanced file system with built-in snapshot capabilities. It is only available on systems that use the BTRFS file system.

After selecting a snapshot utility, you will need to choose a destination for your backups. Timeshift supports a wide range of destination types, including local disks, network shares, and cloud storage providers like Amazon S3 and Google Cloud Storage.

Creating backups

Once Timeshift is configured, you can start creating backups of your system. To create a backup, launch Timeshift and click the “Create” button. You will be prompted to select a snapshot type: system, home, or custom.

System snapshots include all system files and directories, except for those excluded by default (such as temporary files and cache directories).

Home snapshots include all user files and directories in the home directory.

Custom snapshots allow you to select specific files and directories to include in the backup.

After selecting the snapshot type, you can choose to include or exclude specific directories or files from the backup. You can also specify a snapshot label, which is a user-defined name for the snapshot. This can be useful for identifying and organizing your backups.

Once you have configured your snapshot, click the “Create” button to start the backup process. The backup process may take some time, depending on the size of your system and the speed of your storage device. You can monitor the progress of the backup in the Timeshift window.

To create a backup with Timeshift’s Command Line Interface, use the following command:

timeshift --create

This will create a full system snapshot, including all system files and directories, except for those excluded by default (such as temporary files and cache directories).

You can also use the following options to create a different type of snapshot:

  • --home: Create a snapshot that includes all user files and directories in the home directory.
  • --custom: Create a snapshot that allows you to select specific files and directories to include in the backup.

You can also specify a snapshot label with the --label option, which is a user-defined name for the snapshot. This can be useful for identifying and organizing your backups.

For example, to create a custom snapshot of your home directory with the label “home_backup”, you can use the following command:

timeshift --custom --home --label home_backup

Restoring backups

To view a list of available backups, use the following command:

timeshift --list

This will display a list of all available backups, along with their labels and the date and time they were created.

If you need to restore your system from a backup, you can use Timeshift to easily roll back to a previous state. To restore a backup, launch Timeshift and select the snapshot you want to restore from the list. Click the “Restore” button to start the restore process.

To restore a backup with Timeshift’s Command Line Interface, use the following command:

timeshift --restore

This will launch the restore process and prompt you to select a backup from the list of available snapshots. You can also use the --latest option to restore the most recent backup, or the --id option to specify a specific backup by ID.

For example, to restore the most recent backup, you can use the following command:

timeshift --restore --latest

During the restore process, you will be prompted to confirm the restore operation and choose any additional options. For example, you can choose to restore only system files or only user files, or you can choose to overwrite the existing system with the backup.

It is important to note that restoring a snapshot will overwrite any changes made to your system since the snapshot was taken. Make sure to use caution when restoring backups, and consider creating a new snapshot before restoring if you want to keep a copy of your current system state.

Scheduling backups

Timeshift allows you to schedule automatic backups of your system at regular intervals. To schedule a backup, launch Timeshift and click the “Schedule” button. You will be prompted to select a snapshot type and destination, as well as specify the interval and time at which the backups should occur.

To schedule automatic backups with Timeshift’s Command Line Interface, you can use the --schedule option. This will allow you to specify the interval and time at which the backups should occur.

For example, to schedule daily backups at 3:00 AM, you can use the following command:

timeshift --schedule daily 3:00

Timeshift supports a variety of scheduling options, including daily, weekly, and monthly backups. You can also specify the number of snapshots to keep, which determines how many backups will be retained before the oldest ones are deleted.

To cancel a scheduled backup with Timeshift, use the following command:

timeshift --cancel

This will cancel any scheduled backups and remove them from the schedule.

To view the scheduled backups with Timeshift, use the following command:

timeshift --list-scheduled

This will display a list of all scheduled backups, along with their interval and next scheduled time.

Troubleshooting

If you encounter any issues when using Timeshift, there are a few common solutions you can try.

Make sure that you have sufficient disk space available on your backup destination. Timeshift will not be able to create backups if there is not enough space to store them.

Check the Timeshift logs for any error messages or issues that may have occurred during the backup process. You can access the logs by clicking the “Logs” button in the Timeshift window.

Or, to view the Timeshift logs, use the following command:

timeshift --log

This will display a list of all recent backup and restore operations, along with any errors or issues that may have occurred. The logs can be helpful for troubleshooting problems with Timeshift.

If you are using rsync or rsync+ssh as your snapshot utility, make sure that the rsync daemon is running on the destination system.

If you are using a network share or cloud storage provider as your backup destination, make sure that you have properly configured the connection to the destination.

Timeshift is a powerful and user-friendly tool for creating and managing backups on Linux systems. By following the steps outlined in this guide and using the terminal commands provided, you can effectively use Timeshift to protect your system against data loss and system failures. Whether you’re a beginner or an experienced Linux user, Timeshift offers a reliable and flexible solution for managing your backups. Make sure to regularly create and test your backups to ensure that your data is protected and available when you need it.

--

--

Hirusha Adikari

Hi, I'm a Student from Sri Lanka. I'm interested in Tech