btrfs Snapshot and Restore Notes (GRUB)

17 May 2025

Notes on setting up automated btrfs snapshots with the ability to boot them from GRUB and restore them. This post targets an Arch Linux installation but is useful for any Linux system.

The post will go over setting up the snapper tool for creating btrfs snapshots as well as creating automated snapshots when new packages are installed and the system state changes.

Install Dependencies

sudo pacman -S snapper snap-pac grub-btrfs inotify-tools
yay -S btrfs-assistant

Create Snapper Configurations

sudo snapper -c root create-config /
sudo snapper -c home create-config /home

Verify configs

sudo snapper list-configs # Verify

sudo snapper -c root set-config ALLOW_USERS="$USER" SYNC_ACL=yes
sudo snapper -c home set-config ALLOW_USERS="$USER" SYNC_ACL=yes

Set updatedb to not index snapshot directoreis

Add .snapshots at end of PRUNENAMES in /etc/updatedb.conf

Disable automatic timeline snapshots during setup

sudo systemctl status snapper-timeline.timer snapper-cleanup.timer
sudo systemctl disable --now snapper-timeline.timer snapper-cleanup.timer

Enable overlayfs so we can boot snapshots

In /etc/mkinitcpio.conf in HOOKS add grub-btrfs-overlayfs at the end

sudo mkinitcpio -P

Enable grub-btrfsd service

This service automatically updates grub when new snapshots are created or deleted

sudo systemctl enable --now grub-btrfsd.service

Setup timeline snapshots

Setup sensible snapshot limits per snapper Arch wiki limits section.

Disable timeline snapshots for the home subvolume.

sudo snapper -c home set-config TIMELINE_CREATE=no

Enable timeline creation and cleanup timer

sudo systemctl enable --now snapper-timeline.timer
sudo systemctl enable --now snapper-cleanup.timer
sudo systemctl status snapper-timeline.timer
sudo systemctl status snapper-cleanup.timer

Check btrfs-assistant

Can start using btrfs-assistant for manual snapshots.

Acknowledgements


comments powered by Disqus