Hi all,
I’ve been working on btrfs-patrol, a small snapshot and rollback tool made for Fedora’s default install: btrfs with the root and home subvolumes, /boot on its own partition, and optionally LUKS. It’s now in COPR for Fedora 43 and newer (x86_64 and aarch64).
What it does
- Takes a read-only snapshot of
/before each dnf5 transaction, throughlibdnf5-plugin-actions. The description says what changed, such asupgrade kernel-core, mesa-dri-drivers +12 more; install tree. - Takes a daily snapshot with a systemd timer, and prunes old ones (50 by default; snapshots you mark as kept are never pruned).
- Rolls back with one command:
sudo btrfs-patrol rollback 42, then reboot. The current state isn’t lost; it’s kept as a snapshot you can roll forward to.
What it checks before a rollback
/boot isn’t part of the root subvolume on Fedora, so a rollback can leave you with a kernel the restored system has no modules for. btrfs-patrol refuses to roll back unless the snapshot has modules for the running kernel and that kernel has a boot entry, either a systemd-boot/GRUB BLS entry or a unified kernel image. It also refuses layouts that mount the root by subvolid=, which can’t follow a rollback, and undoes its steps if one fails.
It also handles SELinux: the snapshot store gets its labels, and it’s excluded from full relabels, so a relabel can’t mislabel a snapshot you might roll back to.
Install
sudo dnf copr enable jccl1706/btrfs-patrol
sudo dnf install btrfs-patrol
sudo btrfs-patrol setup --dry-run
sudo btrfs-patrol setup
setup shows what it will change (a snapshots subvolume mounted at /.snapshots, an fstab line with a backup of the old file, the timer) and asks before doing it. man btrfs-patrol has the full reference.
Why another tool?
Snapper and Timeshift are both good, but on Fedora’s default layout a rollback isn’t one step: Timeshift’s btrfs mode expects Ubuntu-style @ subvolumes, and Snapper’s rollback needs extra setup to boot the restored root. btrfs-patrol only targets Fedora’s layout, and tries to do that one thing carefully. It’s inspired by timepatrol (GitHub - abdeoliveira/timepatrol: BTRFS snapshot manager and rollback tool · GitHub) by Alan Barros de Oliveira, reimplemented in Python with no dependencies beyond btrfs-progs and util-linux.
Status
It’s young (0.4.1). I’ve tested setup, dnf and timer snapshots, and real rollbacks and reboots on a ThinkPad T480 (LUKS, LVM, systemd-boot, SELinux enforcing), on a stock Fedora Workstation install with GRUB, and on Fedora 44 VMs including one booting a unified kernel image — and a Fedora 44 to 45 upgrade rolled back to 44. Since 0.3.0 it can also snapshot other subvolumes: /home, or /var/log once it is one, each rolled back on its own. Snapshots aren’t backups, so please keep backups.
Source, docs and issues: GitHub - jccl1706/btrfs-patrol: Btrfs snapshot manager and rollback tool for Fedora, inspired by timepatrol · GitHub
Feedback is very welcome, especially from setups I haven’t tried: GRUB instead of systemd-boot, other disk layouts, Silverblue-style systems (not supported yet), or anything that makes setup refuse.