Tutorial

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

The general flow of running Bareos is:

  1. Start the Database

  2. Installing the Bareos Server

  3. Start the Bareos Daemons

  4. Start the Console program to interact with the Bareos Director

  5. Run a job

  6. Test recovering some files from the Volume just written to ensure the backup is good and that you know how to recover. Better test before disaster strikes

  7. Add a second client.

Each of these steps is described in more detail below.

Installing Bareos

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

Starting the Daemons

Assuming you have installed the packages, to start the three daemons, simply enter:

systemctl start services
systemctl start bareos-dir bareos-sd bareos-fd

Or enable and start services in one go

systemctl enable –now services
systemctl enable --now bareos-dir bareos-sd bareos-fd

On Debian based distribution you have to use

systemctl start services (Debian)
systemctl start bareos-director bareos-storage bareos-filedaemon

instead (systemd services need to be named after the package name, not the binary), respectively

systemctl enable –now services
systemctl enable --now bareos-director bareos-storage bareos-filedaemon

Using the Director to Query and Start Jobs

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

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

bconsole
root@host:~# bconsole
   Connecting to Director localhost:9101
    Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
   1000 OK: bareos-dir Version: 23.0.0 (23 September 2023)
   Bareos subscription release.
   Support available on https://www.bareos.com/support/
   You are connected using the default console
   Enter a period (.) to cancel a command.
   *

The asterisk is the console command prompt.

Type help to see a list of available commands:

help
*help
  Command            Description
  =======            ===========
  add                Add media to a pool
  autodisplay        Autodisplay console messages
  automount          Automount after label
  cancel             Cancel a job
  configure          Configure director resources
  create             Create DB Pool from resource
  delete             Delete volume, pool or job
  disable            Disable a job/client/schedule
  enable             Enable a job/client/schedule
  estimate           Performs FileSet estimate, listing gives full listing
  exit               Terminate Bconsole session
  export             Export volumes from normal slots to import/export slots
  gui                Switch between interactive (gui off) and non-interactive (gui on) 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 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
  resolve            Resolve a hostname
  run                Run a job
  status             Report status
  setbandwidth       Sets bandwidth
  setdebug           Sets debug level
  setdevice          Sets device parameter
  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
  truncate           Truncate purged volumes
  unmount            Unmount storage
  umount             Umount - for old-time Unix guys, see unmount
  update             Update volume, pool, slots, job or statistics
  use                Use specific catalog
  var                Does variable expansion
  version            Print Director version
  wait               Wait until no jobs are running
  whoami             Print the user name associated with this console

  When at a prompt, entering a period (.) cancels the command.

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

Running a Job

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

  • Started the Database

  • Installed Bareos

  • Prepared the database for Bareos

  • Started Bareos Director, Storage Daemon and File Daemon

  • Invoked the Console program with bconsole

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
*show filesets
...

FileSet {
  Name = "SelfTest"
  Description = "fileset just to backup some files for selftest"
  Include {
    Options {
      Signature = "XXH128"
      HardLinks = No
      AclSupport = Yes
      XattrSupport = Yes
    }
    File = "/usr/sbin"
  }
}


FileSet {
  Name = "Catalog"
  Description = "Backup the catalog dump and Bareos configuration files."
  Include {
    Options {
      Signature = "XXH128"
      HardLinks = No
      AclSupport = Yes
      XattrSupport = Yes
    }
    File = "/var/lib/bareos/bareos.sql"
    File = "/etc/bareos"
  }
}
...

One of the FileSets is the pre-defined SelfTest (Dir->Fileset) FileSet that will backup the /usr/sbin directory. For testing purposes, we have chosen a directory of moderate size (about 30 Megabytes) and complexity without being too big. The FileSet Catalog (Dir->Fileset) is used for backing up Bareos’s catalog and is not of interest to us for the moment. You can change what is backed up by editing the configuration and changing the File = line in the Fileset (Dir) 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
*status dir
bareos-dir Version: 23.0.0 (23 September 2023) GNU/Linux
Daemon started 2023-09-23T08:59:05+0000. Jobs: run=0, running=0 db:postgresql,

Scheduled Jobs:
Level          Type     Pri  Scheduled          Name               Volume
===================================================================================
Incremental    Backup    10  2023-09-23T21:00:00+0000 backup-bareos-fd   *unknown*
Full           Backup    11  2023-09-23T21:10:00+0000 BackupCatalog      *unknown*
====

Running Jobs:
Console connected at 2023-09-23T08:59:09+0000
No Jobs running.
====
No Terminated Jobs.

Client Initiated Connections (waiting for jobs):
Connect time        Protocol            Authenticated       Name
===================================================================================
====

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 (Dir->Job)at 21:00 and that at 21:10, a BackupCatalog (Dir->Job)is scheduled to run.

Now enter:

status client
*status client
Automatically selected Client: bareos-fd
Connecting to Client bareos-fd at localhost:9102
Probing client protocol... (result will be saved until config reload)
 Handshake: Immediate TLS, Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3

bareos-fd Version: 23.0.0 (23 September 2023) GNU/Linux
Daemon started 2023-09-23T08:59:01+0000. Jobs: run=0 running=0, Bareos subscription binary
 Sizeof: boffset_t=8 size_t=8 debug=0 trace=0 bwlimit=0kB/s

Running Jobs:
bareos-dir (director) connected at: 2023-09-23T09:47:03+0000
No Jobs running.
====

Terminated Jobs:
====

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

Finally do the same for your Bareos Storage Daemon with:

status storage
*status storage
Automatically selected Storage: File
Connecting to Storage daemon File at bareos-sd:9103
 Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3

bareos-sd Version: 23.0.0 (23 September 2023) GNU/Linux
Daemon started 2023-09-23T08:59:03+0000. Jobs: run=0, running=0, Bareos subscription binary
 Sizes: boffset_t=8 size_t=8 int32_t=4 int64_t=8 bwlimit=0kB/s

Job inventory:

No Jobs running.
====

Jobs waiting to reserve a drive:
====

Terminated Jobs:
====

Device status:

Device "FileStorage" (/var/lib/bareos/storage) is not open.
==
====

Used Volume status:
====

====

You will notice that the default Bareos Storage Daemon device is named File (Dir->Storage)and that it will use device /var/lib/bareos/storage, which is not currently open.

Now, let’s actually run a job with:

run
run

you should get the following output:

select job
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
A job name must be specified.
The defined Job resources are:
1: backup-bareos-fd
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 job
Run Backup job
JobName:  backup-bareos-fd
Level:    Incremental
Client:   bareos-fd
Format:   Native
FileSet:  SelfTest
Pool:     Incremental (From Job IncPool override)
Storage:  File (From Job resource)
When:     2023-09-23T09:48:54+0000
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 (Dir->Job)with FileSet SelfTest (Dir->Fileset)as an Incremental job on your Client, and to use Storage File (Dir->Storage)and Pool Incremental (Dir->Pool),and finally, it wants to run it now (the current time should be displayed by your console).

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

job queued
Job queued. JobId=1
You have messages.
*

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

joblog output
*messages
2023-09-23T09:50:04+0000 bareos-dir JobId 1: No prior Full backup Job record found.
2023-09-23T09:50:04+0000 bareos-dir JobId 1: No prior or suitable Full backup found in catalog. Doing FULL backup.
2023-09-23T09:50:06+0000 bareos-dir JobId 1: Start Backup JobId 1, Job=backup-bareos-fd.2023-09-23T09.50.04_03
2023-09-23T09:50:06+0000 bareos-dir JobId 1: Connected Storage daemon at localhost:9103, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:50:06+0000 bareos-dir JobId 1:  Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:50:06+0000 bareos-dir JobId 1: Connected Client: bareos-fd at localhost:9102, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:50:06+0000 bareos-dir JobId 1:  Handshake: Immediate TLS
2023-09-23T09:50:06+0000 bareos-dir JobId 1:  Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:50:06+0000 bareos-dir JobId 1: Created new Volume "Full-0001" in catalog.
2023-09-23T09:50:06+0000 bareos-dir JobId 1: Using Device "FileStorage" to write.
2023-09-23T09:50:06+0000 bareos-fd  JobId 1: Connected Storage daemon at localhost:9103, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:50:06+0000 bareos-fd  JobId 1:  Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:50:06+0000 bareos-fd  JobId 1: Extended attribute support is enabled
2023-09-23T09:50:06+0000 bareos-fd  JobId 1: ACL support is enabled
2023-09-23T09:50:06+0000 bareos-sd  JobId 1: Labeled new Volume "Full-0001" on device "FileStorage" (/var/lib/bareos/storage).
2023-09-23T09:50:06+0000 bareos-sd  JobId 1: Labeled new Volume "Full-0001" on device "FileStorage" (/var/lib/bareos/storage)
2023-09-23T09:50:07+0000 bareos-sd  JobId 1: Releasing device "FileStorage" (/var/lib/bareos/storage).
2023-09-23T09:50:07+0000 bareos-sd  JobId 1: Elapsed time=00:00:01, Transfer rate=62.68 M Bytes/second
2023-09-23T09:50:07+0000 bareos-dir JobId 1: Insert of attributes batch table with 173 entries start
2023-09-23T09:50:07+0000 bareos-dir JobId 1: Insert of attributes batch table done
2023-09-23T09:50:07+0000 bareos-dir JobId 1: Bareos bareos-dir 23.0.0 (23Sep23):
  Build OS:               GNU/Linux
  JobId:                  1
  Job:                    backup-bareos-fd.2023-09-23T09.50.04_03
  Backup Level:           Full (upgraded from Incremental)
  Client:                 "bareos-fd" 23.0.0 (23Sep23) GNU/Linux
  FileSet:                "SelfTest" 2023-09-23T09:50:04+0000
  Pool:                   "Full" (From Job FullPool override)
  Catalog:                "MyCatalog" (From Client resource)
  Storage:                "File" (From Job resource)
  Scheduled time:         2023-09-23T09:48:54+0000
  Start time:             2023-09-23T09:50:06+0000
  End time:               2023-09-23T09:50:07+0000
  Elapsed time:           1 sec
  Priority:               10
  FD Files Written:       173
  SD Files Written:       173
  FD Bytes Written:       62,668,227 (62.66 MB)
  SD Bytes Written:       62,685,875 (62.68 MB)
  Rate:                   62668.2 KB/s
  Software Compression:   None
  VSS:                    no
  Encryption:             no
  Accurate:               no
  Volume name(s):         Full-0001
  Volume Session Id:      1
  Volume Session Time:    1695718743
  Last Volume Bytes:      62,706,904 (62.70 MB)
  Non-fatal FD errors:    0
  SD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Bareos binary info:     Bareos subscription release
  Job triggered by:       User
  Termination:            Backup OK

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

ls -l /var/lib/bareos/storage
total 61240
-rw-r-----. 1 bareos bareos 62706904 Sep 23 09:50 Full-0001

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

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

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

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
*restore all
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"

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:

select resource
Select item:  (1-13): 5
Automatically selected Client: bareos-fd
The defined FileSet resources are:
1: Catalog
2: SelfTest
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 that fileset.

restore filesystem
Select FileSet resource (1-2): 2
+-------+-------+----------+------------+------------------------+------------+
| jobid | level | jobfiles | jobbytes   | starttime              | volumename |
+-------+-------+----------+------------+------------------------+------------+
|     1 | F     |      173 | 62,668,227 | 2023-09-23 09:50:06+00 | Full-0001  |
+-------+-------+----------+------------+------------------------+------------+
You have selected the following JobId: 1

Building directory tree for JobId(s) 1 ...  +++++++++++++++++++++++++++++++++++++++
89 files inserted into the tree.

You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.

cwd is: /
$

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

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

For more information on this, please refer to the Restore Command Chapter of this manual for more details.

To exit this mode and cancel the restore, simply enter: .

To select all files to be restored you enter:

mark all
cwd is: /
$ mark *
173 files marked.
$

To exit the selection mode and continue restore operation enter:

done
done

and you will get the following output:

restore preview
Bootstrap records written to /var/lib/bareos/bareos-dir.restore.2.bsr

The job will require the following
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================

   Full-0001                 File                      FileStorage

Volumes marked with "*" are online.


173 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:         LinuxAll
Backup Client:   bareos-fd
Restore Client:  bareos-fd
Format:          Native
Storage:         File
When:            2023-09-23T09:55:09+0000
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes

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:

restore job report
2023-09-23T09:57:34+0000 bareos-dir JobId 3: Start Restore Job RestoreFiles.2023-09-23T09.57.32_06
2023-09-23T09:57:34+0000 bareos-dir JobId 3: Connected Storage daemon at localhost:9103, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:57:34+0000 bareos-dir JobId 3:  Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:57:35+0000 bareos-dir JobId 3: Using Device "FileStorage" to read.
2023-09-23T09:57:35+0000 bareos-dir JobId 3: Connected Client: bareos-fd at localhost:9102, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:57:35+0000 bareos-dir JobId 3:  Handshake: Immediate TLS
2023-09-23T09:57:35+0000 bareos-dir JobId 3:  Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:57:37+0000 bareos-fd  JobId 3: Connected Storage daemon at localhost:9103, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:57:37+0000 bareos-fd  JobId 3:  Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
2023-09-23T09:57:37+0000 bareos-sd  JobId 3: Ready to read from volume "Full-0001" on device "FileStorage" (/var/lib/bareos/storage).
2023-09-23T09:57:37+0000 bareos-sd  JobId 3: Forward spacing Volume "Full-0001" to file:block 0:217.
2023-09-23T09:57:37+0000 bareos-sd  JobId 3: Releasing device "FileStorage" (/var/lib/bareos/storage).
2023-09-23T09:57:37+0000 bareos-dir JobId 4: Bareos bareos-dir 23.0.0 (23Sep23):
  Build OS:               GNU/Linux
  JobId:                  4
  Job:                    RestoreFiles.2023-09-23T09.57.32_06
  Restore Client:         "bareos-fd" 23.0.0 (23Sep23) GNU/Linux
  Start time:             2023-09-23T09:57:34+0000
  End time:               2023-09-23T09:57:37+0000
  Elapsed time:           3 secs
  Files Expected:         173
  Files Restored:         173
  Bytes Restored:         62,654,733
  Rate:                   20884.9 KB/s
  FD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Bareos binary info:     Bareos subscription release
  Job triggered by:       User
  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:

remove restore directory
root@host:~# rm -rf /tmp/bareos-restore

Quitting the Console Program

Simply enter the command quit.

Adding a Client

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

Hostname (FQDN)

client2.example.com

IP Address

192.168.0.2

OS

Linux (otherwise the paths may differ)

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

Client: install package

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

Director: configure client

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

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

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

This creates two resource configuration files:

  • /etc/bareos/bareos-dir.d/client/client2-fd.conf

  • /etc/bareos/bareos-dir-export/client/client2-fd/bareos-fd.d/director/bareos-dir.conf (assuming your director resource is named bareos-dir)

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

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

Manual configuration of client

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

bareos-dir.d/client/client2-fd.conf
Client {
  Name = client2-fd
  Address = 192.168.0.2
  Password = secret
}

Reload or restart your Bareos Director:

reload the Director configuration
*reload
reloaded

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

Note

You should also consider using Passive mode for the the client, see Passive Clients, especially if you are backing up clients that are not part of your local network.

Client: configure

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

  • /etc/bareos/bareos-fd.d/client/myself.conf

  • /etc/bareos/bareos-fd.d/director/bareos-dir.conf

  • /etc/bareos/bareos-fd.d/director/bareos-mon.conf

  • /etc/bareos/bareos-fd.d/messages/Standard.conf

In detail:

client/myself.conf

defines the name of the client. The default is <hostname>-fd. Changes are only required, if you want to use another name or en- or disable special Bareos File Daemon features. See Client Resource.

director/bareos-dir.conf

gives the Bareos Director bareos-dir full access to this Bareos File Daemon. During installation, the Password (Fd->Director)is set to a random default. Adapt the name and/or the password to your Bareos Director. (The name bareos-dir is the default Bareos Director name since Bareos Version >= 16.2.4.)

director/bareos-mon.conf

gives the Bareos Director bareos-mon restricted access to this Bareos File Daemon. During installation, the Password (Fd->Director)is set to a random value. This resource is intended to be used by the local bareos-tray-monitor.

messages/Standard.conf

defines, how messages should be handled. The default sends all relevant messages to the Bareos Director.

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

Anyhow, the resource will look similar to this:

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

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

restart bareos-fd
service bareos-fd restart

Manual configuration

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

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

See the relation between resource names and password of the different Bareos components in Relation between resource names and passwords.

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

show how bareos-fd would read the current configuration files
bareos-fd --export-config

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

restart bareos-fd
service bareos-fd restart

Note

You should also consider using Passive mode for the the client, see Passive Clients, especially if you are backing up clients that are not part of your local network.

Director: test client, add a job

The following example show how to

  • Verify the network connection from Bareos Director to the Bareos File Daemon.

  • Add a job resource.

  • Dry-run the job (estimate listing).

  • Run the job.

  • Wait for the job to finish.

  • Verify the job.

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

Patience When Starting Daemons or Mounting Blank Tapes

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

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

Pools

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

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

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

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

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

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

Other Useful Console Commands

help

Show the list all all available commands.

help list

Show detail information about a specific command, in this case the command list.

status dir

Print a status of all running jobs and jobs scheduled in the next 24 hours.

status

The console program will prompt you to select a daemon type, then will request the daemon’s status.

status jobid=nn

Print a status of JobId nn if it is running. The Storage daemon is contacted and requested to print a current status of the job as well.

list pools

List the pools defined in the Catalog (normally only Default is used).

list volumes

Lists all the media defined in the Catalog.

list jobs

Lists all jobs in the Catalog that have run.

list jobid=nn

Lists JobId nn from the Catalog.

list jobtotals

Lists totals for all jobs in the Catalog.

list files jobid=nn

List the files that were saved for JobId nn.

list jobmedia

List the media information for each Job run.

messages

Prints any messages that have been directed to the console.

quit

Exit or quit the console program.

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

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