Linux shows you no mercy when you don't have a backup. There are several backup utilities out there, including System Restore for Windows and Time Machine for Mac OS. Timeshift is an open-source software which takes incremental snapshots of your Linux file system at regular intervals, which you can restore later if you accidentally render your system unusable.
Timeshift works in two modes: Rsync mode and BTRFS mode. In the rsync mode, snapshots are taken using rsync and hard links, and common files are shared between the snapshots to save disk space. In the BTRFS mode, snapshots are taken using the BTRFS file system. BTRFS is supported on only systems having an Ubuntu-type subvolume layout.
In this article, we'll install Timeshift on various Linux distros and explore its features. You should be able to take regular system snapshots by the end of this article.
You can use the apt utility to install Timeshift on all versions Debian OS's like Ubuntu, Linux Mint, Elementary OS, etc.
# add-apt-repository ppa:teejee2008/ppa # apt-get update # sudo apt install timeshift
Installing from the GitHub Repository
Using the GitHub repo, you can install Timeshift on all Linux flavors like Linux Mint, Kali OS, Ubuntu, Arch Linux, and Manjaro.
$ wget https://github.com/teejee2008/timeshift/releases/download/v17.10/timeshift-v17.10-amd64.run # chmod +x timeshift-v17.10-amd64.run # ./timeshift-v17.10-amd64.run
To install the 32-bit version, follow these steps:
$ wget https://github.com/teejee2008/timeshift/releases/download/v17.10/timeshift-v17.10-i386.run # chmod +x timeshift-v17.10-i386.run # ./timeshift-v17.10-i386.run
Timeshift can be uninstalling using any of these two easy commands. The first command works with Debian-based systems and the second works with any Linux flavor.
# apt-get remove timeshift
Setting up Timeshift
You can launch Timeshift from your launcher or from the terminal by typing
timeshift-launcher. You'll be asked to enter your password to use the application. Typing only
timeshift in the terminal gives you the command line version.
Timeshift has several important features which require very little time and effort to setup. These are the main features found in the Settings section.
This asks you for the type of snapshots you want to take. You can either take snapshots with rsync or BTRFS. The difference between these two were explained earlier.
Snapshots have large sizes, so it's advisable to have them on another drive or partition. Here, you can select where you want your snapshots to be saved. All snapshots are saved by default at /timeshift but you can select other Linux partitions.
The more frequent snapshots you take, the more space they take. You can schedule when the snapshots are taken and how many times they should be taken. You can take multiple snapshot levels and the number of snapshots to be retained at each level
Timeshift isn't a backup tool for your personal files but for your system's files and settings. This is to prevent your personal data from being overwritten during a restore and also reduce the size of your backups. You can include your user data in this section, as well as your settings (hidden files)
You can add folders or files that match certain criteria which you provide.
Taking a Snapshot
Click on Create and the operation will begin immediately. If you don't have enough space, you'll be warned about that. After the snapshot is created, you'll see a notification confirming the completion.
Restoring a Snapshot
Click on the Restore button and click on Next. If there are any settings you'll like to change, you can do that before proceeding. You can restore snapshots from running system or a Linux live CD (after install Timeshift). If you restored from your running system, you'll be required to reboot. You can choose to restore your snapshots to other volumes or partitions. Note that doing this will overwrite your present data.
There are other options in Timeshift like Deleting and Browsing snapshots. You can perform these operations or learn useful commands in command line by typing