BAR - BAckup aRchiver

BAR is backup archiver program. It can create compressed, encrypted
and split 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,
sftp, webDAV/webDAVs, or SMB/CIFS. 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, convert 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, exfat, xfs),
* 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,
* create PAR2 checksum files,
* store archives directly on external server via ftp or scp,
  sftp, webdav, webdavs,
* store archives on CD/DVD/BD and add error correction codes
  with the external tool dvdisaster,
* 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

mandatory:

* glibc 2.3.2 or higher (mandatory)
* PTHREADs library
* long long datatype (because of large files)
* perl (only for compiling)
* zlib library (http://www.zlib.net)
* icu library (http://site.icu-project.org)

optional:
* bzib2 library (http://www.bzip.org)
* lzma/xz library (http://tukaani.org/xz)
* lzo library (http://www.oberhumer.com/opensource/lzo)
* lz4 library (https://code.google.com/p/lz4)
* Zstandard library (https://facebook.github.io/zstd/)
* xdelta library (http://xdelta.org)
* ssh2 1.6.0 or newer library (http://www.libssh2.org)
* gcrypt library (http://www.gnupg.org)
* nettle (https://www.lysator.liu.se/~nisse/nettle/)
* gmp (https://gmplib.org/)
* gnutls library (http://www.gnu.org/software/gnutls)
* libcurl 7.77 or newer (http://curl.haxx.se)
* c-areas (http://c-ares.haxx.se)
* mmxml (http://www.minixml.org)
* libgpg-error (https://www.gnupg.org/software/libgpg-error/index.html)
* libidn2 2.3.4 or newer (https://ftp.gnu.org/gnu/libidn)
* libiconv library (http://www.gnu.org/software/libiconv)
* Kerberos 5 library (https://kerberos.org/dist/krb5)
* libsmb2 (https://github.com/sahlberg/libsmb2)
* cdio library 1.1 or newer (www.gnu.org/software/libcdio/libcdio.html)
* libisofs (https://dev.lovelyhq.com/libburnia/libisofs)
* libburn (https://dev.lovelyhq.com/libburnia/libburn)
* par2cmdline (https://github.com/Parchive/par2cmdline)
* pcre library (http://www.pcre.org)
* util-linux libraries (https://github.com/util-linux)
* sqlite 3.38 or newer (https://www.sqlite.org/index.html)
* MariaDB server 10.4.22 or newer
* PostgreSQL 9.6.4 or newer
* bison, flex, readline library (for PostgreSQL)
* mtx library (http://sourceforge.net/projects/mtx)
* PAR2
* xfsprogs
* bfd/binutils library (http://ftp.gnu.org/gnu/binutils)
* launch4j

* external tools for DVD: mkisofs, dvdisaster, growisofs,
  eject (optional)

for graphical frontend:
* OpenJDK JRE 1.8 or newer for graphical frontend (see below)
* SWT 3.6 or newer
* ANT and launch4j

for compiling:
* m4
* bison
* xgettext
* perl
* tclsh

for building:
* docker

Note: use the docker file to build a working build environment.

--- Installation

There are pre-compiled binary packages available for several
systems. 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.

1)

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)

2)

Download the additional packages with the supplied script
'download-third-party-packages.sh' (wget, git, svn, patch, unzip,
xz utilities are required):

  download-third-party-packages.sh

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

3)

Then compile and install BAR with:

  ./configure
  make
  make install

Test BAR with:

  make test

Notes:
* for the tests some commands are executed with sudo. Copy the
  bar/tests/bar-sudoers to /etc/sudores.d/bar.

* for the index database tests with MariaDB and PostgreSQL the
  following user credentials have to exists:

  MariaDB:

    User:     test
    Password: test
    Database: bar

  PostgreSQL:

    User:     test
    Password: test
    Database: bar

--- Compression

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

Algorithm  Size  Ratio Time     Memory
--------------------------------------
none       5770M -0.01 132.50s     15M
lzo1       4865M 15.68 154.78s     16M
lzo5       4645M 19.49 1188.28s    16M
lz4-1      4733M 17.97 315.05s     16M
lz4-16     4733M 17.97 309.41s     15M
zstd1      4623M 19.87 233.02s     17M
zstd19     4427M 23.27 5172.18s    71M
zip9       4550M 21.13 744.11s     17M
bzip1      4564M 20.89 1525.49s    16M
bzip9      4536M 21.38 1684.05s    21M
lzma1      4426M 23.28 2097.76s    22M
lzma9      4355M 24.52 3888.69s   654M

Note: measurements where done on a system with 12 cores/24G RAM
      and a RAID1.

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 hybrid
encryption is used: the file meta data and file data is
encrypted with a symmetric algorithm, 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 writing 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 writing to 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 a DVD:

- growisofs
- mkisofs
- dvdisaster
- eject
- nice

--- Graphical frontend

BARControl is a graphical user interface for BAR. It is
written in Java with SWT. To run the graphical user interface
a Java runtime environment V1.8 (JRE8) or newer or Java
development kit V1.8 (JDK8) or newer is required.

To start the graphical user interface type in

On Linux:

  barcontrol.sh

resp.

  java -jar barcontrol-linux.jar
  java -jar barcontrol-linux_64.jar

On Windows:

If the jar is packed with launch4j into an .exe:

  barcontrol.exe

resp.

  java -jar barcontrol-windows.jar
  java -jar barcontrol-windows_64.jar


BARControl ask for a 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 TLS 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:

* Install OpenJDK JRE V1.8 (JRE8) or download from
  https://openjdk.java.net/
* Install Java

In case you do not want to use the included SWT 3.6
in barcontrol-linux*.jar or barcontrol-windows*.jar
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>

--- Term of use and license

When you use BAR you do this with your own responsibility and
risks.  You use BAR as it "is".  You agree that the author of BAR
will not be responsible for any damage on physical or virtual
entities or persons which may be caused directly or indirectly by
BAR.  You agree not to claim for damages against the author of BAR
in case there is an unexpected behavior or there are unexpected
results of BAR (e.  g.  due to bugs in the software) or in case of
miss usage of the BAR.  You can send bug reports and feature
requests - which is encouraged -, but you agree that there is no
liability of the author that a bug is corrected and you agree there
is no claim that anything is changed in BAR by the author.

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 (author of BAR):

torsten.rupp@gmx.net
