Jump to content

Improving on a good thing.

Recommended Posts



I hope this is the right place to post this. 


A bit of background that can be skipped if you are in a hurry:

I am by no means a programmer and try hard just to stay out of the way and keep my head down when using open source software.  I've been using Funtoo for a long time now on my home servers.  These systems started as lab style "blow them away at the drop of a hat when things go bad while flying by the seat of my pants learning a thing or two along the way" machines but over the years they have evolved into a much more stable pattern.  I have a desktop for gaming but I don't run Funtoo on it, choosing Mint instead because "It just works" most of the time.  One of the things that bothers me about Mint is the lack of real data protection in the default install so I set up a raid like I do with my server but instead of mdadm I used brtfs,  This means that the default filesystem snapshot tool in Mint (TimeShift) can't work on my system.  So I dug around and found a very cool utility called "snapper" that auto snapshots my btrfs filesystem.  It does this transparently in the back ground and can be configured to keep so many hourly, daily, weekly (and so on) snapshots.  The cool thing is that it makes a pre and post snapshot every time I unistall or uninstall software with apt.  I looked for snapper in portage and it's there.  This has me thinking about starting a fresh install of Funtoo on my server and using btrfs raid10 and having snapper as a second layer of system protection.

So to the point:

Can snapper automatically snapshot a btrfs filesystem before and after an emerge command is executed?  If not would making it do so be trivial or non-trivial?  If it does so or can easily be made to do so why not add a snapper use flag to btrfs-progs so it would be pulled in if desired by the system admin?

This is the kind of idea I normally keep to myself because I can't write it and I tell myself "If it was that good of an idea it would be done already."  In this case it's something I really would like to have and it would benefit so many people using both Funtoo and Gentoo that I felt I should at least ask.


Link to post
Share on other sites
2 hours ago, lazlo.vii said:

Can snapper automatically snapshot a btrfs filesystem before and after an emerge command is executed?

I've looked at this myself, as I run Funtoo on all of my systems with btrfs as the root filesystem.

I found this page on the Gentoo Wiki, which outlines a way to take pre- and post-snapshots when using Portage. Haven't tried it yet.

Link to post
Share on other sites
8 minutes ago, shadow53 said:

I found this page on the Gentoo Wiki, which outlines a way to take pre- and post-snapshots when using Portage. Haven't tried it yet.

Thank you very much for the link.  Tomorrow I'll spin up a new Funtoo VM and test this out.  If it works as expected is the proper procedure to file a bug against btrfs-progs for a use flag to pull in snapper on request and another bug against snapper to add a use flag for portage auto snapshots via /etc/portage/bashrc? 

Link to post
Share on other sites

OK, I have do my tests and this is what I have found:

1.)  While the script in the Gentoo wiki will generate pre-install snapshots it will not generate post-install snapshots.

2.)  As I feared, the script in the Gentoo wiki is triggered per ebuild install phase.  This means that you get one snapshot per package Portage installs.  This is a bad thing because snapper limits the amount of snapshots it stores and in a large emerge run you might end up overwriting some of the snapshots you made just a while ago.

For this to be really effective Portage would have tell snapper to make a pre snapshot during the pre-compile phase after it does all of it's sanity checks.  Then after the last package is installed and about the same time Portage gives the output messages from all of the packages it would need to call on snapper again to make it's post snapshot.

Snapper does do timeline snapshots correctly with cronie installed though, so that is about 75% of what I want right there.  So from here I'll start backing up my server and get it reinstalled with a btrfs raid10.  I am unsure of how to go about officially requesting the changes I desire or if these changes are really feasible.  If anyone working with Portage cares to comment I would be grateful to hear your thoughts on the subject.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...