NAME
  bar - backup archiver program

SYNOPSIS
  bar [<options>] [--] <archive name> [<file>|<device>...]
  bar [<options>] [--] <key file name>

  Archive name:  [file://] <file name>
                 ftp:// [<login name>[:<password>]@]<host name>/<file name>
                 scp:// [<login name>[:<password>]@]<host name>[:<port>]/<file name>
                 sftp:// [<login name>[:<password>]@]<host name>[:<port>]/<file name>
                 webdav:// [<login name>[:<password>]@]<host name>/<file name>
                 webdavs:// [<login name>[:<password>]@]<host name>/<file name>
                 smb:// [<login name>[:<password>]@]<host name>[:share>]/<file name>
                 cd:// [<device name>:]<file name>
                 dvd:// [<device name>:]<file name>
                 bd:// [<device name>:]<file name>
                 device:// [<device name>:]<file name>

DESCRIPTION
BAR is a backup archiver program for files and disk images to create compressed,
encrypted and split archive files which can be stored on a local hard disk,
via network on a server or (with additional external tools) an optical medium
like a CD, DVD, or BD. It can create full and incremental/differential archives.

Archive files can be created, the content can be listed, tested, compared and
extracted. Individual archive files can be read independent. Listing the contents of
an archive is fast, even when the content is compressed and encrypted. The content
can be compressed with either zip(1), bzip2(1), lzma(1), lzo(1), lz4(1), and
additionally xdelta(1). For encryption several encryption algorithms from the
libcrypt project like AES or TWOFISH can be used. Public key encryption (RSA) is
also supported.

CDs, DVDs, BDs with archive files can be created when the external tools
growisofs(1) and mkisofs(1) are installed. If the tool dvdisaster(1) is
available CDs and DVDs with additional error correction codes can be created.

BAR can be executed as a daemon and can created backups in the background via
the integrated scheduler. The BAR daemon can be controlled via a network
connection (either plain or SSL encrypted) with the graphical front end
barcontrol(3).

OPTIONS

         -c|--create                                                create new files archives
         -m|--image                                                 create new images archives
         -l|--list                                                  list contents of archives
         -t|--test                                                  test contents of archives
         -d|--compare                                               compare contents of archive swith files and images
         -x|--extract                                               restore archives
         --convert                                                  convert archives
         --generate-keys                                            generate new public/private key pair for encryption
         --generate-signature-keys                                  generate new public/private key pair for signature
         --generate-keys-bits=<n>[K]                                key bits (default: 1024)
         --generate-keys-mode=<mode>                                select generate key mode mode
                                                                      secure   : secure keys (default)
                                                                      transient: transient keys (less secure)
         --job=<name or UUID>                                       execute job
         --normal                                                   create normal archive (no incremental list file, default)
         -f|--full                                                  create full archive and incremental list file
         -i|--incremental                                           create incremental archive
         -I|--incremental-list-file=<file name>                     incremental list file name (default: <archive name>.bid)
         --differential                                             create differential archive
         --pattern-type=<type>                                      select pattern type
                                                                      glob    : glob patterns: * and ? (default)
                                                                      regex   : regular expression pattern matching
                                                                      extended: extended regular expression pattern matching
         -T|--storage-list-stdin                                    read storage name list from stdin
         --storage-list=<file name>                                 storage name list file name
         --storage-command=<command>                                storage name command
         -#|--include=<pattern>                                     include pattern
         --include-file-list=<file name>                            include file pattern list file name
         --include-file-command=<command>                           include file pattern command
         --include-image-list=<file name>                           include image pattern list file name
         --include-image-command=<command>                          include image pattern command
         -!|--exclude=<pattern>                                     exclude pattern
         --exclude-list=<file name>                                 exclude pattern list file name
         --exclude-command=<command>                                exclude pattern command
         --mount=<name[,[device][,yes]>                             mount device
         --mount-command=<command>                                  mount command (default: mount %directory)
         --mount-device-command=<command>                           mount device command (default: mount %device %directory)
         --unmount-command=<command>                                unmount command (default: umount %directory)
         --delta-source=<pattern>                                   source pattern
         --tmp-directory=<path>                                     temporary directory (default: /tmp)
         --max-tmp-size=<n>[T|G|M|K]                                max. size of temporary files
         -s|--archive-part-size=<n>[T|G|M|K]                        approximated archive part size
         --fragment-size=<n>[T|G|M|K]                               fragment size (default: 64M)
         --transform=<pattern,string>                               transform file names
         -p|--directory-strip=<n>                                   number of directories to strip on extract
         --destination=<path>                                       destination to restore entries
         --owner=<user:group>                                       user and group of restored files
         --permissions=<<owner>:<group>:<world>|<number>>           permissions of restored files
         --comment=<text>                                           comment
         -C|--directory=<path>                                      change to directory
         -z|--compress-algorithm=<algorithm|xdelta+algorithm>       select compress algorithms to use
                                                                      none         : no compression (default)
                                                                      zip0..zip9   : ZIP compression level 0..9
                                                                      bzip1..bzip9 : BZIP2 compression level 1..9
                                                                      lzma1..lzma9 : LZMA compression level 1..9
                                                                      lzo1..lzo5   : LZO compression level 1..5
                                                                      lz4-0..lz4-16: LZ4 compression level 0..16
                                                                      zstd0..zstd19: ZStd compression level 0..19
         --compress-min-size=<n>[T|G|M|K]                           minimal size of file for compression
         --compress-exclude=<pattern>                               exclude compression pattern
         -y|--crypt-algorithm=<algorithm>                           select crypt algorithms to use
                                                                      none (default)
                                                                      3DES
                                                                      CAST5
                                                                      BLOWFISH
                                                                      AES128
                                                                      AES192
                                                                      AES256
                                                                      TWOFISH128
                                                                      TWOFISH256
                                                                      SERPENT128
                                                                      SERPENT192
                                                                      SERPENT256
                                                                      CAMELLIA128
                                                                      CAMELLIA192
                                                                      CAMELLIA256
         --crypt-type=<type>                                        select crypt type
                                                                      symmetric : symmetric (default)
                                                                      asymmetric: asymmetric
         --crypt-password=<password>                                crypt password (use with care!)
         --crypt-new-password=<password>                            new crypt password (use with care!)
         --crypt-public-key=<file name|data>                        public key for asymmetric encryption
         --crypt-private-key=<file name|data>                       private key for asymmetric decryption
         --signature-public-key=<file name|data>                    public key for signature check
         --signature-private-key=<file name|data>                   private key for signature generation
         --par2-directory=<path>                                    PAR2 checksum directory
         --par2-block-size=<n>[T|G|M|K]                             PAR2 block size (default: 2264)
         --par2-files=<n>                                           number of PAR2 checksum files to create (default: 1)
         --par2-blocks=<n>                                          number of PAR2 error correction blocks (default: 128)
         --ftp-login-name=<name>                                    ftp login name
         --ftp-password=<password>                                  ftp password (use with care!)
         --ftp-max-connections=<n>                                  max. number of concurrent ftp connections
         --ssh-login-name=<name>                                    ssh login name
         --ssh-password=<password>                                  ssh password (use with care!)
         --ssh-port=<n>                                             ssh port (default: 22)
         --ssh-public-key=<file name|data>                          ssh public key
         --ssh-private-key=<file name|data>                         ssh private key
         --ssh-max-connections=<n>                                  max. number of concurrent ssh connections
         --webdav-port=<n>                                          WebDAV port (default: 80)
         --webdav-login-name=<name>                                 WebDAV login name
         --webdav-password=<password>                               WebDAV password (use with care!)
         --webdav-max-connections=<n>                               max. number of concurrent WebDAV connections
         --smb-login-name=<name>                                    SMB/CIFS login name
         --smb-password=<password>                                  SMB/CIFS password (use with care!)
         --smb-share=<name>                                         SMB/CIFS share name
         --smb-max-connections=<n>                                  max. number of concurrent ftp connections
         --server                                                   run in server mode
         --daemon                                                   run in server daemon mode
         -D|--no-detach                                             do not detach in daemon mode
         --server-mode=<mode>                                       select server mode
                                                                      master: master (default)
                                                                      slave : slave
         --server-port=<n>                                          server port (default: 38523)
         --server-tls-port=<n>                                      TLS (SSL) server port
         --server-ca-file=<file name>                               TLS (SSL) server certificate authority file (CA file)
         --server-cert-file=<file name>                             TLS (SSL) server certificate file
         --server-key-file=<file name>                              TLS (SSL) server key file
         --server-password=<password>                               server password (use with care!)
         --server-max-connections=<n>                               max. concurrent connections to server (default: 8)
         --nice-level=<n>                                           general nice level of processes/threads
         --max-threads=<n>                                          max. number of concurrent compress/encryption threads
         --max-band-width=<number or file name>                     max. network band width to use [bits/s]
         --remote-bar-executable=<file name>                        remote BAR executable
         --pre-command=<command>                                    pre-process command
         --post-command=<command>                                   post-process command
         --file-write-pre-command=<command>                         write file pre-process command
         --file-write-post-command=<command>                        write file post-process command
         --ftp-write-pre-command=<command>                          write FTP pre-process command
         --ftp-write-post-command=<command>                         write FTP post-process command
         --scp-write-pre-command=<command>                          write SCP pre-process command
         --scp-write-post-command=<command>                         write SCP post-process command
         --sftp-write-pre-command=<command>                         write SFTP pre-process command
         --sftp-write-post-command=<command>                        write SFTP post-process command
         --webdav-write-pre-command=<command>                       write WebDAV pre-process command
         --webdav-write-post-command=<command>                      write WebDAV post-process command
         --smb-write-pre-command=<command>                          write SMB/CIFS pre-process command
         --smb-write-post-command=<command>                         write SMB/CIFS post-process command
         --cd-device=<device name>                                  CD device (default: /dev/cdrw)
         --cd-request-volume-command=<command>                      request new CD volume command
         --cd-unload-volume-command=<command>                       unload CD volume command (default: )
         --cd-load-volume-command=<command>                         load CD volume command (default: )
         --cd-volume-size=<n>[T|G|M|K]                              CD volume size
         --cd-image-pre-command=<command>                           make CD image pre-process command
         --cd-image-post-command=<command>                          make CD image post-process command
         --cd-image-command=<command>                               make CD image command (default: )
         --cd-ecc-pre-command=<command>                             make CD error-correction codes pre-process command
         --cd-ecc-post-command=<command>                            make CD error-correction codes post-process command
         --cd-ecc-command=<command>                                 make CD error-correction codes command (default: )
         --cd-blank-command=<command>                               blank CD medium command (default: )
         --cd-write-pre-command=<command>                           write CD pre-process command
         --cd-write-post-command=<command>                          write CD post-process command
         --cd-write-command=<command>                               write CD command (default: )
         --cd-write-image-command=<command>                         write CD image command (default: )
         --dvd-device=<device name>                                 DVD device (default: /dev/dvd)
         --dvd-request-volume-command=<command>                     request new DVD volume command
         --dvd-unload-volume-command=<command>                      unload DVD volume command (default: )
         --dvd-load-volume-command=<command>                        load DVD volume command (default: )
         --dvd-volume-size=<n>[T|G|M|K]                             DVD volume size
         --dvd-image-pre-command=<command>                          make DVD image pre-process command
         --dvd-image-post-command=<command>                         make DVD image post-process command
         --dvd-image-command=<command>                              make DVD image command (default: )
         --dvd-ecc-pre-command=<command>                            make DVD error-correction codes pre-process command
         --dvd-ecc-post-command=<command>                           make DVD error-correction codes post-process command
         --dvd-ecc-command=<command>                                make DVD error-correction codes command (default: )
         --dvd-blank-command=<command>                              blank DVD medium command (default: )
         --dvd-write-pre-command=<command>                          write DVD pre-process command
         --dvd-write-post-command=<command>                         write DVD post-process command
         --dvd-write-command=<command>                              write DVD command (default: )
         --dvd-write-image-command=<command>                        write DVD image command (default: )
         --bd-device=<device name>                                  BD device (default: /dev/bd)
         --bd-request-volume-command=<command>                      request new BD volume command
         --bd-unload-volume-command=<command>                       unload BD volume command (default: )
         --bd-load-volume-command=<command>                         load BD volume command (default: )
         --bd-volume-size=<n>[T|G|M|K]                              BD volume size
         --bd-image-pre-command=<command>                           make BD image pre-process command
         --bd-image-post-command=<command>                          make BD image post-process command
         --bd-image-command=<command>                               make BD image command (default: )
         --bd-ecc-pre-command=<command>                             make BD error-correction codes pre-process command
         --bd-ecc-post-command=<command>                            make BD error-correction codes post-process command
         --bd-ecc-command=<command>                                 make BD error-correction codes command (default: )
         --bd-blank-command=<command>                               blank BD medium command (default: )
         --bd-write-pre-command=<command>                           write BD pre-process command
         --bd-write-post-command=<command>                          write BD post-process command
         --bd-write-command=<command>                               write BD command (default: )
         --bd-write-image-command=<command>                         write BD image command (default: )
         --device=<device name>                                     device
         --device-request-volume-command=<command>                  request new volume command
         --device-load-volume-command=<command>                     load volume command
         --device-unload-volume-command=<command>                   unload volume command
         --device-volume-size=<n>[T|G|M|K]                          volume size
         --device-image-pre-command=<command>                       make image pre-process command
         --device-image-post-command=<command>                      make image post-process command
         --device-image-command=<command>                           make image command
         --device-ecc-pre-command=<command>                         make error-correction codes pre-process command
         --device-ecc-post-command=<command>                        make error-correction codes post-process command
         --device-ecc-command=<command>                             make error-correction codes command
         --device-blank-command=<command>                           blank device medium command
         --device-write-pre-command=<command>                       write device pre-process command
         --device-write-post-command=<command>                      write device post-process command
         --device-write-command=<command>                           write device command
         --max-storage-size=<n>[T|G|M|K]                            max. storage size
         --test-created-archives                                    test created archives
         --volume-size=<n>[T|G|M|K]                                 volume size
         --ecc                                                      add error-correction codes with 'dvdisaster' tool
         --always-create-image                                      always create image for CD/DVD/BD/device
         --blank                                                    blank medium before writing
         --jobs-directory=<path name>                               server job directory (default: /etc/bar/jobs)
         --incremental-data-directory=<path name>                   server incremental data directory (default: /var/lib/bar)
         --index-database=<URI>                                     index database URI (default: sqlite3:/var/lib/index.db)
                                                                      sqlite3:<file name>
                                                                      mariadb:<host name>:<user name>:<password>
                                                                      postgresql:<host name>:<user name>:<password>
         --index-database-update                                    enabled update index database
         --index-database-auto-update                               enabled automatic update index database
         --index-database-max-band-width=<number or file name>      max. band width to use for index updates [bis/s]
         --index-database-keep-time=<n>[weeks|week|days|day|h|m|s]  time to keep index data of not existing storages
         --continuous-max-size=<n>[T|G|M|K]                         max. continuous size
         --continuous-min-time-delta=<n>[weeks|week|days|day|h|m|s] min. time between continuous backup of an entry
         --log=<type[,<type>...]>                                   log types
                                                                      none      : no logging (default)
                                                                      errors    : log errors
                                                                      warnings  : log warnings
                                                                      info      : log info
                                                                      ok        : log stored/restored files
                                                                      unknown   : log unknown files
                                                                      skipped   : log skipped files
                                                                      missing   : log missing files
                                                                      incomplete: log incomplete files
                                                                      excluded  : log excluded files
                                                                      storage   : log storage
                                                                      index     : index database
                                                                      continuous: continuous backup
                                                                      all       : log everything
         --log-file=<file name>                                     log file name
         --log-format=<format>                                      log format (default: %Y-%m-%d %H:%M:%S)
         --log-post-command=<command>                               log file post-process command
         --pid-file=<file name>                                     process id file name (default: /run/bar.pid)
         --continuous-min-time-delta=<n>[weeks|week|days|day|h|m|s] min. time between continuous backup of an entry
         --pairing-master-file=<file name>                          pairing master enable file name (default: /var/lib/bar/pairing)
         --info                                                     show meta info
         -g|--group                                                 group files in list
         --all                                                      show all files
         -L|--long-format                                           list in long format
         -H|--human-format                                          list in human readable format
         --numeric-uid-gid                                          print numeric user/group ids
         --numeric-permissions                                      print numeric file/directory permissions
         --no-header-footer                                         no header/footer output in list
         --delete-old-archive-files                                 delete old archive files after creating new files
         --ignore-no-backup-file                                    ignore .nobackup/.NOBACKUP file
         --ignore-no-dump                                           ignore 'no dump' attribute of files
         --command-timeout=<n>[weeks|week|days|day|h|m|s]           execute external command timeout
         --skip-unreadable                                          skip unreadable files
         --force-delta-compression                                  force delta compression of files. Stop on error
         --raw-images                                               store raw images (store all image blocks)
         --no-fragments-check                                       do not check completeness of file fragments
         --no-index-database                                        do not store index database for archives
         --archive-file-mode=<mode>                                 select archive files write mode
                                                                      stop     : stop if archive file exists (default)
                                                                      rename   : rename if archive file exists
                                                                      append   : append to existing archive files
                                                                      overwrite: overwrite existing archive files
         -o|--overwrite-archive-files                               overwrite existing archive files
         --restore-entry-mode=<mode>                                restore entry mode
                                                                      stop         : stop if entry exists (default)
                                                                      rename       : rename entries
                                                                      overwrite    : overwrite entries
                                                                      skip-existing: skip existing entries
         --overwrite-files                                          overwrite existing entries on restore
         --sparse-files                                             create sparse files
         --wait-first-volume                                        wait for first volume
         --no-signature                                             do not create signatures
         --skip-verify-signatures                                   do not verify signatures of archives
         --force-verify-signatures                                  force verify signatures of archives. Stop on error
         --no-bar-on-medium                                         do not store a copy of BAR on medium
         --no-stop-on-error                                         do not immediately stop on error
         --no-stop-on-owner-error                                   do not immediately stop on owner error
         --no-stop-on-attribute-error                               do not immediately stop on attribute error
         --no-storage                                               do not store archives (skip storage, index database
         --dry-run                                                  do dry-run (skip storage/restore, incremental data, index database)
         --new-entity-uuid                                          new entity uuid
         --system-encoding=<encoding>                               system encoding
         --console-encoding=<encoding>                              console encoding
         --force-console-encoding                                   force output via console encoding
         --quiet                                                    suppress any output
         -v|--verbose                                               increment/set verbosity level
         --no-default-config                                        do not read default configuration files
         --config=<file name>                                       configuration file
         --save-configuration=<file name>                           save formated configuration file
         --clean-configuration-comments                             clean comments when saving configuration file
         --version                                                  output version
         -h|--help                                                  output this help
         --xhelp                                                    output help to extended options
         --help-internal                                            output help to internal options

EXAMPLES
Create an archive:

  bar -c home.bar /home
  bar -c home.bar /home --compress-algorithm=lzma9
  bar -c file://home.bar /home --compress-algorithm=xdelta9+lzma9 --delta-source=home-previous.bar

List contents of an archive:

  bar *.bar
  bar -l home*.bar
  bar -L home*.bar

Test archive:

  bar -t home*.bar

Compare contents of an archive with files:

  bar -d home*.bar

Convert contents of an archive:

  bar --convert --compress-algorithm=zstd4 home*.bar

Find most recent file in all archives:

  bar -g -# '*/foo' home*.bar

Verify signature:

  bar --info --force-verify-signatures home*.bar

Restore contents of an archive:

  bar -x home*.bar

DIAGNOSTICS
Exit code is zero if no error occurred. Errors result in a non-zero exit
code and a error message on standard error.

FILES
/etc/bar/bar.cfg

  system wide bar configuration

/etc/bar/jobs

  jobs directory

$HOME/.bar/bar.cfg

  user specific configuration

/etc/ssl/certs/bar-ca.pem, /etc/ssl/certs/bar-server-cert.pem

  BAR TLS/SSL certificates and public keys

/etc/ssl/private/bar-server-key.pem

  BAR TLS/SSL server private key

/etc/logrotate.d/bar

  BAR logfile rotation settings

NOTES
See manual file bar.pdf for further information and details.

BUGS
Please report bugs to torsten.rupp@gmx.net. If possible use bar-debug or
compile BAR with debugging enabled (configure option --enable-debug) and
include a C stack trace in the bug report.
