Arch Linux Snapshots - ryzendew/Linux-Tips-and-Tricks GitHub Wiki

Arch Linux Snapshots Guide

Complete beginner-friendly guide to system snapshots on Arch Linux, including Btrfs snapshots, Timeshift, and snapshot management.


Table of Contents

  1. Btrfs Snapshots
  2. Timeshift
  3. Snapshot Management
  4. Restore from Snapshot

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)"

Timeshift

Install Timeshift

Install Timeshift:

# Install Timeshift
yay -S timeshift

# Launch
sudo timeshift-gtk

Create Snapshot

Create snapshot:

# Create snapshot
sudo timeshift --create

# List snapshots
sudo timeshift --list

Snapshot Management

List Snapshots

List all:

# Btrfs
sudo btrfs subvolume list /

# Timeshift
sudo timeshift --list

Delete Snapshots

Remove old:

# Btrfs
sudo btrfs subvolume delete /mnt/snapshots/old-snapshot

# Timeshift
sudo timeshift --delete --snapshot 'snapshot-name'

Restore from Snapshot

Restore Btrfs

Restore:

# Boot from live USB
# Mount root
# Delete corrupted subvolume
# Restore from snapshot
sudo btrfs subvolume snapshot /mnt/snapshots/snapshot-20240115 /mnt/restored

Restore Timeshift

Restore:

# Boot from live USB
# Launch Timeshift
# Select snapshot
# Restore

Summary

This guide covered Btrfs snapshots, Timeshift, snapshot management, and restoration.


Next Steps


This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.