Throughout my time helping users with openSUSE, one reoccurring issue that I have heard or read from some users has been the issue of system snapshots by Snapper filling up the root file system. Users have complained that their root file system fills up which ultimately locks up their system. This is often caused by setting up the root partition with an insufficient size, less than 40 GiB. Some users may not want to allocate that much space so a common course of action is to either use BTRFS without snapshots, use XFS or ext4.
There is this misguided impression that BTRFS is not a file system to be trusted but I can, with great assurance tell you that I have yet to have an issue with the file system. If you disagree with this than your perception is based on either a non-openSUSE implementation or if you had problems on openSUSE you did not satisfy its recommendation.
BTRFS with snapshots is a good option for newer machines but your disk partition size may be less than the recommended 40GiB for root, here is what you can do to adjust Snapper. As root open the following file in your editor of choice:
Scan down the configuration file and look for the line #limit for number cleanup section. To limit the total number of snapshots, adjust the NUMBER_LIMIT and NUMBER_LIMIT_IMPORTANT lines.
I changed mine to the following:
# limit for number cleanup
After this adjustment, I have no more than 6 total file system snapshots and it reduced the space taken up by snapshots by about 10 GiB. It should be understood that your mileage may vary depending on how much you fiddle with your system and how much software you have installed.
openSUSE is such a stable distribution, even the rolling release, Tumbleweed, that snapshots are almost not necessary. I personally look at snapshots as a kind of insurance policy but the fact is, as long as I have a working internet connection and a working terminal, entering sudo zypper dup (in Tumbleweed) will likely fix any issues I may have caused. As far as Leap is concerned, I haven’t seen an update that brok a system which would require a rollback. That doesn’t mean something couldn’t slip past openQA that may affect your system, I just haven’t seen it.
Also note, I have such confidence in openSUSE Tumbleweed with BTRFS, it is what is on my home server. In over a year, not one update has broken any of the servers or messed with any configurations. It should also be noted that I run older and generally Linux friendly hardware so my chance at issues is much less.
4 thoughts on “Tuning Snapper | BTRFS Snapshot Management on openSUSE”
“BTRFS with snapshots is a good option for newer machines”
BTRFS is a not-so-good option for older machenes, where the HDD nearly reaches it’s EOL (even when tests say the HDD is okay). I had a lot of serious problems (non-booting system) with BTRFS on my quite-old machine (that I never experienced before with openSUSE). I switched to Ext4 and the problems were gone.
I did a internet search and found out that BTRFS seems to work good on newer machines, but there might be problems on older hardware that reaches EOL.
I actually use the snapshots on some older machines but I would agree with you, on an HDD that can be problematic when it is doing maintenance and clearing things out. I have a 2010 netbook with an SSD, using BTRFS and snapshots. It runs openSUSE Tumbleweed and I am very pleased with the system performance. Multimedia performance… well…the wheels of technology have moved on.
I was 1.5 weeks into a Tumbleweed Openbox setup on a 48GB VM and I was installing a separate Python with asdf manager. I needed additional dependencies to accomplish this which I don’t understand because there is a system Python. Anyway, there was a conflict and I chose to replace everything with the new dependencies. It ended up breaking everything even zypper so I couldn’t use it to fix anything. I started to panic. I don’t remember setting up BTRFS and snapper initially but I was able to do a rollback. Problem was it was read-only and I couldn’t update or install anything. I did another rollback with the ambit option and that worked. I was able to install things but when I did a refresh it kept saying “Nothing to do” which seemed off because I know updates are almost daily. I did a forced refresh and that did the trick. So, it does work even on my tiny VM! Unrelated, I use zsh and ohmyzsh and it has a suse plugin with pre-configured aliases which are pretty awesome. I just type “zref && zdup” to upgrade and I don’t even have to type the whole thing because it has auto-completion. It’s a small thing but I thought that was cool. Do I have to setup BTRFS and Snapper? I did install Tumbleweed via Gecko Linux and don’t know if they pre-configured it like other things in the ISO.
On openSUSE proper, there is no additional configuration necessary. I am not totally sure about Gecko Linux. You can easily check to see if it is. I would run “sudo snapper list” to see if there are any snapshots.
When you go into a read-only snapshot, run in terminal: sudo snapper rollback
then reboot. That will allow you to do the updates and the like from the previous snapshot.