PIC
Bareos ;
Backup Archiving REcovery Open Sourced

Main Reference

Bareos GmbH & Co KG

This manual documents Bareos version master (November 26, 2014)
Copyright 1999-2012, Free Software Foundation Europe e.V.
Copyright 2010-2012, Planets Communications B.V.
Copyright 2013-2014, 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 Bareos Configuration
 1.6 Conventions Used in this Document
 1.7 Quick Start
 1.8 Terminology
 1.9 What Bareos is Not
 1.10 Interactions Between the Bareos Services
 1.11 The Current State of Bareos
  1.11.1 What is Implemented
  1.11.2 Advantages Over Other Backup Programs
  1.11.3 Current Implementation Restrictions
  1.11.4 Design Limitations or Restrictions
  1.11.5 Items to Note
2 Installing Bareos
 2.1 Subscribe to a Software Repository
 2.2 Choose a 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.4 Prepare Bareos database
  2.4.1 Debian based Linux Distributions
  2.4.2 Other Platforms
 2.5 Start the daemons
3 Updating Bareos
 3.1 Updating the database schema
  3.1.1 Debian based Linux Distributions
  3.1.2 Other Platforms
4 Getting Started with Bareos
 4.1 Understanding Jobs and Schedules
 4.2 Understanding Pools, Volumes and Labels
 4.3 Setting Up Bareos Configuration Files
  4.3.1 Configuring the Console Program
  4.3.2 Configuring the File daemon
  4.3.3 Configuring the Director
  4.3.4 Configuring the Storage daemon
 4.4 Testing your Configuration Files
 4.5 Testing Compatibility with Your Tape Drive
 4.6 Running Bareos
5 Tutorial
 5.1 Installing Bareos
 5.2 Starting the Database
 5.3 Starting the Daemons
 5.4 Using the Director to Query and Start Jobs
 5.5 Running a Job
 5.6 Restoring Your Files
 5.7 Quitting the Console Program
 5.8 Adding a Second Client
 5.9 When The Tape Fills
 5.10 Other Useful Console Commands
 5.11 Patience When Starting Daemons or Mounting Blank Tapes
 5.12 Difficulties Connecting from the FD to the SD
 5.13 Creating a Pool
 5.14 Labeling Your Volumes
6 Critical Items to Implement Before Production
 6.1 Critical Items
 6.2 Recommended Items
II  Configuration Files
7 Customizing the Configuration Files
 7.1 Character Sets
 7.2 Resource Directive Format
  7.2.1 Comments
  7.2.2 Upper and Lower Case and Spaces
  7.2.3 Including other Configuration Files
  7.2.4 Data Types
  7.2.5 Variable Expansion
 7.3 Resource Types
 7.4 Names, Passwords and Authorization
8 Director Configuration
 8.1 Director Resource
 8.2 Job Resource
 8.3 JobDefs Resource
 8.4 Schedule Resource
  8.4.1 Technical Notes on Schedules
 8.5 FileSet Resource
  8.5.1 FileSet Include Ressource
  8.5.2 FileSet Exclude Ressource
  8.5.3 FileSet Examples
  8.5.4 Windows FileSets
  8.5.5 Testing Your FileSet
 8.6 Client Resource
 8.7 Storage Resource
 8.8 Pool Resource
  8.8.1 Scratch Pool
 8.9 Catalog Resource
 8.10 Messages Resource
 8.11 Console Resource
 8.12 Counter Resource
 8.13 Example Director Configuration File
9 Client/File Daemon Configuration
 9.1 Client Resource
 9.2 Director Resource
 9.3 Messages Resource
 9.4 Example Client 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 Messages Resource
 11.1 Message Types
12 Console Configuration
 12.1 Director Resource
 12.2 ConsoleFont Resource
 12.3 Console Resource
 12.4 Console Commands
 12.5 Example Console Configuration File
13 Monitor Configuration
 13.1 Monitor Resource
 13.2 Director Resource
 13.3 Client Resource
 13.4 Storage Resource
 13.5 Tray Monitor
III  Tasks and Concepts
14 Bareos Console
 14.1 Console Configuration
 14.2 Running the Console Program
  14.2.1 Exit the Console Program
  14.2.2 Running the Console from a Shell Script
 14.3 Console Keywords
 14.4 Console Commands
  14.4.1 Special dot (.) Commands
  14.4.2 Special At (@) Commands
 14.5 Adding Volumes to a Pool
15 The Restore Command
 15.1 General
 15.2 The Restore Command
 15.3 Selecting Files by Filename
 15.4 Replace Options
 15.5 Command Line Arguments
 15.6 Using File Relocation
 15.7 Restoring Directory Attributes
 15.8 Restoring on Windows
 15.9 Restore Errors
 15.10 Example Restore Job Resource
 15.11 File Selection Commands
16 Volume Management
 16.1 Key Concepts and Resource Records
  16.1.1 Pool Options to Limit the Volume Usage
  16.1.2 Automatic Volume Labeling
  16.1.3 Restricting the Number of Volumes and Recycling
 16.2 Concurrent Disk Jobs
 16.3 An Example
 16.4 Backing up to Multiple Disks
 16.5 Considerations for Multiple Clients
 16.6 Automatic Volume Recycling
  16.6.1 Automatic Pruning
  16.6.2 Pruning Directives
  16.6.3 Recycling Algorithm
  16.6.4 Recycle Status
  16.6.5 Making Bareos Use a Single Tape
  16.6.6 Daily, Weekly, Monthly Tape Usage Example
  16.6.7 Automatic Pruning and Recycling Example
  16.6.8 Manually Recycling Volumes
17 Automated Disk Backup
 17.1 Overall Design
  17.1.1 Full Pool
  17.1.2 Differential Pool
  17.1.3 Incremental Pool
 17.2 Configuration Files
18 Autochanger Support
 18.1 Knowing What SCSI Devices You Have
  18.1.1 Linux
  18.1.2 FreeBSD
 18.2 Slots
 18.3 Multiple Devices
 18.4 Device Configuration Records
 18.5 An Example Configuration File
 18.6 A Multi-drive Example Configuration File
 18.7 Specifying Slots When Labeling
 18.8 Changing Cartridges
 18.9 Dealing with Multiple Magazines
 18.10 Update Slots Command
 18.11 Using the Autochanger
 18.12 Barcode Support
 18.13 Use bconsole to display Autochanger content
 18.14 Bareos Autochanger Interface
 18.15 Tapespeed and blocksizes
19 Using Tape Drives without Autochanger
 19.1 Simple One Tape Backup
  19.1.1 Advantages
  19.1.2 Disadvantages
  19.1.3 Practical Details
 19.2 Manually Changing Tapes
 19.3 Daily Tape Rotation
  19.3.1 Advantages
  19.3.2 Disadvantages
  19.3.3 Practical Details
20 Data Spooling
 20.1 Data Spooling Directives
 20.2 Other Points
21 Migration and Copy
 21.1 Migration and Copy Job Resource Directives
 21.2 Migration Pool Resource Directives
 21.3 Important Migration Considerations
 21.4 Example Migration Jobs
  21.4.1 Multiple Storage Daemons
22 Accurate Mode
23 File Deduplication using Base Jobs
24 Plugins
 24.1 File Daemon Plugins
  24.1.1 bpipe Plugin
  24.1.2 PGSQL Plugin
  24.1.3 MSSQL Plugin
  24.1.4 python-fd Plugin
 24.2 Storage Daemon Plugins
  24.2.1 autoxflate-sd
  24.2.2 scsicrypto-sd
  24.2.3 scsitapealert-sd
  24.2.4 python-sd Plugin
 24.3 Director Plugins
  24.3.1 python-dir Plugin
25 The Windows Version of Bareos
 25.1 Windows Installation
  25.1.1 Graphical Installation
  25.1.2 Command Line (Silent) Installation
 25.2 Dealing with Windows Problems
 25.3 Windows Compatibility Considerations
 25.4 Volume Shadow Copy Service (VSS)
  25.4.1 VSS Problems
 25.5 Windows Firewalls
  25.5.1 Network TCP Port
 25.6 Windows Restore Problems
 25.7 Windows Backup Problems
 25.8 Windows Ownership and Permissions Problems
 25.9 Fixing the Windows Boot Record
 25.10 File Daemon: Windows Specific Command Line Options
26 Network setup
 26.1 Passive Clients
  26.1.1 Usage
27 Transport Encryption
 27.1 TLS Configuration Directives
 27.2 Creating a Self-signed Certificate
 27.3 Example TLS Configuration Files
28 Data Encryption
 28.1 Encryption Technical Details
 28.2 Generating Private/Public Encryption Keys
 28.3 Example Data Encryption Configuration
 28.4 Decrypting with a Master Key
29 Catalog Maintenance
 29.1 Catalog Database
  29.1.1 dbconfig-common (Debian)
  29.1.2 Manual Configuration
 29.2 Retention Periods
 29.3 MySQL
  29.3.1 Compacting Your MySQL Database
  29.3.2 Repairing Your MySQL Database
  29.3.3 MySQL Table is Full
  29.3.4 MySQL Server Has Gone Away
  29.3.5 MySQL Temporary Tables
 29.4 PostgreSQL
  29.4.1 Repairing Your PostgreSQL Database
  29.4.2 Compacting Your PostgreSQL Database
 29.5 Performance Issues Indexes
  29.5.1 PostgreSQL Indexes
  29.5.2 MySQL Indexes
  29.5.3 SQLite Indexes
 29.6 Backing Up Your Bareos Database
 29.7 Database Size
30 Bareos Security Issues
 30.1 Configuring and Testing TCP Wrappers
IV  Appendix
A System Requirements
B Operating Systems
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 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.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
G Howtos
 G.1 Use a dummy device to test the backup
 G.2 Backup Of Third Party Databases
  G.2.1 Backup of MSSQL Databases with Bareos Plugin
  G.2.2 Backup of a PostgreSQL Database
  G.2.3 Backup of a MySQL Database
H Disaster Recovery Using Bareos
 H.1 General
  H.1.1 Important Considerations
 H.2 Steps to Take Before Disaster Strikes
 H.3 Bare Metal Recovery of Bareos Clients
  H.3.1 Linux
 H.4 Restoring a Bareos Server
I Troubleshooting
 I.1 Client Access Problems
  I.1.1 Authorization Errors
 I.2 Concurrent Jobs
 I.3 Tape Labels: ANSI or IBM
  I.3.1 Reading
  I.3.2 Writing
 I.4 Tape Drive
  I.4.1 Get Your Tape Drive Working
 I.5 Autochanger
  I.5.1 Testing Autochanger and Adapting mtx-changer script
 I.6 Restore
  I.6.1 Restore a pruned job using a pattern
  I.6.2 Problems Restoring Files
  I.6.3 Restoring Files Can Be Slow
  I.6.4 Restoring When Things Go Wrong
J Debugging
 J.1 Traceback
 J.2 Testing The Traceback
  J.2.1 Getting A Traceback On Other Systems
 J.3 Manually Running Bareos Under The Debugger
K Release Notes
L Bareos Copyright, Trademark, and Licenses
 L.1 Licenses Overview
 L.2 GNU Free Documentation License
 L.3 GNU Affero Gerneral Public License
 L.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.

Both, the Bacula project and the documentation was initiated by 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 five major components or services: Director, Console, File, Storage, and Monitor services.

Bareos Director

The Bareos Director service is the program that 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 service is the program that allows the administrator or user to communicate with the Bareos Director Currently, the Bareos Console is available in two versions: a text-based console and a QT-based GUI interface. The first and simplest is to run the Console program in a shell window (i.e. TTY interface). Most system administrators will find this completely adequate. The second version is a GUI interface that is far from complete, but quite functional as it has most the capabilities of the shell Console. For more details see the Bareos Console Design Document.

Bareos File

The Bareos File service (also known as the Client program) is the software program that is installed on the machine to be backed up. 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 Director. The File services are also responsible for the file system dependent part of restoring the file attributes and data during a recovery operation. For more details see the File Services Daemon Design Document in the Bareos Developer’s Guide. This program runs as a daemon on the machine to be backed up. In addition to Unix/Linux File daemons, there are File daemons for Windows and MacOS.

Bareos Storage

The Bareos Storage services consist of the software programs that perform the storage and recovery of the file attributes and data to the physical backup media or volumes. In other words, the Storage daemon is responsible for reading and writing your tapes (or other storage media, e.g. files). 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. For the technical and porting details see the Catalog Services Design Document in the developer’s documented.

The packages for MySQL and PostgreSQL are available for several operating systems.

Bareos Tray Monitor

A Bareos Tray Monitor service is the program that allows the user to watch current status of Bareos Directors, Bareos File Daemons and Bareos Storage Daemons. Currently, a QT version is available, which works with Linux and Windows.

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 abstration libs and tools for the sql catalog
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-python-pluginPython plugin for Bareos File daemon
bareos-storage 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)


Not all packages (especially optional backends and plugins) are available on all 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 Bareos Configuration

In order for Bareos to understand your system, what clients you want backed up and how, you must create a number of configuration files containing resources (or objects).

TODO: add overview picture

1.6 Conventions Used in this Document

Bareos is in a state of evolution, and as a consequence, this manual will not always agree with the code. If an item in this manual is preceded by an asterisk (*), it indicates that the particular feature is not implemented. If it is preceded by a plus sign (+), it indicates that the feature may be partially implemented.

If you are reading this manual as supplied in a released version of the software, the above paragraph holds true. If you are reading the online version of the manual, http://www.bareos.org, please bear in mind that this version describes the current version in development that may contain features not in the released version. Just the same, it generally lags behind the code a bit.

The source of this document is available at https://github.com/bareos/bareos-docs. As with the rest of the Bareos project, you are welcome to participate and improve it.

1.7 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.8 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.9 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.10 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.

PIC

1.11 The Current State of Bareos

1.11.1 What is Implemented

1.11.2 Advantages Over Other Backup Programs

1.11.3 Current Implementation Restrictions

1.11.4 Design Limitations or Restrictions

1.11.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. Subscribe to a Software Repository
  2. Choose a 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 Subscribe to a Software Repository

You’ll find Bareos binary package repositories at http://download.bareos.org/. The lastet stable released version is available at http://download.bareos.org/bareos/release/latest/. Add the repository to your system.

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). See your distribution’s documentation for details.

2.2 Choose a 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 Choose a 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

RHEL6, CentOS6, Fedora
 
# 
# define parameter 
# 
 
DIST=RHEL_7 
# or 
# DIST=RHEL_6 
# DIST=Fedora_20 
# DIST=CentOS_7 
# 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.1: Bareos installation on RHEL 6 / CentOS 6 / Fedora

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.2: 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 
# or 
# DIST=SLE_11_SP3 
# DIST=openSUSE_13.1 
 
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.3: Bareos installation on SLES / openSUSE

2.3.3 Install on Debian based Linux Distributions

Debian / Ubuntu
 
# 
# define parameter 
# 
 
DIST=Debian_7.0 
# or 
# DIST=Debian_6.0 
# 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.4: Bareos installation on Debian / Ubuntu

2.4 Prepare Bareos database

We assume that you have already your database installed and basically running. Currently the database backend 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.

PIC PIC

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.5: Setup Bareos catalog with PostgreSQL

MySQL

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.6: 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.7: 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.8: 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.

Chapter 3
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.

3.1 Updating the database schema

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

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

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

Take a look in the Release Notes to see, what Bareos updates to require a database schema update.

3.1.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. For details see dbconfig-common (Debian).

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

3.1.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 Maitenance.

Please note! If you’re updating to Bareos <= 13.2.3 and had 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 definied in the same way when calling the update and grant scripts. Newer versions of Bareos read this variables from the Director configuration file /etc/bareos/bareos-dir.conf. However, make sure, 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 3.1: Update PostgreSQL database schema

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

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

MySQL

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 config file ~/.my.cnf. It should look similar to this:

 
[client] 
host=localhost 
user=root 
password=YourPasswordForAccessingMysqlAsRoot  
Configuration 3.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 3.3: Update MySQL database schema

Currently on MySQL is it not neccessary 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 4
Getting Started with Bareos

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

4.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 request you to mount 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 (bareos-dir.conf) as well as information on all the Volumes that have been added to the Pool. Adding Volumes to a Pool is usually done manually with the Console program using the label command.

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. This is usually done 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.

4.3 Setting Up Bareos Configuration Files

On Unix, Bareos configuration files are usualy location in the /etc/bareos/ directory and are named accordingly to the programs that use it: bareos-fd.conf, bareos-sd.conf, bareos-dir.conf, bconsole.conf, etc.

For information about Windows configuration files, see the Windows chapter.

4.3.1 Configuring the Console Program

The Console program is used by the administrator to interact with the Director and to manually start/stop Jobs or to obtain Job status information.

The Console configuration file is named bconsole.conf.

Normally, for first time users, no change is needed to these files. Reasonable defaults are set.

Further details are in the Console configuration chapter.

4.3.2 Configuring the File daemon

The File daemon is a program that runs on each (Client) machine. At the request of the Director, finds the files to be backed up and sends them (their data) to the Storage daemon.

The File daemon configuration file is named bareos-fd.conf. Normally, for first time users, no change is needed to this file. Reasonable defaults are set. However, if you are going to back up more than one machine, you will need to install the File daemon with a unique configuration file on each machine to be backed up. The information about each File daemon must appear in the Director’s configuration file.

Further details are in the File daemon configuration chapter.

4.3.3 Configuring the Director

The Director is the central control program for all the other daemons. It schedules and monitors all jobs to be backed up.

The Director configuration file is named bareos-dir.conf.

In general, the only change you must make is modify the FileSet resource so that the Include configuration directive contains at least one line with a valid name of a directory (or file) to be saved.

You may also want to change the email address for notification from the default root to your email address.

Finally, if you have multiple systems to be backed up, you will need a separate File daemon or Client specification for each system, specifying its name, address, and password. We have found that giving your daemons the same name as your system but post fixed with -fd helps a lot in debugging. That is, if your system name is foobaz, you would give the File daemon the name foobaz-fd. For the Director, you should use foobaz-dir, and for the storage daemon, you might use foobaz-sd. Each of your Bareos components must have a unique name. If you make them all the same, aside from the fact that you will not know what daemon is sending what message, if they share the same working directory, the daemons temporary file names will not be unique, and you will get many strange failures.

More information is in the Director configuration chapter.

4.3.4 Configuring the Storage daemon

The Storage daemon is responsible, at the Director’s request, for accepting data from a File daemon and placing it on Storage media, or in the case of a restore request, to find the data and send it to the File daemon.

The Storage daemon’s configuration file is named bareos-sd.conf. The default configuration comes with backup to disk only, so the Archive device points to a directory in which the Volumes will be created as files when you label the Volume. These Storage resource name and Media Type must be the same as the corresponding ones in the Director’s configuration file bareos-dir.conf.

Further information is in the Storage daemon configuration chapter.

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

 
bareos-dir -t -c /etc/bareos/bareos-dir.conf 
bareos-fd -t -c /etc/bareos/bareos-fd.conf 
bareos-sd -t -c /etc/bareos/bareos-sd.conf 
bconsole -t -c /etc/bareos/bconsole.conf 
bat -t -c /etc/bareos/bat.conf 
bareos-tray-monitor -t -c /etc/bareos/tray-monitor.conf  
Commands 4.1: Testing Configuration Files

will test the configuration files of each of the main programs. If the configuration file is OK, the program will terminate without printing anything.

4.5 Testing Compatibility with Your Tape Drive

Before spending a lot of time on Bareos only to find that it doesn’t work with your tape drive, please read the Testing Your Tape Drive chapter of this manual. TapeTesting chapter is missing! If you have a modern standard SCSI tape drive on a Linux or Solaris, most likely it will work, but better test than be sorry. For FreeBSD (and probably other xBSD flavors), reading the above mentioned tape testing chapter is a must. Also, for FreeBSD, please see The FreeBSD Diary for a detailed description on how to make Bacula work on your system. This information should also work with Bareos.

4.6 Running Bareos

Probably the most important part of running Bareos is being able to restore files. If you haven’t tried recovering files at least once, when you actually have to do it, you will be under a lot more pressure, and prone to make errors, than if you had already tried it once.

To get a good idea how to use Bareos in a short time, we strongly recommend that you follow the example in the Running Bareos Chapter of this manual where you will get detailed instructions on how to run Bareos.

Chapter 5
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 changed the .conf files. If you have modified the .conf files, please go back and uninstall Bareos, then reinstall it, but do not make any changes. The examples in this chapter use the default configuration files, and will write the volumes to disk in your /var/lib/bareos/storage/ directory, in addition, the data backed up will be the source directory where you built Bareos. As a consequence, you can run all the Bareos daemons for these tests as non-root. Please note, in production, your File daemon(s) must run as root. See the Security chapter for more information on this subject.

The general flow of running Bareos is:

  1. Start the Database (if using MySQL or PostgreSQL)
  2. Start the Bareos Daemons
  3. Start the Console program to interact with the Director
  4. Run a job
  5. When the Volume fills, unmount the Volume, if it is a tape, label a new one, and continue running. In this chapter, we will write only to disk files so you won’t need to worry about tapes for the moment.
  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.

5.1 Installing Bareos

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

5.2 Starting the Database

If you are using MySQL or PostgreSQL as the Bareos database, you should start it before you attempt to run a job to avoid getting error messages from Bareos when it starts. If you are using SQLite you need do nothing. SQLite is automatically started by Bareos.

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

The bareos script starts the Storage daemon, the File daemon, and the Director daemon, which all normally run as daemons in the background. If you are using the autostart feature of Bareos, your daemons will either be automatically started on reboot, or you can control them individually with the files bareos-dir, bareos-fd, and bareos-sd, which are usually located in /etc/init.d, though the actual location is system dependent. Some distributions may do this differently.

Note, on Windows, currently only the File daemon is ported, and it must be started differently. Please see the Windows Version of Bareos chapter of this manual.

The rpm packages configure the daemons to run as user=root and group=bareos. The rpm installation also creates the group bareos if it does not exist on the system. Any users that you add to the group bareos will have access to files created by the daemons. To disable or alter this behavior edit the daemon startup scripts:

and then restart as noted above.

The installation chapter of this manual explains how you can install scripts that will automatically restart the daemons when the system starts.

5.4 Using the Director to Query and Start Jobs

To communicate with the director and to query the state of Bareos or run jobs, from the top level directory, simply enter:

bconsole

For simplicity, here we will describe only the bconsole program, also there is also a graphical interface called BAT.

The bconsole runs the Bareos Console program, which connects to the Director daemon. 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 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 5.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           Non-interactive gui mode 
  help          Print help on specific command 
  import        Import volumes from import/export slots to normal slots 
  label         Label a tape 
  list          List objects from catalog 
  llist         Full or long list like list command 
  messages      Display pending messages 
  memory        Print current memory usage 
  mount         Mount storage 
  move          Move slots in an autochanger 
  prune         Prune expired records from catalog 
  purge         Purge records from catalog 
  quit          Terminate Bconsole session 
  query         Query catalog 
  restore       Restore files 
  relabel       Relabel a tape 
  release       Release storage 
  reload        Reload conf file 
  rerun         Rerun a job 
  run           Run a job 
  status        Report status 
  setbandwidth  Sets bandwidth 
  setdebug      Sets debug level 
  setip         Sets new client address -- if authorized 
  show          Show resource records 
  sqlquery      Use SQL to query catalog 
  time          Print current time 
  trace         Turn on/off trace to file 
  unmount       Unmount storage 
  umount        Umount - for old-time Unix guys, see unmount 
  update        Update volume, pool or stats 
  use           Use specific catalog 
  var           Does variable expansion 
  version       Print Director version 
  wait          Wait until no jobs are running  
bconsole 5.2: help

Details of the console program’s commands are explained in the Console Chapter of this manual.

5.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=Full Set 
      O M 
      N 
      I /usr/sbin 
      N 
      E /var/lib/bareos 
      E /var/lib/bareos/storage 
      E /proc 
      E /tmp 
      E /.journal 
      E /.fsck 
      N  
bconsole 5.3: show filesets

This is a pre-defined FileSet that will backup the Bareos source directory. The actual directory names printed should correspond to your system configuration. For testing purposes, we have chosen a directory of moderate size (about 40 Megabytes) and complexity without being too big. The FileSet Catalog is used for backing up Bareos’s catalog and is not of interest to us for the moment. The I entries are the files or directories that will be included in the backup and the E are those that will be excluded, and the O entries are the options specified for the FileSet. You can change what is backed up by editing bareos-dir.conf and changing the File = line in the FileSet 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

and you should get the following output:

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

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 BackupClient1 at 1:05am and that at 1:10, a BackupCatalog is scheduled to run. Note, you should probably change the name BackupClient1 to be the name of your machine, if not, when you add additional clients, it will be very confusing.

Now enter:

status client

and you should get something like:

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

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

Finally do the same for your Storage daemon with:

status storage

and you should get:

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

You will notice that the default Storage daemon device is named File 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:  Full Set  
Pool:     File (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 BackupClient1 with FileSet Full Set (we listed above) as an Incremental job on your Client (your client name will be different), and to use Storage File and Pool Default, and finally, it wants to run it now (the current time should be displayed by your console).

Here we have the choice to run (yes), to modify one or more of the above parameters (mod), or to not run the job (no). Please enter yes, at which point you should immediately get the command prompt (an asterisk). If you wait a few seconds, then enter the command messages you will get back something like:

TODO: Replace bconsole output by current version of Bareos.

28-Apr-2003 14:22 bareos-dir: Last FULL backup time not found. Doing  
                  FULL backup.  
28-Apr-2003 14:22 bareos-dir: Start Backup JobId 1,  
                  Job=Client1.2003-04-28_14.22.33  
28-Apr-2003 14:22 bareos-sd: Job Client1.2003-04-28_14.22.33 waiting.  
                  Cannot find any appendable volumes.  
Please use the "label"  command to create a new Volume for:  
    Storage:      FileStorage  
    Media type:   File  
    Pool:         Default

The first message, indicates that no previous Full backup was done, so Bareos is upgrading our Incremental job to a Full backup (this is normal). The second message indicates that the job started with JobId 1., and the third message tells us that Bareos cannot find any Volumes in the Pool for writing the output. This is normal because we have not yet created (labeled) any Volumes. Bareos indicates to you all the details of the volume it needs.

At this point, the job is BLOCKED waiting for a Volume. You can check this if you want by doing a status dir. In order to continue, we must create a Volume that Bareos can write on. We do so with:

label

and Bareos will print:

The defined Storage resources are:  
     1: File  
Item 1 selected automatically.  
Enter new Volume name:

at which point, you should enter some name beginning with a letter and containing only letters and numbers (period, hyphen, and underscore) are also permitted. For example, enter TestVolume001, and you should get back:

Defined Pools:  
     1: Default  
Item 1 selected automatically.  
Connecting to Storage daemon File at bareos:8103 ...  
Sending label command for Volume "TestVolume001" Slot 0 ...  
3000 OK label. Volume=TestVolume001 Device=/var/lib/bareos/storage  
Catalog record for Volume "TestVolume002", Slot 0  successfully created.  
Requesting mount FileStorage ...  
3001 OK mount. Device=/var/lib/bareos/storage

Finally, enter messages and you should get something like:

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

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

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 TestVolume001

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.

You might ask yourself if you have to label all the Volumes that Bareos is going to use. The answer for disk Volumes, like the one we used, is no. It is possible to have Bareos automatically label volumes. For tape Volumes, you will most likely have to label each of the Volumes you want to use.

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.

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

where you will get:

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

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 ro dir commands to walk up and down the directory tree and view what files will be restored. For example, if I enter cd /usr/sbin and then enter dir I will get a listing of all the files in the Bareos source 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:

rm -rf /tmp/bareos-restore

5.7 Quitting the Console Program

Simply enter the command quit.

5.8 Adding a Second Client

Changes on the Client

If you have gotten the example shown above to work on your system, you may be ready to add a second Client (File daemon). That is you have a second machine that you would like backed up. The only part you need installed on the other machine is the bareos-filedaemon.

This packages installs also its configuration file /etc/bareos/bareos-fd.conf an sets its hostname + -fd as FileDaemon name. However, the client does not known the Bareos Director, so this information must be given manually.

Lets assume, your second like has the hostname client2 and this name is resolvable by DNS from the client and from the Bareos Director.

Specify the Bareos Director in the File Daemon configuration file /etc/bareos/bareos-fd.conf:

...  
#  
# List Directors who are permitted to contact this File daemon  
#  
Director {  
  Name = bareos-dir  
  Password = "PASSWORD" # this is the passwort which you need to use within the client ressource.  
}  
...

The password is also generated at installation time, but you are free to change it. Just keep in mind, it must be identical on the client and the Bareos Director.

Restart the Bareos File Daemon by

root@client2:~ # service bareos-fd restart

Changes on the Server (Bareos Director)

Then you need to make some additions to your Director’s configuration file to define the new File Daemon (Client).

Starting from our original example which should be installed on your system, you should add the following lines (essentially copies of the existing data but with the names changed) to your Director’s configuration file bareos-dir.conf.

Add following section makes the new client know to the Bareos Director. Add this section to the existing Bareos Director configuration file /etc/bareos/bareos-dir.conf:

Client {  
  Name = client2-fd  
  Address = client2             # the name has to be resolvable through DNS. If this is not possible, you can work with IP addresses  
  Password = "PASSWORD"         # password for FileDaemon which has to be the same like the password in the director ressource of the bareos-fd.conf on the backup client. Copy it the the client to this line.  
}

Using this, the client is know to the Bareos Director. Additional you must specify, what to do with this client. Therefore we specify a Job, which mostly takes its settings from the existing DefaultJob:

Job {  
  JobDefs = "DefaultJob"  
  Name    = "client2"  
  Client  = "client2-fd"  
}

Check if the configuration file is correct by

root@bareos:~ # bareos-dir -t -c /etc/bareos/bareos-dir.conf

If everything is okay, reload the Bareos Director:

root@bareos:~ # service bareos-dir reload

Now the setup for the second client should be ready.

To test the functionality, you can run a backup and restore job like in the example with the first attached FileDaemon. However, there is an even earier way to check if a connection to a File Daemon is working. This is the estimate listing command in bconsole. Using this, the Bareos Director immediately connects to a client and returns all files that will be included in the next backup.

Start bconsole and follow the instructions:

* estimate listing

The result should appear immediately.

To make this a real production installation, you will possibly want to use different Pool, or a different schedule. It is up to you to customize.

5.9 When The Tape Fills

If you have scheduled your job, typically nightly, there will come a time when the tape fills up and Bareos cannot continue. In this case, Bareos will send you a message similar to the following:

bareos-sd: block.c:337 === Write error errno=28: ERR=No space left on device

This indicates that Bareos got a write error because the tape is full. Bareos will then search the Pool specified for your Job looking for an appendable volume. In the best of all cases, you will have properly set your Retention Periods and you will have all your tapes marked to be Recycled, and Bareos will automatically recycle the tapes in your pool requesting and overwriting old Volumes. For more information on recycling, please see the Recycling chapter of this manual. If you find that your Volumes were not properly recycled (usually because of a configuration error), please see the Manually Recycling Volumes section of the Recycling chapter.

If like me, you have a very large set of Volumes and you label them with the date the Volume was first writing, or you have not set up your Retention periods, Bareos will not find a tape in the pool, and it will send you a message similar to the following:

bareos-sd: Job usersave.2002-09-19.10:50:48 waiting. Cannot find any  
          appendable volumes.  
Please use the "label"  command to create a new Volume for:  
    Storage:      SDT-10000  
    Media type:   DDS-4  
    Pool:         Default

Until you create a new Volume, this message will be repeated an hour later, then two hours later, and so on doubling the interval each time up to a maximum interval of one day.

The obvious question at this point is: What do I do now?

The answer is simple: first, using the Console program, close the tape drive using the unmount command. If you only have a single drive, it will be automatically selected, otherwise, make sure you release the one specified on the message (in this case STD-10000).

Next, you remove the tape from the drive and insert a new blank tape. Note, on some older tape drives, you may need to write an end of file mark (mt  -f  /dev/nst0  weof) to prevent the drive from running away when Bareos attempts to read the label.

Finally, you use the label command in the Console to write a label to the new Volume. The label command will contact the Storage daemon to write the software label, if it is successful, it will add the new Volume to the Pool, then issue a mount command to the Storage daemon. See the previous sections of this chapter for more details on labeling tapes.

The result is that Bareos will continue the previous Job writing the backup to the new Volume.

If you have a Pool of volumes and Bareos is cycling through them, instead of the above message ”Cannot find any appendable volumes.”, Bareos may ask you to mount a specific volume. In that case, you should attempt to do just that. If you do not have the volume any more (for any of a number of reasons), you can simply mount another volume from the same Pool, providing it is appendable, and Bareos will use it. You can use the list volumes command in the console program to determine which volumes are appendable and which are not.

If like me, you have your Volume retention periods set correctly, but you have no more free Volumes, you can relabel and reuse a Volume as follows:

To manually relabel the Volume use the following additional steps:

5.10 Other Useful Console Commands

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 media
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.
unmount storage=storage-name
Unmounts the drive associated with the storage device with the name storage-name if the drive is not currently being used. This command is used if you wish Bareos to free the drive so that you can use it to label a tape.
mount storage=storage-name
Causes the drive associated with the storage device to be mounted again. When Bareos reaches the end of a volume and requests you to mount a new volume, you must issue this command after you have placed the new volume in the drive. In effect, it is the signal needed by Bareos to know to start reading or writing the new volume.
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.

5.11 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 such as an HP DLT. 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 (at least on my Red Hat Linux system). As a consequence, you are again urged to have patience when inserting blank tapes. Let the device settle down before attempting to access it.

5.12 Difficulties Connecting from the FD to the SD

If you are having difficulties getting one or more of your File daemons to connect to the Storage daemon, it is most likely because you have not used a fully qualified domain name on the Address directive in the Director’s Storage resource. That is the resolver on the File daemon’s machine (not on the Director’s) must be able to resolve the name you supply into an IP address. An example of an address that is guaranteed not to work: localhost. An example that may work: megalon. An example that is more likely to work: magalon.mydomain.com. On Win32 if you don’t have a good resolver (often true on older Windows systems), you might try using an IP address in place of a name.

If your address is correct, then make sure that no other program is using the port 9103 on the Storage daemon’s machine. The Bacula project has reserved these port numbers are by IANA, therefore they should only be used by Bacula and its replacements like Bareos. However, apparently some HP printers do use these port numbers. A netstat -a on the Storage daemon’s machine can determine who is using the 9103 port (used for FD to SD communications in Bareos).

5.13 Creating a Pool

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

When you run a job, one of the things that Bareos must know is what Volumes to use to backup the FileSet. Instead of specifying a Volume (tape) directly, you specify which Pool of Volumes you want Bareos to consult when it wants a tape for writing backups. Bareos will select the first available Volume from the Pool that is appropriate for the Storage device 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, 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

to the console program, which should print something like the following:

*list pools  
Using default Catalog name=MySQL DB=bareos  
+--------+---------+---------+---------+----------+-------------+  
| PoolId | Name    | NumVols | MaxVols | PoolType | LabelFormat |  
+--------+---------+---------+---------+----------+-------------+  
| 1      | Default | 3       | 0       | Backup   | *           |  
| 2      | File    | 12      | 12      | Backup   | File        |  
+--------+---------+---------+---------+----------+-------------+  
*

If you attempt to create the same Pool name a second time, Bareos will print:

Error: Pool Default already exists.  
Once created, you may use the {\bf update} command to  
modify many of the values in the Pool record.

5.14 Labeling Your Volumes

Bareos requires that each Volume contains a software label. There are several strategies for labeling volumes. The one I use is to label them as they are needed by Bareos using the console program. That is when Bareos needs a new Volume, and it does not find one in the catalog, it will send me an email message requesting that I add Volumes to the Pool. I then use the label command in the Console program to label a new Volume and to define it in the Pool database, after which Bareos will begin writing on the new Volume. Alternatively, I can use the Console relabel command to relabel a Volume that is no longer used providing it has VolStatus Purged.

Another strategy is to label a set of volumes at the start, then use them as Bareos requests them. This is most often done if you are cycling through a set of tapes, for example using an autochanger. For more details on recycling, please see the Automatic Volume Recycling chapter of this manual.

If you run a Bareos job, and you have no labeled tapes in the Pool, Bareos will inform you, and you can create them ”on-the-fly” so to speak. In my case, I label my tapes with the date, for example: DLT-18April02. See below for the details of using the label command.

Labeling Volumes with the Console Program

Labeling volumes is normally done by using the console program.

  1. bconsole
  2. label

If Bareos complains that you cannot label the tape because it is already labeled, simply unmount the tape using the unmount command in the console, then physically mount a blank tape and re-issue the label command.

Since the physical storage media is different for each device, the label command will provide you with a list of the defined Storage resources such as the following:

The defined Storage resources are:  
     1: File  
     2: 8mmDrive  
     3: DLTDrive  
     4: SDT-10000  
Select Storage resource (1-4):

At this point, you should have a blank tape in the drive corresponding to the Storage resource that you select.

It will then ask you for the Volume name.

Enter new Volume name:

If Bareos complains:

Media record for Volume xxxx already exists.

It means that the volume name xxxx that you entered already exists in the Media database. You can list all the defined Media (Volumes) with the list media command. Note, the LastWritten column has been truncated for proper printing.

+---------------+---------+--------+----------------+-----/~/-+------------+-----+  
| VolumeName    | MediaTyp| VolStat| VolBytes       | LastWri | VolReten   | Recy|  
+---------------+---------+--------+----------------+---------+------------+-----+  
| DLTVol0002    | DLT8000 | Purged | 56,128,042,217 | 2001-10 | 31,536,000 |   0 |  
| DLT-07Oct2001 | DLT8000 | Full   | 56,172,030,586 | 2001-11 | 31,536,000 |   0 |  
| DLT-08Nov2001 | DLT8000 | Full   | 55,691,684,216 | 2001-12 | 31,536,000 |   0 |  
| DLT-01Dec2001 | DLT8000 | Full   | 55,162,215,866 | 2001-12 | 31,536,000 |   0 |  
| DLT-28Dec2001 | DLT8000 | Full   | 57,888,007,042 | 2002-01 | 31,536,000 |   0 |  
| DLT-20Jan2002 | DLT8000 | Full   | 57,003,507,308 | 2002-02 | 31,536,000 |   0 |  
| DLT-16Feb2002 | DLT8000 | Full   | 55,772,630,824 | 2002-03 | 31,536,000 |   0 |  
| DLT-12Mar2002 | DLT8000 | Full   | 50,666,320,453 | 1970-01 | 31,536,000 |   0 |  
| DLT-27Mar2002 | DLT8000 | Full   | 57,592,952,309 | 2002-04 | 31,536,000 |   0 |  
| DLT-15Apr2002 | DLT8000 | Full   | 57,190,864,185 | 2002-05 | 31,536,000 |   0 |  
| DLT-04May2002 | DLT8000 | Full   | 60,486,677,724 | 2002-05 | 31,536,000 |   0 |  
| DLT-26May02   | DLT8000 | Append |  1,336,699,620 | 2002-05 | 31,536,000 |   1 |  
+---------------+---------+--------+----------------+-----/~/-+------------+-----+

Once Bareos has verified that the volume does not already exist, it will prompt you for the name of the Pool in which the Volume (tape) is to be created. If there is only one Pool (Default), it will be automatically selected.

If the tape is successfully labeled, a Volume record will also be created in the Pool. That is the Volume name and all its other attributes will appear when you list the Pool. In addition, that Volume will be available for backup if the MediaType matches what is requested by the Storage daemon.

When you labeled the tape, you answered very few questions about it – principally the Volume name, and perhaps the Slot. However, a Volume record in the catalog database (internally known as a Media record) contains quite a few attributes. Most of these attributes will be filled in from the default values that were defined in the Pool (i.e. the Pool holds most of the default attributes used when creating a Volume).

It is also possible to add media to the pool without physically labeling the Volumes. This can be done with the add command. For more information, please see the Console Chapter of this manual.

Chapter 6
Critical Items to Implement Before Production

We recommend you take your time before implementing a production 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.

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

6.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 Files

Chapter 7
Customizing the Configuration Files

When each of the Bareos programs starts, it reads a configuration file specified on the command line or the default bareos-dir.conf, bareos-fd.conf, bareos-sd.conf, or console.conf for the Director daemon, the File daemon, the Storage daemon, and the Console program respectively.

Each service (Director, Client, Storage, Console) has its own configuration file 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 service. For example, in the Director’s resource file, the Director resource defines the name of the Director, a number of global Director parameters and his password. In the File daemon configuration file, the Director resource specifies which Directors are permitted to use the File daemon.

If you install a full Bareos system (Director, Storage and File Daemon) to one system, the Bareos packages tries there best to generate a working configuration. However, this configuration is very limited and before you will use Bareos in production, it will be required, that you customize the configuration.

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

The following configuration files must be defined:

7.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, and exactly how you define it will also vary. 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 be automatically converted to UTF-8 format.

7.2 Resource Directive Format

Although, you won’t need to know the details of all the directives a basic knowledge of Bareos resource directives is essential. Each directive contained within the resource (within the braces) is composed of a keyword followed by an equal sign (=) followed by one or more values. The keywords must be one of the known Bareos resource record keywords, and it may be composed of upper or lower case characters and spaces.

Each resource definition MUST contain a Name directive, and may optionally contain a Description directive. The Name directive is used to uniquely identify the resource. The Description directive is (will be) used during display of the Resource to provide easier human recognition. For example:

 
Director { 
  Name = "MyDir" 
  Description = "Main Bareos Director" 
  WorkingDirectory = "$HOME/bareos/bin/working" 
}  
Configuration 7.1: Resource example

Defines the Director resource with the name ”MyDir” and a working directory $HOME/bareos/bin/working. 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.

7.2.1 Comments

When reading the configuration file, blank lines are ignored and everything after a hash sign (#) until the end of the line is taken to be a comment. 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.

7.2.2 Upper and Lower Case and Spaces

Case (upper/lower) and spaces are totally ignored in the resource directive keywords (the part before the equal sign).

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.

Spaces after the equal sign and before the first character of the value are ignored.

In general, spaces within a value are significant (not ignored), and if the value is a name, you must enclose the name in double quotes for the spaces to be accepted. Names may contain up to 127 characters. Currently, a name may contain any ASCII character. Within a quoted string, any character following a backslash (\) is taken as itself (handy for inserting backslashes and double quotes (”)).

Please note, however, 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.

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

If you wish include all files in a specific directory, you can use the following:

 
# Include subfiles associated with configuration of clients. 
# They define the bulk of the Clients, Jobs, and FileSets. 
# Remember to "reload" the Director after adding a client file. 
# 
@|"sh -c for f in /etc/bareos/clientdefs/*.conf ; do echo @${f} ; done’"  
Configuration 7.2: include configuration files

7.2.4 Data Types

When parsing the resource directives, Bareos classifies the data according to the types listed below. The first time you read this, it may appear a bit overwhelming, but in reality, it is all pretty logical and straightforward.

acl
This directive defines what is premitted to access. It does this by a list of strings, separated by ,.

The special keyword *all* allows unrestricted access.

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

directory
A directory is either a quoted or non-quoted string. A directory 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.
integer
A 32 bit integer value. It may be positive or negative.
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.
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. Typically keywords appear on the left side of an equal (i.e. they are Bareos keywords – i.e. Resource names or directive names). Keywords may not be quoted.
name-string
A name-string is similar to a name, except that the name may be quoted and can thus contain additional characters including spaces. Name strings are limited to 127 characters in length. Name strings are typically used on the right side of an equal (i.e. they are values to be associated with a keyword).
password
This is a Bareos password and it is stored internally in MD5 hashed format.
path
File name, including path.
positive integer
A 32 bit positive integer value.
speed
The speed parameter can be specified as k/s, kb/s, m/s or mb/s.
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 ,.
net-address
Netaddress 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-portmust be specific separate. If multiple net-addresses are needed, check if it 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 7.3: 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 IPv6 colon notation, or as a symbolic name (only in the ip specification). Also, 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 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).
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)
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
seconds
minutes
minutes (60 seconds)
hours
hours (3600 seconds)
days
days (3600*24 seconds)
weeks
weeks (3600*24*7 seconds)
months
months (3600*24*30 seconds)
quarters
quarters (3600*24*91 seconds)
years
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.

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

7.2.5 Variable Expansion

Depending on the type of directive, Bareos will expand following variables:

Variable Expansion on Media Labels When labeling a new media, 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.

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

\%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 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 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 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

\%F

Job Files

7.3 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, so you need not worry about creating all these kinds of resources from scratch.






Resource
Director
Client
Storage
Console





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





Schedule x





Storage x x





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

Here is sort of a picture of what names/passwords in which files/Resources must match up:

PIC

In the left column, you will find the Director, Storage, and Client resources, with their names and passwords – these are all in bareos-dir.conf. In the right column are where the corresponding values should be found in the Console, Storage daemon (SD), and File daemon (FD) configuration files.

Please note that the Address, fd-sd, that appears in the Storage resource of the Director, preceded with and asterisk in the above example, 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 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 8
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 data types recognized by Bareos. Please see the Configuration chapter of this manual.

Director resource type may be one of the following:

Job, JobDefs, Client, Storage, Catalog, Schedule, FileSet, Pool, Director, or Messages. We present them here in the most logical order for defining them:

Note, everything revolves around a job and is tied to a job in one way or another.

8.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 = baroes-dir 
  Password = secretpassword 
  QueryFile = "/etc/bareos/query.sql" 
  Maximum Concurrent Jobs = 10 
  Messages = Daemon 
}  
Configuration 8.1: Director Ressource example





configuration directive name
type of data
default value
remark




Absolute Job Timeout = positive-integer
Audit Events = AuditCommandList
Auditing = yes|no no
Backend Directory = DirectoryList /usr/lib64/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
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 = directory /var/lib/bareos (platform specific)
Plugin Directory = directory
Plugin Names = PluginNames
Query File = directory required
Scripts Directory = directory
SD Connect Timeout = time 1800
Statistics Collect Interval = positive-integer150
Statistics Retention = time 160704000
Sub Sys Directory = directory
Subscriptions = positive-integer0
TLS Allowed CN = string-list
TLS Authenticate = yes|no
TLS CA Certificate Dir = directory
TLS CA Certificate File = directory
TLS Certificate = directory
TLS Certificate Revocation List= directory
TLS DH File = directory
TLS Enable = yes|no
TLS Key = directory
TLS Require = yes|no
TLS Verify Peer = yes|no yes
Ver Id = string
Working Directory= directory/var/lib/bareos (platform specific)




Absolute Job Timeout = <positive-integer>

 
Version >= 14.2.0
Audit Events = <AuditCommandList>

 
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 defines, how these messages are handled.  
Version >= 14.2.0
Backend Directory = <DirectoryList>
(default: /usr/lib64/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 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 directive, you must not use either a Dir Port or a Dir Address 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. The default is 9101, so normally this directive need not be specified. This directive should not be used if you specify Dir Addresses (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. The default is 3 minutes.  
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.  
Maximum Concurrent Jobs = <positive-integer>
(default: 1)
where <number> is the maximum number of total Director Jobs that should run concurrently. The default is set to 1, but you may set it to a larger number.

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)
where number is the maximum number of Console Connections that could run concurrently. The default is set to 20, but you may set it to a larger number.  
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 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)
 
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.  
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 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. The same password must appear in the Director resource of the Console configuration file. For added security, the password is never passed across the network but instead a challenge response hash code created with the password. Bareos tries to generate a random password during the configuration process, otherwise it will be left blank and you must manually supply it.

The password is plain text.  

Pid Directory = <directory>
(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 = <directory>

If a directory is specified, the Bareos Director tries to load all Director plugins that are located in this directory. If Plugin Names is also specified, only the specified plugins get loaded.  
Version >= 14.2.0
Plugin Names = <PluginNames>

If a Plugin Directory is specified Plugin Names defines, which Director plugins get loaded.

If Plugin Names is not defined, all plugins get loaded, otherwise the defined ones.

Only the basename is given, the file extension -dir.so is added automatically.

 
Version >= 14.2.0

Query File = <directory>
(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 of the Console.  
Scripts Directory = <directory>

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. The default is 30 minutes.  
Statistics Collect Interval = <positive-integer>
(default: 150)
 
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 = <directory>

 
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>

 
TLS Authenticate = <yes|no>

 
TLS CA Certificate Dir = <directory>

 
TLS CA Certificate File = <directory>

 
TLS Certificate = <directory>

 
TLS Certificate Revocation List = <directory>

 
TLS DH File = <directory>

 
TLS Enable = <yes|no>

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 = <directory>

 
TLS Require = <yes|no>

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

8.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
Backup Format = string Native
Base = ResourceList
Bootstrap = directory
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 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 Diff Interval = time
Max Full Interval = 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
Maxrun Sched Time = time
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 = directory
Write Bootstrap = directory
Write Part After Job= yes|no deprecated
Write Verify List = directory




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.

In this mode, the File daemon must keep data concerning all files in memory. So If you do not have sufficient memory, the backup may either be terribly slow or fail.

For 500.000 files (a typical desktop linux system), it will require approximately 64 Megabytes of RAM on your File daemon to hold the required information.  

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)

PIC
Figure 8.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, and the action that Bareos takes to ensure only one job runs is determined by the other directives (see below).

If Allow Duplicate Jobs is set to no and two jobs are present and none of the three directives given below permit cancelling a job, 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 (default no), 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.  

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 = <directory>

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 of the bootstrap file, please see Restoring Files with the Bootstrap File chapter of this manual.  

Cancel Lower Level Duplicates = <yes|no>
(default: no)
If Allow Duplicates Jobs 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 and Cancel Running Duplicates will be examined.  
Cancel Queued Duplicates = <yes|no>
(default: no)
If Allow Duplicates Jobs 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 Duplicates Jobs 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>

The specified command is run on the client machine as soon as data spooling is complete in order to allow restarting applications on the client as soon as possible. .

Note, please see the notes above in RunScript concerning Windows clients.  

Client Run Before Job = <RunscriptShort>

This directive is the same as Run Before Job except that the program is run on the client machine. The same restrictions apply to Unix systems as noted above for the RunScript.  
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 specification during a Differential backup. This directive is optional.  
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 Plugin Options = <string-list>

 
Enabled = <yes|no>
(default: yes)
This directive allows you to enable or disable automatic execution via the scheduler of a Job.  
FD Plugin Options = <string-list>

 
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 specification during a Full backup. This directive is optional.  
Full Max Runtime = <time>

 
Full Max Wait Time = <time>

Please note! This directive is deprecated.
 
Incremental Backup Pool = <resource-name>

The Incremental Backup Pool specifies a Pool to be used for Incremental backups. It will override any Pool specification during an Incremental backup. This directive is optional.  
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  
Job Defs = <resource-name>

If a Job Defs resource name is specified, all the values contained in the named JobDefs 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 JobDefs 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 JobDefs. This is particularly useful if you have many similar Jobs but with minor variations such as different Clients.  
Job To Verify = <resource-name>

 
Level = <BackupLevel>

The Level directive specifies the default Job level to be run. Each different Job Type (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 a Level 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 accurate mode. 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. As with the Incremental option, you should ensure that the clocks on your server and client are synchronized or as close as possible to avoid the possibility of a file being skipped. Note, on versions 1.33 or greater Bareos automatically makes the necessary adjustments to the time between the server and the client so that the times Bareos uses are synchronized.

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.

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 Diff Interval = <time>

 
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 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 the watchdog thread will kill any Job that has run more than 6 days. The maximum watchdog timeout is independent of MaxRunTime 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 0 which indicates no limit.  
Max Virtual Full Interval = <time>

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


PIC
Figure 8.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)
where <number> is 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. The default is set to 1, but you may set it to a larger number. We strongly recommend that you read the WARNING documented under Maximum Concurrent Jobs in the Director’s resource.  
Maxrun 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.  
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 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.  
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)
 
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 Using File Relocation.  

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 FileSet Changes 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 and Reschedule Times directives. If you cancel the job, it will not be rescheduled. The default is no (i.e. the job 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 resource, or a Run Before Job directive.  

Run After Failed Job = <RunscriptShort>

The specified command is run as an external program after the current job terminates with any error status. This directive is not required. The command string must be a valid program name or name of a shell script. If the exit code of the program run is non-zero, Bareos will print a warning message. Before submitting the specified command to the operating system, Bareos performs character substitution as described above for the RunScript directive. Note, if you wish that your script will run regardless of the exit status of the Job, you can use this:
 
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>

The specified command is run as an external program if the current job terminates normally (without error or without being canceled). This directive is not required. If the exit code of the program run is non-zero, Bareos will print a warning message. Before submitting the specified command to the operating system, Bareos performs character substitution as described above for the RunScript directive.

See the Run After Failed Job if you want to run a script after the job has terminated with any non-normal status.  

Run Before Job = <RunscriptShort>

The specified command is run as an external program prior to running the current Job. This directive is not required, but if it is defined, and if the exit code of the program run is non-zero, the current Bareos job will be canceled.
 
Run Before Job = "echo test"

it’s 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 console chapter 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 DefaultInformation








Runs On Success Yes|No Yes Run command if JobStatus is successful




Runs On Failure Yes|No No Run command if JobStatus isn’t successful




Runs On Client Yes|No Yes Run command on client




Runs When Before|After|Always|AfterVSSNeverWhen run commands




Fail Job On Error Yes/No Yes Fail job if script returns something different from 0




Command Path to your script




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.

In addition, 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.

Before submitting the specified command to the operating system, Bareos performs character substitution of the following characters:

%%%
%b Job Bytes
%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)
%xSpooling 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 Yes No Before






Run After Job Yes No No After






Run After Failed Job No Yes No After






Client Run Before Job Yes Yes Before






Client Run After 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" 
}

Notes about ClientRunBeforeJob

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 RunScript syntax.

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

 
Selection Pattern = <string>

 
Selection Type = <MigrationType>

 
Spool Attributes = <yes|no>
(default: no)
The default is set to no, which means that 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 is set to yes, Spool Attributes is also automatically set to yes.  

Spool Data = <yes|no>
(default: no)
If this directive is set to yes (default no), 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 is also automatically set to yes.  

Spool Size = <Size64>

where the bytes specify the maximum spool size for this job. The default is take from Device Maximum Spool Size 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 may be one of the following: Backup, Restore, Verify, or Admin. This directive is required. Within a particular Job Type, there are also Levels as discussed in the next item.
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.

 

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 = <directory>

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.  
Write Bootstrap = <directory>

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

Write Part After Job = <yes|no>

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

 

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 8.2: Job Resource Example

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

8.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)
 
Name = <name>
(required)
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.

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

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

<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 8.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 
}  

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 
}  

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

8.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)
Windows!Enable VSSIf 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.

The default is no, in which case, if you change the Include or Exclude, Bareos will force a Full backup to ensure that everything is properly backed up.  

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

8.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 8.4: 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 8.11: 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, see the bpluginfo section.

Examples about the bpipe- and the mssql-plugin can be found in the sections about the bpipe plugin and the MSSQL 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 File Set Options 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 scanning problems.

This is perhaps a bit overwhelming, so there are a number of examples included below to illustrate how this works.

You find yourself using a lot of Regex statements, which will cost quite a lot of CPU time, we recommend you simplify them if you can, or better yet convert them to Wild statements which are much more efficient.

The directives within an Options resource may be one of the following:

compression=<GZIP|LZO|LZFAST|LZ4|LZ4HC>

compression=GZIP

All files saved will be software compressed using the GNU ZIP compression format. The compression is done on a file by file basis by the File daemon. If there is a problem reading the tape in a single record of a file, it will at most affect that file and none of the other files on the tape. Normally this option is not needed if you have a modern tape drive as the drive will do its own compression. In fact, if you specify software compression at the same time you have hardware compression turned on, your files may actually take more space on the volume.

Software compression is very important if you are writing your Volumes to a file, and it can also be helpful if you have a fast computer but a slow network, otherwise it is generally better to rely your tape drive’s hardware compression. As noted above, it is not generally a good idea to do both software and hardware compression.

Specifying GZIP uses the default compression level 6 (i.e. GZIP is identical to GZIP6). If you want a different compression level (1 through 9), you can specify it by appending the level number with no intervening spaces to GZIP. Thus compression=GZIP1 would give minimum compression but the fastest algorithm, and compression=GZIP9 would give the highest level of compression, but requires more computation. According to the GZIP documentation, compression levels greater than six generally give very little extra compression and are rather CPU intensive.

You can overwrite this option per Storage resource with AllowCompression option.

compression=LZO

All files saved will be software compressed using the LZO compression format. The compression is done on a file by file basis by the File daemon. Everything else about GZIP is true for LZO.

LZO provides much faster compression and decompression speed but lower compression ratio than GZIP. If your CPU is fast enough you should be able to compress your data without making the backup duration longer.

Note that Bareos only use one compression level LZO1X-1 specified by LZO.

You can overwrite this option per Storage resource with AllowCompression option.

compression=LZFAST

All files saved will be software compressed using the LZFAST compression format. The compression is done on a file by file basis by the File daemon. Everything else about GZIP is true for LZFAST.

LZFAST provides much faster compression and decompression speed but lower compression ratio than GZIP. If your CPU is fast enough you should be able to compress your data without making the backup duration longer.

You can overwrite this option per Storage resource with AllowCompression option.

compression=LZ4

All files saved will be software compressed using the LZ4 compression format. The compression is done on a file by file basis by the File daemon. Everything else about GZIP is true for LZ4.

LZ4 provides much faster compression and decompression speed but lower compression ratio than GZIP. If your CPU is fast enough you should be able to compress your data without making the backup duration longer.

Both LZ4 and LZ4HC have the same decompression speed which is about twice the speed of the LZO compression. So for a restore both LZ4 and LZ4HC are good candidates.

You can overwrite this option per Storage resource with AllowCompression option.

compression=LZ4HC

All files saved will be software compressed using the LZ4HC compression format. The compression is done on a file by file basis by the File daemon. Everything else about GZIP is true for LZ4.

LZ4HC is the High Compression version of the LZ4 compression. It has a higher compression ratio than LZ4 and is more comparable to GZIP-6 in both compression rate and cpu usage.

Both LZ4 and LZ4HC have the same decompression speed which is about twice the speed of the LZO compression. So for a restore both LZ4 and LZ4HC are good candidates.

You can overwrite this option per Storage resource with AllowCompression option.

signature=<SHA1|MD5>

signature=SHA1

An SHA1 signature will be computed for all The SHA1 algorithm is purported to be some what slower than the MD5 algorithm, but at the same time is significantly better from a cryptographic point of view (i.e. much fewer collisions, much lower probability of being hacked.) It adds four more bytes than the MD5 signature. We strongly recommend that either this option or MD5 be specified as a default for all files. Note, only one of the two options MD5 or SHA1 can be computed for any file.
signature=MD5

An MD5 signature will be computed for all files saved. Adding this option generates about 5% extra overhead for each file saved. In addition to the additional CPU time, the MD5 signature adds 16 more bytes per file to your catalog. We strongly recommend that this option or the SHA1 option be specified as a default for all files.
basejob=<options>

The options letters specified are used when running a Backup Level=Full with BaseJobs. The options letters are the same than in the verify= option below.

accurate=<options>
The options letters specified are used when running a Backup Level=Incremental/Differential in Accurate mode. The options letters are the same than in the verify= option below.
verify=<options>

The options letters specified are used when running a Verify Level=Catalog as well as the DiskToCatalog level job. The options letters may be any combination of the following:
i compare the inodes
p compare the permission bits
n compare the number of links
u compare the user id
g compare the group id
s compare the size
a compare the access time
m compare the modification time (st_mtime)
c compare the change time (st_ctime)
d report file size decreases
5 compare the MD5 signature
1 compare the SHA1 signature
A Only for Accurate option, it allows to always backup the file

A useful set of general options on the Level=Catalog or Level=DiskToCatalog verify is pins5 i.e. compare permission bits, inodes, number of links, size, and MD5 changes.

onefs=yes|no

If set to yes (the default), Bareos will remain on a single file system. That is it will not backup file systems that are mounted on a subdirectory. If you are using a *nix system, you may not even be aware that there are several different filesystems as they are often automatically mounted by the OS (e.g. /dev, /net, /sys, /proc, ...). Bareos will inform you when it decides not to traverse into another filesystem. This can be very useful if you forgot to backup a particular partition. An example of the informational message in the job report is:
rufus-fd: /misc is a different filesystem. Will not descend from / into /misc  
rufus-fd: /net is a different filesystem. Will not descend from / into /net  
rufus-fd: /var/lib/nfs/rpc_pipefs is a different filesystem. Will not descend from /var/lib/nfs into /var/lib/nfs/rpc_pipefs  
rufus-fd: /selinux is a different filesystem. Will not descend from / into /selinux  
rufus-fd: /sys is a different filesystem. Will not descend from / into /sys  
rufus-fd: /dev is a different filesystem. Will not descend from / into /dev  
rufus-fd: /home is a different filesystem. Will not descend from / into /home

If you wish to backup multiple filesystems, you can explicitly list each filesystem you want saved. Otherwise, if you set the onefs option to no, Bareos will backup all mounted file systems (i.e. traverse mount points) that are found within the FileSet. Thus if you have NFS or Samba file systems mounted on a directory listed in your FileSet, they will also be backed up. Normally, it is preferable to set onefs=yes and to explicitly name each filesystem you want backed up. Explicitly naming the filesystems you want backed up avoids the possibility of getting into a infinite loop recursing filesystems. Another possibility is to use onefs=no and to set fstype=ext2, .... See the example below for more details.

If you think that Bareos should be backing up a particular directory and it is not, and you have onefs=no set, before you complain, please do:

  stat /  
  stat <filesystem>

where you replace filesystem with the one in question. If the Device: number is different for / and for your filesystem, then they are on different filesystems. E.g.

stat /  
  File: ‘/’  
  Size: 4096            Blocks: 16         IO Block: 4096   directory  
Device: 302h/770d       Inode: 2           Links: 26  
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)  
Access: 2005-11-10 12:28:01.000000000 +0100  
Modify: 2005-09-27 17:52:32.000000000 +0200  
Change: 2005-09-27 17:52:32.000000000 +0200  
 
stat /net  
  File: ‘/home’  
  Size: 4096            Blocks: 16         IO Block: 4096   directory  
Device: 308h/776d       Inode: 2           Links: 7  
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)  
Access: 2005-11-10 12:28:02.000000000 +0100  
Modify: 2005-11-06 12:36:48.000000000 +0100  
Change: 2005-11-06 12:36:48.000000000 +0100

Also be aware that even if you include /home in your list of files to backup, as you most likely should, you will get the informational message that ”/home is a different filesystem” when Bareos is processing the / directory. This message does not indicate an error. This message means that while examining the File = referred to in the second part of the message, Bareos will not descend into the directory mentioned in the first part of the message. However, it is possible that the separate filesystem will be backed up despite the message. For example, consider the following FileSet:

  File = /  
  File = /var

where /var is a separate filesystem. In this example, you will get a message saying that Bareos will not decend from / into /var. But it is important to realise that Bareos will descend into /var from the second File directive shown above. In effect, the warning is bogus, but it is supplied to alert you to possible omissions from your FileSet. In this example, /var will be backed up. If you changed the FileSet such that it did not specify /var, then /var will not be backed up.

honor nodump flag=<yes|no>

If your file system supports the nodump flag (e. g. most BSD-derived systems) Bareos will honor the setting of the flag when this option is set to yes. Files having this flag set will not be included in the backup and will not show up in the catalog. For directories with the nodump flag set recursion is turned off and the directory will be listed in the catalog. If the honor nodump flag option is not defined or set to no every file and directory will be eligible for backup.
portable=yes|no

If set to yes (default is no), the Bareos File daemon will backup Win32 files in a portable format, but not all Win32 file attributes will be saved and restored. By default, this option is set to no, which means that on Win32 systems, the data will be backed up using Windows API calls and on WinNT/2K/XP, all the security and ownership attributes will be properly backed up (and restored). However this format is not portable to other systems – e.g. Unix, Win95/98/Me. When backing up Unix systems, this option is ignored, and unless you have a specific need to have portable backups, we recommend accept the default (no) so that the maximum information concerning your files is saved.
recurse=yes|no

If set to yes (the default), Bareos will recurse (or descend) into all subdirectories found unless the directory is explicitly excluded using an exclude definition. If you set recurse=no, Bareos will save the subdirectory entries, but not descend into the subdirectories, and thus will not save the files or directories contained in the subdirectories. Normally, you will want the default (yes).
sparse=yes|no

Enable special code that checks for sparse files such as created by ndbm. The default is no, so no checks are made for sparse files. You may specify sparse=yes even on files that are not sparse file. No harm will be done, but there will be a small additional overhead to check for buffers of all zero, and if there is a 32K block of all zeros (see below), that block will become a hole in the file, which may not be desirable if the original file was not a sparse file.

Restrictions: Bareos reads files in 32K buffers. If the whole buffer is zero, it will be treated as a sparse block and not written to tape. However, if any part of the buffer is non-zero, the whole buffer will be written to tape, possibly including some disk sectors (generally 4098 bytes) that are all zero. As a consequence, Bareos’s detection of sparse blocks is in 32K increments rather than the system block size. If anyone considers this to be a real problem, please send in a request for change with the reason.

If you are not familiar with sparse files, an example is say a file where you wrote 512 bytes at address zero, then 512 bytes at address 1 million. The operating system will allocate only two blocks, and the empty space or hole will have nothing allocated. However, when you read the sparse file and read the addresses where nothing was written, the OS will return all zeros as if the space were allocated, and if you backup such a file, a lot of space will be used to write zeros to the volume. Worse yet, when you restore the file, all the previously empty space will now be allocated using much more disk space. By turning on the sparse option, Bareos will specifically look for empty space in the file, and any empty space will not be written to the Volume, nor will it be restored. The price to pay for this is that Bareos must search each block it reads before writing it. On a slow system, this may be important. If you suspect you have sparse files, you should benchmark the difference or set sparse for only those files that are really sparse.

You probably should not use this option on files or raw disk devices that are not really sparse files (i.e. have holes in them).

readfifo=yes|no

If enabled, tells the Client to read the data on a backup and write the data on a restore to any FIFO (pipe) that is explicitly mentioned in the FileSet. In this case, you must have a program already running that writes into the FIFO for a backup or reads from the FIFO on a restore. This can be accomplished with the RunBeforeJob directive. If this is not the case, Bareos will hang indefinitely on reading/writing the FIFO. When this is not enabled (default), the Client simply saves the directory entry for the FIFO.

Normally, when Bareos runs a RunBeforeJob, it waits until that script terminates, and if the script accesses the FIFO to write into it, the Bareos job will block and everything will stall. However, Vladimir Stavrinov as supplied tip that allows this feature to work correctly. He simply adds the following to the beginning of the RunBeforeJob script:

   exec > /dev/null

 
Include { 
  Options { 
    signature=SHA1 
    readfifo=yes 
  } 
  File = /home/abc/fifo 
}  
Configuration 8.12: FileSet with Fifo

This feature can be used to do a ”hot” database backup. You can use the RunBeforeJob to create the fifo and to start a program that dynamically reads your database and writes it to the fifo. Bareos will then write it to the Volume.

During the restore operation, the inverse is true, after Bareos creates the fifo if there was any data stored with it (no need to explicitly list it or add any options), that data will be written back to the fifo. As a consequence, if any such FIFOs exist in the fileset to be restored, you must ensure that there is a reader program or Bareos will block, and after one minute, Bareos will time out the write to the fifo and move on to the next file.

If you are planing to use a Fifo for backup, better take a look to the bpipe plugin section.

noatime=yes|no

If enabled, and if your Operating System supports the O_NOATIME file open flag, Bareos will open all files to be backed up with this option. It makes it possible to read a file without updating the inode atime (and also without the inode ctime update which happens if you try to set the atime back to its previous value). It also prevents a race condition when two programs are reading the same file, but only one does not want to change the atime. It’s most useful for backup programs and file integrity checkers (and Bareos can fit on both categories).

This option is particularly useful for sites where users are sensitive to their MailBox file access time. It replaces both the keepatime option without the inconveniences of that option (see below).

If your Operating System does not support this option, it will be silently ignored by Bareos.

mtimeonly=yes|no

If enabled, tells the Client that the selection of files during Incremental and Differential backups should based only on the st_mtime value in the stat() packet. The default is no which means that the selection of files to be backed up will be based on both the st_mtime and the st_ctime values. In general, it is not recommended to use this option.
keepatime=yes|no

The default is no. When enabled, Bareos will reset the st_atime (access time) field of files that it backs up to their value prior to the backup. This option is not generally recommended as there are very few programs that use st_atime, and the backup overhead is increased because of the additional system call necessary to reset the times. However, for some files, such as mailboxes, when Bareos backs up the file, the user will notice that someone (Bareos) has accessed the file. In this, case keepatime can be useful. (I’m not sure this works on Win32).

Note, if you use this feature, when Bareos resets the access time, the change time (st_ctime) will automatically be modified by the system, so on the next incremental job, the file will be backed up even if it has not changed. As a consequence, you will probably also want to use mtimeonly = yes as well as keepatime (thanks to Rudolf Cejka for this tip).

checkfilechanges=yes|no

On versions 2.0.4 or greater, if enabled, the Client will check size, age of each file after their backup to see if they have changed during backup. If time or size mismatch, an error will raise.
 zog-fd: Client1.2007-03-31_09.46.21 Error: /tmp/test mtime changed during backup.

In general, it is recommended to use this option.

hardlinks=yes|no

When enabled (default), this directive will cause hard links to be backed up. However, the File daemon keeps track of hard linked files and will backup the data only once. The process of keeping track of the hard links can be quite expensive if you have lots of them (tens of thousands or more). This doesn’t occur on normal Unix systems, but if you use a program like BackupPC, it can create hundreds of thousands, or even millions of hard links. Backups become very long and the File daemon will consume a lot of CPU power checking hard links. In such a case, set hardlinks=no and hard links will not be backed up. Note, using this option will most likely backup more data and on a restore the file system will not be restored identically to the original.
wild=<string>

Specifies a wild-card string to be applied to the filenames and directory names. Note, if Exclude is not enabled, the wild-card will select which files are to be included. If Exclude=yes is specified, the wild-card will select which files are to be excluded. Multiple wild-card directives may be specified, and they will be applied in turn until the first one that matches. Note, if you exclude a directory, no files or directories below it will be matched.

You may want to test your expressions prior to running your backup by using the bwild program. Please see the Utilities chapter of this manual for more. You can also test your full FileSet definition by using the estimate command in the Console chapter of this manual. It is recommended to enclose the string in double quotes.

wilddir=<string>

Specifies a wild-card string to be applied to directory names only. No filenames will be matched by this directive. Note, if Exclude is not enabled, the wild-card will select directories to be included. If Exclude=yes is specified, the wild-card will select which directories are to be excluded. Multiple wild-card directives may be specified, and they will be applied in turn until the first one that matches. Note, if you exclude a directory, no files or directories below it will be matched.

It is recommended to enclose the string in double quotes.

You may want to test your expressions prior to running your backup by using the bwild program. Please see the Utilities chapter of this manual for more. You can also test your full FileSet definition by using the estimate command in the Console chapter of this manual. An example of excluding with the WildDir option on Win32 machines is presented below.

wildfile=<string>

Specifies a wild-card string to be applied to non-directories. That is no directory entries will be matched by this directive. However, note that the match is done against the full path and filename, so your wild-card string must take into account that filenames are preceded by the full path. If Exclude is not enabled, the wild-card will select which files are to be included. If Exclude=yes is specified, the wild-card will select which files are to be excluded. Multiple wild-card directives may be specified, and they will be applied in turn until the first one that matches.

It is recommended to enclose the string in double quotes.

You may want to test your expressions prior to running your backup by using the bwild program. Please see the Utilities chapter of this manual for more. You can also test your full FileSet definition by using the estimate command in the Console chapter of this manual. An example of excluding with the WildFile option on Win32 machines is presented below.

regex=<string>

Specifies a POSIX extended regular expression to be applied to the filenames and directory names, which include the full path. If Exclude is not enabled, the regex will select which files are to be included. If Exclude=yes is specified, the regex will select which files are to be excluded. Multiple regex directives may be specified within an Options resource, and they will be applied in turn until the first one that matches. Note, if you exclude a directory, no files or directories below it will be matched.

It is recommended to enclose the string in double quotes.

The regex libraries differ from one operating system to another, and in addition, regular expressions are complicated, so you may want to test your expressions prior to running your backup by using the bregex program. Please see the Utilities chapter of this manual for more. You can also test your full FileSet definition by using the estimate command in the Console chapter of this manual.

You find yourself using a lot of Regex statements, which will cost quite a lot of CPU time, we recommend you simplify them if you can, or better yet convert them to Wild statements which are much more efficient.

regexfile=<string>

Specifies a POSIX extended regular expression to be applied to non-directories. No directories will be matched by this directive. However, note that the match is done against the full path and filename, so your regex string must take into account that filenames are preceded by the full path. If Exclude is not enabled, the regex will select which files are to be included. If Exclude=yes is specified, the regex will select which files are to be excluded. Multiple regex directives may be specified, and they will be applied in turn until the first one that matches.

It is recommended to enclose the string in double quotes.

The regex libraries differ from one operating system to another, and in addition, regular expressions are complicated, so you may want to test your expressions prior to running your backup by using the bregex program. Please see the Utilities chapter of this manual for more.

regexdir=<string>

Specifies a POSIX extended regular expression to be applied to directory names only. No filenames will be matched by this directive. Note, if Exclude is not enabled, the regex will select directories files are to be included. If Exclude=yes is specified, the regex will select which files are to be excluded. Multiple regex directives may be specified, and they will be applied in turn until the first one that matches. Note, if you exclude a directory, no files or directories below it will be matched.

It is recommended to enclose the string in double quotes.

The regex libraries differ from one operating system to another, and in addition, regular expressions are complicated, so you may want to test your expressions prior to running your backup by using the bregex program. Please see the Utilities chapter of this manual for more.

Exclude = <yes|no>
(default: no)
When enabled, any files matched within the Options will be excluded from the backup.  
aclsupport=yes|no

The default is no. If this option is set to yes, and you have the POSIX libacl installed on your Linux system, Bareos will backup the file and directory Unix Access Control Lists (ACL) as defined in IEEE Std 1003.1e draft 17 and ”POSIX.1e” (abandoned). This feature is available on Unix systems only and requires the Linux ACL library. Bareos is automatically compiled with ACL support if the libacl library is installed on your Linux system (shown in config.out). While restoring the files Bareos will try to restore the ACLs, if there is no ACL support available on the system, Bareos restores the files and directories but not the ACL information. Please note, if you backup an EXT3 or XFS filesystem with ACLs, then you restore them to a different filesystem (perhaps reiserfs) that does not have ACLs, the ACLs will be ignored.

For other operating systems there is support for either POSIX ACLs or the more extensible NFSv4 ACLs.

The ACL stream format between Operation Systems is not compatible so for example an ACL saved on Linux cannot be restored on Solaris.

The following Operating Systems are currently supported:

  1. AIX (pre-5.3 (POSIX) and post 5.3 (POSIX and NFSv4) ACLs)
  2. Darwin
  3. FreeBSD (POSIX and NFSv4/ZFS ACLs)
  4. HPUX
  5. IRIX
  6. Linux
  7. Solaris (POSIX and NFSv4/ZFS ACLs)
  8. Tru64

xattrsupport=yes|no

The default is no. If this option is set to yes, and your operating system support either so called Extended Attributes or Extensible Attributes Bareos will backup the file and directory XATTR data. This feature is available on UNIX only and depends on support of some specific library calls in libc.

The XATTR stream format between Operating Systems is not compatible so an XATTR saved on Linux cannot for example be restored on Solaris.

On some operating systems ACLs are also stored as Extended Attributes (Linux, Darwin, FreeBSD) Bareos checks if you have the aclsupport option enabled and if so will not save the same info when saving extended attribute information. Thus ACLs are only saved once.

The following Operating Systems are currently supported:

  1. AIX (Extended Attributes)
  2. Darwin (Extended Attributes)
  3. FreeBSD (Extended Attributes)
  4. IRIX (Extended Attributes)
  5. Linux (Extended Attributes)
  6. NetBSD (Extended Attributes)
  7. Solaris (Extended Attributes and Extensible Attributes)
  8. Tru64 (Extended Attributes)
ignore case=yes|no

The default is no. On Windows systems, you will almost surely want to set this to yes. When this directive is set to yes all the case of character will be ignored in wild-card and regex comparisons. That is an uppercase A will match a lowercase a.
fstype=filesystem-type

This option allows you to select files and directories by the filesystem type. The permitted filesystem-type names are:

ext2, jfs, ntfs, proc, reiserfs, xfs, usbdevfs, sysfs, smbfs, iso9660.

You may have multiple Fstype directives, and thus permit matching of multiple filesystem types within a single Options resource. If the type specified on the fstype directive does not match the filesystem for a particular directive, that directory will not be backed up. This directive can be used to prevent backing up non-local filesystems. Normally, when you use this directive, you would also set onefs=no so that Bareos will traverse filesystems.

This option is not implemented in Win32 systems.

DriveType=Windows-drive-type

This option is effective only on Windows machines and is somewhat similar to the Unix/Linux fstype described above, except that it allows you to select what Windows drive types you want to allow. By default all drive types are accepted.

The permitted drivetype names are:

removable, fixed, remote, cdrom, ramdisk

You may have multiple Driveype directives, and thus permit matching of multiple drive types within a single Options resource. If the type specified on the drivetype directive does not match the filesystem for a particular directive, that directory will not be backed up. This directive can be used to prevent backing up non-local filesystems. Normally, when you use this directive, you would also set onefs=no so that Bareos will traverse filesystems.

This option is not implemented in Unix/Linux systems.

hfsplussupport=yes|no

This option allows you to turn on support for Mac OSX HFS plus finder information.
strippath=<integer>

This option will cause integer paths to be stripped from the front of the full path/filename being backed up. This can be useful if you are migrating data from another vendor or if you have taken a snapshot into some subdirectory. This directive can cause your filenames to be overlayed with regular backup data, so should be used only by experts and with great care.
size=sizeoption

This option will allow you to select files by their actual size. You can select either files smaller than a certain size or bigger then a certain size, files of a size in a certain range or files of a size which is within 1 % of its actual size.

The following settings can be used:

  1. <size>-<size> - Select file in range size - size.
  2. <size - Select files smaller than size.
  3. >size - Select files bigger than size.
  4. size - Select files which are within 1 % of size.
shadowing=none|localwarn|localremove|globalwarn|globalremove

The default is none. This option performs a check within the fileset for any file-list entries which are shadowing each other. Lets say you specify / and /usr but /usr is not a seperate filesystem then in the normal situation both / and /usr would lead to data being backuped twice.

The following settings can be used:

  1. none - Do NO shadowing check
  2. localwarn - Do shadowing check within one include block and warn
  3. localremove - Do shadowing check within one include block and remove duplicates
  4. globalwarn - Do shadowing check between all include blocks and warn
  5. globalremove - Do shadowing check between all include blocks and remove duplicates

The local and global part of the setting relate to the fact if the check should be performed only within one include block (local) or between multiple include blocks of the same fileset (global). The warn and remove part of the keyword sets the action e.g. warn the user about shadowing or remove the entry shadowing the other.

meta=tag

This option will add a meta tag to a fileset. These meta tags are used by the Native NDMP protocol to pass NDMP backup or restore environment variables via the Data Management Agent (DMA) in Bareos to the remote NDMP Data Agent. You can have zero or more metatags which are all passed to the remote NDMP Data Agent.

8.5.2 FileSet Exclude Ressource

FileSet Exclude-Ressources very similar to Include-Ressources, except that they only allow following directives:

File = < filename | directory | |command | \<includefile-client | <includefile-server >

Files to exclude are descripted in the same way as at the FileSet Include Ressource.  

For example:

 
FileSet { 
  Name = Exclusion_example 
  Include { 
    Options { 
      Signature = SHA1 
    } 
    File = / 
    File = /boot 
    File = /home 
    File = /rescue 
    File = /usr 
  } 
  Exclude { 
    File = /proc 
    File = /tmp                          # Dont add trailing / 
    File = .journal 
    File = .autofsck 
  } 
}  
Configuration 8.13: FileSet using Exclude

Another way to exclude files and directories is to use the Exclude option from the Include section.

8.5.3 FileSet Examples

The following is an example of a valid FileSet resource definition. Note, the first Include pulls in the contents of the file /etc/backup.list when Bareos is started (i.e. the @), and that file must have each filename to be backed up preceded by a File = and on a separate line.

 
FileSet { 
  Name = "Full Set" 
  Include { 
    Options { 
      Compression=GZIP 
      signature=SHA1 
      Sparse = yes 
    } 
    @/etc/backup.list 
  } 
  Include { 
     Options { 
        wildfile = "*.o" 
        wildfile = "*.exe" 
        Exclude = yes 
     } 
     File = /root/myfile 
     File = /usr/lib/another_file 
  } 
}  
Configuration 8.14: FileSet using import

In the above example, all the files contained in /etc/backup.list will be compressed with GZIP compression, an SHA1 signature will be computed on the file’s contents (its data), and sparse file handling will apply.

The two directories /root/myfile and /usr/lib/another_file will also be saved without any options, but all files in those directories with the extensions .o and .exe will be excluded.

Let’s say that you now want to exclude the directory /tmp. The simplest way to do so is to add an exclude directive that lists /tmp. The example above would then become:

 
FileSet { 
  Name = "Full Set" 
  Include { 
    Options { 
      Compression=GZIP 
      signature=SHA1 
      Sparse = yes 
    } 
    @/etc/backup.list 
  } 
  Include { 
     Options { 
        wildfile = "*.o" 
        wildfile = "*.exe" 
        Exclude = yes 
     } 
     File = /root/myfile 
     File = /usr/lib/another_file 
  } 
  Exclude { 
     File = /tmp                          # dont add trailing / 
  } 
}  
Configuration 8.15: extended FileSet excluding /tmp

You can add wild-cards to the File directives listed in the Exclude directory, but you need to take care because if you exclude a directory, it and all files and directories below it will also be excluded.

Now lets take a slight variation on the above and suppose you want to save all your whole filesystem except /tmp. The problem that comes up is that Bareos will not normally cross from one filesystem to another. Doing a df command, you get the following output:

 
root@linux:~# df 
Filesystem      1k-blocks      Used Available Use% Mounted on 
/dev/hda5         5044156    439232   4348692  10% / 
/dev/hda1           62193      4935     54047   9% /boot 
/dev/hda9        20161172   5524660  13612372  29% /home 
/dev/hda2           62217      6843     52161  12% /rescue 
/dev/hda8         5044156     42548   4745376   1% /tmp 
/dev/hda6         5044156   2613132   2174792  55% /usr 
none               127708         0    127708   0% /dev/shm 
//minimatou/c$   14099200   9895424   4203776  71% /mnt/mmatou 
lmatou:/          1554264    215884   1258056  15% /mnt/matou 
lmatou:/home      2478140   1589952    760072  68% /mnt/matou/home 
lmatou:/usr       1981000   1199960    678628  64% /mnt/matou/usr 
lpmatou:/          995116    484112    459596  52% /mnt/pmatou 
lpmatou:/home    19222656   2787880  15458228  16% /mnt/pmatou/home 
lpmatou:/usr      2478140   2038764    311260  87% /mnt/pmatou/usr 
deuter:/          4806936     97684   4465064   3% /mnt/deuter 
deuter:/home      4806904    280100   4282620   7% /mnt/deuter/home 
deuter:/files    44133352  27652876  14238608  67% /mnt/deuter/files  
Commands 8.16: df

And we see that there are a number of separate filesystems (/ /boot /home /rescue /tmp and /usr not to mention mounted systems). If you specify only / in your Include list, Bareos will only save the Filesystem /dev/hda5. To save all filesystems except /tmp with out including any of the Samba or NFS mounted systems, and explicitly excluding a /tmp, /proc, .journal, and .autofsck, which you will not want to be saved and restored, you can use the following:

 
FileSet { 
  Name = Include_example 
  Include { 
    Options { 
       wilddir = /proc 
       wilddir = /tmp 
       wildfile = "/.journal" 
       wildfile = "/.autofsck" 
       exclude = yes 
    } 
    File = / 
    File = /boot 
    File = /home 
    File = /rescue 
    File = /usr 
  } 
}  
Configuration 8.17: FileSet mount points

Since /tmp is on its own filesystem and it was not explicitly named in the Include list, it is not really needed in the exclude list. It is better to list it in the Exclude list for clarity, and in case the disks are changed so that it is no longer in its own partition.

Now, lets assume you only want to backup .Z and .gz files and nothing else. This is a bit trickier because Bareos by default will select everything to backup, so we must exclude everything but .Z and .gz files. If we take the first example above and make the obvious modifications to it, we might come up with a FileSet that looks like this:

 
FileSet { 
  Name = "Full Set" 
  Include {                    !!!!!!!!!!!! 
     Options {                    This 
        wildfile = "*.Z"          example 
        wildfile = "*.gz"         doesnt 
                                  work 
     }                          !!!!!!!!!!!! 
     File = /myfile 
  } 
}  
Configuration 8.18: Non-working example

The *.Z and *.gz files will indeed be backed up, but all other files that are not matched by the Options directives will automatically be backed up too (i.e. that is the default rule).

To accomplish what we want, we must explicitly exclude all other files. We do this with the following:

 
FileSet { 
  Name = "Full Set" 
  Include { 
     Options { 
        wildfile = "*.Z" 
        wildfile = "*.gz" 
     } 
     Options { 
        Exclude = yes 
        RegexFile = ".*" 
     } 
     File = /myfile 
  } 
}  
Configuration 8.19: Exclude all except specific wildcards

The ”trick” here was to add a RegexFile expression that matches all files. It does not match directory names, so all directories in /myfile will be backed up (the directory entry) and any *.Z and *.gz files contained in them. If you know that certain directories do not contain any *.Z or *.gz files and you do not want the directory entries backed up, you will need to explicitly exclude those directories. Backing up a directory entries is not very expensive.

Bareos uses the system regex library and some of them are different on different OSes. The above has been reported not to work on FreeBSD. This can be tested by using the estimate job=job-name listing command in the console and adapting the RegexFile expression appropriately. In a future version of Bareos, we will supply our own Regex code to avoid such system dependencies.

Please be aware that allowing Bareos to traverse or change file systems can be very dangerous. For example, with the following:

 
FileSet { 
  Name = "Bad example" 
  Include { 
    Options { 
      onefs=no 
    } 
    File = /mnt/matou 
  } 
}  
Configuration 8.20: backup all filesystem below /mnt/matou (use with care)

you will be backing up an NFS mounted partition (/mnt/matou), and since onefs is set to no, Bareos will traverse file systems. Now if /mnt/matou has the current machine’s file systems mounted, as is often the case, you will get yourself into a recursive loop and the backup will never end.

As a final example, let’s say that you have only one or two subdirectories of /home that you want to backup. For example, you want to backup only subdirectories beginning with the letter a and the letter b – i.e. /home/a* and /home/b*. Now, you might first try:

 
FileSet { 
  Name = "Full Set" 
  Include { 
     Options { 
        wilddir = "/home/a*" 
        wilddir = "/home/b*" 
     } 
     File = /home 
  } 
}  
Configuration 8.21: Non-working example

The problem is that the above will include everything in /home. To get things to work correctly, you need to start with the idea of exclusion instead of inclusion. So, you could simply exclude all directories except the two you want to use:

 
FileSet { 
  Name = "Full Set" 
  Include { 
     Options { 
        RegexDir = "^/home/[c-z]" 
        exclude = yes 
     } 
     File = /home 
  } 
}  
Configuration 8.22: Exclude by regex

And assuming that all subdirectories start with a lowercase letter, this would work.

An alternative would be to include the two subdirectories desired and exclude everything else:

 
FileSet { 
  Name = "Full Set" 
  Include { 
     Options { 
        wilddir = "/home/a*" 
        wilddir = "/home/b*" 
     } 
     Options { 
        RegexDir = ".*" 
        exclude = yes 
     } 
     File = /home 
  } 
}  
Configuration 8.23: Include and Exclude

The following example shows how to back up only the My Pictures directory inside the My Documents directory for all users in C:/Documents and Settings, i.e. everything matching the pattern:

C:/Documents and Settings/*/My Documents/My Pictures/*

To understand how this can be achieved, there are two important points to remember:

Firstly, Bareos walks over the filesystem depth-first starting from the File = lines. It stops descending when a directory is excluded, so you must include all ancestor directories of each directory containing files to be included.

Secondly, each directory and file is compared to the Options clauses in the order they appear in the FileSet. When a match is found, no further clauses are compared and the directory or file is either included or excluded.

The FileSet resource definition below implements this by including specifc directories and files and excluding everything else.

 
FileSet { 
  Name = "AllPictures" 
 
  Include { 
 
    File  = "C:/Documents and Settings" 
 
    Options { 
      signature = SHA1 
      verify = s1 
      IgnoreCase = yes 
 
      # Include all users directories so we reach the inner ones.  Unlike a 
      # WildDir pattern ending in *, this RegExDir only matches the top-level 
      # directories and not any inner ones. 
      RegExDir = "^C:/Documents and Settings/[^/]+$" 
 
      # Ditto all users My Documents directories. 
      WildDir = "C:/Documents and Settings/*/My Documents" 
 
      # Ditto all users My Documents/My Pictures directories. 
      WildDir = "C:/Documents and Settings/*/My Documents/My Pictures" 
 
      # Include the contents of the My Documents/My Pictures directories and 
      # any subdirectories. 
      Wild = "C:/Documents and Settings/*/My Documents/My Pictures/*" 
    } 
 
    Options { 
      Exclude = yes 
      IgnoreCase = yes 
 
      # Exclude everything else, in particular any files at the top level and 
      # any other directories or files in the users directories. 
      Wild = "C:/Documents and Settings/*" 
    } 
  } 
}  
Configuration 8.24: Include/Exclude example

8.5.4 Windows FileSets

If you are entering Windows file names, the directory path may be preceded by the drive and a colon (as in c:). However, the path separators must be specified in Unix convention (i.e. forward slash (/)). If you wish to include a quote in a file name, precede the quote with a backslash (\). For example you might use the following for a Windows machine to backup the ”My Documents” directory:

 
FileSet { 
  Name = "Windows Set" 
  Include { 
    Options { 
       WildFile = "*.obj" 
       WildFile = "*.exe" 
       exclude = yes 
     } 
     File = "c:/My Documents" 
  } 
}  
Configuration 8.25: Windows FileSet

For exclude lists to work correctly on Windows, you must observe the following rules:

Thanks to Thiago Lima for summarizing the above items for us. If you are having difficulties getting includes or excludes to work, you might want to try using the estimate job=xxx listing command documented in the Console chapter of this manual.

On Win32 systems, if you move a directory or file or rename a file into the set of files being backed up, and a Full backup has already been made, Bareos will not know there are new files to be saved during an Incremental or Differential backup (blame Microsoft, not us). To avoid this problem, please copy any new directory or files into the backup area. If you do not have enough disk to copy the directory or files, move them, but then initiate a Full backup.

Example Fileset for Windows The following example demostrates a Windows FileSet. It backups all data from all fixed drives and only excludes some Windows temporary data.

 
FileSet { 
  Name = "Windows All Drives" 
  Enable VSS = yes 
  Include { 
    Options { 
      Signature = MD5 
      Drive Type = fixed 
      IgnoreCase = yes 
      WildFile = "[A-Z]:/pagefile.sys" 
      WildDir = "[A-Z]:/RECYCLER" 
      WildDir = "[A-Z]:/$RECYCLE.BIN" 
      WildDir = "[A-Z]:/System Volume Information" 
      Exclude = yes 
    } 
    File = / 
  } 
}  
Configuration 8.26: Windows All Drives FileSet

File = / includes all Windows drives. Using Drive Type = fixed excludes drives like USB-Stick or CD-ROM Drive. Using WildDir = "[A-Z]:/RECYCLER" excludes the backup of the directory RECYCLER from all drives.

8.5.5 Testing Your FileSet

If you wish to get an idea of what your FileSet will really backup or if your exclusion rules will work correctly, you can test it by using the estimate command in the Console program. See the estimate in the Console chapter of this manual.

As an example, suppose you add the following test FileSet:

 
FileSet { 
  Name = Test 
  Include { 
    File = /home/xxx/test 
    Options { 
       regex = ".*\\.c$" 
    } 
  } 
}  
Configuration 8.27: FileSet for all *.c files

You could then add some test files to the directory /home/xxx/test and use the following command in the console:

 
estimate job=<any-job-name> listing client=<desired-client> fileset=Test  
bconsole 8.28: estimate

to give you a listing of all files that match. In the above example, it should be only files with names ending in .c.

8.6 Client Resource

The Client (or FileDaemon) resource defines the attributes of the Clients that are served by this Director; that is the machines that are to be backed up. You will need one Client resource definition for each machine to be backed up.





configuration directive name
type of data
default value
remark




Address = string required
Allow Client Connect = yes|no no
Auth Type = AuthType None
Auto Prune = yes|no no
Catalog = resource-name
Description = string
Enabled = yes|no yes
FD Address = string alias
FD Password = password alias
FD Port = positive-integer9102 alias
File Retention = time 5184000
Hard Quota = Size64 0
Heartbeat Interval = time 0
Job Retention = time 15552000
Maximum Bandwidth Per Job = speed
Maximum Concurrent Jobs = positive-integer1
Name = name required
NDMP Block Size = positive-integer64512
NDMP Log Level = positive-integer4
Passive = yes|no no
Password = password required
Port = positive-integer 9102
Protocol = AuthProtocolTypeNative
Quota Include Failed Jobs = yes|no yes
Soft Quota = Size64 0
Soft Quota Grace Period = time 0
Strict Quotas = yes|no no
TLS Allowed CN = string-list
TLS Authenticate = yes|no
TLS CA Certificate Dir = directory
TLS CA Certificate File = directory
TLS Certificate = directory
TLS Certificate Revocation List= directory
TLS Enable = yes|no
TLS Key = directory
TLS Require = yes|no
Username = string




Address = <string>
(required)
Where the address is a host name, a fully qualified domain name, or a network address in dotted quad notation for a Bareos File server daemon. This directive is required.  
Allow Client Connect = <yes|no>
(default: no)
 
Auth Type = <AuthType>
(default: None)
Specifies the authentication type that must be supplied when connecting to a backup protocol that uses a specific authentication type.

The following values are allowed:

  1. None - Use no password
  2. Clear - Use clear text password
  3. MD5 - Use MD5 hashing

 

Auto Prune = <yes|no>
(default: no)
If AutoPrune is set to yes, Bareos will automatically apply the File retention period and the Job retention period for the Client at the end of the Job. If you leave the default AutoPrune = no, pruning will not be done, and your Catalog will grow in size each time you run a Job. Pruning affects only information in the catalog and not data stored in the backup archives (on Volumes), but if pruning deletes all data referring to a certain volume, the volume is regarded as empty and will possibly be overwritten before the volume retention has expired.  
Catalog = <resource-name>

This specifies the name of the catalog resource to be used for this Client. If none is specified the first defined catalog is used.  
Description = <string>

 
Enabled = <yes|no>
(default: yes)
 
FD Address = <string>

This directive is an alias.

 

FD Password = <password>

This directive is an alias.

 

FD Port = <positive-integer>
(default: 9102)
This directive is an alias.

Where the port is a port number at which the Bareos File server daemon can be contacted. The default is 9102. For NDMP backups set this to 10000.  

File Retention = <time>
(default: 5184000)
The File Retention directive defines the length of time that Bareos will keep File records in the Catalog database after the End time of the Job corresponding to the File records. When this time period expires, and if AutoPrune is set to yes Bareos will prune (remove) File records that are older than the specified File Retention period. Note, this affects only records in the catalog database. It does not affect your archive backups.

File records may actually be retained for a shorter period than you specify on this directive if you specify either a shorter Job Retention or a shorter Volume Retention period. The shortest retention period of the three takes precedence. The time may be expressed in