• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
DefenceDev
No Result
View All Result
ADVERTISEMENT
Home Solutions

Timeshift on Linux: How to Create and Restore System Snapshots

neo by neo
May 27, 2025
in Solutions
0
Timeshift on Linux: How to Create and Restore System Snapshots

Timeshift on Linux: How to Create and Restore System Snapshots

0
SHARES
81
VIEWS
Share on FacebookShare on Twitter
ADVERTISEMENT

About Timeshift

Timeshift Linux snapshots are essential for maintaining a stable and recoverable Linux environment. Whether you’re experimenting with new software or performing system updates, one mistake can potentially break your system.


Timeshift is a powerful tool for Linux users that allows you to take snapshots of your system and easily restore them if something goes wrong. It works similarly to Windows’ System Restore and provides peace of mind without the need to manually manage backups.

Prerequisites

Before using Timeshift, make sure your system meets the following requirements:

  • A Debian/Ubuntu-based distribution (Timeshift also supports Arch and derivatives)
  • Administrative (sudo) privileges
  • Available storage space on your system or an external disk for snapshots
  • Timeshift installed (can be installed via APT or the software center)

To install Timeshift on Ubuntu/Debian:

sudo apt update
sudo apt install timeshift

Benefits and Negatives of Timeshift Linux Snapshots

Benefits

  • Quick system recovery: Restore your OS to a previous state within minutes.
  • Non-destructive backups: User files (by default) are not affected unless you choose to include them.
  • Automated snapshot scheduling: Daily, weekly, or monthly backups.
  • Simple graphical and CLI interface.

Negatives

  • Does not “back up” user data by default (only system files unless manually configured).
  • Can consume a lot of disk space, especially with RSYNC-based snapshots.
  • Not a full substitute for complete system backup (e.g., it doesn’t back up /home unless configured).

Initial Setup

  1. Snapshot type: Choose between RSYNC or BTRFS.
    • RSYNC is suitable for most users.
    • BTRFS is available only on BTRFS-formatted systems with subvolumes.
  2. Select snapshot location: Pick a drive/partition with enough space.
  3. Snapshot schedule: Configure automatic snapshots (daily, weekly, monthly).
  4. User file exclusion/inclusion: By default, Timeshift only backs up system files (not /home). You can include it in settings if desired.

Create a Snapshot

To manually create a snapshot:

Graphical Interface (GUI)

  1. Open Timeshift with sudo privileges.
  2. Click the “Create” button.
  3. Wait for the process to finish. You’ll see the snapshot listed with the date and time.
Linux Timeshift GUI

Command Line Interface (CLI)

sudo timeshift --create --comments "Before software installation"
Troubleshooting: No space left on device

If you encounter the error “No space left on device”, it likely means Timeshift is trying to save snapshots to a partition with insufficient space. To fix this, you can change the snapshot location to a different partition with more free space.

user@2nd-server:~$ sudo timeshift --create --comments "Before software installation"
First run mode (config file not found)
Selected default snapshot type: RSYNC
Mounted '/dev/sda2' at '/run/timeshift/4822/backup'
Selected default snapshot device: /dev/sda2
------------------------------------------------------------------------------
Estimating system size...
Creating new snapshot...(RSYNC)
Saving to device: /dev/sda2, mounted at path: /run/timeshift/4822/backup
Syncing files with rsync...
E: Error writing to file: No space left on device
E: Failed to write file: /run/timeshift/4822/backup/timeshift/snapshots/2025-05-15_09-44-05/rsync-log-changes
E: rsync returned an error
E: Failed to create new snapshot
Failed to create snapshot
------------------------------------------------------------------------------
Removing snapshots (incomplete):
------------------------------------------------------------------------------
Removing '2025-05-15_09-44-05'...
Removed '2025-05-15_09-44-05'
------------------------------------------------------------------------------

IMPORTANT: Store Snapshots on a Separate Partition or Disk

  • Avoid saving snapshots on /boot, /home, or the same root partition if space is limited.
  • Ideally, use a separate disk, LVM volume, or large partition with at least:
    • 20–30 GB free for normal snapshots.

Step 1: Check where you have the space, in my case it is on the /dev/mapper/ubuntu--vg-ubuntu--lv

ADVERTISEMENT
user@2nd-server:~$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              785M  1.2M  784M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   47G  8.9G   36G  20% /
tmpfs                              3.9G     0  3.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
/dev/sda2                          2.0G   97M  1.7G   6% /boot
tmpfs                              785M   12K  785M   1% /run/user/1000

Step 2: Change Snapshot Location

To configure Timeshift to use this location via CLI, run:

ADVERTISEMENT
sudo timeshift --snapshot-device /dev/mapper/ubuntu--vg-ubuntu--lv

Output:

ADVERTISEMENT
App config loaded: /etc/timeshift/timeshift.json
Mounted '/dev/dm-0 (sda3)' at '/run/timeshift/5193/backup'
App config saved: /etc/timeshift/timeshift.json
Check the Timeshift Configuration
  • Check Disk Usage and Choose a Storage Location for the Snapshots
user@2nd-server:~$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              785M  1.2M  784M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   47G   14G   31G  31% /
tmpfs                              3.9G     0  3.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
/dev/sda2                          2.0G   97M  1.7G   6% /boot
tmpfs                              785M   12K  785M   1% /run/user/1000
  • Ceheck Device UUID for Location /dev/mapper/ubuntu--vg-ubuntu--lv
user@2nd-server:~$ sudo blkid
/dev/mapper/ubuntu--vg-ubuntu--lv: UUID="e013cba3-a33a-4def-afe0-41df1cc1e6d8" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda2: UUID="51b9ea97-d3a0-43aa-886e-482392a8c724" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3d865301-bb38-4e2c-8a17-81b0e954698f"
/dev/sda3: UUID="YY3s1l-IVE3-5A2C-XUie-lmRe-F4hS-hGvWrd" TYPE="LVM2_member" PARTUUID="1c4b987e-3928-47cd-853b-47fc2f2af2d8"
/dev/loop1: BLOCK_SIZE="131072" TYPE="squashfs"
/dev/loop2: BLOCK_SIZE="131072" TYPE="squashfs"
/dev/loop0: BLOCK_SIZE="131072" TYPE="squashfs"
/dev/sda1: PARTUUID="1e77b41b-929e-4ef3-9390-e3beda811e4d"
  • Check Timeshift Configuration:
user@2nd-server:~$ more /etc/timeshift/timeshift.json
{
  "backup_device_uuid" : "e013cba3-a33a-4def-afe0-41df1cc1e6d8",
  "parent_device_uuid" : "YY3s1l-IVE3-5A2C-XUie-lmRe-F4hS-hGvWrd",
  "do_first_run" : "false",
  "btrfs_mode" : "false",
  "include_btrfs_home_for_backup" : "false",
  "include_btrfs_home_for_restore" : "false",
  "stop_cron_emails" : "true",
  "schedule_monthly" : "false",
  "schedule_weekly" : "false",
  "schedule_daily" : "false",
  "schedule_hourly" : "false",
  "schedule_boot" : "false",
  "count_monthly" : "2",
  "count_weekly" : "3",
  "count_daily" : "5",
  "count_hourly" : "6",
  "count_boot" : "5",
  "date_format" : "%Y-%m-%d %H:%M:%S",
  "exclude" : [
    "/home/user/**",
    "/nonexistent/**",
    "/root/**"
  ],
  "exclude-apps" : []
}

Restore a Snapshot

In case your system breaks or becomes unstable, restoring a snapshot is simple.

Using GUI

  1. Launch Timeshift.
  2. Select a snapshot.
  3. Click “Restore”.
  4. Follow the on-screen instructions and reboot once done.
Linux Timeshift Restore

Using CLI

sudo timeshift --list
Mounted '/dev/dm-0 (sda3)' at '/run/timeshift/6709/backup'
Scheduled snapshots are disabled - Nothing to do!
------------------------------------------------------------------------------
user@2nd-server:~$ sudo timeshift --list
Mounted '/dev/dm-0 (sda3)' at '/run/timeshift/6767/backup'
Device : /dev/dm-0 (sda3)
UUID   : e013cba3-a33a-4def-afe0-41df1cc1e6d8
Path   : /run/timeshift/6767/backup
Mode   : RSYNC
Status : OK
1 snapshots, 33.0 GB free

Num     Name                 Tags  Description
------------------------------------------------------------------------------
0    >  2025-05-15_10-03-50  O     Before software installation
sudo timeshift --restore
sudo timeshift --restore
Mounted '/dev/dm-0 (sda3)' at '/run/timeshift/6993/backup'

Select snapshot:

Num     Name                 Tags  Description
------------------------------------------------------------------------------
0    >  2025-05-15_10-03-50  O     Before software installation
1    >  2025-05-15_12-08-40  O     Upgrade      

Enter snapshot number (a=Abort, p=Previous, n=Next):0 <-- Enter snapshot ID

Conclusion

Timeshift is a must-have tool for Linux users who want to keep their system safe and recoverable with minimal effort. It’s especially useful before installing new software or applying major updates. While it doesn’t replace a full backup solution for user data, it’s a reliable way to protect your system’s stability.

If you’re looking for a reliable snapshot tool for your Linux distribution, give Timeshift a try—it might save you hours of troubleshooting in the future.

About The Author

neo

See author's posts

ADVERTISEMENT
Previous Post

Oracle VirtualBox: Port Forwarding in NAT Network Mode

Next Post

Install SoftEther VPN Server on Ubuntu 24.04

neo

neo

Related Posts

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script
Docker

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script

Raspberry Pi Monitoring with Monit: Docker, Temperature, Network & More
Solutions

Raspberry Pi Monitoring with Monit: Docker, Temperature & More

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)
Docker

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)
Docker

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)
Docker

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04
Docker

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Next Post
Install SoftEther VPN Server on Ubuntu 24.04

Install SoftEther VPN Server on Ubuntu 24.04

Recommended

How to Remove Application from an Ubuntu Server using apt-get

How to Remove Application from an Ubuntu Server using apt-get

Descripton for kill command on Ubuntu

Linux Process Management, kill Command

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

Fortinet FortiGate Site-to-Site IPsec VPN Troubleshooting

Fortinet FortiGate Site-to-Site IPsec VPN Troubleshooting

ADVERTISEMENT

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Recent News

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

  • Site Map
  • Privacy Policy
  • Facebook Page
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos

© 2025 defencedev.com - All rights reserved.