pict
Bareos ®;
Backup Archiving REcovery Open Sourced

Main Reference

Bareos GmbH & Co KG

This manual documents Bareos version master (September 23, 2016)
Copyright 1999-2012, Free Software Foundation Europe e.V.
Copyright 2010-2012, Planets Communications B.V.
Copyright 2013-2016, 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”.

Contents

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 Packages
 1.5 Quick Start
 1.6 Terminology
 1.7 What Bareos is Not
 1.8 Interactions Between the Bareos Services
 1.9 The Current State of Bareos
  1.9.1 What is Implemented
  1.9.2 Advantages Over Other Backup Programs
  1.9.3 Current Implementation Restrictions
  1.9.4 Design Limitations or Restrictions
  1.9.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 Additional information
  3.4.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.2 Comments
  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
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.2 Slots
 19.3 Multiple Devices
 19.4 Device Configuration Records
 19.5 An Example Configuration File
 19.6 A Multi-drive Example Configuration File
 19.7 Specifying Slots When Labeling
 19.8 Changing Cartridges
 19.9 Dealing with Multiple Magazines
 19.10 Update Slots Command
 19.11 Using the Autochanger
 19.12 Barcode Support
 19.13 Use bconsole to display Autochanger content
 19.14 Bareos Autochanger Interface
 19.15 Tapespeed and blocksizes
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 Data Spooling
 21.1 Data Spooling Directives
  21.1.1 Additional Notes
22 Migration and Copy
 22.1 Important Migration Considerations
 22.2 Configure Copy or Migration Jobs
  22.2.1 Example Migration Jobs
23 Always Incremental Backup Scheme
 23.1 Conventional Backup Scheme Drawbacks
 23.2 Always Incremental Concept
 23.3 How to configure in Bareos
  23.3.1 Always Incremental Backup Job
  23.3.2 Consolidate Job
  23.3.3 Storages and Pools
 23.4 How it works
 23.5 Enhancements for the Always Incremental Backup Scheme
  23.5.1 The basic always incremental scheme
  23.5.2 Always Incremental Max Full Age
  23.5.3 Max Full Consolidations
 23.6 Long Term Storage of Always Incremental Jobs
  23.6.1 Copy Jobs
  23.6.2 Virtual Full Jobs
24 How to manually transfer data/volumes
 24.1 Import Data from a Remote Storage Daemon
 24.2 Import Data from a Independent Remote Full Bareos Installation
25 File Deduplication using Base Jobs
26 Plugins
 26.1 File Daemon Plugins
  26.1.1 bpipe Plugin
  26.1.2 PGSQL Plugin
  26.1.3 MSSQL Plugin
  26.1.4 LDAP Plugin
  26.1.5 Cephfs Plugin
  26.1.6 Rados Plugin
  26.1.7 GlusterFS Plugin
  26.1.8 python-fd Plugin
  26.1.9 VMware Plugin
 26.2 Storage Daemon Plugins
  26.2.1 autoxflate-sd
  26.2.2 scsicrypto-sd
  26.2.3 scsitapealert-sd
  26.2.4 python-sd Plugin
 26.3 Director Plugins
  26.3.1 python-dir Plugin
27 The Windows Version of Bareos
 27.1 Windows Installation
  27.1.1 Graphical Installation
  27.1.2 Command Line (Silent) Installation
  27.1.3 Installing multiple Windows filedaemon services
 27.2 Dealing with Windows Problems
 27.3 Windows Compatibility Considerations
  27.3.1 Exclusively Opened Filed
  27.3.2 Registry
  27.3.3 Windows Reparse Points
  27.3.4 Hard Links
  27.3.5 FilesNotToBackup Registry Key
  27.3.6 Windows dedup support
  27.3.7 Store all file attributes
  27.3.8 Support for Windows EFS filesystems
 27.4 Volume Shadow Copy Service (VSS)
  27.4.1 VSS Problems
 27.5 Windows Firewalls
  27.5.1 Network TCP Port
 27.6 Windows Restore Problems
 27.7 Windows Backup Problems
 27.8 Windows Ownership and Permissions Problems
 27.9 Fixing the Windows Boot Record
 27.10 File Daemon: Windows Specific Command Line Options
28 Network setup
 28.1 Client Initiated Connection
 28.2 Passive Clients
  28.2.1 Usage
29 Transport Encryption
 29.1 TLS Configuration Directives
 29.2 Getting TLS Certificates
 29.3 Example TLS Configuration Files
30 Data Encryption
 30.1 Encryption Technical Details
 30.2 Generating Private/Public Encryption Keys
 30.3 Example Data Encryption Configurations (bareos-fd.conf)
 30.4 Decrypting with a Master Key
31 NDMP Backups with Bareos
 31.1 Example Setup for NDMP backup
  31.1.1 Enable NDMP on your storage appliance
  31.1.2 Bareos Director: Configure NDMP Client Resource
  31.1.3 Bareos Storage Daemon: Configure NDMP
  31.1.4 Bareos Director: Configure a Paired Storage
  31.1.5 Bareos Director: Configure NDMP Fileset
  31.1.6 Bareos Director: Configure NDMP Jobs
 31.2 Run NDMP Backup
  31.2.1 NDMP Backup Level
 31.3 Run NDMP Restore
  31.3.1 Full Restore
  31.3.2 Restore files to original path
  31.3.3 Restore files to different path
 31.4 NDMP Copy Jobs
  31.4.1 Restore to NDMP Primary Storage System
 31.5 NDMP Debugging
 31.6 Limitations
  31.6.1 NDMP Job limitations when scanning in volumes
  31.6.2 Single file restore on incremental backups
  31.6.3 Restore always transfers the full main backup file to the Primary Storage System
 31.7 Tested Environments
32 Catalog Maintenance
 32.1 Catalog Database
  32.1.1 dbconfig-common (Debian)
  32.1.2 Manual Configuration
 32.2 Retention Periods
 32.3 PostgreSQL
  32.3.1 Compacting Your PostgreSQL Database
  32.3.2 Repairing Your PostgreSQL Database
 32.4 MySQL/MariaDB
  32.4.1 Compacting Your MySQL Database
  32.4.2 Repairing Your MySQL Database
  32.4.3 MySQL Table is Full
  32.4.4 MySQL Server Has Gone Away
  32.4.5 MySQL Temporary Tables
 32.5 Performance Issues Indexes
  32.5.1 PostgreSQL Indexes
  32.5.2 MySQL Indexes
  32.5.3 SQLite Indexes
 32.6 Backing Up Your Bareos Database
 32.7 Database Size
33 Bareos Security Issues
 33.1 Configuring and Testing TCP Wrappers
 33.2 Secure Erase Command
IV  Appendix
A System Requirements
B Operating Systems
 B.1
  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 Parameter
  C.1.1 Specifying the Configuration File
  C.1.2 Specifying a Device Name For a Tape
  C.1.3 Specifying a Device Name For a File
  C.1.4 Specifying Volumes
 C.2 Bareos Daemons
  C.2.1 Daemon Command Line Options
  C.2.2 bareos-dir
  C.2.3 bareos-sd
  C.2.4 bareos-fd
 C.3 Interactive Programs
  C.3.1 bconsole
  C.3.2 bareos-webui
  C.3.3 bat
 C.4 Volume Utility Commands
  C.4.1 bls
  C.4.2 bextract
  C.4.3 bscan
  C.4.4 bcopy
  C.4.5 btape
  C.4.6 bscrypto
 C.5 Other Programs
  C.5.1 bsmtp
  C.5.2 bareos-dbcheck
  C.5.3 bregex
  C.5.4 bwild
  C.5.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 Tape Labels: ANSI or IBM
  J.4.1 Reading
  J.4.2 Writing
 J.5 Tape Drive
  J.5.1 Get Your Tape Drive Working
 J.6 Autochanger
  J.6.1 Testing Autochanger and Adapting mtx-changer script
 J.7 Restore
  J.7.1 Restore a pruned job using a pattern
  J.7.2 Problems Restoring Files
  J.7.3 Restoring Files Can Be Slow
  J.7.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
General
Director
Storage Daemon
File Daemon
Console

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 it’s 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).

Catalog

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 Packages

Following Bareos Linux packages are available (release 14.2):



Package Name Description


bareos Backup Archiving REcovery Open Sourced - metapackage
bareos-bat Bareos Admin Tool (GUI)
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-storage Bareos Storage daemon
bareos-storage-ceph CEPH support 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-vix-disklib VMware vix disklib distributable libraries
bareos-webui Bareos Web User Interface


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.5 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.6 Terminology

Administrator
The person or persons responsible for administrating the Bareos system.
Backup
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.
Catalog
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.

Client
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.
Console
The program that interfaces to the Director allowing the user or system administrator to control Bareos.
Daemon
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.
Directive
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.
Director
The main Bareos server daemon that schedules and directs all Bareos operations. Occasionally, the project refers to the Director as DIR.
Differential
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.

FileSet
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.
Incremental
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.

Job
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.
Monitor
The program that interfaces to all the daemons allowing the user or system administrator to monitor Bareos status.
Resource
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, ...
Restore
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.
Schedule
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.
Service
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).
Session
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).
Verify
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.

Scan
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.
Volume
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.7 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.8 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.

pict

#

1.9 The Current State of Bareos

#

1.9.1 What is Implemented

#

1.9.2 Advantages Over Other Backup Programs

#

1.9.3 Current Implementation Restrictions

#

1.9.4 Design Limitations or Restrictions

#

1.9.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 5 steps are required to get to a running Bareos System:

  1. Decide about the Bareos release to use
  2. Decide about the Database Backend
  3. Install the Bareos Software Packages
  4. Prepare Bareos database
  5. 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

Next you have to decide, what database backend you want to use. Bareos supports following database backends:

The PostgreSQL backend is the default. However, the MySQL backend is also supported, while the 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.

#

2.3 Install the Bareos Software Packages

You will have to install the package bareos and the database backend package (bareos-database-*) you want to use. The corresponding database should already be installed and running, see Decide about the Database Backend.

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.

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 
# 
 
DIST=RHEL_7 
# or 
# DIST=Fedora_24 
# DIST=CentOS_7 
 
DATABASE=postgresql 
# or 
# DATABASE=mysql 
 
# add the Bareos repository 
URL=http://download.bareos.org/bareos/release/latest/$DIST 
wget -O /etc/yum.repos.d/bareos.repo $URL/bareos.repo 
 
# install Bareos packages 
yum install bareos bareos-database-$DATABASE  
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.

 
# 
# define parameter 
# 
 
DIST=RHEL_6 
# DIST=CentOS_6 
 
DATABASE=postgresql 
# or 
# DATABASE=mysql 
 
# add the Bareos repository 
URL=http://download.bareos.org/bareos/release/latest/$DIST 
wget -O /etc/yum.repos.d/bareos.repo $URL/bareos.repo 
 
# install Bareos packages 
yum install bareos bareos-database-$DATABASE  
Commands 2.2: Bareos installation on RHEL 6 / CentOS 6

RHEL 5, CentOS 5

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 
# 
 
DIST=RHEL_5 
# or 
# DIST=CentOS_5 
 
DATABASE=postgresql 
# or 
# DATABASE=mysql 
 
# add the Bareos repository 
URL=http://download.bareos.org/bareos/release/latest/$DIST 
wget -O /etc/yum.repos.d/bareos.repo $URL/bareos.repo 
 
# install Bareos packages 
yum install bareos-database-$DATABASE 
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 
# 
 
DIST=SLE_12_SP1 
# or 
# DIST=SLE_11_SP4 
# DIST=openSUSE_Leap_42.1 
# DIST=openSUSE_13.2 
 
DATABASE=postgresql 
# or 
# DATABASE=mysql 
 
# add the Bareos repository 
URL=http://download.bareos.org/bareos/release/latest/$DIST 
zypper addrepo --refresh $URL/bareos.repo 
 
# install Bareos packages 
zypper install bareos bareos-database-$DATABASE  
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 
# 
 
DIST=Debian_8.0 
# or 
# DIST=Debian_7.0 
# DIST=xUbuntu_16.04 
# DIST=xUbuntu_14.04 
# DIST=xUbuntu_12.04 
 
DATABASE=postgresql 
# or 
# DATABASE=mysql 
 
URL=http://download.bareos.org/bareos/release/latest/$DIST/ 
 
# 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-$DATABASE  
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. Currently the database backends PostgreSQL and MySQL are recommended. The Sqlite database backend is only intended for testing purposes.

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

PostgreSQL

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

MySQL/MariaDB

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:

 
[client] 
host=localhost 
user=root 
password=YourPasswordForAccessingMysqlAsRoot  
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:

 
/usr/lib/bareos/scripts/create_bareos_database 
/usr/lib/bareos/scripts/make_bareos_tables 
/usr/lib/bareos/scripts/grant_bareos_privileges  
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.

pict

#

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  

    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=webuiadmin  
    bconsole 3.1: 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 then 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.4: 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.

SELinux

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  

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-weui 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: /etc/bareos-webui/directors.ini 
; 
 
; 
; Section bareos-dir 
; 
[bareos-dir] 
 
; Enable or disable director. Possible values are "yes" or "no", the default is "yes". 
enabled = "yes" 
 
; Fill in the IP-Address or FQDN of your director. 
diraddress = "localhost" 
 
; Default value is 9101 
dirport = 9101 
 
; Set catalog to explicit value if you have multiple catalogs, 
; the default value is "MyCatalog". 
;catalog = "MyCatalog" 
 
; 
; Section remote-dir 
; 
[remote-dir] 
enabled = "no" 
diraddress = "hostname" 
;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.5: /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.

 
[session] 
# Default: 3600 seconds 
timeout=3600 
 
[tables] 
# Define a list of pagination values. 
# Default: 10,25,50,100 
pagination_values=10,25,50,100 
 
# Default number of rows per page 
# for possible values see pagination_values 
# Default: 25 
pagination_default_value=25 
 
# State saving - restore table state on page reload. 
# Default: false 
save_previous_state=false 
 
[autochanger] 
# Pooltype for label to use as filter. 
# See pooltype in output of bconsole: list pools 
# Default: none 
labelpooltype=scratch  
Configuration 3.6: /etc/bareos-webui/configuration.ini

#

3.4 Additional information

#

3.4.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 127.0.0.1:9000 
                #fastcgi_pass 127.0.0.1:9000; 
 
                # 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.7: 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 backward compatibility. #

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 bahaviour, 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.

#

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  

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.

PostgreSQL

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.1: 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.

MySQL/MariaDB

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:

 
[client] 
host=localhost 
user=root 
password=YourPasswordForAccessingMysqlAsRoot  
Configuration 4.2: 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:

 
/usr/lib/bareos/scripts/update_bareos_tables  
Commands 4.3: 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
Tutorial

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

#

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.1: bconsole

The asterisk is the console command prompt.

Type help to see a list of available commands:

 
*help 
  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           Noninteractive 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 oldtime 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.2: 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.3: 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 
bareosdir Version: 13.2.0 (09 April 2013) x86_64pclinuxgnu debian Debian GNU/Linux 6.0 (squeeze) 
Daemon started 23May13 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  23May13 23:05    BackupClient1      testvol 
Full           Backup    11  23May13 23:10    BackupCatalog      testvol 
==== 
 
Running Jobs: 
Console connected at 23May13 13:34 
No Jobs running. 
====  
bconsole 6.4: 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: bareosfd 
Connecting to Client bareosfd at bareos:9102 
 
bareosfd Version: 13.2.0 (09 April 2013)  x86_64pclinuxgnu debian Debian GNU/Linux 6.0 (squeeze) 
Daemon started 23May13 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: 23May13 13:58 
No Jobs running. 
====  
bconsole 6.5: 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 
 
bareossd Version: 13.2.0 (09 April 2013) x86_64pclinuxgnu debian Debian GNU/Linux 6.0 (squeeze) 
Daemon started 23May13 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.6: 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:

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):

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):

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.

 
*messages 
28Apr2003 14:30 bareossd: Wrote label to prelabeled Volume 
   TestVolume001 on device /var/lib/bareos/storage 
28Apr2003 14:30 rufusdir: Bareos 1.30 (28Apr03): 28Apr2003 14:30 
JobId:                  1 
Job:                    BackupClient1.20030428_14.22.33 
FileSet:                Full Set 
Backup Level:           Full 
Client:                 bareosfd 
Start time:             28Apr2003 14:22 
End time:               28Apr2003 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 
28Apr2003 14:30 rufusdir: Begin pruning Jobs. 
28Apr2003 14:30 rufusdir: No Jobs found to prune. 
28Apr2003 14:30 rufusdir: Begin pruning Files. 
28Apr2003 14:30 rufusdir: No Files found to prune. 
28Apr2003 14:30 rufusdir: End auto prune.  
bconsole 6.7: 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.8: 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

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:  (113):  
bconsole 6.9: 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):

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: /  
$

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:

done

and you will get the following output:

Bootstrap records written to  
   /home/user/bareos/testbin/working/restore.bsr  
The restore job will require the following Volumes:  
 
   TestVolume001  
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):

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

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.10: 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)
client2.example.com
IP Address
192.168.0.2
OS
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=client2fd address=192.168.0.2 password=secret 
Created resource config file ”/etc/bareos/bareosdir.d/client/client2fd.conf”: 
Client { 
  Name = client2fd 
  Address = 192.168.0.2 
  Password = secret 
}  
bconsole 6.11: 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.12: 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 = 192.168.0.2 
  Password = secret 
}  
Resource 6.13: bareos-dir.d/client/client2-fd.conf

Reload or restart your Bareos Director:

 
*reload 
reloaded  
bconsole 6.14: 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:

client/myself.conf
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.
director/bareos-dir.conf
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.)
director/bareos-mon.conf
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.
messages/Standard.conf
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.15: 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.16: 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.17: 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.18: 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.19: restart bareos-fd

Director: test client, add a job

The following example show how to

 
*status client=client2fd 
... 
*configure add job name=client2job client=client2fd jobdefs=DefaultJob 
Created resource config file ”/etc/bareos/bareosdir.d/job/client2job.conf”: 
Job { 
  Name = client2job 
  Client = client2fd 
  JobDefs = DefaultJob 
} 
*estimate listing job=client2job 
... 
*run job=client2job 
... 
*wait jobid=... 
... 
*list joblog jobid=... 
... 
*list files jobid=... 
... 
*list volumes 
...  
bconsole 6.20: 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.21: list pools

#

6.11 Other Useful Console Commands

help
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.
status
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.
messages
Prints any messages that have been directed to the console.
quit
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
Configuration

#

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.

Naming

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).

pict

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)
(/etc/bareos/bat.conf)



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.

#

8.2.2 Comments

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.

 
@/etc/bareos/extra/clients.conf  
Configuration 8.3: include a configuration file

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

 
@/etc/bareos/extra/*.conf  
Configuration 8.4: include multiple configuration files

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

 
@|"/etc/bareos/generate_configuration_to_stdout.sh"  
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:

Client
names should be postfixed with -fd
Storage
names should be postfixed with -sd
Director
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

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.

Quotes

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

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.

acl
This directive defines what is permitted to be accessed. It does this by using a list of strings, separated by commas (,_).

The special keyword *all* allows unrestricted access.

Depending on the type of the ACL, the strings can be either resource names, paths or bconsole commands.

auth-type
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:

None
- Use no password
Clear
- Use clear text password
MD5
- Use MD5 hashing
integer
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.

name
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.

password
This is a Bareos password and it is stored internally in MD5 hashed format.
path
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.

speed
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.

string
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.
string-list
Multiple strings, specified in multiple directives, or in a single directive, separated by commas (,).
strname
is similar to a name, except that the name may be quoted and can thus contain additional characters including spaces.
net-address
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).
net-addresses
Specify a set of net-addresses and net-ports. Probably the simplest way to explain this is to show an example:
 
Addresses  = { 
    ip = { addr = 1.2.3.4; port = 1205;} 
    ipv4 = { 
        addr = 1.2.3.4; port = http;} 
    ipv6 = { 
        addr = 1.2.3.4; 
        port = 1205; 
    } 
    ip = { 
        addr = 1.2.3.4 
        port = 1205 
    } 
    ip = { addr = 1.2.3.4 } 
    ip = { addr = 201:220:222::2 } 
    ip = { 
        addr = server.example.com 
    } 
}  
Configuration 8.8: 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.

net-port
Specify a network port (a positive integer).

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

resource
A resource defines a relation to the name of another resource.
size
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:
k
1,024 (kilobytes)
kb
1,000 (kilobytes)
m
1,048,576 (megabytes)
mb
1,000,000 (megabytes)
g
1,073,741,824 (gigabytes)
gb
1,000,000,000 (gigabytes)

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

time
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:
seconds
minutes
(60 seconds)
hours
(3600 seconds)
days
(3600*24 seconds)
weeks
(3600*24*7 seconds)
months
(3600*24*30 seconds)
quarters
(3600*24*91 seconds)
years
(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.

audit-command-list
Specifies the commands that should be logged on execution (audited). E.g.
 
Audit Events = label 
Audit Events = restore  

Based on the type string-list.

yes|no
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

Description

$Year

Year

$Month

Month: 1-12

$Day

Day: 1-31

$Hour

Hour: 0-24

$Minute

Minute: 0-59

$Second

Second: 0-59

$WeekDay

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

$Job

Name of the Job

$Dir

Name of the Director

$Level

Job Level

$Type

Job Type

$JobId

JobId

$JobName

unique name of a job

$Storage

Name of the Storage Daemon

$Client

Name of the Clients

$NumVols

Numbers of volumes in the pool

$Pool

Name of the Pool

$Catalog

Name of the Catalog

$MediaType

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 on RunScripts At the configuration of RunScripts following variables can be used:

Variable

Description

\%c

Client’s Name

\%d

Director’s Name

\%e

Job Exit Code

\%i

JobId

\%j

Unique JobId

\%l

Job Level

\%n

Unadorned Job Name

\%r

Recipients

\%s

Since Time

\%b

Job Bytes

\%B

Job Bytes in human readable format

\%f

Job Files

\%t

Job Type (Backup, ...)

\%v

Read Volume Name (only on Director)

\%V

Write Volume Name (only on Director)

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

Variable

Description

\%a

Archive Device Name

\%c

Changer Device Name

\%d

Changer Drive Index

\%f

Client’s Name

\%j

Job Name

\%o

Command

\%s

Slot Base 0

\%S

Slot Base 1

\%v

Volume Name

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

Variable

Description

\%a

Archive Device Name

\%e

Erase

\%n

Part Number

\%m

Mount Point

\%v

Last Part Name

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

Variable

Description

\%c

Client’s Name

\%d

Director’s Name

\%e

Job Exit Code

\%i

JobId

\%j

Unique Job Id

\%l

Job Level

\%n

Unadorned Job Name

\%s

Since Time

\%t

Job Type (Backup, ...)

\%r

Recipients

\%v

Read Volume Name

\%V

Write Volume Name

\%b

Job Bytes

\%B

Job Bytes in human readable format

\%F

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.






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





NDMP 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.


pict

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
remark




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
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 Require = yes|nono
TLS Verify Peer = yes|noyes
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>
(required)
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)
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>
(required)
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>
(required)
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 JobHistory 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 about how to extract information from the catalog for additional information.

See the Configuration chapter of this manual for additional details of time specification.  

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 indended 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 Require = <yes|no>
(default: no)
Without setting this to yes, Bareos can fall back to use unencryption connections. Enabling this implicietly sets ”TLS Enable = yes”.

 

TLS Verify Peer = <yes|no>
(default: yes)
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.

 

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
remark




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 = ProtocolType 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)

pict
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)
 
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.
Backup

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

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

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.

Differential

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.

VirtualFull

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 offer 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.

Restore

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

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

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.
Catalog

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.

VolumeToCatalog

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.

DiskToCatalog

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).


pict
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>
(required)
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>
(required)
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>
(required)
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 = <ProtocolType>
(default: Native)
The backup protocol to use to run the Job. If not set it will default to Native currently the director understand the following protocols:
  1. Native - The native Bareos protocol
  2. NDMP - The NDMP protocol

 

Prune Files = <yes|no>
(default: no)
Normally, pruning of Files from the Catalog is specified on a Client by Client basis in the Client resource with the AutoPrune directive. If this directive is specified (not normally) 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 the Client resource with the AutoPrune directive. If this directive is specified (not normally) 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 the Pool resource with the AutoPrune directive. Note, this is different from File and Job pruning which is done on a Client by Client basis. If this directive is specified (not normally) 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:
always
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.
ifnewer
if the backed up file (on tape) is newer than the existing file, the existing file is deleted and replaced by the back up.
ifolder
if the backed up file (on tape) is older than the existing file, the existing file is deleted and replaced by the back up.
never
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 jobs. By using the cloning keywords (see below), you can backup the same data (or almost the same data) to two or more drives at the same time. The job-name is normally the same name as the current Job resource (thus creating a clone). However, it may be any Job name, so one job may start other related 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.

Please note that all cloned jobs, as specified in the Run directives are submitted for running before the original job is run (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 until the original job finishes unless you allow multiple simultaneous jobs. Even if you set a lower priority on the clone job, if no other jobs are running, it will start before the original job.

If you are trying to prioritize jobs by using the clone feature (Run directive), 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 ouputs 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:




Options

Value

Information







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




Command

External command




Console

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






Examples:

 
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" 
or 
        Client Run Before Job = "systemstate.bat" 
or 
        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).

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:
SmallestVolume
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.
OldestVolume
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.
Client
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.
Volume
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.
Job
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 control job will then start and run one migration backup job for each of the Jobs found.
SQLQuery
The SQLQuery selection type, used the Selection Pattern Dir Job as an SQL query to obtain the JobIds to be migrated. The Selection Pattern must be a valid SELECT SQL statement for your SQL engine, and it must return the JobId as the first field of the SELECT.
PoolOccupancy
This selection type will cause the Migration job to compute the total size of the specified pool for all Media Types combined. If it exceeds the Migration High Bytes Dir Pool defined in the Pool, the Migration job will migrate all JobIds beginning with the oldest Volume in the pool (determined by Last Write time) until the Pool bytes drop below the Migration Low Bytes Dir Pool defined in the Pool. This calculation should be consider rather approximative because it is made once by the Migration job before migration is begun, and thus does not take into account additional data written into the Pool during the migration. In addition, the calculation of the total Pool byte size is based on the Volume bytes saved in the Volume (Media) database entries. The bytes calculate for Migration is based on the value stored in the Job records of the Jobs to be migrated. These do not include the Storage daemon overhead as is in the total Pool size. As a consequence, normally, the migration will migrate more bytes than strictly necessary.
PoolTime
The PoolTime selection type will cause the Migration job to look at the time each JobId has been in the Pool since the job ended. All Jobs in the Pool longer than the time specified on Migration Time Dir Pool directive in the Pool resource will be migrated.
PoolUncopiedJobs
This selection which copies all jobs from a pool to an other pool which were not copied before is available only for copy Jobs.

 

Spool Attributes = <yes|no>
(default: no)
Is Spool Attributes is disabled, the File attributes are sent by the Storage daemon to the Director as they are stored on tape. However, if you want to avoid the possibility that database updates will slow down writing to the tape, you may want to set the value to yes, in which case the Storage daemon will buffer the File attributes and Storage coordinates to a temporary file in the Working Directory, then when writing the Job data to the tape is completed, the attributes and storage coordinates will be sent to the Director.

NOTE: When Spool Data Dir Job is set to yes, Spool Attributes is also automatically set to yes.

For details, see Data Spooling.  

Spool Data = <yes|no>
(default: no)
If this directive is set to yes, the Storage daemon will be requested to spool the data for this Job to disk rather than write it directly to the Volume (normally a tape).

Thus the data is written in large blocks to the Volume rather than small blocks. This directive is particularly useful when running multiple simultaneous backups to tape. Once all the data arrives or the spool files’ maximum sizes are reached, the data will be despooled and written to tape.

Spooling data prevents interleaving data from several job and reduces or eliminates tape drive stop and start commonly known as ”shoe-shine”.

We don’t recommend using this option if you are writing to a disk file using this option will probably just slow down the backup jobs.

NOTE: When this directive is set to yes, Spool Attributes Dir Job is also automatically set to yes.

For details, see Data Spooling.  

Spool Size = <Size64>

This specifies the maximum spool size for this job. The default is taken from Maximum Spool Size Sd Device limit.  
Storage = <ResourceList>

The Storage directive defines the name of the storage services where you want to backup the FileSet data. For additional details, see the Storage Resource of this manual. The Storage resource may also be specified in the Job’s Pool resource, in which case the value in the Pool resource overrides any value in the Job. This Storage resource definition is not required by either the Job resource or in the Pool, but it must be specified in one or the other, if not an error will result.  
Strip Prefix = <string>

This directive applies only to a Restore job and specifies a prefix to remove from the directory name of all files being restored. This will use the File Relocation feature.

Using Strip Prefix=/etc, /etc/passwd will be restored to /passwd

Under Windows, if you want to restore c:/files to d:/files, you can use:

 
Strip Prefix = c: 
Add Prefix = d:

 

Type = <JobType>
(required)
The Type directive specifies the Job type, which is one of the following:
Backup

Run a backup Job. Normally you will have at least one Backup job for each client you want to save. Normally, unless you turn off cataloging, most all the important statistics and data concerning files backed up will be placed in the catalog.
Restore

Run a restore Job. Normally, you will specify only one Restore job which acts as a sort of prototype that you will modify using the console program in order to perform restores. Although certain basic information from a Restore job is saved in the catalog, it is very minimal compared to the information stored for a Backup job – for example, no File database entries are generated since no Files are saved.

Restore jobs cannot be automatically started by the scheduler as is the case for Backup, Verify and Admin jobs. To restore files, you must use the restore command in the console.

Verify

Run a verify Job. In general, verify jobs permit you to compare the contents of the catalog to the file system, or to what was backed up. In addition, to verifying that a tape that was written can be read, you can also use verify as a sort of tripwire intrusion detection.
Admin

Run an admin Job. An Admin job can be used to periodically run catalog pruning, if you do not want to do it at the end of each Backup Job. Although an Admin job is recorded in the catalog, very little data is saved.
Migrate
defines the job that is run as being a Migration Job. A Migration Job is a sort of control job and does not have any Files associated with it, and in that sense they are more or less like an Admin job. Migration jobs simply check to see if there is anything to Migrate then possibly start and control new Backup jobs to migrate the data from the specified Pool to another Pool. Note, any original JobId that is migrated will be marked as having been migrated, and the original JobId can nolonger be used for restores; all restores will be done from the new migrated Job.
Copy
defines the job that is run as being a Copy Job. A Copy Job is a sort of control job and does not have any Files associated with it, and in that sense they are more or less like an Admin job. Copy jobs simply check to see if there is anything to Copy then possibly start and control new Backup jobs to copy the data from the specified Pool to another Pool. Note that when a copy is made, the original JobIds are left unchanged. The new copies can not be used for restoration unless you specifically choose them by JobId. If you subsequently delete a JobId that has a copy, the copy will be automatically upgraded to a Backup rather than a Copy, and it will subsequently be used for restoration.
Consolidate
is used to consolidate Always Incremental Backups jobs, see Always Incremental Backup Scheme. It has been introduced in Bareos Version >= 16.2.4.

Within a particular Job Type, there are also Levels, see Level Dir Job.  

Verify Job = <resource-name>

This directive is an alias.

If you run a verify job without this directive, the last job run will be compared with the catalog, which means that you must immediately follow a backup by a verify command. If you specify a Verify Job Bareos will find the last job with that name that ran. This permits you to run all your backups, then run Verify jobs on those that you wish to be verified (most often a VolumeToCatalog) so that the tape just written is re-read.  

Virtual Full Backup Pool = <resource-name>

 
Where = <path>

This directive applies only to a Restore job and specifies a prefix to the directory name of all files being restored. This permits files to be restored in a different location from which they were saved. If Where is not specified or is set to backslash (/), the files will be restored to their original location. By default, we have set Where in the example configuration files to be /tmp/bareos-restores. This is to prevent accidental overwriting of your files.

Please note! To use Where on NDMP backups, please read Restore files to different path.  

Write Bootstrap = <path>

The writebootstrap directive specifies a file name where Bareos will write a bootstrap file for each Backup job run. This directive applies only to Backup Jobs. If the Backup job is a Full save, Bareos will erase any current contents of the specified file before writing the bootstrap records. If the Job is an Incremental or Differential save, Bareos will append the current bootstrap record to the end of the file.

Using this feature, permits you to constantly have a bootstrap file that can recover the current state of your system. Normally, the file specified should be a mounted drive on another machine, so that if your hard disk is lost, you will immediately have a bootstrap record available. Alternatively, you should copy the bootstrap file to another machine after it is updated. Note, it is a good idea to write a separate bootstrap file for each Job backed up including the job that backs up your catalog database.

If the bootstrap-file-specification begins with a vertical bar (|), Bareos will use the specification as the name of a program to which it will pipe the bootstrap record. It could for example be a shell script that emails you the bootstrap record.

Before opening the file or executing the specified command, Bareos performs character substitution like in RunScript directive. To automatically manage your bootstrap files, you can use this in your JobDefs resources:

 
Job Defs { 
  ... 
  Write Bootstrap = "%c_%n.bsr" 
  ... 
}

For more details on using this file, please see chapter The Bootstrap File.  

Write Part After Job = <yes|no>

Please note! This directive is deprecated.
 
Write Verify List = <path>

 

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

 
Job { 
  Name = "Minou" 
  Type = Backup 
  Level = Incremental                 # default 
  Client = Minou 
  FileSet="Minou Full Set" 
  Storage = DLTDrive 
  Pool = Default 
  Schedule = "MinouWeeklyCycle" 
  Messages = Standard 
}  
Configuration 9.2: Job Resource Example

#

9.3 JobDefs Resource

The JobDefs resource permits all the same directives that can appear in a Job resource. However, a JobDefs resource does not create a Job, rather it can be referenced within a Job to provide defaults for that Job. This permits you to concisely define several nearly identical Jobs, each one referencing a JobDefs resource which contains the defaults. Only the changes from the defaults need to be mentioned in each Job.

#

9.4 Schedule Resource

The Schedule resource provides a means of automatically scheduling a Job as well as the ability to override the default Level, Pool, Storage and Messages resources. If a Schedule resource is not referenced in a Job, the Job can only be run manually. In general, you specify an action to be taken and when.





configuration directive name
type of data
default value
remark




Description = string
Enabled = yes|no yes
Name = name required
Run = job-overrides> <date-time-specification




Description = <string>

 
Enabled = <yes|no>
(default: yes)
En- or disable this resource.

 

Name = <name>
(required)
The name of the resource.

The name of the schedule being defined.  

Run = <job-overrides> <date-time-specification>

The Run directive defines when a Job is to be run, and what overrides if any to apply. You may specify multiple run directives within a Schedule resource. If you do, they will all be applied (i.e. multiple schedules). If you have two Run directives that start at the same time, two Jobs will start at the same time (well, within one second of each other).

The Job-overrides permit overriding the Level, the Storage, the Messages, and the Pool specifications provided in the Job resource. In addition, the FullPool, the IncrementalPool, and the DifferentialPool specifications permit overriding the Pool specification according to what backup Job Level is in effect.

By the use of overrides, you may customize a particular Job. For example, you may specify a Messages override for your Incremental backups that outputs messages to a log file, but for your weekly or monthly Full backups, you may send the output by email by using a different Messages override.

Job-overrides are specified as: keyword=value where the keyword is Level, Storage, Messages, Pool, FullPool, DifferentialPool, or IncrementalPool, and the value is as defined on the respective directive formats for the Job resource. You may specify multiple Job-overrides on one Run directive by separating them with one or more spaces or by separating them with a trailing comma. For example:

Level=Full
is all files in the FileSet whether or not they have changed.
Level=Incremental
is all files that have changed since the last backup.
Pool=Weekly
specifies to use the Pool named Weekly.
Storage=DLT_Drive
specifies to use DLT_Drive for the storage device.
Messages=Verbose
specifies to use the Verbose message resource for the Job.
FullPool=Full
specifies to use the Pool named Full if the job is a full backup, or is upgraded from another type to a full backup.
DifferentialPool=Differential
specifies to use the Pool named Differential if the job is a differential backup.
IncrementalPool=Incremental
specifies to use the Pool named Incremental if the job is an incremental backup.
Accurate=yes|no
tells Bareos to use or not the Accurate code for the specific job. It can allow you to save memory and and CPU resources on the catalog server in some cases.
SpoolData=yes|no
tells Bareos to use or not to use spooling for the specific job.

Date-time-specification determines when the Job is to be run. The specification is a repetition, and as a default Bareos is set to run a job at the beginning of the hour of every hour of every day of every week of every month of every year. This is not normally what you want, so you must specify or limit when you want the job to run. Any specification given is assumed to be repetitive in nature and will serve to override or limit the default repetition. This is done by specifying masks or times for the hour, day of the month, day of the week, week of the month, week of the year, and month when you want the job to run. By specifying one or more of the above, you can define a schedule to repeat at almost any frequency you want.

Basically, you must supply a month, day, hour, and minute the Job is to be run. Of these four items to be specified, day is special in that you may either specify a day of the month such as 1, 2, ... 31, or you may specify a day of the week such as Monday, Tuesday, ... Sunday. Finally, you may also specify a week qualifier to restrict the schedule to the first, second, third, fourth, or fifth week of the month.

For example, if you specify only a day of the week, such as Tuesday the Job will be run every hour of every Tuesday of every Month. That is the month and hour remain set to the defaults of every month and all hours.

Note, by default with no other specification, your job will run at the beginning of every hour. If you wish your job to run more than once in any given hour, you will need to specify multiple run specifications each with a different minute.

The date/time to run the Job can be specified in the following way in pseudo-BNF:

<week-keyword> ::=

1st | 2nd | 3rd | 4th | 5th | first | second | third | fourth | fifth | last

<wday-keyword> ::=

sun | mon | tue | wed | thu | fri | sat | sunday | monday | tuesday | wednesday | thursday | friday | saturday

<week-of-year-keyword> ::=

w00 | w01 | ... w52 | w53

<month-keyword> ::=

jan | feb | mar | apr | may | jun | jul | aug | sep | oct | nov | dec | january | february | ... | december

<digit> ::=

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0

<number> ::=

<digit> | <digit><number>

<12hour> ::=

0 | 1 | 2 | ... 12

<hour> ::=

0 | 1 | 2 | ... 23

<minute> ::=

0 | 1 | 2 | ... 59

<day> ::=

1 | 2 | ... 31

<time> ::=

<hour>:<minute> | <12hour>:<minute>am | <12hour>:<minute>pm

<time-spec> ::=

at <time> | hourly

<day-range> ::=

<day>-<day>

<month-range> ::=

<month-keyword>-<month-keyword>

<wday-range> ::=

<wday-keyword>-<wday-keyword>

<range> ::=

<day-range> | <month-range> | <wday-range>

<modulo> ::=

<day>/<day> | <week-of-year-keyword>/<week-of-year-keyword>

<date> ::=

<date-keyword> | <day> | <range>

<date-spec> ::=

<date> | <date-spec>

<day-spec> ::=

<day> | <wday-keyword> | <day> | <wday-range> | <week-keyword> <wday-keyword> | <week-keyword> <wday-range> | daily

<month-spec> ::=

<month-keyword> | <month-range> | monthly

<date-time-spec> ::=

<month-spec> <day-spec> <time-spec>

::=
::=
::=
::=
::=

 

Note, the Week of Year specification wnn follows the ISO standard definition of the week of the year, where Week 1 is the week in which the first Thursday of the year occurs, or alternatively, the week which contains the 4th of January. Weeks are numbered w01 to w53. w00 for Bareos is the week that precedes the first ISO week (i.e. has the first few days of the year if any occur before Thursday). w00 is not defined by the ISO specification. A week starts with Monday and ends with Sunday.

According to the NIST (US National Institute of Standards and Technology), 12am and 12pm are ambiguous and can be defined to anything. However, 12:01am is the same as 00:01 and 12:01pm is the same as 12:01, so Bareos defines 12am as 00:00 (midnight) and 12pm as 12:00 (noon). You can avoid this abiguity (confusion) by using 24 hour time specifications (i.e. no am/pm).

An example schedule resource that is named WeeklyCycle and runs a job with level full each Sunday at 2:05am and an incremental job Monday through Saturday at 2:05am is:

 
Schedule { 
  Name = "WeeklyCycle" 
  Run = Level=Full sun at 2:05 
  Run = Level=Incremental mon-sat at 2:05 
}  
Configuration 9.3: Schedule Example

An example of a possible monthly cycle is as follows:

 
Schedule { 
  Name = "MonthlyCycle" 
  Run = Level=Full Pool=Monthly 1st sun at 2:05 
  Run = Level=Differential 2nd-5th sun at 2:05 
  Run = Level=Incremental Pool=Daily mon-sat at 2:05 
}  

The first of every month:

 
Schedule { 
  Name = "First" 
  Run = Level=Full on 1 at 2:05 
  Run = Level=Incremental on 2-31 at 2:05 
}  

The last friday of the month (i.e. the last friday in the last week of the month)

 
Schedule { 
  Name = "Last Friday" 
  Run = Level=Full last fri at 21:00 
}  

Every 10 minutes:

 
Schedule { 
  Name = "TenMinutes" 
  Run = Level=Full hourly at 0:05 
  Run = Level=Full hourly at 0:15 
  Run = Level=Full hourly at 0:25 
  Run = Level=Full hourly at 0:35 
  Run = Level=Full hourly at 0:45 
  Run = Level=Full hourly at 0:55 
}  

The modulo scheduler makes it easy to specify schedules like odd or even days/weeks, or more generally every n days or weeks. It is called modulo scheduler because it uses the modulo to determine if the schedule must be run or not. The second variable behind the slash lets you determine in which cycle of days/weeks a job should be run. The first part determines on which day/week the job should be run first. E.g. if you want to run a backup in a 5-week-cycle, starting on week 3, you set it up as w03/w05.

 
Schedule { 
  Name = "Odd Days" 
  Run = 1/2 at 23:10 
} 
 
Schedule { 
  Name = "Even Days" 
  Run = 2/2 at 23:10 
} 
 
Schedule { 
  Name = "On the 3rd week in a 5-week-cycle" 
  Run = w03/w05 at 23:10 
} 
 
Schedule { 
  Name = "Odd Weeks" 
  Run = w01/w02 at 23:10 
} 
 
Schedule { 
  Name = "Even Weeks" 
  Run = w02/w02 at 23:10 
}  
Configuration 9.4: Schedule Examples: modulo

#

9.4.1 Technical Notes on Schedules

Internally Bareos keeps a schedule as a bit mask. There are six masks and a minute field to each schedule. The masks are hour, day of the month (mday), month, day of the week (wday), week of the month (wom), and week of the year (woy). The schedule is initialized to have the bits of each of these masks set, which means that at the beginning of every hour, the job will run. When you specify a month for the first time, the mask will be cleared and the bit corresponding to your selected month will be selected. If you specify a second month, the bit corresponding to it will also be added to the mask. Thus when Bareos checks the masks to see if the bits are set corresponding to the current time, your job will run only in the two months you have set. Likewise, if you set a time (hour), the hour mask will be cleared, and the hour you specify will be set in the bit mask and the minutes will be stored in the minute field.

For any schedule you have defined, you can see how these bits are set by doing a show schedules command in the Console program. Please note that the bit mask is zero based, and Sunday is the first day of the week (bit zero).

#

9.5 FileSet Resource

The FileSet resource defines what files are to be included or excluded in a backup job. A FileSet resource is required for each backup Job. It consists of a list of files or directories to be included, a list of files or directories to be excluded and the various backup options such as compression, encryption, and signatures that are to be applied to each file.

Any change to the list of the included files will cause Bareos to automatically create a new FileSet (defined by the name and an MD5 checksum of the Include/Exclude contents). Each time a new FileSet is created, Bareos will ensure that the next backup is always a Full save.





configuration directive name
type of data
default value
remark




Description = string
Enable VSS = yes|no yes
Exclude {IncludeExcludeItem }
Ignore File Set Changes = yes|no no
Include {IncludeExcludeItem }
Name = name required




Description = <string>

Information only.  
Enable VSS = <yes|no>
(default: yes)
If this directive is set to yes the File daemon will be notified that the user wants to use a Volume Shadow Copy Service (VSS) backup for this job. This directive is effective only on the Windows File Daemon. It permits a consistent copy of open files to be made for cooperating writer applications, and for applications that are not VSS away, Bareos can at least copy open files. The Volume Shadow Copy will only be done on Windows drives where the drive (e.g. C:, D:, ...) is explicitly mentioned in a File directive. For more information, please see the Windows chapter of this manual.  
Exclude = <IncludeExcludeItem>

Describe the files, that should get excluded from a backup, see section about the FileSet Exclude Ressource.  
Ignore File Set Changes = <yes|no>
(default: no)
Normally, if you modify the FileSet Include or Exclude lists, the next backup will be forced to a Full so that Bareos can guarantee that any additions or deletions are properly saved.

We strongly recommend against setting this directive to yes, since doing so may cause you to have an incomplete set of backups.

If this directive is set to yes, any changes you make to the FileSet Include or Exclude lists, will not force a Full during subsequent backups.  

Include = <IncludeExcludeItem>

Describe the files, that should get included to a backup, see section about the FileSet Include Ressource.  
Name = <name>
(required)
The name of the resource.

The name of the FileSet resource.  

#

9.5.1 FileSet Include Ressource

The Include resource must contain a list of directories and/or files to be processed in the backup job.

Normally, all files found in all subdirectories of any directory in the Include File list will be backed up. Note, see below for the definition of <file-list>. The Include resource may also contain one or more Options resources that specify options such as compression to be applied to all or any subset of the files found when processing the file-list for backup. Please see below for more details concerning Options resources.

There can be any number of Include resources within the FileSet, each having its own list of directories or files to be backed up and the backup options defined by one or more Options resources.

Please take note of the following items in the FileSet syntax:

  1. There is no equal sign (=) after the Include and before the opening brace ({). The same is true for the Exclude.
  2. Each directory (or filename) to be included or excluded is preceded by a File =. Previously they were simply listed on separate lines.
  3. The Exclude resource does not accept Options.
  4. When using wild-cards or regular expressions, directory names are always terminated with a slash (/) and filenames have no trailing slash.
File = < filename | dirname | |command | <includefile-client | <includefile-server >

The file list consists of one file or directory name per line. Directory names should be specified without a trailing slash with Unix path notation.

Windows users, please take note to specify directories (even c:/...) in Unix path notation. If you use Windows conventions, you will most likely not be able to restore your files due to the fact that the Windows path separator was defined as an escape character long before Windows existed, and Bareos adheres to that convention (i.e. means the next character appears as itself).

You should always specify a full path for every directory and file that you list in the FileSet. In addition, on Windows machines, you should always prefix the directory or filename with the drive specification (e.g. c:/xxx) using Unix directory name separators (forward slash). The drive letter itself can be upper or lower case (e.g. c:/xxx or C:/xxx).

Bareos’s default for processing directories is to recursively descend in the directory saving all files and subdirectories. Bareos will not by default cross filesystems (or mount points in Unix parlance). This means that if you specify the root partition (e.g. /), Bareos will save only the root partition and not any of the other mounted filesystems. Similarly on Windows systems, you must explicitly specify each of the drives you want saved (e.g. c:/ and d:/ ...). In addition, at least for Windows systems, you will most likely want to enclose each specification within double quotes particularly if the directory (or file) name contains spaces. The df command on Unix systems will show you which mount points you must specify to save everything. See below for an example.

Take special care not to include a directory twice or Bareos will backup the same files two times wasting a lot of space on your archive device. Including a directory twice is very easy to do. For example:

 
  Include { 
    Options { 
      compression=GZIP 
    } 
    File = / 
    File = /usr 
  }  
Configuration 9.5: File Set

on a Unix system where /usr is a subdirectory (rather than a mounted filesystem) will cause /usr to be backed up twice.

<file-list> is a list of directory and/or filename names specified with a File = directive. To include names containing spaces, enclose the name between double-quotes. Wild-cards are not interpreted in file-lists. They can only be specified in Options resources.

There are a number of special cases when specifying directories and files in a file-list. They are:

Exclude Dir Containing = <filename>

This directive can be added to the Include section of the FileSet resource. If the specified filename (filename-string) is found on the Client in any directory to be backed up, the whole directory will be ignored (not backed up). We recommend to use the filename .nobackup, as it is a hidden file on unix systems, and explains what is the purpose of the file.

For example:

 
    # List of files to be backed up 
    FileSet { 
        Name = "MyFileSet" 
        Include { 
            Options { 
                signature = MD5 
            } 
            File = /home 
            Exclude Dir Containing = .nobackup 
        } 
    } 
      
Configuration 9.12: Exlude Directories containing the file .nobackup

But in /home, there may be hundreds of directories of users and some people want to indicate that they don’t want to have certain directories backed up. For example, with the above FileSet, if the user or sysadmin creates a file named .nobackup in specific directories, such as

    /home/user/www/cache/.nobackup  
    /home/user/temp/.nobackup  
    

then Bareos will not backup the two directories named:

    /home/user/www/cache  
    /home/user/temp  
    

NOTE: subdirectories will not be backed up. That is, the directive applies to the two directories in question and any children (be they files, directories, etc).

Plugin = <plugin-name:plugin-parameter1:plugin-parameter2:>

Instead of only specifying files, a file set can also use plugins. Plugins are additional libraries that handle specific requirements. The purpose of plugins is to provide an interface to any system program for backup and restore. That allows you, for example, to do database backups without a local dump.

The syntax and semantics of the Plugin directive require the first part of the string up to the colon to be the name of the plugin. Everything after the first colon is ignored by the File daemon but is passed to the plugin. Thus the plugin writer may define the meaning of the rest of the string as he wishes.

The program bpluginfo can be used, to retreive information about a specific plugin.

Examples about the bpipe- and the mssql-plugin can be found in the sections about the bpipe Plugin and the Backup of MSSQL Databases with Bareos Plugin.

Note: It is also possible to define more than one plugin directive in a FileSet to do several database dumps at once.

Options = <>

See the FileSet Options Ressource section.

FileSet Options Ressource

The Options resource is optional, but when specified, it will contain a list of keyword=value options to be applied to the file-list. See below for the definition of file-list. Multiple Options resources may be specified one after another. As the files are found in the specified directories, the Options will applied to the filenames to determine if and how the file should be backed up. The wildcard and regular expression pattern matching parts of the Options resources are checked in the order they are specified in the FileSet until the first one that matches. Once one matches, the compression and other flags within the Options specification will apply to the pattern matched.

A key point is that in the absence of an Option or no other Option is matched, every file is accepted for backing up. This means that if you want to exclude something, you must explicitly specify an Option with an exclude = yes and some pattern matching.

Once Bareos determines that the Options resource matches the file under consideration, that file will be saved without looking at any other Options resources that may be present. This means that any wild cards must appear before an Options resource without wild cards.

If for some reason, Bareos checks all the Options resources to a file under consideration for backup, but there are no matches (generally because of wild cards that don’t match), Bareos as a default will then backup the file. This is quite logical if you consider the case of no Options clause is specified, where you want everything to be backed up, and it is important to keep in mind when excluding as mentioned above.

However, one additional point is that in the case that no match was found, Bareos will use the options found in the last Options resource. As a consequence, if you want a particular set of ”default” options, you should put them in an Options resource after any other Options.

It is a good idea to put all your wild-card and regex expressions inside double quotes to prevent conf file