BAR - BAckup aRchiver

BAR is backup archiver program. It can create compressed, encrypted
and splitted archives of files and disk images which can be stored
on a hard disk, cd, dvd, bd or directly on a server via ftp, scp or
sftp. BAR can create full and incremental/differential archives. A
server-mode and a scheduler is integrated for making
automated backups in the background.

--- Features

* create, list, test, compare and extract archives of files
  and disk images
* fast access to entries in archives: can find and extract single
  files without decompressing/decryption of the whole archive
* full and incremental/differential backup files archives
* support for raw and several file systems for disk images (ext,
  fat, reiserfs)
* can split archives into parts of selectable size; each part can
  be read independent
* compress of data with zlib, bzip2, lzma, lzo, lz4, or zstd
  algorithms
* encrypt archive content with gcrypt algorithms (BLOWFISH,
  TWOFISH, AES, a. o.),
* asymmetric encryption with RSA
* store archives directly on external server via ftp or scp,
  sftp, webdav,
* with external tools: store archives on CD/DVD/BD including
  error correction codes,
* support storage on a generic device,
* multicore support for compression and encryption,
* server mode with included scheduler for doing backups regularly.
  Controlling the server can be done via network connection
  (plain & TLS/SSL),
* optional internal database with information to all stored files
  and disk images,
* graphical front end for server to check server status, create
  jobs, start jobs and stop jobs.

--- Requirements
* Unix system
* glibc 2.3.2 or higher (mandatory)
* PTHREADs library (mandatory)
* zlib library (mandatory)
* icu library from http://site.icu-project.org (mandatory)
* bzib2 library from http://www.bzip.org (optional)
* lzma library from http://tukaani.org/xz (optional)
* lzo library from http://www.oberhumer.com/opensource/lzo (optional)
* lz4 library from https://code.google.com/p/lz4 (optional)
* zstd library from https://facebook.github.io/zstd/ (optional)
* xdelta library from http://xdelta.org (optional)
* ssh2 library from http://www.libssh2.org (optional)
* gcrypt library from http://www.gnupg.org (optional)
* gnutls library from http://www.gnu.org/software/gnutls
  (optional)
* curl from http://curl.haxx.se (optional)
* c-areas from http://c-ares.haxx.se (optional)
* mmxml from http://www.minixml.org (optional)
* libiconv library http://www.gnu.org/software/libiconv
* cdio library from www.gnu.org/software/libcdio/libcdio.html (optional)
* pcre library from http://www.pcre.org (optional)
* mtx library from http://sourceforge.net/projects/mtx (optional)
* bfd library from http://ftp.gnu.org/gnu/binutils (optional)
* long long datatype (because of large files)
* perl (only for compiling)
* external tools for DVD: mkisofs, dvdisaster, growisofs,
  eject (optional)
* Java 1.6 or newer for graphical frontend (see below)
* SWT 3.6 or newer (optional)
* ANT and launch4j (optional)
* EPM (optional)

--- Installation

There are pre-compiled binary packages available for several
system. You can download them from

  http://www.kigen.de/projects/bar/index.html

If there is no binary package available for your system, you
can compile bar by yourself. The following additional packages
are mandatory:

* http://www.zlib.net/zlib-1.2.8.tar.gz
* http://site.icu-project.org

The following additional packages are optional:

* http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz
* http://tukaani.org/xz/xz-5.2.0.tar.gz
* http://www.oberhumer.com/opensource/lzo
* https://code.google.com/p/lz4
* https://facebook.github.io/zstd/
* http://xdelta.org
* ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.10.tar.bz2
* ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.5.0.tar.bz2
* http://www.lysator.liu.se/~nisse/nettle
* http://www.gmplib.org
* ftp://ftp.gnu.org/pub/gnu/gnutls/gnutls-3.1.18.tar.bz2
* http://www.minixml.org
* http://c-ares.haxx.se
* http://site.icu-project.org/
* http://curl.haxx.se
* http://prdownloads.sourceforge.net/libssh2/libssh2-1.6.0.tar.gz?download
* http://www.gnu.org/software/libiconv
* www.gnu.org/software/libcdio/libcdio.html
* http://www.pcre.org
* http://sourceforge.net/projects/mtx
* http://ftp.gnu.org/gnu/binutils
* http://www.epmhome.org/index.php

1)

Download the additional packages with supplied script
'download-third-party-packages.sh' (wget, svn, patch,unzip, xz
utilities are required), extract them and set the required links for
bar:

  download-third-party-packages.sh

Note: bar configure will build the additional packages into a temporary
      directory and link the libraries statically.

2)

Install the following development packages (or newer versions):

  gcc
  gcc-c++
  openjdk-6-jdk
  make
  m4
  xgettext (getext-devel package)
  icu
  perl
  tclsh (tcl package)
  epm

3)

Then compile and install BAR with:

  ./configure
  make
  make install

Test BAR with:

  make test

Note: for the image tests some commands are executed with sudo.
Create a file /etc/sudores.d/bar with:

--- cut ---
# allow BAR tests
Cmnd_Alias BAR_CHATTR=\
  /usr/bin/chattr * data/*, \
  /usr/bin/chattr * configure-*
Cmnd_Alias BAR_LOSETUP=\
  /sbin/losetup -d /dev/loop[01], \
  /sbin/losetup /dev/loop[01] test/dev[01].dat, \
  /sbin/losetup /dev/loop[01] test/dev0[ab].dat
Cmnd_Alias BAR_CHMOD=\
  /bin/chmod o+rw /dev/loop[01]
Cmnd_Alias BAR_DD=\
  /bin/dd if=/dev/loop[01] of=-
Cmnd_Alias BAR_MKFS=\
  /sbin/mkfs -t * /dev/loop[01]
Cmnd_Alias BAR_MOUNT=\
  /bin/mount /dev/loop[01] test/dev[01]
Cmnd_Alias BAR_UMOUNT=\
  /bin/umount test/dev[01]
Cmnd_Alias BAR_CP=\
  /bin/cp -r -p test/data/* test/dev[01]
Cmnd_Alias BAR_DIFF=\
  /usr/bin/diff -r test/dev0 test/dev1

ALL ALL=NOPASSWD:\
  BAR_LOSETUP,\
  BAR_CHMOD,\
  BAR_DD,\
  BAR_MKFS,\
  BAR_MOUNT,\
  BAR_UMOUNT,\
  BAR_CP, \
  BAR_DIFF
--- cut ---

--- Compression

For compression zip, bzip2, lzma, lzo, lz4, or zstd can be used. The
compression algorithms offer different levels of compression ration and
time. The following values give a rough impression for compression of
some arbitary data:

Algorithm  Size  Ratio Time   Memory
---------------------------------------
none        738M -     31.59s    11M
lzo1        400M 45.75 36.71s    11M
lzo5        315M 57.30 38.59s    17M
lz4-1       357M 51.63 41.39s    14M
lz4-16      357M 51.63 34.40s    14M
zstd-1      309M 58.08 23.27s    18M
zstd-19     237M 67.85 58.28s   657M
zip9        281M 61.89 41.55s    13M
bzip1       273M 62.98 29.12s    20M
bzip9       265M 64.03 30.35s    80M
lzma1       233M 68.33 32.44s   114M
lzma9       213M 71.04 69.02s  1796M

The compression of lzma9 is usually better than for bzip9 or zip9,
lzo, lz4, or zstd but the compression time and the required memory
also increased significantly.

Compression with lzo, lz4, or zstd is much faster compared to the
other algorithms, but with a limited compression ratio.

--- Archive files and encryption

For encryption the algorithms of the gcrypt library are used.
The BAR archive files are not encrypted in a single block,
instead each stored file is encrypted. The archive file
structure is readable (an BAR archive is organized in
"chunks"; see archiv_format.def if you are interested in
details), thus everybody can detect e. g. how many files are
stored in the archive, but nobody except the owner of the
passphrase used for encryption can read the contents of the
files nor the file meta data, e. g. file names (as long as the
used encryption algorithm is not broken by someone).

For asymmetric encryption a pair of keys with hybrit
encryption is used: the file meta data and file data is
encrypted with a symmetric algorithmis, e. g. AES or Twofish.
The key for symmetric encryption is chosen from random data,
encrypted asymmetric with the public key and stored in the BAR
archive files, too. Those archives can only be read when the
private key is available to decrypt the symmetric key. With
asymmetric encryption BAR archives can be created without
knowledge of the password needed for decryption.

--- Storage on a DVD

For storing archive files on DVD an external program like
"growisofs" is needed which is actually writing data to a DVD.
BAR create the archive files in a temporary directory and then
call the external tool for burning the DVD. The tool
"growisofs" is recommented for storing archive files directly
on DVD. An ISO image can also be created first e. g. with
mkisofs. BAR support external pre- and post-processing
commands when creating an ISO-image and burning a DVD. With
these commands e. g. dvdisaster can be integrated into BAR to
create RS-protected backup DVDs.

The following external tools are needed with the default
settings of BAR to create an DVD:

- growisofs
- mkisofs
- dvdisaster
- eject
- nice

--- Graphical frontend

BARControl is a graphical user interface for BAR. It is
written in Java with SWT (Note: the former version used
TclTk). To run the graphical user interface a Java
runtime environment V1.6 (JRE6) or newer or Java
development kit V1.6 (JDK6) or newer is required.

To start the graphical user interface (for 32bit
systems) type in

On Linux:

  barcontrol.sh

resp.

  java -jar barcontrol-linux.jar

On Windows:

If jar is packed with launch4j into an .exe:

  barcontrol.exe

resp.

  java -jar barcontrol-windows.jar


BARControl ask for server name where BAR is running and the
login password and then connect to the running BAR server
either via TLS or a plain socket connection. BARControl can
edit jobs on a server, display the current status of jobs
and start or stop jobs.

To use BARControl the BAR server daemon have to be
startet first. Either enter

  bar --daemon

or use the start-script 'barserver' from /etc/init.d.

Please note that for a TLS connection the TSL keys and
cerificate files have to be available.

Note: If you want to use a ssh tunnel to connect to the bar
      server connect the ssh tunnel to port number 38523
      (plain connection) or 38524 (TLS connenction).

Install Java, SWT, launch4j:

* Download Java JRE V1.6 (JRE6) from http://www.sun.com
* Install Java

In case you do not want to use the included SWT 3.6
in barcontrol-linux.jar or barcontrol-windows.jar and
use instead barcontrol.jar (which does not include the
SWT files) SWT have to be installed:

* Download SWT from http://www.eclipse.org/swt
* Install SWT to some directory

To start BARControl with the installed SWT you have to
specify the path to the swt.jar file, e. g.

  java -classpath /usr/local/swt/swt.jar:barcontrol.jar BARControl

If a single executable file should be created the
BARControl jar file can be wrapped with launch4j:

* Download launch4j from http://launch4j.sourceforge.net
* Install

Note: call configure with

  --with-launchj4-dir=<path>

--- License

BAR and all files are under the GPL version 2. The full GPL
version 2 license text can be found here:

  http://www.gnu.org/licenses/gpl-2.0.html

BARControl is using SWT. SWT is under the "Eclipse Public License"
which can be found here:

  http://www.eclipse.org/org/documents/epl-v10.php

--- Contact

Send an email to

torsten.rupp@gmx.net
