Backup and Restore Linux System Settings with Timeshift [Beginner's Guide]

This beginner's guide shows you how to back up and restore Linux systems easily with the Timeshift application.
Warp Terminal

Beginner or advanced, a Linux user will, at some point, find the need for a backup solution.

All it takes is one sudo command to go wrong, and youโ€™ll be sent back to the Stone Age. Linux shows you no mercy when you donโ€™t have a solid backup.

There are lots of impressive backup software available for Linux. Almost all distros come with an easy-to-use backup tool like Deja Dup. It backs up and keeps your docs, music and other important stuff safe. When you reinstall Linux, you can get your important data back thanks to the backup you created.

However, you'll have to reinstall the software, and drivers and reconfigure the freshly installed system. And that's no less than a nightmare.

This is where tools like Timeshift help.

Backup and restore Linux system settings desktop with Timeshift

When you are in a situation where you messed up the system settings and want to get back to the previous state, Timeshift backup helps.

Heck, it can even get you out of situations where you cannot even log in to your system.

Timeshift doesnโ€™t back up your regular files in the home folder.

At least not by default. You can do that with Deja Dup, the default backup application installed in distros like Ubuntu.

Timeshift is for backing up system files and settings. So when you are configuring your system and making some customization and mess the system up in the process, you could revert to the older system snapshot.

๐Ÿšง

Timeshift is designed to protect system files and settings. It is NOT a backup tool and is not meant to protect user data. Entire contents of users' home directories are excluded by default.

Installing Timeshift in Linux

Letโ€™s see how to install Timeshift in various Linux distributions.

1. For Ubuntu and Linux Mint

Timeshift is available in the Universe repository of Ubuntu 20.04 and higher versions. This means you can install it on Ubuntu 20.04 and Linux Mint 20 using the apt command.

Open the terminal in Ubuntu and enter the following command:

sudo apt install timeshift
๐Ÿ“‹
Timeshift is now installed by default in Linux Mint.

2. For Arch Linux and its derivatives

The latest version of Timeshift backup solution is available in the Arch User Repository. Enable AUR and get Timeshift.

The below command uses yay as the AUR helper:

yay -S timeshift

3. For Fedora and its derivatives

Timeshift is available in the repos of Fedora and you can install it using:

sudo dnf install timeshift
โœ‹
Timeshift is primarily for desktop Linux systems. There are different backup solutions for Linux servers.

How to use Timeshift to backup a Linux system

Now that you have it installed letโ€™s see how to use it.

Well, thereโ€™s no command line hassle here. Launch Timeshift from the menu. Put in your sudo password when asked. Click on Create. Done.

Don't worry; I'll show each step in detail.

Creating a system backup

Below, you can find how to create a normal system backup using Timeshift.

Step 1: Open Timeshift

After you have installed Timeshift, launch it from your system menu. It will ask for your user account password.

Timeshift ask administrative password while opening the application
Timeshift Authentication Request

Step 2: Select Snapshot Type

Once Timeshift is opened, select the Snapshot type from the next window. You have two options to choose from:

  • RSync: Snapshots are taken using rsync and hard-links. Common files are shared between snapshots, which saves disk space. Each snapshot is a full system backup that can be browsed with a file manager.
  • BTRFS: Snapshots are taken using the in-built features of the BTRFS file system. BTRFS snapshots are supported only on BTRFS systems having an Ubuntu-type subvolume layout (with @ and @home subvolumes).
๐Ÿ“‹
If you don't know about BTRFS, chances are that you are using the default EXT4 filesystem. In that case, go with RSYNC.

Don't worry, if you select BTRFS in an EXT4 system, it will show this error:

If you select Timeshift's BTRFS option in a non-BTRFS system, it will throw you an error
Timeshift BTFS Error

This will start estimating your system size.

Step 3: Select the storage device

In this stage, you need to give the location where the backup will be stored.

You can use your computer's hard disk or an external USB disk for backup storage.

If you use your computer's hard disk, the Timehsift backups can be created automatically on a schedule.

If you use an external USB disk, you have to manually create the backups when you plug it in or keep it plugged in always.

๐Ÿ’ก
It is recommended to use an external drive as the backup location in case anything serious happens to your hard drive. And the USB or external drive you are going to use should be formatted to a Linux filesystem. Otherwise, it will not be detected.
Choosing the location for timeshift backup
Partition the Drive

Now, you will be able to view various devices with supported filesystems on the Timeshift window.

Timeshift listing various drives in the system, that can be used as a location for your backup
Backup Location

You can see in the above screenshot that, I have selected my formatted external drive. Select your desired location and click Next.

Step 4: Configure Scheduled Snapshots

The next screen will guide you to set up scheduled backups. There are several scheduling options like monthly, weekly, daily, hourly etc.

Select any one of them or multiple of them.

Timeshift's Snapshot scheduling window, where you can set the intervel and number of copies to be saved.
Scheduling Snapshots

Also, you can set the number of copies you want to keep, of each type of scheduled backups.

๐Ÿšง
You need to have a good amount of storage at hand so that both backup and your day-to-day work go smoothly.

Step 5: Select the Files / Folders

In this step, you need to select what parts of your system are going to back up.

By default, the user files are not backed up. Only those files that are needed to make the system up and running, are backed up.

This has several advantages. If you back up the user files, while restoring, those files will be overwritten, and any changes you have made after creating the backup will be gone. So, choose those folders wisely.

Select the directories that need to be backed up
Files need to be backed up

As you can see from the above screenshot, there is an option to back up the hidden files. This means that you can back up your config files also. But keep in mind that, upon restore, the changes that you have made will be overwritten with the old backed up file.

Once done, click Finish to complete the setup.

Click on the finish button of Timeshift setup wizard to complete the initial set up
Click Finish to Set up

Step 6: Create the backup

After the initial setup is completed, you will reach to the Timeshift home page, where you can create the first backup by clicking on the Create button.

Click on the Create button to start create backup
Click on Create Button

This will start creating the backup for you. Wait for the process to complete.

The progress window, where you can view the backup status, number of files created etc.
Backup creation in progress

Use Timeshift to handpick files and folders to backup (if needed)

Timeshift can also be used to back up particular files or folders only, along with your other system backup.

For example, if you want to back up your ~/.bashrc and your Music folder, you can do that.

Step 1: Go to Settings

You need to finish the initial setup, that means up to reaching the Create backup page. From there, select the Settings button.

Click on the Settings button inside Timeshift for additional options
Click on Settings

Step 2: Select Files/Folders

On the next dialog box, go to the Filters tab and select Add Files / Add Folders option. This will open the file browser and select the File/Folder accordingly and click on Open.

Select additional files or folders or both, that you need to back up along with the system
Select Files or Folders

Step 3: Set the Files/Folder to be included in the backup

Now, you need to make sure that, the files/folders you selected should be included in the backup. By default, they are excluded. For this, change the radio button adjacent to the files/folders towards the "+" sign. Then click OK.

Turn the radio button towards the "Plus" category for those files.folders you need to include in the back up
Check the new entries as included

Or you can click on the Summary button to view the summary of files/folders, that are excluded/included on the backup. Files/folders with a preceding "+" sign will be included in the backup.

The summary page, accessed via the "summary" button, where you can view the file/folder included or excluded status
Summary of Excluded/Included list

You can create the backup with the selected items by clicking on the Create button.

Use Timeshift to backup files with specific extensions (if needed)

Like the above, you can back up files that have certain extensions using Timeshift. For example, if you want to backup all .mp3 or .pdf files, you can do that.

Step 1: Add Specific Extensions

First, you need to select the Settings and then to Filters tab, as in the previous step. Now, click on the Add button on the bottom and provide the extensions that you want to backup separately.

Provide extensions on the appropriate field, to make file inclusion based on extensions
Inclusion/Exclusion based on file extensions

Not that, the extensions should be chained in the format :

*.mp3,*.png,*.pdf

Once done, press okay.

Step 2: Add the list to be included

Make the selected extensions to be included, by turning the adjacent radio button to "+" sign. On the screen, you can see, although I added the extensions, it is not included (toggle the radio to "plus" side).

Confirm whether the files with provided extensions need to be included or excluded.
Confirm inclusion by extension

Press OK and then hit the Create button to start the backup process.

How to restore your Linux system from Timeshift backup

In the above sections, you have seen various methods to back up your Linux system using Timeshift. So now, you will be looking at restoring the system using the backup you have.

1. From the same OS

When you can still log onto to your OS and want to go back to a previous state, just launch Timeshift from Menu or Dash and select a Restore Image and hit restore. Thatโ€™s all.

If your backup is on external USB, you should plug it in, of course.

Select a snapshot from the list of available snapshots and click on restore button to start restoring that particular snapshot
Restore selected snapshot
๐Ÿšง

Once you finished the restoration, reboot the system to get the effect.

2. Restoring when you canโ€™t log into your Linux system

This section is for systems that canโ€™t log into a graphical environment. There is still hope to get it back to the normal state.

Youโ€™ll need a live Linux USB. Create one using another computer.

I highly recommend keeping an Ubuntu Live USB or any other live Linux USB, as this can be a lifesaver. There is no excuse for not having this.

Step 1: Install Timeshift in Live USB

Boot into the live Linux session and install Timeshift. Yes, you can install applications in live sessions.

In order to install Timeshift in Ubuntu Live USB, you need to first enable the Universe repository, using:

sudo add-apt-repository universe

Once that's done, enter:

sudo apt install timeshift

Now, you can use Timeshift in live USB.

Step 2: Go through the Setup Wizard

After installation, launch the application and follow the set-up wizard. That is, first select rsync and click Next.

Select RSYNC and Click on Next button
Click on RSYNC and Next

Now, select the backup drive you had used earlier from the list.

Select the backup drive, where you earlier created the backup of your system from the list
Select the backup drive

This will bring you to the main Timeshift window, where you can find your backup listed.

Step 3: Restore the backup

Select the backup that you want to restore and click restore.

Click on the restore button after selecting a snapshot, to start restore process
Restore the backup from within live USB

In the next screen, it will ask about the restore paths. Provide it according to your system.

Change the locations, where the mentioned paths needs to be added according to your system
Change the Installation location properly

I recommend you let Timeshift install the bootloader again.

๐Ÿ’ก

If you are facing any issues with the restore, confirm the locations of restore, as this may vary for your system. Also, sometimes, when any error occurs related to 'initramfs', you can solve it by enabling the update initramfs button and retry.

Once Next is pressed, it will start a Dry run.

Comparing the files and a dry run is performed by Timeshift
Comparing Files (Dry Run)

Timeshift will then ask to confirm the actions.

Confirm the suggested actions, by clicking on the Next button
Confirm Actions

Click on Next, if you are satisfied with the actions to be performed. This will give you a disclaimer about data formatting to be performed. Click Next again.

Data modification warning is displayed, which you want to confirm
Data modification warning

Restoration will be started once you click next.

System restore in Progress
Restore in Progress

Wait for some time so that the restoration is complete. It will give you a completed window, once everything is OK.

When restore process is finished, it will show you a complete message
Restore complete message

Reboot the system and then remove the Live USB when prompted. Later, boot into your restored Linux system.

Hopefully, things will be back to normal.

Conclusion

Backup and restore Linux system

Can backup and restore Linux system get any easier? This program gives you the ability to tinker around, mess up and try new stuff without any fear or regret.

An invaluable tool in any Linux user's arsenal. No wonder, Linux Mint has started providing it by default.

What is your view on the amazing Timeshift? How do you back up your Linux system?

Also, do tell us situations where you messed up real bad and timeshift could have been or has been useful. Donโ€™t forget to share. You might save a Linux life :D

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries ๐Ÿ•ต๏ธโ€โ™‚๏ธ

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! Youโ€™ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.