You are not logged in.

#1 2024-03-12 16:44:54

Registered: 2011-09-30
Posts: 56

Major system upgrade/rollback with btrfs snapshots


I haven't upgraded my system in a while (incl. KDE) and I wonder if there's some guide to do so without risk, leveraging btrfs' snapshot/rollback feature (using systemd boot loader).
I use pacman in conjunction with btrfs snapshots (IOW every update incorporates a btrfs snapshot).

Is it hassle-freely possible to just btrfs-rollback a pacman -Syu? Can I just boot from an USB pendrive and delete the latest btrfs snapshot/root?
Or, ideally, even boot into a previous snapshot and later delete diverging filesystem state.



#2 2024-03-16 22:09:58

Registered: 2019-08-02
Posts: 24

Re: Major system upgrade/rollback with btrfs snapshots

Not sure what your definition of hassle-free is, but it will take a few steps :-)
First of all you need to make sure that you are booting from a btrfs subvolume. You should be able to tell by looking at your systemd-boot config file, it should show the name of the subvolume you are booting from. It's probably called "@"

I am not at my PC, so here's from the top of my head:
To boot from an older snapshot of @ you will have to
1. move the current @ to e.g "@broken", followed by a mv "@lastknowngood"  to @
2. Snapshots are usually read-only, which means you need to run "btrfs subvolume @ ....- rw" next.
If you now reboot the lastknowngood snapshot will be active .

But, it's highly likely that your kernel/boot files changed between the broken @ and @lastknowngood. Which means your reboot will fail because of different kernel versions in /boot (newer) and @ (older).
I keep a copy of /boot in my @ so it gets included in the snapshots should I ever need them.
Hence, step 3. cp /bootCopy to /boot
4. reboot


Board footer

Powered by FluxBB