Bareos ®
Backup Archiving REcovery Open Sourced

Main Reference

Bareos GmbH & Co KG

This manual documents Bareos version master (January 10, 2019)
Copyright © 1999-2012, Free Software Foundation Europe e.V.
Copyright © 2010-2012, Planets Communications B.V.
Copyright © 2013-2018, Bareos GmbH & Co. KG
Bareos ® is a registered trademark of Bareos GmbH & Co KG.
Bacula ® is a registered trademark of Kern Sibbald.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ”GNU Free Documentation License”.


I  Introduction and Tutorial
1 What is Bareos?
 1.1 History
 1.2 Who Needs Bareos?
 1.3 Bareos Components or Services
 1.4 Bareos Version Numbers and Releases
 1.5 Bareos Packages
 1.6 Quick Start
 1.7 Terminology
 1.8 What Bareos is Not
 1.9 Interactions Between the Bareos Services
 1.10 The Current State of Bareos
  1.10.1 What is Implemented
  1.10.2 Advantages Over Other Backup Programs
  1.10.3 Current Implementation Restrictions
  1.10.4 Design Limitations or Restrictions
  1.10.5 Items to Note
2 Installing Bareos
 2.1 Decide about the Bareos release to use
 2.2 Decide about the Database Backend
 2.3 Install the Bareos Software Packages
  2.3.1 Install on RedHat based Linux Distributions
  2.3.2 Install on SUSE based Linux Distributions
  2.3.3 Install on Debian based Linux Distributions
  2.3.4 Install on Univention Corporate Server
 2.4 Prepare Bareos database
  2.4.1 Debian based Linux Distributions
  2.4.2 Other Platforms
 2.5 Start the daemons
3 Installing Bareos Webui
 3.1 Features
 3.2 System Requirements
  3.2.1 Version < 16.2
 3.3 Installation
  3.3.1 Adding the Bareos Repository
  3.3.2 Install the bareos-webui package
  3.3.3 Minimal Configuration
  3.3.4 Configuration Details
 3.4 Upgrade from 15.2 to 16.2
  3.4.1 Console/Profile changes
  3.4.2 directors.ini
  3.4.3 configuration.ini
 3.5 Additional information
  3.5.1 NGINX
4 Updating Bareos
 4.1 Updating the configuration files
 4.2 Updating the database scheme
  4.2.1 Debian based Linux Distributions
  4.2.2 Other Platforms
5 Getting Started with Bareos
 5.1 Understanding Jobs and Schedules
 5.2 Understanding Pools, Volumes and Labels
 5.3 Setting Up Bareos Configuration Files
 5.4 Testing your Configuration Files
6 Tutorial
 6.1 Starting the Database
 6.2 Installing Bareos
 6.3 Starting the Daemons
 6.4 Using the Director to Query and Start Jobs
 6.5 Running a Job
 6.6 Restoring Your Files
 6.7 Quitting the Console Program
 6.8 Adding a Client
 6.9 Patience When Starting Daemons or Mounting Blank Tapes
 6.10 Pools
 6.11 Other Useful Console Commands
7 Critical Items to Implement Before Production
 7.1 Critical Items
 7.2 Recommended Items
II  Configuration
8 Customizing the Configuration
 8.1 Configuration Path Layout
  8.1.1 What configuration will be used?
  8.1.2 Subdirectory Configuration Scheme
 8.2 Configuration File Format
  8.2.1 Character Sets
  8.2.3 Semicolons
  8.2.4 Including other Configuration Files
 8.3 Resource
  8.3.1 Resource Directive
  8.3.2 Resource Directive Keyword
  8.3.3 Resource Directive Value
  8.3.4 Resource Types
 8.4 Names, Passwords and Authorization
9 Director Configuration
 9.1 Director Resource
 9.2 Job Resource
 9.3 JobDefs Resource
 9.4 Schedule Resource
  9.4.1 Technical Notes on Schedules
 9.5 FileSet Resource
  9.5.1 FileSet Include Ressource
  9.5.2 FileSet Exclude Ressource
  9.5.3 FileSet Examples
  9.5.4 Windows FileSets
  9.5.5 Testing Your FileSet
 9.6 Client Resource
 9.7 Storage Resource
 9.8 Pool Resource
  9.8.1 Scratch Pool
 9.9 Catalog Resource
 9.10 Messages Resource
 9.11 Console Resource
 9.12 Profile Resource
 9.13 Counter Resource
 9.14 Example Director Configuration File
10 Storage Daemon Configuration
 10.1 Storage Resource
 10.2 Director Resource
 10.3 NDMP Resource
 10.4 Device Resource
  10.4.1 Edit Codes for Mount and Unmount Directives
  10.4.2 Devices that require a mount (USB)
 10.5 Autochanger Resource
 10.6 Messages Resource
 10.7 Example Storage Daemon Configuration File
11 Client/File Daemon Configuration
 11.1 Client Resource
 11.2 Director Resource
 11.3 Messages Resource
 11.4 Example Client Configuration File
12 Messages Resource
 12.1 Message Types
13 Console Configuration
 13.1 Director Resource
 13.2 Console Resource
 13.3 Example Console Configuration File
  13.3.1 Using Named Consoles
14 Monitor Configuration
 14.1 Monitor Resource
 14.2 Director Resource
 14.3 Client Resource
 14.4 Storage Resource
 14.5 Tray Monitor
III  Tasks and Concepts
15 Bareos Console
 15.1 Console Configuration
 15.2 Running the Console Program
  15.2.1 Exit the Console Program
  15.2.2 Running the Console from a Shell Script
 15.3 Console Keywords
 15.4 Console Commands
  15.4.1 Special dot (.) Commands
  15.4.2 Special At (@) Commands
 15.5 Adding Volumes to a Pool
16 The Restore Command
 16.1 General
 16.2 The Restore Command
 16.3 Selecting Files by Filename
 16.4 Replace Options
 16.5 Command Line Arguments
 16.6 Using File Relocation
 16.7 Restoring Directory Attributes
 16.8 Restoring on Windows
 16.9 Restore Errors
 16.10 Example Restore Job Resource
 16.11 File Selection Commands
17 Volume Management
 17.1 Key Concepts and Resource Records
  17.1.1 Pool Options to Limit the Volume Usage
  17.1.2 Automatic Volume Labeling
  17.1.3 Restricting the Number of Volumes and Recycling
 17.2 Concurrent Disk Jobs
  17.2.1 Example for two clients, separate devices and recycling
  17.2.2 Using Multiple Storage Devices
 17.3 Automatic Volume Recycling
  17.3.1 Automatic Pruning
  17.3.2 Pruning Directives
  17.3.3 Recycling Algorithm
  17.3.4 Recycle Status
  17.3.5 Daily, Weekly, Monthly Tape Usage Example
  17.3.6 Automatic Pruning and Recycling Example
  17.3.7 Manually Recycling Volumes
18 Automated Disk Backup
 18.1 Overall Design
  18.1.1 Full Pool
  18.1.2 Differential Pool
  18.1.3 Incremental Pool
 18.2 Configuration Files
19 Autochanger Support
 19.1 Knowing What SCSI Devices You Have
  19.1.1 Linux
  19.1.2 FreeBSD
  19.1.3 Solaris
 19.2 Slots
 19.3 Multiple Devices
 19.4 Device Configuration Records
 19.5 Specifying Slots When Labeling
 19.6 Changing Cartridges
 19.7 Dealing with Multiple Magazines
 19.8 Update Slots Command
 19.9 Using the Autochanger
 19.10 Barcode Support
 19.11 Use bconsole to display Autochanger content
 19.12 Bareos Autochanger Interface
 19.13 Tapespeed and blocksizes
 19.14 Tape Drive Cleaning
20 Using Tape Drives without Autochanger
 20.1 Simple One Tape Backup
  20.1.1 Advantages
  20.1.2 Disadvantages
  20.1.3 Practical Details
 20.2 Manually Changing Tapes
 20.3 Daily Tape Rotation
  20.3.1 Advantages
  20.3.2 Disadvantages
  20.3.3 Practical Details
21 Storage Backends
 21.1 Droplet Storage Backend
  21.1.1 Requirements
  21.1.2 Installation
  21.1.3 Configuration
  21.1.4 Troubleshooting
 21.2 GFAPI Storage Backend
 21.3 Rados Storage Backend
22 Data Spooling
 22.1 Data Spooling Directives
  22.1.1 Additional Notes
23 Migration and Copy
 23.1 Important Migration Considerations
 23.2 Configure Copy or Migration Jobs
  23.2.1 Example Migration Jobs
24 Always Incremental Backup Scheme
 24.1 Conventional Backup Scheme Drawbacks
 24.2 Always Incremental Concept
 24.3 How to configure in Bareos
  24.3.1 Always Incremental Backup Job
  24.3.2 Consolidate Job
  24.3.3 Storages and Pools
 24.4 How it works
 24.5 Enhancements for the Always Incremental Backup Scheme
  24.5.1 The basic always incremental scheme
  24.5.2 Always Incremental Max Full Age
  24.5.3 Max Full Consolidations
 24.6 Long Term Storage of Always Incremental Jobs
  24.6.1 Copy Jobs
  24.6.2 Virtual Full Jobs
25 How to manually transfer data/volumes
 25.1 Import Data from a Remote Storage Daemon
 25.2 Import Data from a Independent Remote Full Bareos Installation
26 File Deduplication using Base Jobs
27 Plugins
 27.1 File Daemon Plugins
  27.1.1 bpipe Plugin
  27.1.2 PGSQL Plugin
  27.1.3 MySQL Plugin
  27.1.4 MSSQL Plugin
  27.1.5 LDAP Plugin
  27.1.6 Cephfs Plugin
  27.1.7 Rados Plugin
  27.1.8 GlusterFS Plugin
  27.1.9 python-fd Plugin
  27.1.10 VMware Plugin
 27.2 Storage Daemon Plugins
  27.2.1 autoxflate-sd
  27.2.2 scsicrypto-sd
  27.2.3 scsitapealert-sd
  27.2.4 python-sd Plugin
 27.3 Director Plugins
  27.3.1 python-dir Plugin
28 The Windows Version of Bareos
 28.1 Windows Installation
  28.1.1 Graphical Installation
  28.1.2 Command Line (Silent) Installation
 28.2 Dealing with Windows Problems
  28.2.1 Antivirus Program
  28.2.2 Enable Debuggging
 28.3 Windows Compatibility Considerations
  28.3.1 Exclusively Opened Files
  28.3.2 Backing up the Windows Registry
  28.3.3 Windows Reparse Points
  28.3.4 Hard Links
  28.3.5 FilesNotToBackup Registry Key
  28.3.6 Windows dedup support
  28.3.7 Store all file attributes
  28.3.8 Support for Windows EFS filesystems
 28.4 Volume Shadow Copy Service (VSS)
  28.4.1 VSS Problems
 28.5 Windows Firewalls
  28.5.1 Network TCP Port
 28.6 Windows Restore Problems
 28.7 Windows Backup Problems
 28.8 Windows Ownership and Permissions Problems
 28.9 Advanced Windows Configuration
  28.9.1 Windows Service
  28.9.2 Windows Specific Command Line Options
29 Network setup
 29.1 Client Initiated Connection
 29.2 Passive Clients
  29.2.1 Usage
 29.3 Using different IP Adresses for SD – FD Communication
30 Transport Encryption
 30.1 TLS Configuration Directives
 30.2 Getting TLS Certificates
 30.3 Example TLS Configuration Files
  30.3.1 Bareos Director
  30.3.2 Bareos Storage Daemon
  30.3.3 Bareos File Daemon
31 Data Encryption
 31.1 Encryption Technical Details
 31.2 Generating Private/Public Encryption Keys
 31.3 Example Data Encryption Configurations (bareos-fd.conf)
 31.4 Decrypting with a Master Key
32 NDMP Backups with Bareos
 32.1 NDMP Basics
  32.1.1 NDMP Topologies
 32.2 NDMP Backup in Bareos
  32.3.1 Example Setup for NDMP_BAREOS backup
  32.3.2 Run NDMP Backup
  32.3.3 Run NDMP Restore
  32.3.4 NDMP Copy Jobs
  32.3.5 Limitations
  32.4.1 Example Setup for NDMP_NATIVE backup
  32.4.2 Label Tapes
  32.4.3 Run NDMP_NATIVE Backup
  32.4.4 Run NDMP_NATIVE Restore
  32.4.5 Limitations
 32.5 NDMP Common
  32.5.1 NDMP Backup Level
  32.5.2 NDMP Debugging
  32.5.3 Bareos NDMP Common Limitations
  32.5.4 Tested Environments
33 Catalog Maintenance
 33.1 Catalog Database
  33.1.1 dbconfig-common (Debian)
  33.1.2 Manual Configuration
 33.2 Retention Periods
  33.2.1 Database Size
  33.2.2 Setting Retention Periods
 33.3 PostgreSQL
  33.3.1 Compacting Your PostgreSQL Database
  33.3.2 Repairing Your PostgreSQL Database
 33.4 MySQL/MariaDB
  33.4.1 MySQL/MariaDB Support
  33.4.2 Compacting Your MySQL Database
  33.4.3 Repairing Your MySQL Database
  33.4.4 MySQL Table is Full
  33.4.5 MySQL Server Has Gone Away
  33.4.6 MySQL Temporary Tables
  33.4.7 MySQL: Lock Wait Timeout
 33.5 Backing Up Your Bareos Database
34 Bareos Security Issues
 34.1 Configuring and Testing TCP Wrappers
 34.2 Secure Erase Command
IV  Appendix
A System Requirements
B Operating Systems
  B.1.1 Packages for the different Linux platforms
  B.1.2 Univention Corporate Server
  B.1.3 Debian.org / Ubuntu Universe
  B.1.4 Mac OS X
C Bareos Programs
 C.1 Bareos Daemons
  C.1.1 Daemon Command Line Options
  C.1.2 bareos-dir
  C.1.3 bareos-sd
  C.1.4 bareos-fd
 C.2 Interactive Programs
  C.2.1 bconsole
  C.2.2 bareos-webui
  C.2.3 bat
 C.3 Volume Utility Commands
  C.3.1 Parameter
  C.3.2 bls
  C.3.3 bextract
  C.3.4 bscan
  C.3.5 bcopy
  C.3.6 btape
  C.3.7 bscrypto
 C.4 Other Programs
  C.4.1 bsmtp
  C.4.2 bareos-dbcheck
  C.4.3 bregex
  C.4.4 bwild
  C.4.5 bpluginfo
D The Bootstrap File
 D.1 Bootstrap File Format
 D.2 Automatic Generation of Bootstrap Files
 D.3 Bootstrap for bscan
 D.4 Bootstrap Example
E Verify File Integrity with Bareos
 E.1 The Details
 E.2 Running the Verify
 E.3 What To Do When Differences Are Found
 E.4 A Verify Configuration Example
F Backward Compatibility
 F.1 Tape Formats
 F.2 Compatibility between Bareos and Bacula
  F.2.1 Upgrade from Bacula 5.2 to Bareos
G Catalog Tables
 G.1 Job
  G.1.1 JobStatus
H Howtos
 H.1 Use a dummy device to test the backup
 H.2 Backup Of Third Party Databases
  H.2.1 Backup of MSSQL Databases with Bareos Plugin
  H.2.2 Backup of a PostgreSQL Database
  H.2.3 Backup of a MySQL Database
I Disaster Recovery Using Bareos
 I.1 General
  I.1.1 Important Considerations
 I.2 Steps to Take Before Disaster Strikes
 I.3 Bare Metal Recovery of Bareos Clients
  I.3.1 Linux
 I.4 Restoring a Bareos Server
J Troubleshooting
 J.1 Debug Messages
 J.2 Client Access Problems
  J.2.1 Difficulties Connecting from the FD to the SD
  J.2.2 Authorization Errors
 J.3 Concurrent Jobs
 J.4 Media VolWrites: integer out of range
 J.5 Tape Labels: ANSI or IBM
  J.5.1 Reading
  J.5.2 Writing
 J.6 Tape Drive
  J.6.1 Get Your Tape Drive Working
 J.7 Autochanger
  J.7.1 Testing Autochanger and Adapting mtx-changer script
 J.8 Restore
  J.8.1 Restore a pruned job using a pattern
  J.8.2 Problems Restoring Files
  J.8.3 Restoring Files Can Be Slow
  J.8.4 Restoring When Things Go Wrong
K Debugging
 K.1 Traceback
 K.2 Testing The Traceback
  K.2.1 Getting A Traceback On Other Systems
 K.3 Manually Running Bareos Under The Debugger
L Release Notes
M Bareos Copyright, Trademark, and Licenses
 M.1 Licenses Overview
 M.2 GNU Free Documentation License
 M.3 GNU Affero Gerneral Public License
 M.4 GNU Lesser Gerneral Public License
V  Index
Storage Daemon
File Daemon

Part I
Introduction and Tutorial


Chapter 1
What is Bareos?

Bareos is a set of computer programs that permits the system administrator to manage backup, recovery, and verification of computer data across a network of computers of different kinds. Bareos can also run entirely upon a single computer and can backup to various types of media, including tape and disk.

In technical terms, it is a network Client/Server based backup program. Bareos is relatively easy to use and efficient, while offering many advanced storage management features that make it easy to find and recover lost or damaged files. Due to its modular design, Bareos is scalable from small single computer systems to systems consisting of hundreds of computers located over a large network. #

1.1 History

Bareos is a fork of the open source project Bacula version 5.2. In 2010 the Bacula community developer Marco van Wieringen started to collect rejected or neglected community contributions in his own branch. This branch was later on the base of Bareos and since then was enriched by a lot of new features.

This documentation also bases on the original Bacula documentation, it is technically also a fork of the documenation created following the rules of the GNU Free Documentation License.

Original author of Bacula and its documentation is Kern Sibbald. We thank Kern and all contributors to Bacula and it’s documentation. We maintain a list of contributors to Bacula (until the time we’ve started the fork) and Bareos in our AUTHORS file.


1.2 Who Needs Bareos?

If you are currently using a program such as tar, dump, or bru to backup your computer data, and you would like a network solution, more flexibility, or catalog services, Bareos will most likely provide the additional features you want. However, if you are new to Unix systems or do not have offsetting experience with a sophisticated backup package, the Bareos project does not recommend using Bareos as it is much more difficult to setup and use than tar or dump.

If you want Bareos to behave like the above mentioned simple programs and write over any tape that you put in the drive, then you will find working with Bareos difficult. Bareos is designed to protect your data following the rules you specify, and this means reusing a tape only as the last resort. It is possible to ”force” Bareos to write over any tape in the drive, but it is easier and more efficient to use a simpler program for that kind of operation.

If you would like a backup program that can write to multiple volumes (i.e. is not limited by your tape drive capacity), Bareos can most likely fill your needs.

If you are currently using a sophisticated commercial package such as Legato Networker, ARCserveIT, Arkeia, IBM Tivoli Storage Manager or PerfectBackup+, you may be interested in Bareos, which provides many of the same features and is free software available under the GNU AGPLv3 software license.


1.3 Bareos Components or Services

Bareos is made up of the following major components or services: Director, Console, File, Storage, and Monitor services.

Bareos Director

The Director is the central control program for all the other daemons. It schedules and supervises all the backup, restore, verify and archive operations. The system administrator uses the Bareos Director to schedule backups and to recover files. The Director runs as a daemon (or service) in the background.

Bareos Console

The Bareos Console (bconsole) is the program that allows the administrator or user to communicate with the Bareos Director. It runs in a shell window (i.e. TTY interface). Most system administrators will find this completely adequate. For more details see the Bareos Console.

Bareos File Daemon

The Bareos File Daemon is a program that must be installed on each (Client) machine that should be backed up. At the request of the Bareos Director, it finds the files to be backed up and sends them (their data) to the Bareos Storage Daemon.

It is specific to the operating system on which it runs and is responsible for providing the file attributes and data when requested by the Bareos Director.

The Bareos File Daemon is also responsible for the file system dependent part of restoring the file attributes and data during a recovery operation. This program runs as a daemon on the machine to be backed up.

Bareos Storage Daemon

The Bareos Storage Daemon is responsible, at the Bareos Director request, for accepting data from a Bareos File Daemon and storing the file attributes and data to the physical backup media or volumes. In the case of a restore request, it is responsible to find the data and send it to the Bareos File Daemon.

There can be multiple Bareos Storage Daemon in your environment, all controlled by the same Bareos Director.

The Storage services runs as a daemon on the machine that has the backup device (such as a tape drive).


The Catalog services are comprised of the software programs responsible for maintaining the file indexes and volume databases for all files backed up. The Catalog services permit the system administrator or user to quickly locate and restore any desired file. The Catalog services sets Bareos apart from simple backup programs like tar and bru, because the catalog maintains a record of all Volumes used, all Jobs run, and all Files saved, permitting efficient restoration and Volume management. Bareos currently supports three different databases, MySQL, PostgreSQL, and SQLite, one of which must be chosen when building Bareos.

The three SQL databases currently supported (MySQL, PostgreSQL or SQLite) provide quite a number of features, including rapid indexing, arbitrary queries, and security. Although the Bareos project plans to support other major SQL databases, the current Bareos implementation interfaces only to MySQL, PostgreSQL and SQLite.

To perform a successful save or restore, the following four daemons must be configured and running: the Director daemon, the File daemon, the Storage daemon, and the Catalog service (MySQL, PostgreSQL or SQLite).


1.4 Bareos Version Numbers and Releases

Bareos version numbers consists of three parts: YY.Q.C


year (last two digits)


quarter of the year


year and quarter of the code freeze. After this, as a general rule, no new feature should get introduced to this Bareos branch. Subsequent release are for bugfixing.


Release counter. For every subsequent release, this counter is incremented. Beginning with 16.2, numbers from 1 to 3 represents the month of the quarter during development. After the code freeze, the number is set to 4. So, stable releases get number from 4 onwards. Maintenance releases get numbers starting from 5 onwards.

Following information can be determined from the Bareos release bareos-16.2.4:

For details about the different releases see Release Notes.


1.5 Bareos Packages

Following Bareos Linux packages are available (release 17.2.4):

Package Name Description

bareos Backup Archiving REcovery Open Sourced - metapackage
bareos-bconsole Bareos administration console (CLI)
bareos-client Bareos client Meta-All-In-One package
bareos-common Common files, required by multiple Bareos packages
bareos-database-common Generic abstraction libs and files to connect to a database
bareos-database-mysql Libs and tools for mysql catalog
bareos-database-postgresql Libs and tools for postgresql catalog
bareos-database-sqlite3 Libs and tools for sqlite3 catalog
bareos-database-tools Bareos CLI tools with database dependencies (bareos-dbcheck, bscan)
bareos-devel Devel headers
bareos-director Bareos Director daemon
bareos-director-python-plugin Python plugin for Bareos Director daemon
bareos-filedaemon Bareos File daemon (backup and restore client)
bareos-filedaemon-ceph-plugin CEPH plugin for Bareos File daemon
bareos-filedaemon-glusterfs-plugin GlusterFS plugin for Bareos File daemon
bareos-filedaemon-ldap-python-pluginLDAP Python plugin for Bareos File daemon
bareos-filedaemon-python-plugin Python plugin for Bareos File daemon
bareos-regress-config Required files for bareos-regress
bareos-storage Bareos Storage daemon
bareos-storage-ceph CEPH support for the Bareos Storage daemon
bareos-storage-droplet Object Storage support (through libdroplet) for the Bareos Storage daemon
bareos-storage-fifo FIFO support for the Bareos Storage backend
bareos-storage-glusterfs GlusterFS support for the Bareos Storage daemon
bareos-storage-python-plugin Python plugin for Bareos Storage daemon
bareos-storage-tape Tape support for the Bareos Storage daemon
bareos-tools Bareos CLI tools (bcopy, bextract, bls, bregex, bwild)
bareos-traymonitor Bareos Tray Monitor (QT)
bareos-vadp-dumper VADP Dumper - vStorage APIs for Data Protection Dumper program
bareos-vmware-plugin Bareos VMware plugin
bareos-vmware-plugin-compat Bareos VMware plugin compatibility
bareos-vmware-vix-disklib VMware vix disklib distributable libraries
bareos-webui Bareos Web User Interface
python-bareos Backup Archiving REcovery Open Sourced - Python module

Not all packages (especially optional backends and plugins) are available on all platforms. For details, see Packages for the different Linux platforms.

Additionally, packages containing debug information are available. These are named differently depending on the distribution (bareos-debuginfo or bareos-dbg or ).

Not all packages are required to run Bareos.


1.6 Quick Start

To get Bareos up and running quickly, the author recommends that you first scan the Terminology section below, then quickly review the next chapter entitled The Current State of Bareos, then the Installing Bareos, the Getting Started with Bareos, which will give you a quick overview of getting Bareos running. After which, you should proceed to the chapter How to Configure Bareos, and finally the chapter on Running Bareos.


1.7 Terminology

The person or persons responsible for administrating the Bareos system.
The term Backup refers to a Bareos Job that saves files.
Bootstrap File
The bootstrap file is an ASCII file containing a compact form of commands that allow Bareos or the stand-alone file extraction utility (bextract) to restore the contents of one or more Volumes, for example, the current state of a system just backed up. With a bootstrap file, Bareos can restore your system without a Catalog. You can create a bootstrap file from a Catalog to extract any file or files you wish.
The Catalog is used to store summary information about the Jobs, Clients, and Files that were backed up and on what Volume or Volumes. The information saved in the Catalog permits the administrator or user to determine what jobs were run, their status as well as the important characteristics of each file that was backed up, and most importantly, it permits you to choose what files to restore. The Catalog is an online resource, but does not contain the data for the files backed up. Most of the information stored in the catalog is also stored on the backup volumes (i.e. tapes). Of course, the tapes will also have a copy of the file data in addition to the File Attributes (see below).

The catalog feature is one part of Bareos that distinguishes it from simple backup and archive programs such as dump and tar.

In Bareos’s terminology, the word Client refers to the machine being backed up, and it is synonymous with the File services or File daemon, and quite often, it is referred to it as the FD. A Client is defined in a configuration file resource.
The program that interfaces to the Director allowing the user or system administrator to control Bareos.
Unix terminology for a program that is always present in the background to carry out a designated task. On Windows systems, as well as some Unix systems, daemons are called Services.
The term directive is used to refer to a statement or a record within a Resource in a configuration file that defines one specific setting. For example, the Name directive defines the name of the Resource.
The main Bareos server daemon that schedules and directs all Bareos operations. Occasionally, the project refers to the Director as DIR.
A backup that includes all files changed since the last Full save started. Note, other backup programs may define this differently.
File Attributes
The File Attributes are all the information necessary about a file to identify it and all its properties such as size, creation date, modification date, permissions, etc. Normally, the attributes are handled entirely by Bareos so that the user never needs to be concerned about them. The attributes do not include the file’s data.
File daemon
The daemon running on the client computer to be backed up. This is also referred to as the File services, and sometimes as the Client services or the FD.

A FileSet is a Resource contained in a configuration file that defines the files to be backed up. It consists of a list of included files or directories, a list of excluded files, and how the file is to be stored (compression, encryption, signatures). For more details, see the FileSet Resource in the Director chapter of this document.
A backup that includes all files changed since the last Full, Differential, or Incremental backup started. It is normally specified on the Level directive within the Job resource definition, or in a Schedule resource.

A Bareos Job is a configuration resource that defines the work that Bareos must perform to backup or restore a particular Client. It consists of the Type (backup, restore, verify, etc), the Level (full, differential, incremental, etc.), the FileSet, and Storage the files are to be backed up (Storage device, Media Pool). For more details, see the Job Resource in the Director chapter of this document.
The program that interfaces to all the daemons allowing the user or system administrator to monitor Bareos status.
A resource is a part of a configuration file that defines a specific unit of information that is available to Bareos. It consists of several directives (individual configuration statements). For example, the Job resource defines all the properties of a specific Job: name, schedule, Volume pool, backup type, backup level, ...
A restore is a configuration resource that describes the operation of recovering a file from backup media. It is the inverse of a save, except that in most cases, a restore will normally have a small set of files to restore, while normally a Save backs up all the files on the system. Of course, after a disk crash, Bareos can be called upon to do a full Restore of all files that were on the system.
A Schedule is a configuration resource that defines when the Bareos Job will be scheduled for execution. To use the Schedule, the Job resource will refer to the name of the Schedule. For more details, see the Schedule Resource in the Director chapter of this document.
This is a program that remains permanently in memory awaiting instructions. In Unix environments, services are also known as daemons.
Storage Coordinates
The information returned from the Storage Services that uniquely locates a file on a backup medium. It consists of two parts: one part pertains to each file saved, and the other part pertains to the whole Job. Normally, this information is saved in the Catalog so that the user doesn’t need specific knowledge of the Storage Coordinates. The Storage Coordinates include the File Attributes (see above) plus the unique location of the information on the backup Volume.
Storage Daemon
The Storage daemon, sometimes referred to as the SD, is the code that writes the attributes and data to a storage Volume (usually a tape or disk).
Normally refers to the internal conversation between the File daemon and the Storage daemon. The File daemon opens a session with the Storage daemon to save a FileSet or to restore it. A session has a one-to-one correspondence to a Bareos Job (see above).
A verify is a job that compares the current file attributes to the attributes that have previously been stored in the Bareos Catalog. This feature can be used for detecting changes to critical system files similar to what a file integrity checker like Tripwire does. One of the major advantages of using Bareos to do this is that on the machine you want protected such as a server, you can run just the File daemon, and the Director, Storage daemon, and Catalog reside on a different machine. As a consequence, if your server is ever compromised, it is unlikely that your verification database will be tampered with.

Verify can also be used to check that the most recent Job data written to a Volume agrees with what is stored in the Catalog (i.e. it compares the file attributes), *or it can check the Volume contents against the original files on disk.

Retention Period
There are various kinds of retention periods that Bareos recognizes. The most important are the File Retention Period, Job Retention Period, and the Volume Retention Period. Each of these retention periods applies to the time that specific records will be kept in the Catalog database. This should not be confused with the time that the data saved to a Volume is valid.

The File Retention Period determines the time that File records are kept in the catalog database. This period is important for two reasons: the first is that as long as File records remain in the database, you can ”browse” the database with a console program and restore any individual file. Once the File records are removed or pruned from the database, the individual files of a backup job can no longer be ”browsed”. The second reason for carefully choosing the File Retention Period is because the volume of the database File records use the most storage space in the database. As a consequence, you must ensure that regular ”pruning” of the database file records is done to keep your database from growing too large. (See the Console prune command for more details on this subject).

The Job Retention Period is the length of time that Job records will be kept in the database. Note, all the File records are tied to the Job that saved those files. The File records can be purged leaving the Job records. In this case, information will be available about the jobs that ran, but not the details of the files that were backed up. Normally, when a Job record is purged, all its File records will also be purged.

The Volume Retention Period is the minimum of time that a Volume will be kept before it is reused. Bareos will normally never overwrite a Volume that contains the only backup copy of a file. Under ideal conditions, the Catalog would retain entries for all files backed up for all current Volumes. Once a Volume is overwritten, the files that were backed up on that Volume are automatically removed from the Catalog. However, if there is a very large pool of Volumes or a Volume is never overwritten, the Catalog database may become enormous. To keep the Catalog to a manageable size, the backup information should be removed from the Catalog after the defined File Retention Period. Bareos provides the mechanisms for the catalog to be automatically pruned according to the retention periods defined.

A Scan operation causes the contents of a Volume or a series of Volumes to be scanned. These Volumes with the information on which files they contain are restored to the Bareos Catalog. Once the information is restored to the Catalog, the files contained on those Volumes may be easily restored. This function is particularly useful if certain Volumes or Jobs have exceeded their retention period and have been pruned or purged from the Catalog. Scanning data from Volumes into the Catalog is done by using the bscan program. See the bscan section of the Bareos Utilities chapter of this manual for more details.
A Volume is an archive unit, normally a tape or a named disk file where Bareos stores the data from one or more backup jobs. All Bareos Volumes have a software label written to the Volume by Bareos so that it identifies what Volume it is really reading. (Normally there should be no confusion with disk files, but with tapes, it is easy to mount the wrong one.)


1.8 What Bareos is Not

Bareos is a backup, restore and verification program and is not a complete disaster recovery system in itself, but it can be a key part of one if you plan carefully and follow the instructions included in the Disaster Recovery chapter of this manual.


1.9 Interactions Between the Bareos Services

The following block diagram shows the typical interactions between the Bareos Services for a backup job. Each block represents in general a separate process (normally a daemon). In general, the Director oversees the flow of information. It also maintains the Catalog.



1.10 The Current State of Bareos


1.10.1 What is Implemented


1.10.2 Advantages Over Other Backup Programs


1.10.3 Current Implementation Restrictions


1.10.4 Design Limitations or Restrictions


1.10.5 Items to Note


Chapter 2
Installing Bareos

If you are like me, you want to get Bareos running immediately to get a feel for it, then later you want to go back and read about all the details. This chapter attempts to accomplish just that: get you going quickly without all the details.

Bareos comes prepackaged for a number of Linux distributions. So the easiest way to get to a running Bareos installation, is to use a platform where prepacked Bareos packages are available. Additional information can be found in the chapter Operating Systems.

If Bareos is available as a package, only 4 steps are required to get to a running Bareos system:

  1. Decide about the Bareos release to use
  2. Install the Bareos Software Packages
  3. Prepare Bareos database
  4. Start the daemons

This will start a very basic Bareos installation which will regularly backup a directory to disk. In order to fit it to your needs, you’ll have to adapt the configuration and might want to backup other clients. #

2.1 Decide about the Bareos release to use

You’ll find Bareos binary package repositories at http://download.bareos.org/. The latest stable released version is available at http://download.bareos.org/bareos/release/latest/.

The public key to verify the repository is also in repository directory (Release.key for Debian based distributions, repodata/repomd.xml.key for RPM based distributions).

Section Install the Bareos Software Packages describes how to add the software repository to your system.


2.2 Decide about the Database Backend

Bareos offers the following database backends:

PostgreSQL is the default backend.

MariaDB/MySQL backend is also included.

Sqlite backend is intended for testing purposes only.

The Bareos database packages have there dependencies only to the database client packages, therefore the database itself must be installed manually.

If you do not explicitly choose a database backend, your operating system installer will choose one for you. The default should be PostgreSQL, but depending on your operating system and the already installed packages, this may differ.


2.3 Install the Bareos Software Packages

The package bareos is only a meta package, that contains dependencies to the main components of Bareos, see Bareos Packages. If you want to setup a distributed environment (like one Director, separate database server, multiple Storage daemons) you have to choose the corresponding Bareos packages to install on each hosts instead of just installing the bareos package.


2.3.1 Install on RedHat based Linux Distributions

RHEL7, CentOS7, Fedora

Bareos Version >= 15.2.0 requires the Jansson library package. On RHEL 7 it is available through the RHEL Server Optional channel. On CentOS 7 and Fedora is it included on the main repository.

# define parameter 
# or 
# DIST=CentOS_7 
# DIST=Fedora_26 
# DIST=Fedora_25 
# or 
# RELEASE=release/latest/ 
# RELEASE=experimental/nightly/ 
# add the Bareos repository 
wget -O /etc/yum.repos.d/bareos.repo $URL/bareos.repo 
# install Bareos packages 
yum install bareos bareos-database-postgresql  
Commands 2.1: Bareos installation on RHEL 7 / CentOS 7 / Fedora

RHEL 6, CentOS 6

Bareos Version >= 15.2.0 requires the Jansson library package. This package is available on EPEL 6. Make sure, it is available on your system.

# add EPEL repository, if not already present. 
# Required for the jansson package. 
rpm -Uhv https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm 
# define parameter 
# DIST=CentOS_6 
# or 
# RELEASE=release/latest/ 
# RELEASE=experimental/nightly/ 
# add the Bareos repository 
wget -O /etc/yum.repos.d/bareos.repo $URL/bareos.repo 
# install Bareos packages 
yum install bareos bareos-database-postgresql  
Commands 2.2: Bareos installation on RHEL 6 / CentOS 6


yum in RHEL 5/CentOS 5 has slightly different behaviour as far as dependency resolving is concerned: it sometimes install a dependent package after the one that has the dependency defined. To make sure that it works, install the desired Bareos database backend package first in a separate step:

# define parameter 
# or 
# RELEASE=release/latest/ 
# RELEASE=experimental/nightly/ 
# add the Bareos repository 
wget -O /etc/yum.repos.d/bareos.repo $URL/bareos.repo 
# install Bareos packages 
yum install bareos-database-postgresql 
yum install bareos  
Commands 2.3: Bareos installation on RHEL 5 / CentOS 5


2.3.2 Install on SUSE based Linux Distributions

SUSE Linux Enterprise Server (SLES), openSUSE
# define parameter 
# or 
# DIST=SLE_12_SP2 
# DIST=SLE_12_SP1 
# DIST=SLE_11_SP4 
# DIST=openSUSE_Leap_42.3 
# DIST=openSUSE_Leap_42.2 
# or 
# RELEASE=release/latest/ 
# RELEASE=experimental/nightly/ 
# add the Bareos repository 
zypper addrepo --refresh $URL/bareos.repo 
# install Bareos packages 
zypper install bareos bareos-database-postgresql  
Commands 2.4: Bareos installation on SLES / openSUSE


2.3.3 Install on Debian based Linux Distributions

Debian / Ubuntu

Bareos Version >= 15.2.0 requires the Jansson library package. On Ubuntu is it available in Ubuntu Universe. In Debian, is it included in the main repository.

# define parameter 
# or 
# DIST=Debian_8.0 
# DIST=xUbuntu_16.04 
# DIST=xUbuntu_14.04 
# DIST=xUbuntu_12.04 
# or 
# RELEASE=release/latest/ 
# RELEASE=experimental/nightly/ 
# add the Bareos repository 
printf "deb $URL /\n" > /etc/apt/sources.list.d/bareos.list 
# add package key 
wget -q $URL/Release.key -O- | apt-key add - 
# install Bareos packages 
apt-get update 
apt-get install bareos bareos-database-postgresql  
Commands 2.5: Bareos installation on Debian / Ubuntu

If you prefer using the versions of Bareos directly integrated into the distributions, please note that there are some differences, see Limitations of the Debian.org/Ubuntu Universe version of Bareos.


2.3.4 Install on Univention Corporate Server


Bareos offers additional functionality and integration into an Univention Corporate Server environment. Please follow the intructions in Univention Corporate Server.

If you are not interested in this additional functionality, the commands described in Install on Debian based Linux Distributions will also work for Univention Corporate Servers.


2.4 Prepare Bareos database

We assume that you have already your database installed and basically running. Using the PostgreSQL database backend is recommended.

The easiest way to set up a database is using an system account that have passwordless local access to the database. Often this is the user root for MySQL and the user postgres for PostgreSQL.

For details, see chapter Catalog Maintenance.


2.4.1 Debian based Linux Distributions

Since Bareos Version >= 14.2.0 the Debian (and Ubuntu) based packages support the dbconfig-common mechanism to create and update the Bareos database.

Follow the instructions during install to configure it according to your needs.

pict pict

If you decide not to use dbconfig-common (selecting <No> on the initial dialog), follow the instructions for Other Platforms.

The selectable database backends depend on the bareos-database-* packages installed.

For details see dbconfig-common (Debian).


2.4.2 Other Platforms


If your are using PostgreSQL and your PostgreSQL administration user is postgres (default), use following commands:

su postgres -c /usr/lib/bareos/scripts/create_bareos_database 
su postgres -c /usr/lib/bareos/scripts/make_bareos_tables 
su postgres -c /usr/lib/bareos/scripts/grant_bareos_privileges  
Commands 2.6: Setup Bareos catalog with PostgreSQL


Make sure, that root has direct access to the local MySQL server. Check if the command mysql connects to the database without defining the password. This is the default on RedHat and SUSE distributions. On other systems (Debian, Ubuntu), create the file ~/.my.cnf with your authentication informations:

Configuration 2.7: MySQL credentials file .my.cnf

It is recommended, to secure the Bareos database connection with a password. See Catalog Maintenance – MySQL about how to archieve this. For testing, using a password-less MySQL connection is probable okay. Setup the Bareos database tables by following commands:

Commands 2.8: Setup Bareos catalog with MySQL

As some Bareos updates require a database schema update, therefore the file /root/.my.cnf might also be useful in the future.


2.5 Start the daemons

service bareos-dir start 
service bareos-sd start 
service bareos-fd start  
Commands 2.9: Start the Bareos Daemons

You will eventually have to allow access to the ports 9101-9103, used by Bareos.

Now you should be able to access the director using the bconsole.

When you want to use the bareos-webui, please refer to the chapter Installing Bareos Webui.


Chapter 3
Installing Bareos Webui

This chapter addresses the installation process of the Bareos Webui.

Since Version >= 15.2.0 Bareos Webui is part of the Bareos project and available for a number of platforms.



3.1 Features


3.2 System Requirements


3.2.1 Version < 16.2

Bareos Webui Version >= 16.2.4 incorporates the required Zend Framework 2 components, no extra Zend Framework installation is required. For older versions of bareos-webui, you must install Zend Framework separately. Unfortunately, not all distributions offer Zend Framework 2 packages. The following list shows where to get the Zend Framework 2 package:

Also be aware, that older versions of Bareos Director do not support the Subdirectory Configuration Scheme and therefore Bareos configuration resource files must be included manually.


3.3 Installation


3.3.1 Adding the Bareos Repository

If not already done, add the Bareos repository that is matching your Linux distribution. Please have a look at the chapter Install the Bareos Software Packages for more information on how to achieve this.


3.3.2 Install the bareos-webui package

After adding the repository simply install the bareos-webui package via your package manager.


3.3.3 Minimal Configuration

This assumes, Bareos Director and Bareos Webui are installed on the same host.

  1. If you are using SELinux, allow HTTPD scripts and modules make network connections:
    setsebool -P httpd_can_network_connect on  
    Commands 3.5:

    For details, see SELinux.

  2. Restart Apache (to load configuration provided by bareos-webui, see Configure your Apache Webserver)
  3. Use bconsole to create a user with name admin and password secret and permissions defined in webui-adminDir Profile:
    *configure add console name=admin password=secret profile=webui-admin  
    bconsole 3.6: add a named console

    Of course, you can choose other names and passwords. For details, see Create a restricted consoles.

  4. Login to http://HOSTNAME/bareos-webui with username and password as created in 3.


3.3.4 Configuration Details

Create a restricted consoles

There is not need, that Bareos Webui itself provide a user management. Instead it uses so named ConsoleDir defined in the Bareos Director. You can have multiple consoles with different names and passwords, sort of like multiple users, each with different privileges.

At least one ConsoleDir is required to use the Bareos Webui.

To allow a user with name admin and password secret to access the Bareos Director with permissions defined in the webui-adminDir Profile (see Configuration of profile resources), either

For details, please read Console Resource.

Configuration of profile resources

The package bareos-webui comes with a predefined profile for Bareos Webui: webui-adminDir Profile.

If your Bareos Webui is installed on another system than the Bareos Director, you have to copy the profile to the Bareos Director.

This is the default profile, giving access to all Bareos resources and allowing all commands used by the Bareos Webui:

Profile { 
  Name = webui-admin 
  CommandACL = !.bvfs_clear_cache, !.exit, !.sql, !configure, !create, !delete, !purge, !sqlquery, !umount, !unmount, *all* 
  Job ACL = *all* 
  Schedule ACL = *all* 
  Catalog ACL = *all* 
  Pool ACL = *all* 
  Storage ACL = *all* 
  Client ACL = *all* 
  FileSet ACL = *all* 
  Where ACL = *all* 
  Plugin Options ACL = *all* 
Resource 3.9: bareos-dir.d/profile/webui-admin.conf

The ProfileDir itself does not give any access to the Bareos Director, but can be used by ConsoleDir, which do give access to the Bareos Director, see Create a restricted consoles.

For details, please read Profile Resource.


To use Bareos Director on a system with SELinux enabled, permission must be given to HTTPD to make network connections:

setsebool -P httpd_can_network_connect on  
Commands 3.10:

Configure your Apache Webserver

The package bareos-webui provides a default configuration for Apache. Depending on your distribution, it is installed at /etc/apache2/conf.d/bareos-webui.conf, /etc/httpd/conf.d/bareos-webui.conf or /etc/apache2/available-conf/bareos-webui.conf.

The required Apache modules, setenv, rewrite and php are enabled via package postinstall script. However, after installing the bareos-webui package, you need to restart your Apache webserver manually.

Configure your /etc/bareos-webui/directors.ini

Configure your directors in /etc/bareos-webui/directors.ini to match your settings.

The configuration file /etc/bareos-webui/directors.ini should look similar to this:

; Bareos WebUI Configuration File 
; File: /etc/bareos-webui/directors.ini 
; Section localhost-dir 
; Enable or disable section. Possible values are "yes" or "no", the default is "yes". 
enabled = "yes" 
; Fill in the IP-Address or FQDN of you director. 
diraddress = "localhost" 
; Default value is 9101 
dirport = 9101 
; Set catalog to explicit value if you have multiple catalogs 
;catalog = "MyCatalog" 
; TLS verify peer 
; Possible values: true or false 
tls_verify_peer = false 
; Server can do TLS 
; Possible values: true or false 
server_can_do_tls = false 
; Server requires TLS 
; Possible values: true or false 
server_requires_tls = false 
; Client can do TLS 
; Possible values: true or false 
client_can_do_tls = false 
; Client requires TLS 
; Possible value: true or false 
client_requires_tls = false 
; Path to the certificate authority file 
; E.g. ca_file = "/etc/bareos-webui/tls/BareosCA.crt" 
;ca_file = "" 
; Path to the cert file which needs to contain the client certificate and the key in PEM encoding 
; E.g. ca_file = "/etc/bareos-webui/tls/restricted-named-console.pem" 
;cert_file = "" 
; Passphrase needed to unlock the above cert file if set 
;cert_file_passphrase = "" 
; Allowed common names 
; E.g. allowed_cns = "host1.example.com" 
;allowed_cns = "" 
; Section another-host-dir 
enabled = "no" 
diraddress = "" 
dirport = 9101 
;catalog = "MyCatalog" 
;tls_verify_peer = false 
;server_can_do_tls = false 
;server_requires_tls = false 
;client_can_do_tls = false 
;client_requires_tls = false 
;ca_file = "" 
;cert_file = "" 
;cert_file_passphrase = "" 
;allowed_cns = ""  
Configuration 3.11: /etc/bareos-webui/directors.ini

You can add as many directors as you want, also the same host with a different name and different catalog, if you have multiple catalogs.

Configure your /etc/bareos-webui/configuration.ini

Since Version >= 16.2.2 you are able to configure some parameters of the Bareos Webui to your needs.

; Bareos WebUI Configuration File 
; File: /etc/bareos-webui/configuration.ini 
; Default: 3600 seconds 
; Autorefresh Interval 
; Default: 60000 milliseconds 
; Possible values for pagination 
; Default: 10,25,50,100 
; Default number of rows per page 
; for possible values see pagination_values 
; Default: 25 
; State saving - restore table state on page reload. 
; Default: false 
; Pooltype for label to use as filter. 
; Default: none 
Configuration 3.12: /etc/bareos-webui/configuration.ini


3.4 Upgrade from 15.2 to 16.2


3.4.1 Console/Profile changes

The Bareos Webui Director profile shipped with Bareos 15.2 (webuiDir Profile in the file /etc/bareos/bareos-dir.d/webui-profiles.conf) is not sufficient to use the Bareos Webui 16.2. This has several reasons:

  1. The handling of acls is more strict in Bareos 16.2 than it has been in Bareos 15.2. Substring matching is no longer enabled, therefore you need to change .bvfs_* to .bvfs_.* in your Command ACL Dir Profile to have a proper regular expression. Otherwise the restore module won’t work any longer, especially the file browser.
  2. The Bareos Webui 16.2 uses following additional commands:

If you used an unmodified /etc/bareos/bareos-dir.d/webui-profiles.conf file, the easiest way is to overwrite it with the new profile file /etc/bareos/bareos-dir.d/profile/webui-admin.conf. The new webui-adminDir Profile allows all commands, except of the dangerous ones, see Configuration of profile resources.


3.4.2 directors.ini

Since Version >= 16.2.0 it is possible to work with different catalogs. Therefore the catalog parameter has been introduced. If you don’t set a catalog explicitly the default MyCatalogDir Catalog will be used. Please see Configure your /etc/bareos-webui/directors.ini for more details.


3.4.3 configuration.ini

Since 16.2 the Bareos Webui introduced an additional configuration file besides the directors.ini file named configuration.ini where you are able to adjust some parameters of the webui to your needs. Please see Configure your /etc/bareos-webui/directors.ini for more details.


3.5 Additional information


3.5.1 NGINX

If you prefer to use Bareos Webui on Nginx with php5-fpm instead of Apache, a basic working configuration could look like this:

server { 
        listen       9100; 
        server_name  bareos; 
        root         /var/www/bareos-webui/public; 
        location / { 
                index index.php; 
                try_files $uri $uri/ /index.php?$query_string; 
        location ~ .php$ { 
                include snippets/fastcgi-php.conf; 
                # php5-cgi alone: 
                # pass the PHP 
                # scripts to FastCGI server 
                # listening on 
                # php5-fpm: 
                fastcgi_pass unix:/var/run/php5-fpm.sock; 
                # APPLICATION_ENV:  set to development or production 
                #fastcgi_param APPLICATION_ENV development; 
                fastcgi_param APPLICATION_ENV production; 
Configuration 3.13: bareos-webui on nginx

This will make the Bareos Webui accessible at http://bareos:9100/ (assuming your DNS resolve the hostname bareos to the NGINX server).


Chapter 4
Updating Bareos

In most cases, a Bareos update is simply done by a package update of the distribution. Please remind, that Bareos Director and Bareos Storage Daemon must always have the same version. The version of the File Daemon may differ, see chapter about ??. #

4.1 Updating the configuration files

When updating Bareos through the distribution packaging mechanism, the existing configuration kept as they are.

If you don’t want to modify the behavior, there is normally no need to modify the configuration.

However, in some rare cases, configuration changes are required. These cases are described in the Release Notes.

With Bareos version 16.2.4 the default configuration uses the Subdirectory Configuration Scheme. This scheme offers various improvements. However, if your are updating from earlier versions, your existing single configuration files (/etc/bareos/bareos-*.conf) stay in place and are contentiously used by Bareos. The new default configuration resource files will also be installed (/etc/bareos/bareos-*.d/*/*.conf). However, they will only be used, when the legacy configuration file does not exist.

See Updates from Bareos < 16.2.4 for details and how to migrate to Subdirectory Configuration Scheme.


4.2 Updating the database scheme

Sometimes improvements in Bareos make it necessary to update the database scheme.

Please note! If the Bareos catalog database does not have the current schema, the Bareos Director refuses to start.

Detailed information can then be found in the log file /var/log/bareos/bareos.log.

Take a look into the Release Notes to see which Bareos updates do require a database scheme update.

Please note! Especially the upgrade to Bareos 17.2.0 restructures the File database table. In larger installations this is very time consuming and temporarily doubles the amount of required database disk space.


4.2.1 Debian based Linux Distributions

Since Bareos Version >= 14.2.0 the Debian (and Ubuntu) based packages support the dbconfig-common mechanism to create and update the Bareos database. If this is properly configured, the database schema will be automatically adapted by the Bareos packages.

Please note! When using the PostgreSQL backend and updating to Bareos < 14.2.3, it is necessary to manually grant database permissions, normally by using

root@linux:~#  su - postgres -c /usr/lib/bareos/scripts/grant_bareos_privileges  
Commands 4.1:

For details see dbconfig-common (Debian).

If you disabled the usage of dbconfig-common, follow the instructions for Other Platforms.


4.2.2 Other Platforms

This has to be done as database administrator. On most platforms Bareos knows only about the credentials to access the Bareos database, but not about the database administrator to modify the database schema.

The task of updating the database schema is done by the script /usr/lib/bareos/scripts/update_bareos_tables.

However, this script requires administration access to the database. Depending on your distribution and your database, this requires different preparations. More details can be found in chapter Catalog Maintenance.

Please note! If you’re updating to Bareos <= 13.2.3 and have configured the Bareos database during install using Bareos environment variables (db_name, db_user or db_password, see Catalog Maintenance), make sure to have these variables defined in the same way when calling the update and grant scripts. Newer versions of Bareos read these variables from the Director configuration file /etc/bareos/bareos-dir.conf. However, make sure that the user running the database scripts has read access to this file (or set the environment variables). The postgres user normally does not have the required permissions.


If your are using PostgreSQL and your PostgreSQL administrator is postgres (default), use following commands:

su postgres -c /usr/lib/bareos/scripts/update_bareos_tables 
su postgres -c /usr/lib/bareos/scripts/grant_bareos_privileges  
Commands 4.2: Update PostgreSQL database schema

The grant_bareos_privileges command is required, if new databases tables are introduced. It does not hurt to run it multiple times.

After this, restart the Bareos Director and verify it starts without problems.


Make sure, that root has direct access to the local MySQL server. Check if the command mysql without parameter connects to the database. If not, you may be required to adapt your local MySQL configuration file ~/.my.cnf. It should look similar to this:

Configuration 4.3: MySQL credentials file .my.cnf

If you are able to connect via the mysql to the database, run the following script from the Unix prompt:

Commands 4.4: Update MySQL database schema

Currently on MySQL is it not necessary to run grant_bareos_privileges, because access to the database is already given using wildcards.

After this, restart the Bareos Director and verify it starts without problems.


Chapter 5
Getting Started with Bareos


5.1 Understanding Jobs and Schedules

In order to make Bareos as flexible as possible, the directions given to Bareos are specified in several pieces. The main instruction is the job resource, which defines a job. A backup job generally consists of a FileSet, a Client, a Schedule for one or several levels or times of backups, a Pool, as well as additional instructions. Another way of looking at it is the FileSet is what to backup; the Client is who to backup; the Schedule defines when, and the Pool defines where (i.e. what Volume).

Typically one FileSet/Client combination will have one corresponding job. Most of the directives, such as FileSets, Pools, Schedules, can be mixed and matched among the jobs. So you might have two different Job definitions (resources) backing up different servers using the same Schedule, the same Fileset (backing up the same directories on two machines) and maybe even the same Pools. The Schedule will define what type of backup will run when (e.g. Full on Monday, incremental the rest of the week), and when more than one job uses the same schedule, the job priority determines which actually runs first. If you have a lot of jobs, you might want to use JobDefs, where you can set defaults for the jobs, which can then be changed in the job resource, but this saves rewriting the identical parameters for each job. In addition to the FileSets you want to back up, you should also have a job that backs up your catalog.

Finally, be aware that in addition to the backup jobs there are restore, verify, and admin jobs, which have different requirements.


5.2 Understanding Pools, Volumes and Labels

If you have been using a program such as tar to backup your system, Pools, Volumes, and labeling may be a bit confusing at first. A Volume is a single physical tape (or possibly a single file) on which Bareos will write your backup data. Pools group together Volumes so that a backup is not restricted to the length of a single Volume (tape). Consequently, rather than explicitly naming Volumes in your Job, you specify a Pool, and Bareos will select the next appendable Volume from the Pool and mounts it.

Although the basic Pool options are specified in the Director’s Pool resource, the real Pool is maintained in the Bareos Catalog. It contains information taken from the Pool resource (configuration file) as well as information on all the Volumes that have been added to the Pool.

For each Volume, Bareos maintains a fair amount of catalog information such as the first write date/time, the last write date/time, the number of files on the Volume, the number of bytes on the Volume, the number of Mounts, etc.

Before Bareos will read or write a Volume, the physical Volume must have a Bareos software label so that Bareos can be sure the correct Volume is mounted. Depending on your configuration, this is either done automatically by Bareos or manually using the label command in the Console program.

The steps for creating a Pool, adding Volumes to it, and writing software labels to the Volumes, may seem tedious at first, but in fact, they are quite simple to do, and they allow you to use multiple Volumes (rather than being limited to the size of a single tape). Pools also give you significant flexibility in your backup process. For example, you can have a ”Daily” Pool of Volumes for Incremental backups and a ”Weekly” Pool of Volumes for Full backups. By specifying the appropriate Pool in the daily and weekly backup Jobs, you thereby insure that no daily Job ever writes to a Volume in the Weekly Pool and vice versa, and Bareos will tell you what tape is needed and when.

For more on Pools, see the Pool Resource section of the Director Configuration chapter, or simply read on, and we will come back to this subject later.


5.3 Setting Up Bareos Configuration Files

On Unix, Bareos configuration files are usually located in the /etc/bareos/ directory and are named accordingly to the programs that use it. Since Bareos Version >= 16.2.4 the default configuration is stored as one file per resource in subdirectories under bareos-dir.d, bareos-sd.d or bareos-fd.d. For details, see Customizing the Configuration and Subdirectory Configuration Scheme.


5.4 Testing your Configuration Files

You can test if your configuration file is syntactically correct by running the appropriate daemon with the -t option. The daemon will process the configuration file and print any error messages then terminate.

As the Bareos Director and Bareos Storage Daemon runs as user bareos, testing the configuration should be done as bareos.

This is especially required to test the Bareos Director, as it also connects to the database and checks if the catalog schema version is correct. Depending on your database, only the bareos has permission to access it.

su bareos -s /bin/sh -c "/usr/sbin/bareos-dir -t" 
su bareos -s /bin/sh -c "/usr/sbin/bareos-sd -t" 
bareos-fd -t 
bconsole -t 
bareos-tray-monitor -t  
Commands 5.1: Testing Configuration Files


Chapter 6

This chapter will guide you through running Bareos. To do so, we assume you have installed Bareos. However, we assume that you have not modified the configuration. The examples in this chapter use the default configuration files and will write the volumes to disk in your /var/lib/bareos/storage/ directory.

The general flow of running Bareos is:

  1. Start the Database (if using PostgreSQL or MySQL/MariaDB)
  2. Installing Bareos
  3. Start the Bareos Daemons
  4. Start the Console program to interact with the Bareos Director
  5. Run a job
  6. Test recovering some files from the Volume just written to ensure the backup is good and that you know how to recover. Better test before disaster strikes
  7. Add a second client.

Each of these steps is described in more detail below. #

6.1 Starting the Database

If you are using PostgreSQL or MySQL/MariaDB as the Bareos database, you should start it before you install Bareos. If you are using Sqlite you need do nothing. Sqlite is automatically started by the Bareos Director.


6.2 Installing Bareos

For installing Bareos, follow the instructions from the Installing Bareos chapter.


6.3 Starting the Daemons

Assuming you have installed the packages, to start the three daemons, from your installation directory, simply enter:

service bareos-dir start 
service bareos-sd start 
service bareos-fd start  
bconsole 6.1: start services


6.4 Using the Director to Query and Start Jobs

To communicate with the Bareos Director and to query the state of Bareos or run jobs, the bconsole program can be used as a textual interface. Alternatively, for most purposes, also the Bareos Webui can be used, but for simplicity, here we will describe only the bconsole program.

The bconsole runs the Bareos Console program, which connects to the Bareos Director. Since Bareos is a network program, you can run the Console program anywhere on your network. Most frequently, however, one runs it on the same machine as the Bareos Director. Normally, the Console program will print something similar to the following:

root@linux:~# bconsole 
Connecting to Director bareos:9101 
Enter a period to cancel a command. 
Commands 6.2: bconsole

The asterisk is the console command prompt.

Type help to see a list of available commands:

  Command       Description 
  =======       =========== 
  add           Add media to a pool 
  autodisplay   Autodisplay console messages 
  automount     Automount after label 
  cancel        Cancel a job 
  create        Create DB Pool from resource 
  delete        Delete volume, pool or job 
  disable       Disable a job 
  enable        Enable a job 
  estimate      Performs FileSet estimate, listing gives full listing 
  exit          Terminate Bconsole session 
  export        Export volumes from normal slots to import/export slots 
  gui           Non-interactive gui mode 
  help          Print help on specific command 
  import        Import volumes from import/export slots to normal slots 
  label         Label a tape 
  list          List objects from catalog 
  llist         Full or long list like list command 
  messages      Display pending messages 
  memory        Print current memory usage 
  mount         Mount storage 
  move          Move slots in an autochanger 
  prune         Prune expired records from catalog 
  purge         Purge records from catalog 
  quit          Terminate Bconsole session 
  query         Query catalog 
  restore       Restore files 
  relabel       Relabel a tape 
  release       Release storage 
  reload        Reload conf file 
  rerun         Rerun a job 
  run           Run a job 
  status        Report status 
  setbandwidth  Sets bandwidth 
  setdebug      Sets debug level 
  setip         Sets new client address -- if authorized 
  show          Show resource records 
  sqlquery      Use SQL to query catalog 
  time          Print current time 
  trace         Turn on/off trace to file 
  unmount       Unmount storage 
  umount        Umount - for old-time Unix guys, see unmount 
  update        Update volume, pool or stats 
  use           Use specific catalog 
  var           Does variable expansion 
  version       Print Director version 
  wait          Wait until no jobs are running  
bconsole 6.3: help

Details of the console program’s commands are explained in the Bareos Console chapter.


6.5 Running a Job

At this point, we assume you have done the following:

Furthermore, we assume for the moment you are using the default configuration files.

At this point, enter the show filesets and you should get something similar this:

*show filesets 
FileSet { 
  Name = "SelfTest" 
  Include { 
    Options { 
      Signature = MD5 
    File = "/usr/sbin" 
FileSet { 
  Name = "Catalog" 
  Include { 
    Options { 
      Signature = MD5 
    File = "/var/lib/bareos/bareos.sql" 
    File = "/etc/bareos" 
bconsole 6.4: show filesets

One of the FileSets is the pre-defined SelfTestDir FileSet FileSet that will backup the /usr/sbin directory. For testing purposes, we have chosen a directory of moderate size (about 30 Megabytes) and complexity without being too big. The FileSet CatalogDir FileSet is used for backing up Bareos’s catalog and is not of interest to us for the moment. You can change what is backed up by editing the configuration and changing the File = line in the FileSetDir resource.

Now is the time to run your first backup job. We are going to backup your Bareos source directory to a File Volume in your /var/lib/bareos/storage/ directory just to show you how easy it is. Now enter:

*status dir 
bareos-dir Version: 13.2.0 (09 April 2013) x86_64-pc-linux-gnu debian Debian GNU/Linux 6.0 (squeeze) 
Daemon started 23-May-13 13:17. Jobs: run=0, running=0 mode=0 
 Heap: heap=270,336 smbytes=59,285 max_bytes=59,285 bufs=239 max_bufs=239 
Scheduled Jobs: 
Level          Type     Pri  Scheduled          Name               Volume 
Incremental    Backup    10  23-May-13 23:05    BackupClient1      testvol 
Full           Backup    11  23-May-13 23:10    BackupCatalog      testvol 
Running Jobs: 
Console connected at 23-May-13 13:34 
No Jobs running. 
bconsole 6.5: status dir

where the times and the Director’s name will be different according to your setup. This shows that an Incremental job is scheduled to run for the Job BackupClient1Dir Job at 1:05am and that at 1:10, a BackupCatalogDir Job is scheduled to run.

Now enter:

*status client 
Automatically selected Client: bareos-fd 
Connecting to Client bareos-fd at bareos:9102 
bareos-fd Version: 13.2.0 (09 April 2013)  x86_64-pc-linux-gnu debian Debian GNU/Linux 6.0 (squeeze) 
Daemon started 23-May-13 13:17. Jobs: run=0 running=0. 
 Heap: heap=135,168 smbytes=26,000 max_bytes=26,147 bufs=65 max_bufs=66 
 Sizeof: boffset_t=8 size_t=8 debug=0 trace=0 bwlimit=0kB/s 
Running Jobs: 
Director connected at: 23-May-13 13:58 
No Jobs running. 
bconsole 6.6: status client

In this case, the client is named bareos-fdDir Client your name might be different, but the line beginning with bareos-fd Version is printed by your Bareos File Daemon, so we are now sure it is up and running.

Finally do the same for your Bareos Storage Daemon with:

*status storage 
Automatically selected Storage: File 
Connecting to Storage daemon File at bareos:9103 
bareos-sd Version: 13.2.0 (09 April 2013) x86_64-pc-linux-gnu debian Debian GNU/Linux 6.0 (squeeze) 
Daemon started 23-May-13 13:17. Jobs: run=0, running=0. 
 Heap: heap=241,664 smbytes=28,574 max_bytes=88,969 bufs=73 max_bufs=74 
 Sizes: boffset_t=8 size_t=8 int32_t=4 int64_t=8 mode=0 bwlimit=0kB/s 
Running Jobs: 
No Jobs running. 
Device status: 
Device "FileStorage" (/var/lib/bareos/storage) is not open. 
Used Volume status: 
bconsole 6.7: status storage

You will notice that the default Bareos Storage Daemon device is named FileDir Storage and that it will use device /var/lib/bareos/storage, which is not currently open.

Now, let’s actually run a job with:

bconsole 6.8: run

you should get the following output:

Automatically selected Catalog: MyCatalog 
Using Catalog "MyCatalog" 
A job name must be specified. 
The defined Job resources are: 
     1: BackupClient1 
     2: BackupCatalog 
     3: RestoreFiles 
Select Job resource (1-3):  
bconsole 6.9: select job

Here, Bareos has listed the three different Jobs that you can run, and you should choose number 1 and type enter, at which point you will get:

Run Backup job 
JobName:  BackupClient1 
Level:    Incremental 
Client:   bareos-fd 
Format:   Native 
FileSet:  SelfTest 
Pool:     Full (From Job resource) 
NextPool: *None* (From unknown source) 
Storage:  File (From Job resource) 
When:     2013-05-23 14:50:04 
Priority: 10 
OK to run? (yes/mod/no):  
bconsole 6.10: run job

At this point, take some time to look carefully at what is printed and understand it. It is asking you if it is OK to run a job named BackupClient1Dir Job with FileSet SelfTestDir FileSet as an Incremental job on your Client, and to use Storage FileDir Storage and Pool FullDir Pool, and finally, it wants to run it now (the current time should be displayed by your console).

Here we have the choice to run (yes), to modify one or more of the above parameters (mod), or to not run the job (no). Please enter yes, at which point you should immediately get the command prompt (an asterisk).

If you wait a few seconds, then enter the command messages you will get back something like:

TODO: Replace bconsole output by current version of Bareos.

28-Apr-2003 14:30 bareos-sd: Wrote label to prelabeled Volume 
   "TestVolume001" on device /var/lib/bareos/storage 
28-Apr-2003 14:30 rufus-dir: Bareos 1.30 (28Apr03): 28-Apr-2003 14:30 
JobId:                  1 
Job:                    BackupClient1.2003-04-28_14.22.33 
FileSet:                Full Set 
Backup Level:           Full 
Client:                 bareos-fd 
Start time:             28-Apr-2003 14:22 
End time:               28-Apr-2003 14:30 
Files Written:          1,444 
Bytes Written:          38,988,877 
Rate:                   81.2 KB/s 
Software Compression:   None 
Volume names(s):        TestVolume001 
Volume Session Id:      1 
Volume Session Time:    1051531381 
Last Volume Bytes:      39,072,359 
FD termination status:  OK 
SD termination status:  OK 
Termination:            Backup OK 
28-Apr-2003 14:30 rufus-dir: Begin pruning Jobs. 
28-Apr-2003 14:30 rufus-dir: No Jobs found to prune. 
28-Apr-2003 14:30 rufus-dir: Begin pruning Files. 
28-Apr-2003 14:30 rufus-dir: No Files found to prune. 
28-Apr-2003 14:30 rufus-dir: End auto prune.  
bconsole 6.11: run

If you don’t see the output immediately, you can keep entering messages until the job terminates.

Instead of typing messages multiple times, you can also ask bconsole to wait, until a specific job is finished:

*wait jobid=1  
bconsole 6.12: wait

or just wait , which waits for all running jobs to finish.

Another useful command is autodisplay on. With autodisplay activated, messages will automatically be displayed as soon as they are ready.

If you do an ls -l of your /var/lib/bareos/storage directory, you will see that you have the following item:

-rw-r-----    1 bareos bareos   39072153 Apr 28 14:30 Full-001  
bconsole 6.13: volume

This is the file Volume that you just wrote and it contains all the data of the job just run. If you run additional jobs, they will be appended to this Volume unless you specify otherwise.

If you would like to stop here, you can simply enter quit in the Console program.

If you would like to try restoring the files that you just backed up, read the following section.


6.6 Restoring Your Files

If you have run the default configuration and run the job as demonstrated above, you can restore the backed up files in the Console program by entering:

*restore all 
First you select one or more JobIds that contain files 
to be restored. You will be presented several methods 
of specifying the JobIds. Then you will be allowed to 
select which files from those JobIds are to be restored. 
To select the JobIds, you have the following choices: 
     1: List last 20 Jobs run 
     2: List Jobs where a given File is saved 
     3: Enter list of comma separated JobIds to select 
     4: Enter SQL list command 
     5: Select the most recent backup for a client 
     6: Select backup for a client before a specified time 
     7: Enter a list of files to restore 
     8: Enter a list of files to restore before a specified time 
     9: Find the JobIds of the most recent backup for a client 
    10: Find the JobIds for a backup for a client before a specified time 
    11: Enter a list of directories to restore for found JobIds 
    12: Select full restore to a specified Job date 
    13: Cancel 
Select item:  (1-13):  
bconsole 6.14: restore

As you can see, there are a number of options, but for the current demonstration, please enter 5 to do a restore of the last backup you did, and you will get the following output:

Automatically selected Client: bareos-fd 
The defined FileSet resources are: 
     1: Catalog 
     2: Full Set 
Select FileSet resource (1-2):  
bconsole 6.15: select resource

As you can see, Bareos knows what client you have, and since there was only one, it selected it automatically. Select 2, because you want to restore files from the file set.

| jobid | level | jobfiles | jobbytes   | starttime           | volumename    | 
|     1 | F     |      166 | 19,069,526 | 2013-05-05 23:05:02 | TestVolume001 | 
You have selected the following JobIds: 1 
Building directory tree for JobId(s) 1 ...  +++++++++++++++++++++++++++++++++++++++++ 
165 files inserted into the tree and marked for extraction. 
You are now entering file selection mode where you add (mark) and 
remove (unmark) files to be restored. No files are initially added, unless 
you used the "all" keyword on the command line. 
Enter "done" to leave this mode. 
cwd is: / 
bconsole 6.16: restore filesystem

where I have truncated the listing on the right side to make it more readable.

Then Bareos produced a listing containing all the jobs that form the current backup, in this case, there is only one, and the Storage daemon was also automatically chosen. Bareos then took all the files that were in Job number 1 and entered them into a directory tree (a sort of in memory representation of your filesystem). At this point, you can use the cd and ls or dir commands to walk up and down the directory tree and view what files will be restored. For example, if you enter cd /usr/sbin and then enter dir you will get a listing of all the files in the /usr/sbin/ directory. On your system, the path might be somewhat different. For more information on this, please refer to the Restore Command Chapter of this manual for more details.

To exit this mode, simply enter:

bconsole 6.17: done

and you will get the following output:

Bootstrap records written to 
The restore job will require the following Volumes: 
1444 files selected to restore. 
Run Restore job 
JobName:         RestoreFiles 
Bootstrap:      /home/user/bareos/testbin/working/restore.bsr 
Where:          /tmp/bareos-restores 
Replace:        always 
FileSet:        Full Set 
Backup Client:  rufus-fd 
Restore Client: rufus-fd 
Storage:        File 
JobId:          *None* 
When:           2005-04-28 14:53:54 
OK to run? (yes/mod/no): 
Bootstrap records written to /var/lib/bareos/bareos-dir.restore.1.bsr 
The job will require the following 
   Volume(s)                 Storage(s)                SD Device(s) 
    TestVolume001             File                      FileStorage 
Volumes marked with "*" are online. 
166 files selected to be restored. 
Run Restore job 
JobName:         RestoreFiles 
Bootstrap:       /var/lib/bareos/bareos-dir.restore.1.bsr 
Where:           /tmp/bareos-restores 
Replace:         Always 
FileSet:         Full Set 
Backup Client:   bareos-fd 
Restore Client:  bareos-fd 
Format:          Native 
Storage:         File 
When:            2013-05-23 15:56:53 
Catalog:         MyCatalog 
Priority:        10 
Plugin Options:  *None* 
OK to run? (yes/mod/no):  
bconsole 6.18: job report

If you answer yes your files will be restored to /tmp/bareos-restores. If you want to restore the files to their original locations, you must use the mod option and explicitly set Where: to nothing (or to /). We recommend you go ahead and answer yes and after a brief moment, enter messages , at which point you should get a listing of all the files that were restored as well as a summary of the job that looks similar to this:

23-May 15:24 bareos-dir JobId 2: Start Restore Job RestoreFiles.2013-05-23_15.24.01_10 
23-May 15:24 bareos-dir JobId 2: Using Device "FileStorage" to read. 
23-May 15:24 bareos-sd JobId 2: Ready to read from volume "TestVolume001" on device "FileStorage" (/var/lib/bareos/storage). 
23-May 15:24 bareos-sd JobId 2: Forward spacing Volume "TestVolume001" to file:block 0:194. 
23-May 15:58 bareos-dir JobId 3: Bareos bareos-dir 13.2.0 (09Apr13): 
  Build OS:               x86_64-pc-linux-gnu debian Debian GNU/Linux 6.0 (squeeze) 
  JobId:                  2 
  Job:                    RestoreFiles.2013-05-23_15.58.48_11 
  Restore Client:         bareos-fd 
  Start time:             23-May-2013 15:58:50 
  End time:               23-May-2013 15:58:52 
  Files Expected:         166 
  Files Restored:         166 
  Bytes Restored:         19,069,526 
  Rate:                   9534.8 KB/s 
  FD Errors:              0 
  FD termination status:  OK 
  SD termination status:  OK 
  Termination:            Restore OK  
bconsole 6.19: job report

After exiting the Console program, you can examine the files in /tmp/bareos-restores, which will contain a small directory tree with all the files. Be sure to clean up at the end with:

root@linux:~# rm -rf /tmp/bareos-restore  
Commands 6.20: remove restore directory


6.7 Quitting the Console Program

Simply enter the command quit .


6.8 Adding a Client

If you have gotten the example shown above to work on your system, you may be ready to add a second Client (Bareos File Daemon). That is you have a second machine that you would like backed up. Lets assume, following settings about the machine you want to add to your backup environment:

Hostname (FQDN)
IP Address
Linux (otherwise the paths may differ)

For this you have to make changes on the server side (Bareos Director) and the client side.

Client: install package

See Installing Bareos about how to add the Bareos repository. The only part you need installed on the other machine is the bareos-filedaemon.

Director: configure client

Bareos Version >= 16.2.4 offers the configure add command to add resources to the Bareos Director.

Start the bconsole and use the configure add client command. Address must be a DNS resolvable name or an IP address.

*configure add client name=client2-fd address= password=secret 
Created resource config file "/etc/bareos/bareos-dir.d/client/client2-fd.conf": 
Client { 
  Name = client2-fd 
  Address = 
  Password = secret 
bconsole 6.21: add a client

This creates two resource configuration files:

The /etc/bareos/bareos-dir-export/client/client2-fd/bareos-fd.d/director/bareos-dir.conf is the required resource needed on the Bareos File Daemon. You can copy it to the destination:

scp /etc/bareos/bareos-dir-export/client/client2-fd/bareos-fd.d/director/bareos-dir.conf root@client2.example.com:/etc/bareos/bareos-fd.d/director/  
Commands 6.22: Copy the bareos-fd director resource to the new client

Manual configuration

Alternatively you can configure your resources manually. On the Bareos Director create the file

Client { 
  Name = client2-fd 
  Address = 
  Password = secret 
Resource 6.23: bareos-dir.d/client/client2-fd.conf

Reload or restart your Bareos Director:

bconsole 6.24: reload the Director configuration

The corresponding Bareos File Daemon director resource can be created directly on the client, see below.

Client: configure

The package bareos-filedaemon Version >= 16.2.4 brings several configuration files:

In detail:

defines the name of the client. The default is <hostname>-fd. Changes are only required, if you want to use another name or en- or disable special Bareos File Daemon features. See Client Resource.
gives the Bareos Director bareos-dir full access to this Bareos File Daemon. During installation, the Password Fd Director is set to a random default. Adapt the name and/or the password to your Bareos Director. (The name bareos-dir is the default Bareos Director name since Bareos Version >= 16.2.4.)
gives the Bareos Director bareos-mon restricted access to this Bareos File Daemon. During installation, the Password Fd Director is set to a random value. This resource is intended to be used by the local bareos-tray-monitor.
defines, how messages should be handled. The default sends all relevant messages to the Bareos Director.

If your Bareos Director is named bareos-dir, the /etc/bareos/bareos-fd.d/director/bareos-dir.conf may already be overwritten by the file you copied from the Bareos Director. If your Director has another name, an addition resource file will exists. You can define an arbitrary number of Bareos Director’s in your Bareos File Daemon configuration. However, normally you will only have one DirectorFd with full control of your Bareos File Daemon and optional one DirectorFd for monitoring (used by the Bareos Tray Monitor).

Anyhow, the resource will look similar to this:

Director { 
  Name = bareos-dir 
  Password = "[md5]5ebe2294ecd0e0f08eab7690d2a6ee69" 
Resource 6.25: bareos-fd.d/director/bareos-dir.conf

After a restart of the Bareos File Daemon to reload the configuration this resource allows the access for a Bareos Director with name bareos-dir and password secret (stored in MD5 format).

service bareos-fd restart  
Commands 6.26: restart bareos-fd

Manual configuration

If you have not created the DirectorFd by configure , you can create it also manually. If your Bareos Director is also named bareos-dir, modify or create the file /etc/bareos/bareos-fd.d/director/bareos-dir.conf:

Director { 
  Name = "bareos-dir"   # Name of your Bareos Director 
  Password = "secret"   # Password (cleartext or MD5) must be identical 
                        # to the password of your client reosurce in the Direcotr 
                        # (bareos-dir.d/client/client2-fd.conf) 
Resource 6.27: bareos-fd.d/director/bareos-dir.conf

See the relation between resource names and password of the different Bareos components in Names, Passwords and Authorization.

If your are not using the Subdirectory Configuration Scheme, make sure that this resource file gets included in your Bareos File Daemon configuration. You can verify this by

bareos-fd -xc  
Commands 6.28: show how bareos-fd would read the current configuration files

After modifying the file, you have to restart the Bareos File Daemon:

service bareos-fd restart  
Commands 6.29: restart bareos-fd

Director: test client, add a job

The following example show how to

*status client=client2-fd 
*configure add job name=client2-job client=client2-fd jobdefs=DefaultJob 
Created resource config file "/etc/bareos/bareos-dir.d/job/client2-job.conf": 
Job { 
  Name = client2-job 
  Client = client2-fd 
  JobDefs = DefaultJob 
*estimate listing job=client2-job 
*run job=client2-job 
*wait jobid=... 
*list joblog jobid=... 
*list files jobid=... 
*list volumes 
bconsole 6.30: test the client and add a job resource


6.9 Patience When Starting Daemons or Mounting Blank Tapes

When you start the Bareos daemons, the Storage daemon attempts to open all defined storage devices and verify the currently mounted Volume (if configured). Until all the storage devices are verified, the Storage daemon will not accept connections from the Console program. If a tape was previously used, it will be rewound, and on some devices this can take several minutes. As a consequence, you may need to have a bit of patience when first contacting the Storage daemon after starting the daemons. If you can see your tape drive, once the lights stop flashing, the drive will be ready to be used.

The same considerations apply if you have just mounted a blank tape in a drive. It can take a minute or two before the drive properly recognizes that the tape is blank. If you attempt to mount the tape with the Console program during this recognition period, it is quite possible that you will hang your SCSI driver. As a consequence, you are again urged to have patience when inserting blank tapes. Let the device settle down before attempting to access it.


6.10 Pools

Creating the Pool is automatically done when the Bareos Director starts, so if you understand Pools, you can skip to the next section.

When you run a backup job, one of the things that Bareos must know is what Volumes to use. Instead of specifying a Volume (tape) directly, you specify which Pool of Volumes you want Bareos to consult when it wants a Volume for writing backups. Bareos will select the first available Volume from the Pool that is appropriate for the Storage Dir Job you have specified for the Job being run. When a volume has filled up with data, Bareos will change its VolStatus from Append to Full, and then Bareos will use the next volume and so on. If no appendable Volume exists in the Pool, the Director will attempt to recycle an old Volume. For details, please read the Automatic Volume Recycling chapter.

If there are still no appendable Volumes available, Bareos will send a message requesting the operator to create an appropriate Volume.

Bareos keeps track of the Pool name, the volumes contained in the Pool, and a number of attributes of each of those Volumes.

When Bareos starts, it ensures that all Pool resource definitions have been recorded in the catalog. You can verify this by entering:

*list pools 
| PoolId | Name         | NumVols | MaxVols | PoolType | LabelFormat   | 
| 1      | Full         | 1       | 100     | Backup   | Full-         | 
| 2      | Differential | 0       | 100     | Backup   | Differential- | 
| 3      | Incremental  | 1       | 100     | Backup   | Incremental-  | 
| 4      | Scratch      | 0       | 0       | Backup   | *             | 
bconsole 6.31: list pools


6.11 Other Useful Console Commands

Show the list all all available commands.
help list
Show detail information about a specific command, in this case the command list .
status dir
Print a status of all running jobs and jobs scheduled in the next 24 hours.
The console program will prompt you to select a daemon type, then will request the daemon’s status.
status jobid=nn
Print a status of JobId nn if it is running. The Storage daemon is contacted and requested to print a current status of the job as well.
list pools
List the pools defined in the Catalog (normally only Default is used).
list volumes
Lists all the media defined in the Catalog.
list jobs
Lists all jobs in the Catalog that have run.
list jobid=nn
Lists JobId nn from the Catalog.
list jobtotals
Lists totals for all jobs in the Catalog.
list files jobid=nn
List the files that were saved for JobId nn.
list jobmedia
List the media information for each Job run.
Prints any messages that have been directed to the console.
Exit or quit the console program.

Most of the commands given above, with the exception of list, will prompt you for the necessary arguments if you simply enter the command name.

The full list of commands is shown in the chapter Console Commands.


Chapter 7
Critical Items to Implement Before Production

We recommend you take your time before implementing a production on a Bareos backup system since Bareos is a rather complex program, and if you make a mistake, you may suddenly find that you cannot restore your files in case of a disaster. This is especially true if you have not previously used a major backup product.

If you follow the instructions in this chapter, you will have covered most of the major problems that can occur. It goes without saying that if you ever find that we have left out an important point, please inform us, so that we can document it to the benefit of everyone.


7.1 Critical Items

The following assumes that you have installed Bareos, you more or less understand it, you have at least worked through the tutorial or have equivalent experience, and that you have set up a basic production configuration. If you haven’t done the above, please do so and then come back here. The following is a sort of checklist that points with perhaps a brief explanation of why you should do it. In most cases, you will find the details elsewhere in the manual. The order is more or less the order you would use in setting up a production system (if you already are in production, use the checklist anyway).


7.2 Recommended Items

Although these items may not be critical, they are recommended and will help you avoid problems.

If you absolutely must implement a system where you write a different tape each night and take it offsite in the morning. We recommend that you do several things:

Part II


Chapter 8
Customizing the Configuration

Each Bareos component (Director, Client, Storage, Console) has its own configuration containing a set of resource definitions. These resources are very similar from one service to another, but may contain different directives (records) depending on the component. For example, in the Director configuration, the Director Resource defines the name of the Director, a number of global Director parameters and his password. In the File daemon configuration, the Director Resource specifies which Directors are permitted to use the File daemon.

If you install all Bareos daemons (Director, Storage and File Daemon) onto one system, the Bareos package tries its best to generate a working configuration as a basis for your individual configuration.

The details of each resource and the directives permitted therein are described in the following chapters.

The following configuration files must be present:


8.1 Configuration Path Layout

When a Bareos component starts, it reads its configuration. In Bareos < 16.2.2 only configuration files (which optionally can include other files) are supported. Since Bareos Version >= 16.2.2 also configuration subdirectories are supported.


In this section, the following naming is used:


8.1.1 What configuration will be used?

When starting a Bareos component, it will look for its configuration. Bareos components allow the configuration file/directory to be specified as a command line parameter -c $PATH.

As the $CONFIGDIR differs between platforms or is overwritten by the path parameter, the documentation will often refer to the configuration without the leading path (e.g. $COMPONENT.d/*/*.conf instead of $CONFIGDIR/$COMPONENT.d/*/*.conf).


When subdirectory configuration is used, all files matching $PATH/$COMPONENT.d/*/*.conf will be read, see Subdirectory Configuration Scheme.

Relation between Bareos components and configuration

Bareos component

Configuration File
(default path on Unix)

                        Subdirectory Configuration Scheme
                        (default path on Unix)
                        since Bareos >= 16.2.2

bareos-dir bareos-dir.conf bareos-dir.d
Director Configuration (/etc/bareos/bareos-dir.conf) (/etc/bareos/bareos-dir.d/)

bareos-sd bareos-sd.conf bareos-sd.d
Storage Daemon Configuration (/etc/bareos/bareos-sd.conf) (/etc/bareos/bareos-sd.d/)

bareos-fd bareos-fd.conf bareos-fd.d
Client/File Daemon Configuration(/etc/bareos/bareos-fd.conf) (/etc/bareos/bareos-fd.d/)

bconsole bconsole.conf bconsole.d
Console Configuration (/etc/bareos/bconsole.conf) (/etc/bareos/bconsole.d/)

bareos-traymonitor tray-monitor.conf tray-monitor.d
Monitor Configuration (/etc/bareos/tray-monitor.conf) (/etc/bareos/tray-monitor.d/)

bat bat.conf (not supported)

Volume Utility Commands bareos-sd.conf bareos-sd.d
(use the bareos-sd configuration) (/etc/bareos/bareos-sd.conf) (/etc/bareos/bareos-sd.d/)


8.1.2 Subdirectory Configuration Scheme

If the subdirectory configuration is used, instead of a single configuration file, all files matching $COMPONENT.d/*/*.conf are read as a configuration, see What configuration will be used?.

Reason for the Subdirectory Configuration Scheme

In Bareos < 16.2.2, Bareos uses one configuration file per component.

Most larger Bareos environments split their configuration into separate files, making it easier to manage the configuration.

Also some extra packages (bareos-webui, plugins, ...) require a configuration, which must be included into the Bareos Director or Bareos Storage Daemon configuration. The subdirectory approach makes it easier to add or modify the configuration resources of different Bareos packages.

The Bareos configure command requires a configuration directory structure, as provided by the subdirectory approach.

From Bareos Version >= 16.2.4 on, new installations will use configuration subdirectories by default.

Resource file conventions

Using Subdirectories Configuration Scheme

New installation

Updates from Bareos < 16.2.4


8.2 Configuration File Format

A configuration file consists of one or more resources (see Resource).

Bareos programs can work with


8.2.1 Character Sets

Bareos is designed to handle most character sets of the world, US ASCII, German, French, Chinese, ... However, it does this by encoding everything in UTF-8, and it expects all configuration files (including those read on Win32 machines) to be in UTF-8 format. UTF-8 is typically the default on Linux machines, but not on all Unix machines, nor on Windows, so you must take some care to ensure that your locale is set properly before starting Bareos.

To ensure that Bareos configuration files can be correctly read including foreign characters, the LANG environment variable must end in .UTF-8. A full example is en_US.UTF-8. The exact syntax may vary a bit from OS to OS, so that the way you have to define it will differ from the example. On most newer Win32 machines you can use notepad to edit the conf files, then choose output encoding UTF-8.

Bareos assumes that all filenames are in UTF-8 format on Linux and Unix machines. On Win32 they are in Unicode (UTF-16) and will hence be automatically converted to UTF-8 format.



When reading a configuration, blank lines are ignored and everything after a hash sign (#) until the end of the line is taken to be a comment.


8.2.3 Semicolons

A semicolon (;) is a logical end of line and anything after the semicolon is considered as the next statement. If a statement appears on a line by itself, a semicolon is not necessary to terminate it, so generally in the examples in this manual, you will not see many semicolons.


8.2.4 Including other Configuration Files

If you wish to break your configuration file into smaller pieces, you can do so by including other files using the syntax @filename where filename is the full path and filename of another file. The @filename specification can be given anywhere a primitive token would appear.

Configuration 8.3: include a configuration file

Since Bareos Version >= 16.2.1 wildcards in pathes are supported:

Configuration 8.4: include multiple configuration files

By using @|command it is also possible to include the output of a script as a configuration:

Configuration 8.5: use the output of a script as configuration

or if a parameter should be used:

@|"sh -c ’/etc/bareos/generate_client_configuration_to_stdout.sh clientname=client1.example.com’"  
Configuration 8.6: use the output of a script with parameter as a configuration

The scripts are called at the start of the daemon. You should use this with care.


8.3 Resource

A resource is defined as the resource type (see Resource Types), followed by an open brace ({), a number of Resource Directives, and ended by a closing brace (})

Each resource definition MUST contain a Name directive. It can contain a Description directive. The Name directive is used to uniquely identify the resource. The Description directive can be used during the display of the Resource to provide easier human recognition. For example:

Director { 
  Name = "bareos-dir" 
  Description = "Main Bareos Director" 
  Query File = "/usr/lib/bareos/scripts/query.sql" 
Configuration 8.7: Resource example

defines the Director resource with the name bareos-dir and a query file /usr/lib/bareos/scripts/query.sql.

When naming resources, for some resource types naming conventions should be applied:

names should be postfixed with -fd
names should be postfixed with -sd
names should be postfixed with -dir

These conventions helps a lot when reading log messages.


8.3.1 Resource Directive

Each directive contained within the resource (within the curly braces {}) is composed of a Resource Directive Keyword followed by an equal sign (=) followed by a Resource Directive Value. The keywords must be one of the known Bareos resource record keywords.


8.3.2 Resource Directive Keyword

A resource directive keyword is the part before the equal sign (=) in a Resource Directive. The following sections will list all available directives by Bareos component resources.

Upper and Lower Case and Spaces

Case (upper/lower) and spaces are ignored in the resource directive keywords.

Within the keyword (i.e. before the equal sign), spaces are not significant. Thus the keywords: name, Name, and N a m e are all identical.


8.3.3 Resource Directive Value

A resource directive value is the part after the equal sign (=) in a Resource Directive.


Spaces after the equal sign and before the first character of the value are ignored. Other spaces within a value may be significant (not ignored) and may require quoting.


In general, if you want spaces in a name to the right of the first equal sign (=), you must enclose that name within double quotes. Otherwise quotes are not generally necessary because once defined, quoted strings and unquoted strings are all equal.

Within a quoted string, any character following a backslash () is taken as itself (handy for inserting backslashes and double quotes (”)).

Please note! If the configure directive is used to define a number, the number is never to be put between surrounding quotes. This is even true if the number is specified together with its unit, like 365 days.


Numbers are not to be quoted, see Quotes. Also do not prepend numbers by zeros (0), as these are not parsed in the expected manner (write 1 instead of 01).

Data Types

When parsing the resource directives, Bareos classifies the data according to the types listed below.

This directive defines what is permitted to be accessed. It does this by using a list of regular expressions, separated by commas (,) or using multiple directives. If ! is prepended, the expression is negated. The special keyword *all* allows unrestricted access.

Depending on the type of the ACL, the regular expressions can be either resource names, paths or console commands.

Since Bareos Version >= 16.2.4 regular expression are handled more strictly. Before also substring matches has been accepted.

For clarification, we demonstrate the usage of ACLs by some examples for Command ACL Dir Console:

Command ACL = help  
Configuration 8.8: Allow only the help command
Command ACL = help, list  
Configuration 8.9: Allow the help and the list command
Command ACL = help, iDoNotExist  
Configuration 8.10: Allow the help and the (not existing) iDoNotExist command
Command ACL = *all*  
Configuration 8.11: Allow all commands (special keyword)
Command ACL = !sqlquery, !u.*, *all*  
Configuration 8.12: Allow all commands except sqlquery and commands starting with u


Command ACL = !sqlquery, !u.* 
Command ACL = *all*  
Configuration 8.13: Some as above. Specifying it in multiple lines doesn’t change the meaning
Command ACL = !sqlquery 
Command ACL = !u.* 
Comamnd ACL = !set(ip|debug) 
Comamnd ACL = *all*  
Configuration 8.14: Additional deny the setip and setdebug commands

Please note! ACL checking stops at the first match. So the following definition allows all commands, which might not be what you expected:

# WARNING: this configuration ignores !sqlquery, as *all* is matched before. 
Command ACL = *all*, !sqlquery  
Configuration 8.15: Wrong: Allows all commands
Specifies the authentication type that must be supplied when connecting to a backup protocol that uses a specific authentication type. Currently only used for NDMP Resource.

The following values are allowed:

- Use no password
- Use clear text password
- Use MD5 hashing
A 32 bit integer value. It may be positive or negative.

Don’t use quotes around the number, see Quotes.

long integer
A 64 bit integer value. Typically these are values such as bytes that can exceed 4 billion and thus require a 64 bit value.

Don’t use quotes around the number, see Quotes.

job protocol

The protocol to run a the job. Following protocols are available:

Native Bareos job protocol.
Deprecated. Alias for NDMP_BAREOS.
Since Bareos Version >= 17.2.3. See NDMP_BAREOS.
Since Bareos Version >= 17.2.3. See NDMP_NATIVE.
A keyword or name consisting of alphanumeric characters, including the hyphen, underscore, and dollar characters. The first character of a name must be a letter. A name has a maximum length currently set to 127 bytes.

Please note that Bareos resource names as well as certain other names (e.g. Volume names) must contain only letters (including ISO accented letters), numbers, and a few special characters (space, underscore, ...). All other characters and punctuation are invalid.

This is a Bareos password and it is stored internally in MD5 hashed format.
A path is either a quoted or non-quoted string. A path will be passed to your standard shell for expansion when it is scanned. Thus constructs such as $HOME are interpreted to be their correct values. The path can either reference to a file or a directory.
positive integer
A 32 bit positive integer value.

Don’t use quotes around the number, see Quotes.

The speed parameter can be specified as k/s, kb/s, m/s or mb/s.

Don’t use quotes around the parameter, see Quotes.

A quoted string containing virtually any character including spaces, or a non-quoted string. A string may be of any length. Strings are typically values that correspond to filenames, directories, or system command names. A backslash () turns the next character into itself, so to include a double quote in a string, you precede the double quote with a backslash. Likewise to include a backslash.
Multiple strings, specified in multiple directives, or in a single directive, separated by commas (,).
is similar to a name, except that the name may be quoted and can thus contain additional characters including spaces.
is either a domain name or an IP address specified as a dotted quadruple in string or quoted string format. This directive only permits a single address to be specified. The net-port must be specificly separated. If multiple net-addresses are needed, please assess if it is also possible to specify net-addresses (plural).
Specify a set of net-addresses and net-ports. Probably the simplest way to explain this is to show an example:
Addresses  = { 
    ip = { addr =; port = 1205;} 
    ipv4 = { 
        addr =; port = http;} 
    ipv6 = { 
        addr =; 
        port = 1205; 
    ip = { 
        addr = 
        port = 1205 
    ip = { addr = } 
    ip = { addr = 201:220:222::2 } 
    ip = { 
        addr = server.example.com 
Configuration 8.16: net-addresses

where ip, ip4, ip6, addr, and port are all keywords. Note, that the address can be specified as either a dotted quadruple, or in IPv6 colon notation, or as a symbolic name (only in the ip specification). Also, the port can be specified as a number or as the mnemonic value from the /etc/services file. If a port is not specified, the default one will be used. If an ip section is specified, the resolution can be made either by IPv4 or IPv6. If ip4 is specified, then only IPv4 resolutions will be permitted, and likewise with ip6.

Specify a network port (a positive integer).

Don’t use quotes around the parameter, see Quotes.

A resource defines a relation to the name of another resource.
A size specified as bytes. Typically, this is a floating point scientific input format followed by an optional modifier. The floating point input is stored as a 64 bit integer value. If a modifier is present, it must immediately follow the value with no intervening spaces. The following modifiers are permitted:
1,024 (kilobytes)
1,000 (kilobytes)
1,048,576 (megabytes)
1,000,000 (megabytes)
1,073,741,824 (gigabytes)
1,000,000,000 (gigabytes)

Don’t use quotes around the parameter, see Quotes.

A time or duration specified in seconds. The time is stored internally as a 64 bit integer value, but it is specified in two parts: a number part and a modifier part. The number can be an integer or a floating point number. If it is entered in floating point notation, it will be rounded to the nearest integer. The modifier is mandatory and follows the number part, either with or without intervening spaces. The following modifiers are permitted:
(60 seconds)
(3600 seconds)
(3600*24 seconds)
(3600*24*7 seconds)
(3600*24*30 seconds)
(3600*24*91 seconds)
(3600*24*365 seconds)

Any abbreviation of these modifiers is also permitted (i.e. seconds may be specified as sec or s). A specification of m will be taken as months.

The specification of a time may have as many number/modifier parts as you wish. For example:

1 week 2 days 3 hours 10 mins  
1 month 2 days 30 sec

are valid date specifications.

Don’t use quotes around the parameter, see Quotes.

Specifies the commands that should be logged on execution (audited). E.g.
Audit Events = label 
Audit Events = restore  
Configuration 8.17:

Based on the type string-list.

Either a yes or a no (or true or false).

Variable Expansion

Depending on the directive, Bareos will expand to the following variables:

Variable Expansion on Volume Labels

When labeling a new volume (see Label Format Dir Pool), following Bareos internal variables can be used:

Internal Variable





Month: 1-12


Day: 1-31


Hour: 0-24


Minute: 0-59


Second: 0-59


Day of the week: 0-6, using 0 for Sunday


Name of the Job


Name of the Director


Job Level


Job Type




unique name of a job


Name of the Storage Daemon


Name of the Clients


Numbers of volumes in the pool


Name of the Pool


Name of the Catalog


Type of the media

Additional, normal environment variables can be used, e.g. $HOME oder $HOSTNAME.

With the exception of Job specific variables, you can trigger the variable expansion by using the var command.

Variable Expansion in Autochanger Commands At the configuration of autochanger commands the following variables can be used:




Archive Device Name


Changer Device Name


Changer Drive Index


Client’s Name


Job Name




Slot Base 0


Slot Base 1


Volume Name

Variable Expansion in Mount Commands At the configuration of mount commands the following variables can be used:




Archive Device Name




Part Number


Mount Point


Last Part Name

Variable Expansion on RunScripts Variable Expansion on RunScripts is described at Run Script Dir Job.

Variable Expansion in Mail and Operator Commands At the configuration of mail and operator commands the following variables can be used:




Client’s Name


Director’s Name


Job Exit Code




Unique Job Id


Job Level


Unadorned Job Name


Since Time


Job Type (Backup, ...)




Read Volume Name


Write Volume Name


Job Bytes


Job Bytes in human readable format


Job Files


8.3.4 Resource Types

The following table lists all current Bareos resource types. It shows what resources must be defined for each service (daemon). The default configuration files will already contain at least one example of each permitted resource.


Autochanger x

Catalog x

Client x x

Console x x

Device x

Director x x x x

FileSet x

Job x

JobDefs x

Message x x x


Pool x

Profile x

Schedule x

Storage x x


8.4 Names, Passwords and Authorization

In order for one daemon to contact another daemon, it must authorize itself with a password. In most cases, the password corresponds to a particular name, so both the name and the password must match to be authorized. Passwords are plain text, any text. They are not generated by any special process; just use random text.

The default configuration files are automatically defined for correct authorization with random passwords. If you add to or modify these files, you will need to take care to keep them consistent.


Figure 8.1: Relation between resource names and passwords

In the left column, you can see the Director, Storage, and Client resources and their corresponding names and passwords – these are all in bareos-dir.conf. In the right column the corresponding values in the Console, Storage daemon (SD), and File daemon (FD) configuration files are shown.

Please note that the address fw-sd, that appears in the Storage resource of the Director, is passed to the File daemon in symbolic form. The File daemon then resolves it to an IP address. For this reason you must use either an IP address or a resolvable fully qualified name. A name such as localhost, not being a fully qualified name, will resolve in the File daemon to the localhost of the File daemon, which is most likely not what is desired. The password used for the File daemon to authorize with the Storage daemon is a temporary password unique to each Job created by the daemons and is not specified in any .conf file.


Chapter 9
Director Configuration

Of all the configuration files needed to run Bareos, the Director’s is the most complicated and the one that you will need to modify the most often as you add clients or modify the FileSets.

For a general discussion of configuration files and resources including the recognized data types see Customizing the Configuration.

Everything revolves around a job and is tied to a job in one way or another.

The Bareos Director knows about following resource types:


9.1 Director Resource

The Director resource defines the attributes of the Directors running on the network. Only a single Director resource is allowed.

The following is an example of a valid Director resource definition:

Director { 
  Name = bareos-dir 
  Password = secretpassword 
  QueryFile = "/etc/bareos/query.sql" 
  Maximum Concurrent Jobs = 10 
  Messages = Daemon 
Configuration 9.1: Director Resource example

configuration directive name
type of data
default value

Absolute Job Timeout = positive-integer
Audit Events = audit-command-list
Auditing = yes|no no
Backend Directory = DirectoryList /usr/lib/bareos/backends (platform specific)
Description = string
Dir Address = net-address 9101
Dir Addresses = net-addresses 9101
Dir Port = net-port 9101
Dir Source Address = net-address 0
FD Connect Timeout = time 180
Heartbeat Interval = time 0
Key Encryption Key = password
Log Timestamp Format = string
Maximum Concurrent Jobs = positive-integer 1
Maximum Connections = positive-integer 30
Maximum Console Connections = positive-integer 20
Messages = resource-name
Name = name required
NDMP Log Level = positive-integer 4
NDMP Snooping = yes|no
Omit Defaults = yes|no yes deprecated
Optimize For Size = yes|no no
Optimize For Speed = yes|no no
Password = password required
Pid Directory = path /var/lib/bareos (platform specific)
Plugin Directory = path
Plugin Names = PluginNames
Query File = path required
Scripts Directory = path
SD Connect Timeout = time 1800
Secure Erase Command = string
Statistics Collect Interval= positive-integer150
Statistics Retention = time 160704000
Sub Sys Directory = path deprecated
Subscriptions = positive-integer0
TLS Allowed CN = string-list
TLS Authenticate = yes|no no
TLS CA Certificate Dir = path
TLS CA Certificate File = path
TLS Certificate = path
TLS Certificate Revocation List= path
TLS Cipher List = string
TLS DH File = path
TLS Enable = yes|nono
TLS Key = path
TLS Psk Enable = yes|noyes
TLS Psk Require = yes|nono
TLS Require = yes|nono
TLS Verify Peer = yes|nono
Use Pam Authentication = yes|nono
Ver Id = string
Working Directory = path /var/lib/bareos (platform specific)

Absolute Job Timeout = <positive-integer>

Version >= 14.2.0
Audit Events = <audit-command-list>

Specify which commands (see Console Commands) will be audited. If nothing is specified (and Auditing Dir Director is enabled), all commands will be audited.  
Version >= 14.2.0
Auditing = <yes|no>
(default: no)
This directive allows to en- or disable auditing of interaction with the Bareos Director. If enabled, audit messages will be generated. The messages resource configured in Messages Dir Director defines, how these messages are handled.  
Version >= 14.2.0
Backend Directory = <DirectoryList>
(default: /usr/lib/bareos/backends (platform specific))
This directive specifies a directory from where the Bareos Director loads his dynamic backends.  
Description = <string>

The text field contains a description of the Director that will be displayed in the graphical user interface. This directive is optional.  
Dir Address = <net-address>
(default: 9101)
This directive is optional, but if it is specified, it will cause the Director server (for the Console program) to bind to the specified address. If this and the Dir Addresses Dir Director directives are not specified, the Director will bind to any available address (the default).  
Dir Addresses = <net-addresses>
(default: 9101)
Specify the ports and addresses on which the Director daemon will listen for Bareos Console connections.

Please note that if you use the Dir Addresses Dir Director directive, you must not use either a Dir Port Dir Director or a Dir Address Dir Director directive in the same resource.  

Dir Port = <net-port>
(default: 9101)
Specify the port on which the Director daemon will listen for Bareos Console connections. This same port number must be specified in the Director resource of the Console configuration file. This directive should not be used if you specify Dir Addresses Dir Director (N.B plural) directive.  
Dir Source Address = <net-address>
(default: 0)
This record is optional, and if it is specified, it will cause the Director server (when initiating connections to a storage or file daemon) to source its connections from the specified address. Only a single IP address may be specified. If this record is not specified, the Director server will source its outgoing connections according to the system routing table (the default).  
FD Connect Timeout = <time>
(default: 180)
where time is the time that the Director should continue attempting to contact the File daemon to start a job, and after which the Director will cancel the job.  
Heartbeat Interval = <time>
(default: 0)
This directive is optional and if specified will cause the Director to set a keepalive interval (heartbeat) in seconds on each of the sockets it opens for the Client resource. This value will override any specified at the Director level. It is implemented only on systems that provide the setsockopt TCP_KEEPIDLE function (Linux, ...). The default value is zero, which means no change is made to the socket.  
Key Encryption Key = <password>

This key is used to encrypt the Security Key that is exchanged between the Director and the Storage Daemon for supporting Application Managed Encryption (AME). For security reasons each Director should have a different Key Encryption Key.  
Log Timestamp Format = <string>

Version >= 15.2.3
Maximum Concurrent Jobs = <positive-integer>
(default: 1)
This directive specifies the maximum number of total Director Jobs that should run concurrently.

The Volume format becomes more complicated with multiple simultaneous jobs, consequently, restores may take longer if Bareos must sort through interleaved volume blocks from multiple simultaneous jobs. This can be avoided by having each simultaneous job write to a different volume or by using data spooling, which will first spool the data to disk simultaneously, then write one spool file at a time to the volume thus avoiding excessive interleaving of the different job blocks.

See also the section about Concurrent Jobs.  

Maximum Connections = <positive-integer>
(default: 30)
Maximum Console Connections = <positive-integer>
(default: 20)
This directive specifies the maximum number of Console Connections that could run concurrently.  
Messages = <resource-name>

The messages resource specifies where to deliver Director messages that are not associated with a specific Job. Most messages are specific to a job and will be directed to the Messages resource specified by the job. However, there are a messages that can occur when no job is running.  
Name = <name>
The name of the resource.

The director name used by the system administrator.  

NDMP Log Level = <positive-integer>
(default: 4)
This directive sets the loglevel for the NDMP protocol library.  
Version >= 13.2.0
NDMP Snooping = <yes|no>

This directive enables the Snooping and pretty printing of NDMP protocol information in debugging mode.  
Version >= 13.2.0
Omit Defaults = <yes|no>
(default: yes)
Please note! This directive is deprecated.
Omit config variables with default values when dumping the config.

When showing the configuration, omit those parameter that have there default value assigned.  

Optimize For Size = <yes|no>
(default: no)
If set to yes this directive will use the optimizations for memory size over speed. So it will try to use less memory which may lead to a somewhat lower speed. Its currently mostly used for keeping all hardlinks in memory.

If none of Optimize For Size Dir Director and Optimize For Speed Dir Director is enabled, Optimize For Size Dir Director is enabled by default.  

Optimize For Speed = <yes|no>
(default: no)
If set to yes this directive will use the optimizations for speed over the memory size. So it will try to use more memory which lead to a somewhat higher speed. Its currently mostly used for keeping all hardlinks in memory. Its relates to the Optimize For Size Dir Director option set either one to yes as they are mutually exclusive.  
Password = <password>
Specifies the password that must be supplied for the default Bareos Console to be authorized. This password correspond to Password Console Director of the Console configuration file.

The password is plain text.  

Pid Directory = <path>
(default: /var/lib/bareos (platform specific))
This directive is optional and specifies a directory in which the Director may put its process Id file. The process Id file is used to shutdown Bareos and to prevent multiple copies of Bareos from running simultaneously. Standard shell expansion of the Directory is done when the configuration file is read so that values such as $HOME will be properly expanded.

The PID directory specified must already exist and be readable and writable by the Bareos daemon referencing it.

Typically on Linux systems, you will set this to: /var/run. If you are not installing Bareos in the system directories, you can use the Working Directory as defined above.  

Plugin Directory = <path>

Plugins are loaded from this directory. To load only specific plugins, use ’Plugin Names’.

Version >= 14.2.0

Plugin Names = <PluginNames>

List of plugins, that should get loaded from ’Plugin Directory’ (only basenames, ’-dir.so’ is added automatically). If empty, all plugins will get loaded.

Version >= 14.2.0

Query File = <path>
This directive is required and specifies a directory and file in which the Director can find the canned SQL statements for the query command.  
Scripts Directory = <path>

This directive is currently unused.


SD Connect Timeout = <time>
(default: 1800)
where time is the time that the Director should continue attempting to contact the Storage daemon to start a job, and after which the Director will cancel the job.  
Secure Erase Command = <string>

Specify command that will be called when bareos unlinks files.

When files are no longer needed, Bareos will delete (unlink) them. With this directive, it will call the specified command to delete these files. See Secure Erase Command for details.  
Version >= 15.2.1

Statistics Collect Interval = <positive-integer>
(default: 150)
Bareos offers the possibility to collect statistic information from its connected devices. To do so, Collect Statistics Dir Storage must be enabled. This interval defines, how often the Director connects to the attached Storage Daemons to collect the statistic information.  
Version >= 14.2.0
Statistics Retention = <time>
(default: 160704000)
The Statistics Retention directive defines the length of time that Bareos will keep statistics job records in the Catalog database after the Job End time (in the catalog JobHisto table). When this time period expires, and if user runs prune stats command, Bareos will prune (remove) Job records that are older than the specified period.

Theses statistics records aren’t use for restore purpose, but mainly for capacity planning, billings, etc. See chapter Job Statistics for additional information.  

Sub Sys Directory = <path>

Please note! This directive is deprecated.
Subscriptions = <positive-integer>
(default: 0)
In case you want check that the number of active clients don’t exceed a specific number, you can define this number here and check with the status subscriptions command.

However, this is only intended to give a hint. No active limiting is implemented.  
Version >= 12.4.4

TLS Allowed CN = <string-list>

”Common Name”s (CNs) of the allowed peer certificates.


TLS Authenticate = <yes|no>
(default: no)
Use TLS only to authenticate, not for encryption.


TLS CA Certificate Dir = <path>

Path of a TLS CA certificate directory.


TLS CA Certificate File = <path>

Path of a PEM encoded TLS CA certificate(s) file.


TLS Certificate = <path>

Path of a PEM encoded TLS certificate.


TLS Certificate Revocation List = <path>

Path of a Certificate Revocation List file.


TLS Cipher List = <string>

List of valid TLS Ciphers.


TLS DH File = <path>

Path to PEM encoded Diffie-Hellman parameter file. If this directive is specified, DH key exchange will be used for the ephemeral keying, allowing for forward secrecy of communications.


TLS Enable = <yes|no>
(default: no)
Enable TLS support.

Bareos can be configured to encrypt all its network traffic. See chapter TLS Configuration Directives to see, how the Bareos Director (and the other components) must be configured to use TLS.  

TLS Key = <path>

Path of a PEM encoded private key. It must correspond to the specified ”TLS Certificate”.


TLS Psk Enable = <yes|no>
(default: yes)
Enable TLS-PSK support.


TLS Psk Require = <yes|no>
(default: no)
Without setting this to yes, Bareos can fall back to use unencryption connections. Enabling this implicitly sets ”TLS-PSK Enable = yes”.


TLS Require = <yes|no>
(default: no)
Without setting this to yes, Bareos can fall back to use unencrypted connections. Enabling this implicitly sets ”TLS Enable = yes”.


TLS Verify Peer = <yes|no>
(default: no)
If disabled, all certificates signed by a known CA will be accepted. If enabled, the CN of a certificate must the Address or in the ”TLS Allowed CN” list.


Use Pam Authentication = <yes|no>
(default: no)
Ver Id = <string>

where string is an identifier which can be used for support purpose. This string is displayed using the version command.  
Working Directory = <path>
(default: /var/lib/bareos (platform specific))
This directive is optional and specifies a directory in which the Director may put its status files. This directory should be used only by Bareos but may be shared by other Bareos daemons. Standard shell expansion of the directory is done when the configuration file is read so that values such as $HOME will be properly expanded.

The working directory specified must already exist and be readable and writable by the Bareos daemon referencing it.  


9.2 Job Resource

The Job resource defines a Job (Backup, Restore, ...) that Bareos must perform. Each Job resource definition contains the name of a Client and a FileSet to backup, the Schedule for the Job, where the data are to be stored, and what media Pool can be used. In effect, each Job resource must specify What, Where, How, and When or FileSet, Storage, Backup/Restore/Level, and Schedule respectively. Note, the FileSet must be specified for a restore job for historical reasons, but it is no longer used.

Only a single type (Backup, Restore, ...) can be specified for any job. If you want to backup multiple FileSets on the same Client or multiple Clients, you must define a Job for each one.

Note, you define only a single Job to do the Full, Differential, and Incremental backups since the different backup levels are tied together by a unique Job name. Normally, you will have only one Job per Client, but if a client has a really huge number of files (more than several million), you might want to split it into to Jobs each with a different FileSet covering only part of the total files.

Multiple Storage daemons are not currently supported for Jobs, so if you do want to use multiple storage daemons, you will need to create a different Job and ensure that for each Job that the combination of Client and FileSet are unique. The Client and FileSet are what Bareos uses to restore a client, so if there are multiple Jobs with the same Client and FileSet or multiple Storage daemons that are used, the restore will not work. This problem can be resolved by defining multiple FileSet definitions (the names must be different, but the contents of the FileSets may be the same).

configuration directive name
type of data
default value

Accurate = yes|no no
Add Prefix = string
Add Suffix = string
Allow Duplicate Jobs = yes|no yes
Allow Higher Duplicates = yes|no yes
Allow Mixed Priority = yes|no no
Always Incremental = yes|no no
Always Incremental Job Retention= time 0
Always Incremental Keep Number= positive-integer 0
Always Incremental Max Full Age = time
Backup Format = string Native
Base = ResourceList
Bootstrap = path
Cancel Lower Level Duplicates = yes|no no
Cancel Queued Duplicates = yes|no no
Cancel Running Duplicates = yes|no no
Catalog = resource-name
Client = resource-name
Client Run After Job = RunscriptShort
Client Run Before Job = RunscriptShort
Description = string
Differential Backup Pool = resource-name
Differential Max Runtime = time
Differential Max Wait Time = time deprecated
Dir Plugin Options = string-list
Enabled = yes|no yes
FD Plugin Options = string-list
File History Size = Size64 10000000
File Set = resource-name
Full Backup Pool = resource-name
Full Max Runtime = time
Full Max Wait Time = time deprecated
Incremental Backup Pool = resource-name
Incremental Max Runtime = time
Incremental Max Wait Time= time deprecated
Job Defs = resource-name
Job To Verify = resource-name
Level = BackupLevel
Max Concurrent Copies = positive-integer 100
Max Diff Interval = time
Max Full Consolidations = positive-integer 0
Max Full Interval = time
Max Run Sched Time = time
Max Run Time = time
Max Start Delay = time
Max Virtual Full Interval = time
Max Wait Time = time
Maximum Bandwidth = speed
Maximum Concurrent Jobs= positive-integer 1
Messages = resource-name required
Name = name required
Next Pool = resource-name
Plugin Options = string-list alias, deprecated
Pool = resource-name required
Prefer Mounted Volumes = yes|no yes
Prefix Links = yes|no no
Priority = positive-integer 10
Protocol = job protocol Native
Prune Files = yes|no no
Prune Jobs = yes|no no
Prune Volumes = yes|no no
Purge Migration Job = yes|no no
Regex Where = string
Replace = ReplaceOption Always
Rerun Failed Levels = yes|no no
Reschedule Interval = time 1800
Reschedule On Error= yes|no no
Reschedule Times = positive-integer 5
Run = string-list
Run After Failed Job= RunscriptShort
Run After Job = RunscriptShort
Run Before Job = RunscriptShort
Run Script {Runscript }
Save File History = yes|no yes
Schedule = resource-name
SD Plugin Options = string-list
Selection Pattern = string
Selection Type = MigrationType
Spool Attributes = yes|no no
Spool Data = yes|no no
Spool Size = Size64
Storage = ResourceList
Strip Prefix = string
Type = JobType required
Verify Job = resource-name alias
Virtual Full Backup Pool= resource-name
Where = path
Write Bootstrap = path
Write Part After Job = yes|no deprecated
Write Verify List = path

Accurate = <yes|no>
(default: no)
In accurate mode, the File daemon knowns exactly which files were present after the last backup. So it is able to handle deleted or renamed files.

When restoring a FileSet for a specified date (including ”most recent”), Bareos is able to restore exactly the files and directories that existed at the time of the last backup prior to that date including ensuring that deleted files are actually deleted, and renamed directories are restored properly.

When doing VirtualFull backups, it is advised to use the accurate mode, otherwise the VirtualFull might contain already deleted files.

However, using the accurate mode has also disadvantages:


Add Prefix = <string>

This directive applies only to a Restore job and specifies a prefix to the directory name of all files being restored. This will use File Relocation feature.  
Add Suffix = <string>

This directive applies only to a Restore job and specifies a suffix to all files being restored. This will use File Relocation feature.

Using Add Suffix=.old, /etc/passwd will be restored to /etc/passwsd.old  

Allow Duplicate Jobs = <yes|no>
(default: yes)

Figure 9.1: Allow Duplicate Jobs usage

A duplicate job in the sense we use it here means a second or subsequent job with the same name starts. This happens most frequently when the first job runs longer than expected because no tapes are available.

If this directive is enabled duplicate jobs will be run. If the directive is set to no then only one job of a given name may run at one time. The action that Bareos takes to ensure only one job runs is determined by the directives

If none of these directives is set to yes, Allow Duplicate Jobs is set to no and two jobs are present, then the current job (the second one started) will be cancelled.  

Allow Higher Duplicates = <yes|no>
(default: yes)
Allow Mixed Priority = <yes|no>
(default: no)
When set to yes, this job may run even if lower priority jobs are already running. This means a high priority job will not have to wait for other jobs to finish before starting. The scheduler will only mix priorities when all running jobs have this set to true.

Note that only higher priority jobs will start early. Suppose the director will allow two concurrent jobs, and that two jobs with priority 10 are running, with two more in the queue. If a job with priority 5 is added to the queue, it will be run as soon as one of the running jobs finishes. However, new priority 10 jobs will not be run until the priority 5 job has finished.  

Always Incremental = <yes|no>
(default: no)
Enable/disable always incremental backup scheme.

Version >= 16.2.4

Always Incremental Job Retention = <time>
(default: 0)
Backup Jobs older than the specified time duration will be merged into a new Virtual backup.

Version >= 16.2.4

Always Incremental Keep Number = <positive-integer>
(default: 0)
Guarantee that at least the specified number of Backup Jobs will persist, even if they are older than ”Always Incremental Job Retention”.

Version >= 16.2.4

Always Incremental Max Full Age = <time>

If ”AlwaysIncrementalMaxFullAge” is set, during consolidations only incremental backups will be considered while the Full Backup remains to reduce the amount of data being consolidated. Only if the Full Backup is older than ”AlwaysIncrementalMaxFullAge”, the Full Backup will be part of the consolidation to avoid the Full Backup becoming too old .

Version >= 16.2.4

Backup Format = <string>
(default: Native)
The backup format used for protocols which support multiple formats. By default, it uses the Bareos Native Backup format. Other protocols, like NDMP supports different backup formats for instance:


Base = <ResourceList>

The Base directive permits to specify the list of jobs that will be used during Full backup as base. This directive is optional. See the Base Job chapter for more information.  
Bootstrap = <path>

The Bootstrap directive specifies a bootstrap file that, if provided, will be used during Restore Jobs and is ignored in other Job types. The bootstrap file contains the list of tapes to be used in a restore Job as well as which files are to be restored. Specification of this directive is optional, and if specified, it is used only for a restore job. In addition, when running a Restore job from the console, this value can be changed.

If you use the restore command in the Console program, to start a restore job, the bootstrap file will be created automatically from the files you select to be restored.

For additional details see The Bootstrap File chapter.  

Cancel Lower Level Duplicates = <yes|no>
(default: no)
If Allow Duplicate Jobs Dir Job is set to no and this directive is set to yes, Bareos will choose between duplicated jobs the one with the highest level. For example, it will cancel a previous Incremental to run a Full backup. It works only for Backup jobs. If the levels of the duplicated jobs are the same, nothing is done and the directives Cancel Queued Duplicates Dir Job and Cancel Running Duplicates Dir Job will be examined.  
Cancel Queued Duplicates = <yes|no>
(default: no)
If Allow Duplicate Jobs Dir Job is set to no and if this directive is set to yes any job that is already queued to run but not yet running will be canceled.  
Cancel Running Duplicates = <yes|no>
(default: no)
If Allow Duplicate Jobs Dir Job is set to no and if this directive is set to yes any job that is already running will be canceled.  
Catalog = <resource-name>

This specifies the name of the catalog resource to be used for this Job. When a catalog is defined in a Job it will override the definition in the client.  
Version >= 13.4.0
Client = <resource-name>

The Client directive specifies the Client (File daemon) that will be used in the current Job. Only a single Client may be specified in any one Job. The Client runs on the machine to be backed up, and sends the requested files to the Storage daemon for backup, or receives them when restoring. For additional details, see the Client Resource of this chapter. This directive is required For versions before 13.3.0, this directive is required for all Jobtypes. For Version >= 13.3.0 it is required for all Jobtypes but Copy or Migrate jobs.  
Client Run After Job = <RunscriptShort>

This is a shortcut for the Run Script Dir Job resource, that run on the client after a backup job.  
Client Run Before Job = <RunscriptShort>

This is basically a shortcut for the Run Script Dir Job resource, that run on the client before the backup job.

Please note! For compatibility reasons, with this shortcut, the command is executed directly when the client receive it. And if the command is in error, other remote runscripts will be discarded. To be sure that all commands will be sent and executed, you have to use Run Script Dir Job syntax.  

Description = <string>

Differential Backup Pool = <resource-name>

The Differential Backup Pool specifies a Pool to be used for Differential backups. It will override any Pool Dir Job specification during a Differential backup.  
Differential Max Runtime = <time>

The time specifies the maximum allowed time that a Differential backup job may run, counted from when the job starts (not necessarily the same as when the job was scheduled).  
Differential Max Wait Time = <time>

Please note! This directive is deprecated.
This directive has been deprecated in favor of Differential Max Runtime Dir Job.  
Dir Plugin Options = <string-list>

These settings are plugin specific, see Director Plugins.  
Enabled = <yes|no>
(default: yes)
En- or disable this resource.

This directive allows you to enable or disable automatic execution via the scheduler of a Job.  

FD Plugin Options = <string-list>

These settings are plugin specific, see File Daemon Plugins.  
File History Size = <Size64>
(default: 10000000)
When using NDMP and Save File History Dir Job is enabled, this directives controls the size of the internal temporary database (LMDB) to translate NDMP file and directory information into Bareos file and directory information.

File History Size must be greater the number of directories + files of this NDMP backup job.

Please note! This uses a large memory mapped file (File History Size 256=⇒ around 2,3 GB for the File History Size = 10000000). On 32-bit systems or if a memory limit for the user running the Bareos Director (normally bareos) exists (verify by su - bareos -s /bin/sh -c "ulimit -a"), this may fail.  
Version >= 15.2.4

File Set = <resource-name>

The FileSet directive specifies the FileSet that will be used in the current Job. The FileSet specifies which directories (or files) are to be backed up, and what options to use (e.g. compression, ...). Only a single FileSet resource may be specified in any one Job. For additional details, see the FileSet Resource section of this chapter. This directive is required (For versions before 13.3.0 for all Jobtypes and for versions after that for all Jobtypes but Copy and Migrate).  
Full Backup Pool = <resource-name>

The Full Backup Pool specifies a Pool to be used for Full backups. It will override any Pool Dir Job specification during a Full backup.  
Full Max Runtime = <time>

The time specifies the maximum allowed time that a Full backup job may run, counted from when the job starts (not necessarily the same as when the job was scheduled).  
Full Max Wait Time = <time>

Please note! This directive is deprecated.
This directive has been deprecated in favor of Full Max Runtime Dir Job.  
Incremental Backup Pool = <resource-name>

The Incremental Backup Pool specifies a Pool to be used for Incremental backups. It will override any Pool Dir Job specification during an Incremental backup.  
Incremental Max Runtime = <time>

The time specifies the maximum allowed time that an Incremental backup job may run, counted from when the job starts, (not necessarily the same as when the job was scheduled).  
Incremental Max Wait Time = <time>

Please note! This directive is deprecated.
This directive has been deprecated in favor of Incremental Max Runtime Dir Job  
Job Defs = <resource-name>

If a Job Defs resource name is specified, all the values contained in the named Job Defs resource will be used as the defaults for the current Job. Any value that you explicitly define in the current Job resource, will override any defaults specified in the Job Defs resource. The use of this directive permits writing much more compact Job resources where the bulk of the directives are defined in one or more Job Defs. This is particularly useful if you have many similar Jobs but with minor variations such as different Clients. To structure the configuration even more, Job Defs themselves can also refer to other Job Defs.  
Job To Verify = <resource-name>

Level = <BackupLevel>

The Level directive specifies the default Job level to be run. Each different Type Dir Job (Backup, Restore, Verify, ...) has a different set of Levels that can be specified. The Level is normally overridden by a different value that is specified in the Schedule Resource. This directive is not required, but must be specified either by this directive or as an override specified in the Schedule Resource.

For a Backup Job, the Level may be one of the following:

When the Level is set to Full all files in the FileSet whether or not they have changed will be backed up.

When the Level is set to Incremental all files specified in the FileSet that have changed since the last successful backup of the the same Job using the same FileSet and Client, will be backed up. If the Director cannot find a previous valid Full backup then the job will be upgraded into a Full backup. When the Director looks for a valid backup record in the catalog database, it looks for a previous Job with:
  • The same Job name.
  • The same Client name.
  • The same FileSet (any change to the definition of the FileSet such as adding or deleting a file in the Include or Exclude sections constitutes a different FileSet.
  • The Job was a Full, Differential, or Incremental backup.
  • The Job terminated normally (i.e. did not fail or was not canceled).
  • The Job started no longer ago than Max Full Interval.

If all the above conditions do not hold, the Director will upgrade the Incremental to a Full save. Otherwise, the Incremental backup will be performed as requested.

The File daemon (Client) decides which files to backup for an Incremental backup by comparing start time of the prior Job (Full, Differential, or Incremental) against the time each file was last ”modified” (st_mtime) and the time its attributes were last ”changed”(st_ctime). If the file was modified or its attributes changed on or after this start time, it will then be backed up.

Some virus scanning software may change st_ctime while doing the scan. For example, if the virus scanning program attempts to reset the access time (st_atime), which Bareos does not use, it will cause st_ctime to change and hence Bareos will backup the file during an Incremental or Differential backup. In the case of Sophos virus scanning, you can prevent it from resetting the access time (st_atime) and hence changing st_ctime by using the --no-reset-atime option. For other software, please see their manual.

When Bareos does an Incremental backup, all modified files that are still on the system are backed up. However, any file that has been deleted since the last Full backup remains in the Bareos catalog, which means that if between a Full save and the time you do a restore, some files are deleted, those deleted files will also be restored. The deleted files will no longer appear in the catalog after doing another Full save.

In addition, if you move a directory rather than copy it, the files in it do not have their modification time (st_mtime) or their attribute change time (st_ctime) changed. As a consequence, those files will probably not be backed up by an Incremental or Differential backup which depend solely on these time stamps. If you move a directory, and wish it to be properly backed up, it is generally preferable to copy it, then delete the original.

However, to manage deleted files or directories changes in the catalog during an Incremental backup you can use Job Resource. This is quite memory consuming process.


When the Level is set to Differential all files specified in the FileSet that have changed since the last successful Full backup of the same Job will be backed up. If the Director cannot find a valid previous Full backup for the same Job, FileSet, and Client, backup, then the Differential job will be upgraded into a Full backup. When the Director looks for a valid Full backup record in the catalog database, it looks for a previous Job with:
  • The same Job name.
  • The same Client name.
  • The same FileSet (any change to the definition of the FileSet such as adding or deleting a file in the Include or Exclude sections constitutes a different FileSet.
  • The Job was a FULL backup.
  • The Job terminated normally (i.e. did not fail or was not canceled).
  • The Job started no longer ago than Max Full Interval.

If all the above conditions do not hold, the Director will upgrade the Differential to a Full save. Otherwise, the Differential backup will be performed as requested.

The File daemon (Client) decides which files to backup for a differential backup by comparing the start time of the prior Full backup Job against the time each file was last ”modified” (st_mtime) and the time its attributes were last ”changed” (st_ctime). If the file was modified or its attributes were changed on or after this start time, it will then be backed up. The start time used is displayed after the Since on the Job report. In rare cases, using the start time of the prior backup may cause some files to be backed up twice, but it ensures that no change is missed.

When Bareos does a Differential backup, all modified files that are still on the system are backed up. However, any file that has been deleted since the last Full backup remains in the Bareos catalog, which means that if between a Full save and the time you do a restore, some files are deleted, those deleted files will also be restored. The deleted files will no longer appear in the catalog after doing another Full save. However, to remove deleted files from the catalog during a Differential backup is quite a time consuming process and not currently implemented in Bareos. It is, however, a planned future feature.

As noted above, if you move a directory rather than copy it, the files in it do not have their modification time (st_mtime) or their attribute change time (st_ctime) changed. As a consequence, those files will probably not be backed up by an Incremental or Differential backup which depend solely on these time stamps. If you move a directory, and wish it to be properly backed up, it is generally preferable to copy it, then delete the original. Alternatively, you can move the directory, then use the touch program to update the timestamps.

However, to manage deleted files or directories changes in the catalog during an Differential backup you can use accurate mode. This is quite memory consuming process. See for more details.

Every once and a while, someone asks why we need Differential backups as long as Incremental backups pickup all changed files. There are possibly many answers to this question, but the one that is the most important for me is that a Differential backup effectively merges all the Incremental and Differential backups since the last Full backup into a single Differential backup. This has two effects: 1. It gives some redundancy since the old backups could be used if the merged backup cannot be read. 2. More importantly, it reduces the number of Volumes that are needed to do a restore effectively eliminating the need to read all the volumes on which the preceding Incremental and Differential backups since the last Full are done.


When the Level is set to VirtualFull, a new Full backup is generated from the last existing Full backup and the matching Differential- and Incremental-Backups. It matches this according the Name Dir Client and Name Dir FileSet. This means, a new Full backup get created without transfering all the data from the client to the backup server again. The new Full backup will be stored in the pool defined in Next Pool Dir Pool.

Please note! Opposite to the other backup levels, VirtualFull may require read and write access to multiple volumes. In most cases you have to make sure, that Bareos does not try to read and write to the same Volume.


For a Restore Job, no level needs to be specified.

For a Verify Job, the Level may be one of the following:

does a scan of the specified FileSet and stores the file attributes in the Catalog database. Since no file data is saved, you might ask why you would want to do this. It turns out to be a very simple and easy way to have a Tripwire like feature using Bareos. In other words, it allows you to save the state of a set of files defined by the FileSet and later check to see if those files have been modified or deleted and if any new files have been added. This can be used to detect system intrusion. Typically you would specify a FileSet that contains the set of system files that should not change (e.g. /sbin, /boot, /lib, /bin, ...). Normally, you run the InitCatalog level verify one time when your system is first setup, and then once again after each modification (upgrade) to your system. Thereafter, when your want to check the state of your system files, you use a Verify level = Catalog. This compares the results of your InitCatalog with the current state of the files.

Compares the current state of the files against the state previously saved during an InitCatalog. Any discrepancies are reported. The items reported are determined by the verify options specified on the Include directive in the specified FileSet (see the FileSet resource below for more details). Typically this command will be run once a day (or night) to check for any changes to your system files.

Please note! If you run two Verify Catalog jobs on the same client at the same time, the results will certainly be incorrect. This is because Verify Catalog modifies the Catalog database while running in order to track new files.


This level causes Bareos to read the file attribute data written to the Volume from the last backup Job for the job specified on the VerifyJob directive. The file attribute data are compared to the values saved in the Catalog database and any differences are reported. This is similar to the DiskToCatalog level except that instead of comparing the disk file attributes to the catalog database, the attribute data written to the Volume is read and compared to the catalog database. Although the attribute data including the signatures (MD5 or SHA1) are compared, the actual file data is not compared (it is not in the catalog).

VolumeToCatalog jobs need a client to extract the metadata, but this client does not have to be the original client. We suggest to use the client on the backup server itself for maximum performance.

Please note! If you run two Verify VolumeToCatalog jobs on the same client at the same time, the results will certainly be incorrect. This is because the Verify VolumeToCatalog modifies the Catalog database while running.


This level causes Bareos to read the files as they currently are on disk, and to compare the current file attributes with the attributes saved in the catalog from the last backup for the job specified on the VerifyJob directive. This level differs from the VolumeToCatalog level described above by the fact that it doesn’t compare against a previous Verify job but against a previous backup. When you run this level, you must supply the verify options on your Include statements. Those options determine what attribute fields are compared.

This command can be very useful if you have disk problems because it will compare the current state of your disk against the last successful backup, which may be several jobs.

Note, the current implementation does not identify files that have been deleted.


Max Concurrent Copies = <positive-integer>
(default: 100)
Max Diff Interval = <time>

The time specifies the maximum allowed age (counting from start time) of the most recent successful Differential backup that is required in order to run Incremental backup jobs. If the most recent Differential backup is older than this interval, Incremental backups will be upgraded to Differential backups automatically. If this directive is not present, or specified as 0, then the age of the previous Differential backup is not considered.  
Max Full Consolidations = <positive-integer>
(default: 0)
If ”AlwaysIncrementalMaxFullAge” is configured, do not run more than ”MaxFullConsolidations” consolidation jobs that include the Full backup.

Version >= 16.2.4

Max Full Interval = <time>

The time specifies the maximum allowed age (counting from start time) of the most recent successful Full backup that is required in order to run Incremental or Differential backup jobs. If the most recent Full backup is older than this interval, Incremental and Differential backups will be upgraded to Full backups automatically. If this directive is not present, or specified as 0, then the age of the previous Full backup is not considered.  
Max Run Sched Time = <time>

The time specifies the maximum allowed time that a job may run, counted from when the job was scheduled. This can be useful to prevent jobs from running during working hours. We can see it like Max Start Delay + Max Run Time.  
Max Run Time = <time>

The time specifies the maximum allowed time that a job may run, counted from when the job starts, (not necessarily the same as when the job was scheduled).

By default, the watchdog thread will kill any Job that has run more than 6 days. The maximum watchdog timeout is independent of Max Run Time and cannot be changed.  

Max Start Delay = <time>

The time specifies the maximum delay between the scheduled time and the actual start time for the Job. For example, a job can be scheduled to run at 1:00am, but because other jobs are running, it may wait to run. If the delay is set to 3600 (one hour) and the job has not begun to run by 2:00am, the job will be canceled. This can be useful, for example, to prevent jobs from running during day time hours. The default is no limit.  
Max Virtual Full Interval = <time>

The time specifies the maximum allowed age (counting from start time) of the most recent successful Virtual Full backup that is required in order to run Incremental or Differential backup jobs. If the most recent Virtual Full backup is older than this interval, Incremental and Differential backups will be upgraded to Virtual Full backups automatically. If this directive is not present, or specified as 0, then the age of the previous Virtual Full backup is not considered.  
Version >= 14.4.0
Max Wait Time = <time>

The time specifies the maximum allowed time that a job may block waiting for a resource (such as waiting for a tape to be mounted, or waiting for the storage or file daemons to perform their duties), counted from the when the job starts, (not necessarily the same as when the job was scheduled).

Figure 9.2: Job time control directives


Maximum Bandwidth = <speed>

The speed parameter specifies the maximum allowed bandwidth that a job may use.  
Maximum Concurrent Jobs = <positive-integer>
(default: 1)
Specifies the maximum number of Jobs from the current Job resource that can run concurrently. Note, this directive limits only Jobs with the same name as the resource in which it appears. Any other restrictions on the maximum concurrent jobs such as in the Director, Client or Storage resources will also apply in addition to the limit specified here.

For details, see the Concurrent Jobs chapter.  

Messages = <resource-name>
The Messages directive defines what Messages resource should be used for this job, and thus how and where the various messages are to be delivered. For example, you can direct some messages to a log file, and others can be sent by email. For additional details, see the Messages Resource Chapter of this manual. This directive is required.  
Name = <name>
The name of the resource.

The Job name. This name can be specified on the Run command in the console program to start a job. If the name contains spaces, it must be specified between quotes. It is generally a good idea to give your job the same name as the Client that it will backup. This permits easy identification of jobs.

When the job actually runs, the unique Job Name will consist of the name you specify here followed by the date and time the job was scheduled for execution. This directive is required.


Next Pool = <resource-name>

A Next Pool override used for Migration/Copy and Virtual Backup Jobs.  
Plugin Options = <string-list>

Please note! This directive is deprecated.
This directive is an alias.


Pool = <resource-name>
The Pool directive defines the pool of Volumes where your data can be backed up. Many Bareos installations will use only the Default pool. However, if you want to specify a different set of Volumes for different Clients or different Jobs, you will probably want to use Pools. For additional details, see the Pool Resource of this chapter. This directive is required.

In case of a Copy or Migration job, this setting determines what Pool will be examined for finding JobIds to migrate. The exception to this is when Selection Type Dir Job = SQLQuery, and although a Pool directive must still be specified, no Pool is used, unless you specifically include it in the SQL query. Note, in any case, the Pool resource defined by the Pool directive must contain a Next Pool Dir Pool = ... directive to define the Pool to which the data will be migrated.  

Prefer Mounted Volumes = <yes|no>
(default: yes)
If the Prefer Mounted Volumes directive is set to yes, the Storage daemon is requested to select either an Autochanger or a drive with a valid Volume already mounted in preference to a drive that is not ready. This means that all jobs will attempt to append to the same Volume (providing the Volume is appropriate – right Pool, ... for that job), unless you are using multiple pools. If no drive with a suitable Volume is available, it will select the first available drive. Note, any Volume that has been requested to be mounted, will be considered valid as a mounted volume by another job. This if multiple jobs start at the same time and they all prefer mounted volumes, the first job will request the mount, and the other jobs will use the same volume.

If the directive is set to no, the Storage daemon will prefer finding an unused drive, otherwise, each job started will append to the same Volume (assuming the Pool is the same for all jobs). Setting Prefer Mounted Volumes to no can be useful for those sites with multiple drive autochangers that prefer to maximize backup throughput at the expense of using additional drives and Volumes. This means that the job will prefer to use an unused drive rather than use a drive that is already in use.

Despite the above, we recommend against setting this directive to no since it tends to add a lot of swapping of Volumes between the different drives and can easily lead to deadlock situations in the Storage daemon. We will accept bug reports against it, but we cannot guarantee that we will be able to fix the problem in a reasonable time.

A better alternative for using multiple drives is to use multiple pools so that Bareos will be forced to mount Volumes from those Pools on different drives.  

Prefix Links = <yes|no>
(default: no)
If a Where path prefix is specified for a recovery job, apply it to absolute links as well. The default is No. When set to Yes then while restoring files to an alternate directory, any absolute soft links will also be modified to point to the new alternate directory. Normally this is what is desired – i.e. everything is self consistent. However, if you wish to later move the files to their original locations, all files linked with absolute names will be broken.  
Priority = <positive-integer>
(default: 10)
This directive permits you to control the order in which your jobs will be run by specifying a positive non-zero number. The higher the number, the lower the job priority. Assuming you are not running concurrent jobs, all queued jobs of priority 1 will run before queued jobs of priority 2 and so on, regardless of the original scheduling order.

The priority only affects waiting jobs that are queued to run, not jobs that are already running. If one or more jobs of priority 2 are already running, and a new job is scheduled with priority 1, the currently running priority 2 jobs must complete before the priority 1 job is run, unless Allow Mixed Priority is set.

If you want to run concurrent jobs you should keep these points in mind:

If you have several jobs of different priority, it may not best to start them at exactly the same time, because Bareos must examine them one at a time. If by Bareos starts a lower priority job first, then it will run before your high priority jobs. If you experience this problem, you may avoid it by starting any higher priority jobs a few seconds before lower priority ones. This insures that Bareos will examine the jobs in the correct order, and that your priority scheme will be respected.  

Protocol = <job protocol>
(default: Native)
The backup protocol to use to run the Job. See job protocol.  
Prune Files = <yes|no>
(default: no)
Normally, pruning of Files from the Catalog is specified on a Client by Client basis in Auto Prune Dir Client. If this directive is specified and the value is yes, it will override the value specified in the Client resource.  
Prune Jobs = <yes|no>
(default: no)
Normally, pruning of Jobs from the Catalog is specified on a Client by Client basis in Auto Prune Dir Client. If this directive is specified and the value is yes, it will override the value specified in the Client resource.  
Prune Volumes = <yes|no>
(default: no)
Normally, pruning of Volumes from the Catalog is specified on a Pool by Pool basis in Auto Prune Dir Pool directive. Note, this is different from File and Job pruning which is done on a Client by Client basis. If this directive is specified and the value is yes, it will override the value specified in the Pool resource.  
Purge Migration Job = <yes|no>
(default: no)
This directive may be added to the Migration Job definition in the Director configuration file to purge the job migrated at the end of a migration.  
Regex Where = <string>

This directive applies only to a Restore job and specifies a regex filename manipulation of all files being restored. This will use File Relocation feature.

For more informations about how use this option, see RegexWhere Format.  

Replace = <ReplaceOption>
(default: Always)
This directive applies only to a Restore job and specifies what happens when Bareos wants to restore a file or directory that already exists. You have the following options for replace-option:
when the file to be restored already exists, it is deleted and then replaced by the copy that was backed up. This is the default value.
if the backed up file (on tape) is newer than the existing file, the existing file is deleted and replaced by the back up.
if the backed up file (on tape) is older than the existing file, the existing file is deleted and replaced by the back up.
if the backed up file already exists, Bareos skips restoring this file.


Rerun Failed Levels = <yes|no>
(default: no)
If this directive is set to yes (default no), and Bareos detects that a previous job at a higher level (i.e. Full or Differential) has failed, the current job level will be upgraded to the higher level. This is particularly useful for Laptops where they may often be unreachable, and if a prior Full save has failed, you wish the very next backup to be a Full save rather than whatever level it is started as.

There are several points that must be taken into account when using this directive: first, a failed job is defined as one that has not terminated normally, which includes any running job of the same name (you need to ensure that two jobs of the same name do not run simultaneously); secondly, the Ignore File Set Changes Dir FileSet directive is not considered when checking for failed levels, which means that any FileSet change will trigger a rerun.  

Reschedule Interval = <time>
(default: 1800)
If you have specified Reschedule On Error = yes and the job terminates in error, it will be rescheduled after the interval of time specified by time-specification. See the time specification formats in the Configure chapter for details of time specifications. If no interval is specified, the job will not be rescheduled on error.  
Reschedule On Error = <yes|no>
(default: no)
If this directive is enabled, and the job terminates in error, the job will be rescheduled as determined by the Reschedule Interval Dir Job and Reschedule Times Dir Job directives. If you cancel the job, it will not be rescheduled.

This specification can be useful for portables, laptops, or other machines that are not always connected to the network or switched on.  

Reschedule Times = <positive-integer>
(default: 5)
This directive specifies the maximum number of times to reschedule the job. If it is set to zero (the default) the job will be rescheduled an indefinite number of times.  
Run = <string-list>

The Run directive (not to be confused with the Run option in a Schedule) allows you to start other jobs or to clone the current jobs.

The part after the equal sign must be enclosed in double quotes, and can contain any string or set of options (overrides) that you can specify when entering the run command from the console. For example storage=DDS-4 .... In addition, there are two special keywords that permit you to clone the current job. They are level=%l and since=%s. The %l in the level keyword permits entering the actual level of the current job and the %s in the since keyword permits putting the same time for comparison as used on the current job. Note, in the case of the since keyword, the %s must be enclosed in double quotes, and thus they must be preceded by a backslash since they are already inside quotes. For example:

run = "Nightly-backup level=%l since=\"%s\" storage=DDS-4"

A cloned job will not start additional clones, so it is not possible to recurse.

Jobs started by Run Dir Job are submitted for running before the original job (while it is being initialized). This means that any clone job will actually start before the original job, and may even block the original job from starting. It evens ignores Priority Dir Job.

If you are trying to prioritize jobs, you will find it much easier to do using a Run Script Dir Job resource or a Run Before Job Dir Job directive.  

Run After Failed Job = <RunscriptShort>

This is a shortcut for the Run Script Dir Job resource, that runs a command after a failed job.

If the exit code of the program run is non-zero, Bareos will print a warning message.

Run Script { 
  Command = "echo test" 
  Runs When = After 
  Runs On Failure = yes 
  Runs On Client  = no 
  Runs On Success = yes    # default, you can drop this line 


Run After Job = <RunscriptShort>

This is a shortcut for the Run Script Dir Job resource, that runs a command after a successful job (without error or without being canceled).

If the exit code of the program run is non-zero, Bareos will print a warning message.  

Run Before Job = <RunscriptShort>

This is a shortcut for the Run Script Dir Job resource, that runs a command before a job.

If the exit code of the program run is non-zero, the current Bareos job will be canceled.

Run Before Job = "echo test"

is equivalent to:

Run Script { 
  Command = "echo test" 
  Runs On Client = No 
  Runs When = Before 


Run Script = <Runscript>

The RunScript directive behaves like a resource in that it requires opening and closing braces around a number of directives that make up the body of the runscript.

The specified Command (see below for details) is run as an external program prior or after the current Job. This is optional. By default, the program is executed on the Client side like in ClientRunXXXJob.

Console options are special commands that are sent to the director instead of the OS. At this time, console command outputs are redirected to log with the jobid 0.

You can use following console command: delete, disable, enable, estimate, list, llist, memory, prune, purge, reload, status, setdebug, show, time, trace, update, version, .client, .jobs, .pool, .storage. See Bareos Console for more information. You need to specify needed information on command line, nothing will be prompted. Example:

Console = "prune files client=\%c" 
Console = "update stats age=3"

You can specify more than one Command/Console option per RunScript.

You can use following options may be specified in the body of the runscript:




Runs On Success

Yes | No

run if JobStatus is successful

Runs On Failure

Yes | No

run if JobStatus isn’t successful

Runs On Client

Yes | No

run command on client

Runs When

Never | Before | After | Always | AfterVSS

When to run

Fail Job On Error

Yes | No

Fail job if script returns something different from 0


External command


Console command

Any output sent by the command to standard output will be included in the Bareos job report. The command string must be a valid program name or name of a shell script.

Please note! The command string is parsed then fed to the OS, which means that the path will be searched to execute your specified command, but there is no shell interpretation. As a consequence, if you invoke complicated commands or want any shell features such as redirection or piping, you must call a shell script and do it inside that script. Alternatively, it is possible to use sh -c ’...’ in the command definition to force shell interpretation, see example below.

Before executing the specified command, Bareos performs character substitution of the following characters:

%b Job Bytes
%BJob Bytes in human readable format
%c Client’s name
%d Daemon’s name (Such as host-dir or host-fd)
%DDirector’s name (Also valid on file daemon)
%e Job Exit Status
%f Job FileSet (Only on director side)
%F Job Files
%h Client address
%i Job Id
%j Unique Job Id
%l Job Level
%n Job name
%p Pool name (Only on director side)
%PDaemon PID
%s Since time
%t Job type (Backup, ...)
%v Read Volume name(s) (Only on director side)
%VWrite Volume name(s) (Only on director side)
%wStorage name (Only on director side)
%x Spooling enabled? (”yes” or ”no”)

Some character substitutions are not available in all situations. The Job Exit Status code %e edits the following values:

Thus if you edit it on a command line, you will need to enclose it within some sort of quotes.

You can use these following shortcuts:

Keyword RunsOnSuccessRunsOnFailureFailJobOnErrorRuns On ClientRunsWhen

Run Before Job Dir Job Yes No Before

Run After Job Dir Job Yes No No After

Run After Failed Job Dir Job No Yes No After

Client Run Before Job Dir Job Yes Yes Before

Client Run After Job Dir Job Yes No Yes After


Run Script { 
  RunsWhen = Before 
  FailJobOnError = No 
  Command = "/etc/init.d/apache stop" 
RunScript { 
  RunsWhen = After 
  RunsOnFailure = Yes 
  Command = "/etc/init.d/apache start" 
RunScript { 
  RunsWhen = Before 
  FailJobOnError = Yes 
  Command = "sh -c top -b -n 1 > /var/backup/top.out’" 

Special Windows Considerations

You can run scripts just after snapshots initializations with AfterVSS keyword.

In addition, for a Windows client, please take note that you must ensure a correct path to your script. The script or program can be a .com, .exe or a .bat file. If you just put the program name in then Bareos will search using the same rules that cmd.exe uses (current directory, Bareos bin directory, and PATH). It will even try the different extensions in the same order as cmd.exe. The command can be anything that cmd.exe or command.com will recognize as an executable file.

However, if you have slashes in the program name then Bareos figures you are fully specifying the name, so you must also explicitly add the three character extension.

The command is run in a Win32 environment, so Unix like commands will not work unless you have installed and properly configured Cygwin in addition to and separately from Bareos.

The System %Path% will be searched for the command. (under the environment variable dialog you have have both System Environment and User Environment, we believe that only the System environment will be available to bareos-fd, if it is running as a service.)

System environment variables can be referenced with %var% and used as either part of the command name or arguments.

So if you have a script in the Bareos
bin directory then the following lines should work fine:

        Client Run Before Job = "systemstate" 
        Client Run Before Job = "systemstate.bat" 
        Client Run Before Job = "\"C:/Program Files/Bareos/systemstate.bat\""

The outer set of quotes is removed when the configuration file is parsed. You need to escape the inner quotes so that they are there when the code that parses the command line for execution runs so it can tell what the program name is.

The special characters &<>()@| will need to be quoted, if they are part of a filename or argument.

If someone is logged in, a blank ”command” window running the commands will be present during the execution of the command.

Some Suggestions from Phil Stracchino for running on Win32 machines with the native Win32 File daemon:

  1. You might want the ClientRunBeforeJob directive to specify a .bat file which runs the actual client-side commands, rather than trying to run (for example) regedit /e directly.
  2. The batch file should explicitly ’exit 0’ on successful completion.
  3. The path to the batch file should be specified in Unix form:

    Client Run Before Job = "c:/bareos/bin/systemstate.bat"

    rather than DOS/Windows form:

    INCORRECT: Client Run Before Job = "c:\bareos \bin \systemstate .bat"

For Win32, please note that there are certain limitations:

Client Run Before Job = "C:/Program Files/Bareos/bin/pre-exec.bat"

Lines like the above do not work because there are limitations of cmd.exe that is used to execute the command. Bareos prefixes the string you supply with cmd.exe /c. To test that your command works you should type cmd /c "C:/Program Files/test.exe" at a cmd prompt and see what happens. Once the command is correct insert a backslash () before each double quote (”), and then put quotes around the whole thing when putting it in the director’s .conf file. You either need to have only one set of quotes or else use the short name and don’t put quotes around the command path.

Below is the output from cmd’s help as it relates to the command line passed to the /c option.

If /C or /K is specified, then the remainder of the command line after the switch is processed as a command line, where the following logic is used to process quote (”) characters:

  1. If all of the following conditions are met, then quote characters on the command line are preserved:
    • no /S switch.
    • exactly two quote characters.
    • no special characters between the two quote characters, where special is one of: &<>()@| 
    • there are one or more whitespace characters between the the two quote characters.
    • the string between the two quote characters is the name of an executable file.
  2. Otherwise, old behavior is to see if the first character is a quote character and if so, strip the leading character and remove the last quote character on the command line, preserving any text after the last quote character.


Save File History = <yes|no>
(default: yes)
Allow disabling storing the file history, as this causes problems problems with some implementations of NDMP (out-of-order metadata).

With File History Size Dir Job the maximum number of files and directories inside a NDMP job can be configured.

Please note! The File History is required to do a single file restore from NDMP backups. With this disabled, only full restores are possible.  
Version >= 14.2.0

Schedule = <resource-name>

The Schedule directive defines what schedule is to be used for the Job. The schedule in turn determines when the Job will be automatically started and what Job level (i.e. Full, Incremental, ...) is to be run. This directive is optional, and if left out, the Job can only be started manually using the Console program. Although you may specify only a single Schedule resource for any one job, the Schedule resource may contain multiple Run directives, which allow you to run the Job at many different times, and each run directive permits overriding the default Job Level Pool, Storage, and Messages resources. This gives considerable flexibility in what can be done with a single Job. For additional details, see Schedule Resource.  
SD Plugin Options = <string-list>

These settings are plugin specific, see Storage Daemon Plugins.  
Selection Pattern = <string>

Selection Patterns is only used for Copy and Migration jobs, see Migration and Copy. The interpretation of its value depends on the selected Selection Type Dir Job.

For the OldestVolume and SmallestVolume, this Selection pattern is not used (ignored).

For the Client, Volume, and Job keywords, this pattern must be a valid regular expression that will filter the appropriate item names found in the Pool.

For the SQLQuery keyword, this pattern must be a valid SELECT SQL statement that returns JobIds.  

Selection Type = <MigrationType>

Selection Type is only used for Copy and Migration jobs, see Migration and Copy. It determines how a migration job will go about selecting what JobIds to migrate. In most cases, it is used in conjunction with a Selection Pattern Dir Job to give you fine control over exactly what JobIds are selected. The possible values are:
This selection keyword selects the volume with the fewest bytes from the Pool to be migrated. The Pool to be migrated is the Pool defined in the Migration Job resource. The migration control job will then start and run one migration backup job for each of the Jobs found on this Volume. The Selection Pattern, if specified, is not used.
This selection keyword selects the volume with the oldest last write time in the Pool to be migrated. The Pool to be migrated is the Pool defined in the Migration Job resource. The migration control job will then start and run one migration backup job for each of the Jobs found on this Volume. The Selection Pattern, if specified, is not used.
The Client selection type, first selects all the Clients that have been backed up in the Pool specified by the Migration Job resource, then it applies the Selection Pattern Dir Job as a regular expression to the list of Client names, giving a filtered Client name list. All jobs that were backed up for those filtered (regexed) Clients will be migrated. The migration control job will then start and run one migration backup job for each of the JobIds found for those filtered Clients.
The Volume selection type, first selects all the Volumes that have been backed up in the Pool specified by the Migration Job resource, then it applies the Selection Pattern Dir Job as a regular expression to the list of Volume names, giving a filtered Volume list. All JobIds that were backed up for those filtered (regexed) Volumes will be migrated. The migration control job will then start and run one migration backup job for each of the JobIds found on those filtered Volumes.
The Job selection type, first selects all the Jobs (as defined on the Name Dir Job directive in a Job resource) that have been backed up in the Pool specified by the Migration Job resource, then it applies the Selection Pattern Dir Job as a regular expression to the list of Job names, giving a filtered Job name list. All JobIds that were run for those filtered (regexed) Job names will be migrated. Note, for a given Job named, they can be many jobs (JobIds) that ran. The migration contr