How to set-up snapper and use it for recovery?

Hello, I am a new user coming from Windows. I’d like to set-up snapper and learn how to use it in case something happens with the OS. Thus far I installed snapper via the terminal and I also installed Btrfs Assistant.

My first question is what should I create a snapshot of? Two subvolumes I have are /home and /root but I don’t know where could the most problems occur? (I’m thinking /root because it’s the more crucial one but it’s also less likely to be modified)

Next, how would I use these snapshots in case something indeed goes wrong? What if the system fails to boot? In my first hour of use I already did that after upgrading all of the important system files and then manually restarting prematurely (I never got notified of it still updating or finishing). Being new to the system I thought it would be have “Seamless Updates” something Android already has and indeed that’s true to some extent.

Important note: I don’t consider this to be a backup, I might call it that but it’s not what it is, I already have all my data backed up and this system is only supposed to be a shortcut to getting my system back in case something goes wrong (so I don’t have to do a complete reinstall with several dozens of hours needed to set everything up again).

1 Like

You should back up your /home where all of your documents, pictures etc are kept.

You can always reinstall your /root from install media or reinstall your system.

If you have a highly customised /root system that you have put a lot of work into, then back that up too.

Hey @danilojonic, welcome to Fedora! :fedora:

If you haven’t already, I recommend this Fedora Magazine article on btrfs snapshots. While it doesn’t cover Snapper specifically, it’s a nice primer on the overall subject.

Anywho, onto your question about what to create a snapshot of. If your primary goal is to be able to recover from a bad system update, root (/) is definitely the subvolume you would want to take snapshots of. As you’ve pointed out, since you’re not planning to use snapshots as a backup strategy, home is probably less important for you.

My personal configuration is to take snapshots of the root subvolume once a day with one week of history. I don’t snapshot my home subvolume because I use specific backups for that data. Additionally, because of how btrfs snapshots work (they are copy-on-write), they can get quite large and cause a lot of disk usage if the snapshot is of a subvolume that changes frequently.

As far as using btrfs snapshots as restore points for root is concerned, take a peek at this article that shows how to configure them via Btrfs Assistant. None of it is Framework specific, it just happens to be a helpful article they’ve posted.

Hopefully this gets you going in the direction you were looking for.

1 Like

For the backup part, I would not save the whole /home directory because there are lots of useless things there, like the browser cache (of course if you don’t purge it before). Instead I would point to the /documents, /images, and other subdir.

For the system recovery-restore, I can think of two situations where you may need it, one is a unfortunate update (never happened to me yet on Fedora) the other is you intentionally mess with the system and then you want to revert to a “clean” state.

For the second, the intentional changes you want to revert, yes, it is a good solution, expecially if you have got a very complicated “base” configuration. In my own case I have a very basic default Fedora install so it is easier to just reinstall from scratch.

For the first, it is good only if you have the whole thing set in order to take a snapshot before each single update (or DNF install - remove) and to have the option to pick the “restore point” at boot (given the system at least loads the boot menu).

There is a problem with re-installing the system from Fedora images, if the issue is the update, right after the installation usually you are told to update and then you are back to the problem.

2 Likes

Yeah no I already had my important files backed up and so I just transferred them into /home. I’d backup only those specific folders whenever I make a bigger change in them.

As for the situations when I’ll need it, yeah as a newbie I’m more likely to screw up the system so the 2nd scenario is totally valid for me.

Ah I got it, /root is the more important after all and /home (or more accurately some parts of it) should be backed up onto a different drive.

Thank you for the links, I’ll check them out.

1 Like

Honestly I don’t know how you can screw the system, the only “wrong” thing you could do is to force install some software (that is not provided by Fedora’s repositories) via some script you find on the Internet.

So please don’t do that.
NEVER run somebody’s else scripts.

Until you install and remove software using DNF (preferred way) or Gnome Software (bleah :slight_smile: ), I don’t think anything can go wrong to the point you need a system restore procedure.

You can also be proactive and install Fedora in one of its “immutable” versions, like Silverblue. In short, that means the system is provided as image and all the system files are read-only so you cannot make changes where you shouldn’t. You can add your software as “flatpak”, that means self-contained and somehow sandboxed packages. Fedora “immutable” is extremely safe, of course there are some limitations that you can work around with the “overlay” trick (see the documentation if needed).

On a side note, WIndows is not that bad either, the main way you can screw it up is to install “utilities” to clean, repair or improve the system. It is an old sad story, I learned it the hard way like most people. With one big caveat: in Windows since ever the user is told to install anything from third party untrusted sources. You download the “setup.exe” from some site and execute that as “admin”. Suicidal. In “linux” you get either the repositories, that are somehow safe and/or the said self contained - sandboxed flatpaks or snaps (that are better for “immutable” systems).

When you say “/root”, do you literally mean /root (home directory for the root account), or do you mean / (often called the root partition)?

By “/root” I mean “/” or the parent directory of “/home” and many others.

I didn’t setup a root account so the actual folder “/root” is accessible only when acting as an administrator.

I am not exactly sure which one of these is needed for backup because actual “/root” folder seems to be very important with all the warnings whereas “/” seems to have everything including “/boot” and other things that might be crucial for the system.

So the way I see it I should create snapshots of “/” without the child directory “/home”.

When I open btrfs assistant, there’s 2 subvolumes already. One is called “home” and the other one is called “root”. Inspecting each of these subvolumes tells me that the “root” is actually “/” and not the “/root” folder itself.

1 Like

Sounds good. So that ‘root’ subvolume is what you want to take snapshots of in order to have a “system restore point”. The /root folder often doesn’t contain anything critical, but it will be contained inside that subvolume anyway.

As you’ve seen, /home is on its own subvolume, so it won’t be included in snapshots of the ‘root’ subvolume.

I screwed up my system within 1 hour when I tried upgrading crucial system components and then I restarted prematurely without seeing the “install & restart” button in the software center. Then it ended up in a black screen boot and never recovered. Even the older kernel version or fedora (0) couldn’t save it so I reinstalled.

Since then nothing bad has happened except me realizing the downsides and limitations of flatpaks (thus far everything I installed was a flatpak because I thought it would be superior to not rely on anything other than itself).

1 Like

Hold on.
First, there are two “kinds” of Fedora here.
The “traditional linux distribution Fedora” and the “immutable fedora”.
In several variants (Gnome, KDE, etc).

Usually you are given a graphical tool for searching, installing software and updating everything, the same tool allows to enable or disable the respositories from where you get your software.

In Fedora Gnome you get “Gnome Software”.

It is not the best way to manage software on Fedora “traditional”, you are also given the DNF tool from the terminal and it has got several advantages, mainly it tells you exactly what it is doing and it also allows to undo the changes by selecting them from its own “history”.

I have Gnome Software disabled so it is still available but it does not start at boot. You have to place a config text file in some directory to achieve that, there isn’t an option.

Anyway, if you use DNF from the terminal you are shown the progress and then you are told something like “all done” and it means it.

Now somebody will say the “reboot-install-reboot” from Gnome Software is safer because you don’t make changes on a live system and you apply the updates fully only after the reboot but I never had any issue using DNF the dumb way. The advatages are much bigger than the disavantages.

Anyway, forcefully interrupt the update is a very bad idea in any case, even on Windows. You may be ok with “ctrl-canc” but for sure not when you unpower the PC.

Flatpak does not have “limitations” besides the fact the software is confined in some sandbox and so in some conditions you must change the permissions to access the system. Im my opinion the main disadvantages are bloat, because each flatpak brings all the libraries and stuff it needs and security, because you don’t get flatpak from Fedora but from a third party “store”. Those are not “limitations”, are “features”, by design, accepting the bloat you can install packages on any distribution, any version and the “store” allows to distribute again on any distribution, any version.

Flatpak is of course needed with “immutable” distributions since you aren’t allowed to make changes to the system outside your /home. The whole “self contained package” is ideal for that.

1 Like