Posted on | April 6, 2010 | No Comments
A silly but interesting thought came over me today while I was working on a backup suite, wouldn’t it be easier if full system backups produced archives that could be re-installed via the system package manager? This would allow a bare metal restore on top of a base system, up to any version of the original in the past. For instance, you install apache and then configure it. A backup would not be all of the apache configurations, it would just be a series of diffs from the time that you originally installed apache.
I already accomplish this in /etc with version control and special file systems, but important text configurations sometimes live outside of /etc. For instance, if you install Mercurial, you will probably create a file named .hgrc in your home directory. That file should be restored during a full restoration after installing the base package. The same goes with bash_profile, etc.
The installwatch utility is very, very handy to catalog what gets placed where when installing software (i.e. during a make install). There is even a utility called checkinstall that helps make .deb / .rpm packages directly from source builds and installations. That really doesn’t help in this case, since it would just watch everything the package copied into place.
To pull this off, what you would need is a database that listed ‘commonly user configured’ files per package, even if the package did not provide them (i.e. .hgrc). To my knowledge no such database exists, but it could.
All of this is basically a result of picking through trixbox and freepbx (old and new) while deciding what really has to be saved in order to duplicate the system on a new installation. Tying in with something like inotify, this would provide a very nice granular rollback mechanism. Before I decide if I really want to write it, I have to consider merge conflicts during normal package upgrades, but that’s already a problem.