Easy ways to restore snapper btrfs snapshots?

How do you restore snapper snapshots? (of the root volume)

I saw this https://wiki.archlinux.org/title/snapper#Restoring_/_to_its_previous_snapshot but it talks about loading from a LiveCD, mounting volumes, etc.

Is there any easy way (when the system is still booting fine) like in Timeshift where you just choose the snapshot, it gets restored and you reboot?

If you take manual snapshots, there is no press button way to restore those because there is takes human knowledge to know where to restore them.

If you use tools like snapper or timeshift, then it becomes possible. I maintain a tool called btrfs-assistant which is in AUR that does this for snapper snapshots and there are others as well.

Alternatively, you could write a simple script that was specific to your system to do it.

No matter how you do it, be vary careful about restoring a snapshot on a running system. It can be done, but you should reboot immediately afterwards.

1 Like

Yes. There is. hehehehe :grin:

But for that is borg needed.

With snapper I use:

  • grub-btrfs
  • snap-pac
  • snap-pac-grub

being able to boot from a snapshot is usually enough for any problem to be fixed on the main subvol

A post was split to a new topic: Problem restoring btrfs snapshots

I use grub-btrfs which makes selecting a snapshot for boot quite easy.

Have you used both grub-btrfs / snap-pac and why do you prefer one over the other?

They do different things. I am not sure it makes sense to compare them.

grub-btrfs is for booting off snapshots.

snap-pac takes snapper snapshots before and after pacman transactions.

That’s very interesting. Currently I use snapper to grab snapshots on a time-schedule.

If I were to run snap-pac alongside, would grub-btrfs pick up the snapshots it creates, or do you need to run snap-pac-grub specifically for those?

Those snapshots are just like any other snapshots so they will get picked up if the others are. Usually this is done by enabling the path unit.

I use grub-btrfs + snap-pac / snap-pac-grub & limit my snapshots to 50. I think it’s better to run a system so booting from a snapshot should be a last resort (since installing these 3 packages I’ve never needed to use them).

Here are some notes on how I keep my system stable & always bootable:

  • I’ve been running btrfs as my root filesystem for around 8-9 years & I think in this period there has only ever been one time I needed to boot from a snapshot to fix a broken system (I run linux-hardened & linux-lts kernels so I should always have a bootable system)

  • I also keep the last 3 package versions with a pacman hook (install pacman-contrib to get paccache) This way I can always roll back any software which doesn’t work for whatever reason:

#  /etc/pacman.d/hooks/remove_old_cache.hook
Operation = Remove
Operation = Install
Operation = Upgrade
Type = Package
Target = *

Description = Keep the previous 2 pkg versions + currently installed...
When = PostTransaction
Exec = /usr/bin/paccache -rvk3
  • To run any services on my system & for testing I use containers so as not to pollute my system (I use mainly lxd & less often podman).

  • My desktop has been XFCE for at least 15 years - it doesn’t have all the bells & whistles but is very very stable & I don’t remember any breakage in this time.