Quickly Back up FileSystem With Timeshift on Ubuntu 22.04
This guide, brought to you by Orcacore, aims to teach you How To Back up FileSystem With Timeshift on Ubuntu 22.04. Timeshift is a powerful system restore tool specifically designed for Linux operating systems. It offers a straightforward way to create and manage system backups, allowing you to revert to a previous state if something goes wrong. Learning How To Back up FileSystem With Timeshift on Ubuntu 22.04 can be a lifesaver.
Timeshift operates by creating snapshots of your system. These snapshots capture the state of your system files and settings at a particular point in time. It uses either rsync
or btrfs
mode, depending on your Linux distribution and chosen configuration. Essentially, Timeshift creates a restore point when your system is stable and functioning correctly. This backup encompasses all system files and settings, but intentionally excludes user files and documents to keep the backup focused and efficient.
This approach ensures that if you inadvertently make changes to your system while configuring or customizing it – changes that lead to instability or errors – you can easily restore your system to the previously saved restore point, effectively undoing all the problematic modifications. This makes How To Back up FileSystem With Timeshift on Ubuntu 22.04 a very valuable skill.
To successfully Back up FileSystem With Timeshift on Ubuntu 22.04, you should log in to your Ubuntu server as a non-root user with sudo
privileges. If you need assistance setting up such a user, you can refer to Orcacore’s guide on Initial Server Setup with Ubuntu 22.04.
1. Install Latest Timeshift on Ubuntu 22.04
The recommended method for installing TimeShift is to use the LaunchPAD PPA maintained by Tony George, the developer behind TimeShift. This PPA provides the latest stable version of the software.
First, import the PPA using the following command:
sudo add-apt-repository ppa:teejee2008/timeshift -y
Next, update your system’s APT package lists to recognize the newly added PPA:
sudo apt update
Now, install the latest version of TimeShift on your Ubuntu 22.04 system using the following command:
sudo apt install timeshift -y
2. How To Launch TimeShift on Ubuntu 22.04?
Once the installation is complete, you can launch TimeShift from the graphical user interface. Navigate to the following path:
**Activities > Show Applications > TimeShift.**

Upon launching TimeShift, you can immediately begin creating snapshots. Alternatively, you can access the settings to configure scheduled snapshots based on your specific needs and preferences.
3. Create Snapshots with Timeshift on Ubuntu 22.04
Timeshift offers two primary modes of operation: Rsync mode and BTRFS mode.
In rsync mode, snapshots are created using the rsync
utility and hard links. This method efficiently shares common files between snapshots, minimizing disk space usage. In BTRFS mode, snapshots are taken using the BTRFS file system’s built-in snapshotting capabilities. However, BTRFS mode is only supported on systems that have an Ubuntu-type subvolume layout.

Scheduling snapshots is highly recommended for most users. Regular snapshots provide a safety net, enabling you to recover your system if any installations introduce bugs or instability.

TimeShift offers a wide range of configuration options, including location selection, filters, and more. These options allow advanced users to fine-tune their backups to meet specific requirements.
4. How To Remove Timeshift?
If you decide that you no longer need Timeshift, you can easily remove it using the following command:
sudo apt autoremove timeshift --purge
To remove the PPA repository as well, use the following command:
sudo add-apt-repository --remove ppa:teejee2008/timeshift -y
Conclusion
You have now learned how to Back up and Restore FileSystem With Timeshift on Ubuntu 22.04. Using Timeshift on Ubuntu 22.04 offers a convenient and reliable method for backing up your filesystem. Its snapshot functionality allows you to revert your system to a previous state in case of errors or system failures. With its intuitive interface and robust features, TimeShift is an excellent tool for maintaining system stability and providing peace of mind during updates or configuration changes. How To Back up FileSystem With Timeshift on Ubuntu 22.04 is an important skill for any Ubuntu user.
Enjoy! Please subscribe to us on Facebook and Twitter.
You may also like to read the following articles:
Backup and restore data on Linux with restic
Ubuntu Turn Off Automatic Updates From CLI
Alternative Solutions for File System Backup on Ubuntu 22.04
While Timeshift provides a user-friendly and efficient way to back up your Ubuntu 22.04 system, alternative solutions exist that may be more suitable depending on your specific needs and technical expertise. Here are two alternative approaches: using rsync
directly and using BorgBackup
.
1. Direct rsync
Scripting
rsync
is a powerful command-line utility that forms the foundation of many backup solutions, including Timeshift (in rsync mode). Using rsync
directly provides greater flexibility and control over the backup process, but it requires more manual configuration.
Explanation:
rsync
efficiently copies files from one location to another, minimizing data transfer by only copying the differences between the source and destination. This makes it ideal for incremental backups. A well-crafted rsync
script can automate the backup process, including scheduling and retention policies.
Code Example:
#!/bin/bash
# Configuration
SOURCE="/path/to/your/system/files" # Replace with the directory you want to back up
DESTINATION="/path/to/your/backup/location" # Replace with the backup directory
TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S)
BACKUP_DIR="$DESTINATION/backup_$TIMESTAMP"
# Create the backup directory
mkdir -p "$BACKUP_DIR"
# Perform the rsync backup
rsync -avz --delete --exclude={'/dev/*','/proc/*','/sys/*','/tmp/*','/run/*','/mnt/*','/media/*','/lost+found'} "$SOURCE/" "$BACKUP_DIR/"
# Optional: Create a log file
echo "Backup completed at $TIMESTAMP" > "$BACKUP_DIR/backup.log"
echo "Backup created in: $BACKUP_DIR"
Explanation of the script:
SOURCE
: Specifies the directory to be backed up. Important: Change this!DESTINATION
: Specifies the directory where backups will be stored. Important: Change this!TIMESTAMP
: Generates a unique timestamp for each backup.BACKUP_DIR
: Creates a directory with the timestamp for the specific backup.mkdir -p "$BACKUP_DIR"
: Creates the backup directory if it doesn’t exist.- *`rsync -avz –delete –exclude={‘/dev/‘,’/proc/‘,’/sys/‘,’/tmp/‘,’/run/‘,’/mnt/‘,’/media/‘,’/lost+found’}
**: This is the core
rsync` command:-a
: Archive mode, preserves permissions, ownership, timestamps, etc.-v
: Verbose mode, provides more output.-z
: Compresses data during transfer.--delete
: Deletes files in the destination that no longer exist in the source. Use with caution!--exclude
: Excludes specific directories from the backup (e.g., temporary files, system directories). Customize this list based on your needs.
- The
echo
commands create a simple log file indicating when the backup was performed.
To schedule this script to run automatically (e.g., daily), you can use cron
:
- Save the script to a file (e.g.,
backup_script.sh
). - Make the script executable:
chmod +x backup_script.sh
. - Open the crontab editor:
crontab -e
. - Add a line like this to run the script daily at 2:00 AM:
0 2 * * * /path/to/backup_script.sh
. Replace/path/to/backup_script.sh
with the actual path to your script.
Advantages:
- Flexibility: Full control over the backup process.
- Efficiency:
rsync
‘s incremental backup capabilities save time and disk space. - No External Dependencies:
rsync
is typically pre-installed on most Linux distributions.
Disadvantages:
- Requires Technical Expertise: You need to understand
rsync
options and scripting. - Manual Configuration: Setting up scheduling, retention, and error handling requires manual effort.
- No Built-in GUI: All configuration and management is done through the command line.
2. BorgBackup
BorgBackup (often referred to as Borg) is a deduplicating backup program. It excels at creating space-efficient backups, making it an excellent choice for users with limited storage or those who want to minimize backup size.
Explanation:
Borg uses a technique called deduplication to avoid storing redundant data. When creating a backup, Borg identifies and stores only the unique chunks of data, referencing existing chunks for identical data. This significantly reduces the overall backup size, especially for systems with many similar files or frequently updated files. Borg also supports encryption and compression.
Code Example (Installation and Basic Usage):
First, install BorgBackup:
sudo apt update
sudo apt install borgbackup
Then, initialize a Borg repository:
borg init /path/to/your/borg/repository
Important: You will be prompted to create a passphrase. Store this passphrase securely! You’ll need it to access your backups.
Now, create a backup:
borg create /path/to/your/borg/repository::mybackup-$(date +%Y-%m-%d) /path/to/your/system/files
List backups in the repository:
borg list /path/to/your/borg/repository
To mount a backup:
mkdir /mnt/borg_restore
borg mount /path/to/your/borg/repository::mybackup-2024-10-27 /mnt/borg_restore
To unmount the backup:
borg unmount /mnt/borg_restore
To prune (delete) old backups, keeping only the last 7 daily, 4 weekly, and 6 monthly backups:
borg prune --keep-daily 7 --keep-weekly 4 --keep-monthly 6 /path/to/your/borg/repository
Finally, compact the repository to reclaim space:
borg compact /path/to/your/borg/repository
Advantages:
- Deduplication: Significantly reduces backup size.
- Encryption: Provides secure backups.
- Compression: Further reduces backup size.
- Efficient: Fast backup and restore speeds.
Disadvantages:
- Command-Line Interface: Primarily command-line driven (though GUI frontends exist).
- Requires Initial Setup: Setting up the repository and passphrase requires initial configuration.
- Learning Curve: Understanding Borg’s concepts and commands takes some effort.
These alternative solutions offer different trade-offs between flexibility, ease of use, and features. Choosing the right solution depends on your specific requirements, technical skills, and comfort level with command-line tools. While Timeshift is a good starting point, exploring rsync
or BorgBackup can provide more tailored and efficient backup strategies for your Ubuntu 22.04 system.