Tiny SNAPPER tutorial on ROME

If you want to have an hourly snapshot of your files, and maybe you are not a Timeshift fan, then you can install OpenMandriva with BTRFS filesystem and install Snapper via:

dnf install snapper

Then do there two commands to get Snapper ready for configuration:

sudo mkdir -p /etc/snapper/configs
sudo touch /etc/sysconfig/snapper

Then make a configuration for root and home filesystems:

snapper -c root create-config /
snapper -c home create-config /home

Then it will start doing your hourly snapshots which you can tune by editing the file:

/etc/snapper/configs/home

or

/etc/snapper/configs/root

You can do a manual snapshot at any time with:

snapper -c root create --description whateverdescription

(replace root with home if that’s what you want)

And now you can dig-out your hourly backed-up files from /home/.snapshots/ folder.

Video with explanation here:

8 Likes

Thank you so much! I watched it, and I tried it out. You did such an awesome job; it was so easy.

1 Like

Thanks :pray:

Thanks a lot for the detailed instructions and the video :pray:. Just tried it out on one of my test machine, and it works great. Also perfect timing, as I was planning on installing OM on several of my machines :grin:.

4 Likes

Excellent tutorial. I added this page to my Linkwarden for future reference. Thanks!

1 Like

@darth For your information: SNAPPER tiny tutorial (ROME) in the Resources category.
Please tell me if you wish to show a license (like this for example).
Nice tutorial :wink:

Thanks. You can add CC BY SA, cool. Thanks again.

2 Likes

Thank you Darth.

Concerning the snapshots of /, I integrated the snapshots into grub-btrfs to add bootable entries in grub. It’s much easier to set up, I think, than the timeshift method. However, the snapshots are not bootable. This may be an issue with how OMLx initializes during boot, b/c the snapshot of the root fs is read-only during the boot process. It hangs, in other words. I may have a solution by having btrfs continually mark all root snapshots as rw (I found a script to do just this). Of course, one would still have to tell snapper to rollback once bootup is completed. At any rate, if I can get the root snapshots to be bootable, I’ll write back! Or if anyone has a solution, please let me know!

1 Like

I wanted to do what you are proposing before I learned that BTRFS snapshots don’t backup ALL files, so I need to study this more before I can understand if it’s actually useful to boot into a snapshot and expect everything to work.

The other possible issue is corrupting files by snapshotting at the same time while files are being written.

These two challenges made me shorten my tutorial to what works for sure and that what I am unsure of I left for further study. If I learn anything useful I will join you in this effort.

1 Like

Great, thank you! For now, the Timeshift tutorial does the same thing, but it works on the bootup from snapshots taken.
We’ll get this snapper method working! It’s easier to get set up and if we got this working and grub-btrfs in the repo, it would be awesome, and easy for newcomers. Potentially a click and go situation, especially since the python-dnf-plugin-snapper is already in the repo. It is DNF4 only, though, but I’m sure that’s not a problem for migrating the plugin to DNF5.

Perhaps this guide will be helpful.

1 Like

openSUSE developed snapper and the method to boot the read-only snapshots and that would be the place to start. Sadly, their wiki does not compare with the Arch Wiki.

2 Likes

I think DNF5 needs more time testing in OM before pushing it as the only DNF to everyone. I reverted back to using 4 after 5 threw some errors trying to install something from OM repo that 4 installs just fine. May have been Emacs, I don’t remember anymore.

1 Like

I understand :slight_smile: I’m just testing DNF5 out and helping when I find problems to help with the eventual move to DNF5. I think the aesthetic of DNF4 looks nicer in the terminal readout, personally, but DNF5 is faster :military_helmet:

This is exciting. I found the implementation for dnf5 to run snapper. Apparently, the dnf team deprecated the way they implemented plugins, and they moved to an actions based system for pre and post dnf transactions. Anyway, one can make their own plugin. Thankfully, they gave the reimplementation of the dnf4 snapper plugin as an example (so nice! lol). Ultimately, it will go in /etc/dnf/libdnf5-plugins/actions.d/ where one can just create a file called snapper.actions with this content:

# Creates pre snapshot before the transaction and stores the snapshot number in the "tmp.snapper_pre_number" variable.
pre_transaction::::/usr/bin/sh -c echo\ "tmp.snapper_pre_number=$(snapper\ create\ -t\ pre\ -p)"

# If the variable "tmp.snapper_pre_number" exists, it creates post snapshot after the transaction and removes the variable "tmp.snapper_pre_number".
post_transaction::::/usr/bin/sh -c [\ -n\ "${tmp.snapper_pre_number}"\ ]\ &&\ snapper\ create\ -t\ post\ --pre-number\ "${tmp.snapper_pre_number}"\ ;\ echo\ tmp.snapper_pre_number

How cool is that? Anyway, the point is, whether one is using dnf4 or dnf5, we have what we need to run the snapper pre and post transaction snapshots. I’ll try the tutorial on setting up the /.snapper folder with the root directory in fstab later. I’m just uber glad with the new actions framework in dnf5. so cool

1 Like

Now I wished I would’ve done btrfs. lol.

Wheres that thumb drive…

1 Like

Well, don’t get in a big hurry yet. Once this is working though, it will be great.

Although, I do already have btrfs installed, so that doesn’t hurt. :smiley:

1 Like