bKappa is a 2009 experiment in crude but transparent and cross-platform incremental backup. bKappa backups are simple directory trees and lists of files. They are easy to browse and examine and do not use symbolic or hard links. It is crude in the sense that bKappa only tracks files by name, not by content. This means it cannot detect when a file has been renamed and makes full copies of renamed and partially changed files.
bKappa is written in Python. It generates standalone restore scripts for the POSIX shell and PowerShell 1.0 and later that do not require Python. The PowerShell scripts are cross-platform.
While bKappa 1.x saw some real use on the developer’s machines, it is not heavily-tested the way backup software should be. The 2024 update bKappa 2 was made to satisfy curiosity rather than for production. Do not trust bKappa to preserve important data.
You can download bKappa from SourceForge.
bKappa requires Python 3.7 or later. Using evaluated settings requires Starlark-PyO3 to be installed. You can install Starlark-PyO3 in a venv.
bkappa.sourceforge.io/old houses outdated documentation written for version 1.x.
bKappa creates snapshots in repositories. bKappa repositories are directories with a structure that bKappa recognizes. You can back up multiple source directories to a repository. Source directories are the top-level directories of your backups. A snapshot is a backup copy of any number of source directories that for every directory may reference previous snapshots of the same directory.
To avoid conflicts, back up only one source directory with a particular name per repository.
Only a single bKappa process should be using a repository at any time. In the current version it is up to the user to ensure this (for example, through locking in a cron job).
bKappa is configured with a text configuration file that can be one
of two types. The first type contains lines with a source directory path
followed by optional exclusion patterns. Each part of the line is
separated with the pipe character |
. This is called
“non-evaluated settings”. The exclusion patterns are Python fnmatch
patterns applied to whole paths.
/home/foo/Documents
/home/foo|*/Downloads/*|*/Documents/*
The second type contains lines with Python-like Starlark expressions that can reference built-in and environment variables. They are called “evaluated settings”. The following is an example of evaluated settings. It similar to the non-evaluated example but uses a variable for the home directory.
+ "/Documents", [])
(home "*/Downloads/*", "*/Documents/*"]) (home, [
bKappa defines these additional global variables for evaluated expressions:
home
—the user’s home directory.environ
—a dictionary containing the environment
variables.platform
—a dictionary with system information. Its keys
are:
bits
: platform.architecture()[0]
machine
: platform.machine()
node
: platform.node()
os_name
: os.name
platform
: platform.platform()
processor
: platform.processor()
release
: platform.release()
system
: platform.system()
version
: platform.version()
Here is how you can create and restore a snapshot on a POSIX system.
mkdir -p /tmp/bkappa/repo/
mkdir /tmp/bkappa/source/
echo '/tmp/bkappa/source' > /tmp/bkappa/repo/settings.ne
echo 'Hello, world!' > /tmp/bkappa/source/test-file
./backup.py /tmp/bkappa/repo/
./backup.py /tmp/bkappa/repo/ -r /tmp/bkappa/repo/*/restore.json -o /tmp/bkappa/restore/
cat /tmp/bkappa/restore/tmp/bkappa/source/test-file
restore.dat
)
with JSON (restore.json
).restore-dat2json.py
).eval
with Starlark (Starlark-PyO3) for safe
evaluated settings.findlatest
that resulted in
some unmodified files getting copied over.run.bat
that would retain old
parameters on a new run.joinpath
that could result in an
corrupted path on concatenation (though not if used the way bKappa
currently uses it).findlatest
function has been optimized.-m
/--merge
to merge them
instead.bKappa is free software distributed under the MIT License. See the
file LICENSE
for details.