4. Details about bakonf

bakonf home page is http://www.nongnu.org/bakonf/. The project is hosted at http://savannah.nongnu.org/projects/bakonf/.

You can regard bakonf as a rescue archive creator. It creates an archive of configuration files and metadata information about the system. By metadata, I mean data which is not found anywhere in the filesystem as simple files: partition table layout, hardware configuration, kernel version, etc.

Table 1. Archive layout

FilenameDescriptionCreated when
READMEA file which contains informations about the archive: when it was generated, with wich options and on what hostAlways
unarchived_files.lstA file which contains details about which files couldn't be backed up; this can happen when bakonf is not run as root, or when it scans NFS directoriesWhen filesystem backup has been performed
commands_with_errors.lstA file which contains details about which commands have exited with non-zero status. Their output is still stored in the archive, though.When metadata backup has been performed
filesystem/Under this path are stored the files backed up.When filesystem backup has been performed
metadata/Under this path are stored the files resulted from metadata backup.When metadata backup has been performed

4.1. Filesystem backup

Bakonf can be operated in two modes: level 0, level 1. In level 0, it archives all of the specified configuration files and registers the state of those configuration files in a database (called virtuals database), of type Berkley DB. In level 1, it archives only the files modified since the last level 0 backup; it does this by comparing the virtuals database with the filesystem.

4.1.1. File types and states

Here is how bakonf treats files

directories

they won't be archived if they don't contain files to be backed up. On the other hand, for each file to be backed up, bakonf will also backup (non-recursively) its parent directories (except root) so that you have the user, group, mtime and permissions of each directory. For example, if /usr/local/etc/myconfig has been selected for archiving, bakonf will actually archive this list of items: /usr, /usr/local, /usr/local/etc, /usr/local/etc/myconfig.

regular files

regular files will be archived by bakonf if they aren't excluded by the noscan configuration directive. In case this is a partial backup (as opossed to a full backup), bakonf will make the following tests:

  1. size of file saved in database ≠ actual file size? if true, the file will be backed up;

  2. md5 hash saved ≠ actual md5 hash? if true, file will be backed up;

  3. sha hash save ≠ actual sha hash? if true file will be backed up;

  4. file will not be backed up.

Here we could introduce another form of backup, only file metadata backup, in case file contents hasn't changed, but file mode (permissions, owner) have.

symbolic links

bakonf doesn't follow symbolic links ever; it treats a symbolic link like a configuration file (its configration value resided in its name and its target). The tests made by bakonf are, in order:

  1. link target must be equal, or the file is backed up

  2. user and group ownership must be equal, or the file is backed up

  3. permission bits must be equal, or the file is backed up

  4. the file is not backed up

block devices, character devices, fifos, sockets

bakonf always selects these to backed up. Of course, some of them won't be backed up by tar, but regarding bakonf, it will select those for backup.

when the file type in archive is different than actual file type

in this case, bakonf always selects the file for archiving

4.2. Metadata

Metadata allows you to have more information about a system than is available in the filesystem. The current implementation allows you to store output of shell commands. Suggestions about other items are welcome.

4.2.1. Partition table

The most important metadata item is partition table about your disks, in the eventuality that you have a data error in partition table. The command to back this up varies, for example:

OS: GNU/Linux

Command: sfdisk -d /dev/hda

OS: FreeBSD

Command: fdisk /dev/ad0

4.2.2. Device list

Having the device list is and their hardware configuration is useful in order to have a quick overview if you want to clone the configuration from one system to another (to see corespondece between config files and hardware config). Examples of scanning the configuration:

OS: GNU/Linux

Command(s): lspci -vv; lsusb -vv

OS: FreeBSD

Command(s): pciconf -lv; usbdevs -v

4.3. What can I use bakonf for?

At least for:

4.4. Requirements

To use bakonf, you must have the following: