Installing from scratch (but keeping config)

Hi everyone,

Sometimes we need to install from scratch.
But we want to keep the config.

I think we are prepared for that,
there must be a tool for it.

There must be a tool to diff a generic installation
vs/ the local modifications (in configs, /etc)

I once heard about union mounts.
Let's mount the local config atop the generic image
This can be done with zfs (with snaps of the configs)

It should be easy to boot that.
That is actually what boot environments are made for?

But I'm asking for something different.
I want to take a snap of my custom configs
to mount that atop a fresh install.

I think, this can be done with zfs,
to have generic, readonly image of freebsd.

we would then mount /var

~eike
 
Even good idea you have, i dont trust it. I never seen a good working procedure.. But if one can give i'm very open ...

First joking answer, use NixOS.
Now serious answer.
First backup /etc & /usr/local/etc you will need them
Then run "pkg prime-origins" it gives the list of your installed packages , you will need it.
If you dont have a database , you can just delete everything.
Install everything new..
Copy the backup of /usr/local/etc
Copy the relevant files from /etc

So now you have a clean new system with all configs restored.

About boot environments. They are very nice. BUT : I never in my 15 FreeBSD life needed them.. So i don't use them..

Readonly image.. Why ?. You start firefox and it needs a cache ....

Make a zfs snapshot , that is readonly.
 
It depends on what you mean exactly with "config".

The most easiest way to setup, maintain and restore it was to do keep copies of the according directories and files, which also are updated regulary, e.g. with cron running a small script that executes rsync.
Then, at a new installation, you simply copy those files from your backup repository to your freshly installed machine, maybe also with a small script using rsync.

Another way was using tar with
Code:
-P, --absolute-paths
           Preserve pathnames. By default, absolute pathnames (those that begin with a character) have the
           leading slash removed both when creating archives and extracting from them. Also, tar will refuse
           to extract archive entries whose pathnames contain or whose target directory would be altered by
           a symlink. This option suppresses these behaviors.
This way all config-files could be stored into a single tar archive, and being extracted from it directly to their original locations. But WARNING! test this carefully, and ensure that's working correctly.

Another way was to use a version control system on the according directories/files.
 
You simply have to collect a definive source base and describe all changes you want to keep in the universal end result. My experience is that the default settings of a lot aren't consistent enough to skip explicit configuration. Generating an installable medium of an existing outconfigured system is too complicated to have it working on several different target computers.
Who remembers mergemaster? Does it still exist? I never used it seriously because it was always incomplete and still required an almost the same amount of manual configuration after a run. It's too hard to cover everything consistently to actually save time on creating your own installation with everything you need.
 
mergemaster is obsolete.
you should use "etcupdate -p" ; installworld ; "etc-update -B"
1 problem that starts there is the unclear difference between /etc and /usr/local/etc. Not all ports handle it the same, so you have to look at it per port. /etc/X11/xorg.conf? I don't remember X.org being a base component...
 
No it's not MG. All ports write to /usr/local/etc and never to /etc
Which means if you backup /usr/local/etc you have all configs for all ports
[ postgresql is the only exception]
/etc is only used by "base install"
 
Neither mergemaster(8), or etcupdate(8) will do anything in /usr/local/etc/ or /etc/rc.conf.

Not all ports handle it the same, so you have to look at it per port. /etc/X11/xorg.conf? I don't remember X.org being a base component...
Installing Xorg (x11/xorg) doesn't create an xorg.conf file, not in /etc/X11 nor in /usr/local/etc/X11/. That configuration file always had to be created, even during the XFree86 days.
 
Back
Top