# use version control to track system changes?



## bstamper (Jan 13, 2011)

Hi all,

I'm still learning FreeBSD. I have a few sandboxes that I experiment with, and on occasion start over from scratch just for the experience. For unrelated reasons I've been learning to use version control lately (namely Git), and I got to thinking that it might be a nice way to keep a log of changes that I make to files in /etc as well as to track my installs and upgrades of ports and packages. I also imagine doing separate 'development branches' when I start major things like installing a GUI.

So my question to more experienced users is: Does this make sense? If you wanted to do this, what directories or files would you track? Would it be possible to track enough of the system that one could simply checkout different versions and that would be fully sufficient to undo/redo changes? Or to clone a configuration onto another machine? I know that packages would still need downloaded, etc., and varying hardware comes into play.

Thanks,

Brian


----------



## graudeejs (Jan 13, 2011)

I try to track /etc/ and /usr/local/etc/ with Mercurial.

I also use zfs and sysutils/zfsnap.
I create hourly zfs snapshots, so in case something goes very wrong, I can simply rollback.


----------



## SirDice (Jan 13, 2011)

Using some kind of version control system works really well. At my current job we manage a complete network management tool that way. It's been set up rather clever. Developers add new stuff, we verify it and tag it if it's good. The tagged stuff automatically gets released to production the following morning. When things go wrong we are there to fix it or roll back the last change. Obviously you need to make sure that never happens so we also have a tag for testing. You really, really don't want to have to answer to about 2000 pissed off network engineers :x


----------



## anomie (Jan 13, 2011)

bstamper said:
			
		

> So my question to more experienced users is: Does this make sense? If you wanted to do this, what directories or files would you track?



Sure it does. And I track virtually every critical config file / script that I rely on using rcs(1) (part of the FreeBSD base system). 



			
				bstamper said:
			
		

> Would it be possible to track enough of the system that one could simply checkout different versions and that would be fully sufficient to undo/redo changes? Or to clone a configuration onto another machine?



Yep, and the distributed version control options mentioned previously might do the trick. 

Or... you might actually be wandering into _configuration management_ territory, which is enabled by sysutils/cfengine, sysutils/puppet, and the like. (Recent discussion here, BTW.)


----------



## bstamper (Jan 14, 2011)

All very interesting responses, thank you! I hope even more come in.

I think as a relative noob my first task is to learn more about which directories and files are essential for this sort of thing. And I think the point about "configuration management" is a good one, I can probably learn a lot by studying that, as it does indeed seem to be a similar task.

Thank you,

Brian


----------



## Fred (Jan 16, 2011)

There is also etckeeper (there doesn't seem to be a port for it), that also tracks things like ownership and permissions of files that VCS usually don't.


----------



## shitson (Jan 16, 2011)

This is what i use, very simple. Not as good as Git or others. But does the trick. http://onlamp.com/pub/a/bsd/2000/10/19/Big_Scary_Daemons.html


----------

