Linux Snapshots - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux Snapshots Guide
Complete beginner-friendly guide to system snapshots on Linux, covering Arch Linux, CachyOS, and other distributions including Btrfs snapshots, Timeshift, and snapshot management.
Table of Contents
Btrfs Snapshots
Create Snapshot
Manual snapshot:
# Create snapshot
sudo btrfs subvolume snapshot / /mnt/snapshots/snapshot-$(date +%Y%m%d)
# List snapshots
sudo btrfs subvolume list /
Automatic Snapshots
Setup automation:
# Create script
sudo vim /usr/local/bin/btrfs-snapshot.sh
Script:
#!/bin/bash
SNAPSHOT_DIR="/mnt/snapshots"
sudo btrfs subvolume snapshot / "$SNAPSHOT_DIR/$(date +%Y%m%d-%H%M%S)"
Make executable:
sudo chmod +x /usr/local/bin/btrfs-snapshot.sh
Add to cron:
# Edit crontab
sudo crontab -e
# Daily snapshot
0 2 * * * /usr/local/bin/btrfs-snapshot.sh
Timeshift
Install Timeshift
Install Timeshift:
# Arch/CachyOS
yay -S timeshift
# Debian/Ubuntu
sudo apt install timeshift
# Fedora
sudo dnf install timeshift
Create Snapshot
Create snapshot:
# Create snapshot
sudo timeshift --create
# List snapshots
sudo timeshift --list
GUI
Launch GUI:
# Launch GUI
sudo timeshift-gtk
Snapshot Management
List Snapshots
List all snapshots:
# Btrfs
sudo btrfs subvolume list /
# Timeshift
sudo timeshift --list
Delete Snapshot
Remove snapshot:
# Btrfs
sudo btrfs subvolume delete /mnt/snapshots/snapshot-name
# Timeshift
sudo timeshift --delete --snapshot snapshot-name
Restore from Snapshot
Restore Btrfs Snapshot
Restore:
# Boot from live USB
# Mount root
# Restore snapshot
sudo btrfs subvolume snapshot /mnt/snapshots/snapshot-name /mnt/restored
Restore Timeshift Snapshot
Restore:
# Boot from live USB
# Launch Timeshift
# Select snapshot
# Restore
Troubleshooting
Snapshot Issues
Check snapshots:
# List snapshots
sudo btrfs subvolume list /
# Check space
sudo btrfs filesystem df /mnt/snapshots
Summary
This guide covered snapshots for Arch Linux, CachyOS, and other distributions, including Btrfs snapshots, Timeshift, and restoration.
Next Steps
- Btrfs Guide - Btrfs setup
- Backup and Restore - Backups
- System Recovery - System recovery
- ArchWiki Snapshots: https://wiki.archlinux.org/title/Btrfs#Snapshots
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.