Bacula Tapes Bacula is an open-source, enterprise-level computer backup system for heterogeneous networks. Bacula is by far the most popular Open Source backup program. It is designed to automate backup tasks that had often required intervention from a systems administrator or computer operator. Bacula supports Linux, UNIX, Windows, and macOS backup clients, and a range of professional backup devices including tape libraries.

Today I will look at configuring the Client & FileSets resources. These are part of the bacula-dir.conf file. I will also look at the bacula-fd.conf file, which is responsible for defining the Client Daemon that runs on the client as a daemon.

Throughout the posts I will shamelessly quote the main Bacula Documentation as I see no sense in duplicating the good work that has already been done by the Bacula team. However, I will also go into detail where necessary to point out parts that I feel need extra explanation, relative to the configurations I have made.

Client Configuration

The following file, bacula-fd.conf, resides on each host that is to be backed up. The host will also need to have the bacula-fd daemon installed and running to respond to the director and allow backups.

bacula-fd.conf

FileDaemon {
  Name =                     bacula.pbdigital.org-fd
  FDport =                   9102
  WorkingDirectory =         /var/db/bacula
  Pid Directory =            /var/run
  Maximum Concurrent Jobs =  20
}

Director {
  Name =      bacula.pbdigital.org-dir
  Password =  "secret"
}

Messages {
  Name =      Standard
  director =  bacula.pbdigital.org-dir = all, !skipped, !restored
}

Of note I will outline the following directives:

  • File Daemon Resource - The Client (or File Daemon) Configuration is one of the simpler ones to specify. Generally, other than changing the Client name so that error messages are easily identified, you will not need to modify the default Client configuration file.

    • Name - The client name that must be used by the Director when connecting. Generally, it is a good idea to use a name related to the machine so that error messages can be easily identified if you have multiple Clients.

    • FDPort - This is a registered IANA port of the Client Daemon. Unless you have a very specific use case, you should probably not change this.

    • Working Directory - The directory in which the File Daemon may put its status files.

    For more details see the File Daemon Resource [20] in the Bacula documentation.

  • Director Resource - The Director resource specifies the Name of the Director which is permitted to contact the File Daemon. The Director Name and Password must match the corresponding values in the Clients Resource of the Director’s configuration file.

    For more information on the Director Resource directives, see section [20.2] in the Bacula manual.

  • Messages Resource - The Message Resource defines which messages will be handled in relation to the storage device.

    • Name - This is set to Standard which we have discussed in the Messages Resource section.

    • director - Send the message to the Director whose name is given in the address field.

    For full details see The Message Resource section [22] in the Bacula manual.

Client Resource

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

Includes/clients.conf

# Client (File Services) to backup
Client {
  Name =            bacula.pbdigital.org-fd
  Address =         bacula.pbdigital.org
  FDPort =          9102
  Catalog =         MyCatalog
  Password =        "secret"
  File Retention =  363 days
  Job Retention =   363 days
  AutoPrune =       yes
}

Client {
  Name =            nagios.pbdigital.org-fd
  Address =         nagios.pbdigital.org
  FDPort =          9102
  Catalog =         MyCatalog
  Password =        "secret"
  File Retention =  363 days
  Job Retention =   363 days
  AutoPrune =       yes
}

Of note I will outline the following directives:

  • Name - The client name which will be used in the Job resource directive or in the console run command.

  • Address - Where the address is a host name, a fully qualified domain name, or a network address in dotted quad notation for a Bacula File server daemon.

  • FDPort - Where the port is a port number at which the Bacula File server daemon can be contacted. This is a registered IANA port of the Client Daemon. Unless you have a very specific use case, you should probably not change this.

  • Catalog - This specifies the name of the catalog resource to be used for this client.

  • Password - This is the password to be used when establishing a connection with the client file daemon. This password must be the same password defined for the client in the bacula-fd.conf of the host that Bacula is connecting to.

  • File Retention - The File Retention directive defines the length of time that Bacula 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 Bacula will prune (remove) File records that are older than the specified File Retention period.

NOTE!: 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. As we have defined different retention settings for different jobs, e.g. daily, weekly & monthly, we want the Volume Retention directive of the Pools Resource to be the authoritative directive. Therefore we set the File Retention period to 363 days which is longer than any time periods defined in the Includes/pools.conf file.

  • Job Retention - The Job Retention directive defines the length of time that Bacula will keep Job records in the Catalog database after the Job End time. When this time period expires, and if AutoPrune is set to yes Bacula will prune (remove) Job records that are older than the specified File Retention period.

    Please see the note immediatley above for what determines the actual retention period that will apply.

  • AutoPrune - If AutoPrune is set to yes (default), Bacula will automatically apply the File retention period and the Job retention period for the Client at the end of the Job.

For more details see the Clients Resource [19.13] in the Bacula documentation.

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

Includes/filesets.conf

# List of files to be backed up
FileSet {
  Name = bacula.pbdigital.org-fs
  Include {
    Options {
      signature = MD5
    }
    File = /etc
    File = /home
    File = /opt/bin
    File = /root
    File = /usr/local/etc
  }
}

FileSet {
  Name = nagios.pbdigital.org-fs
  Include {
    Options {
      signature = MD5
    }
    File = /etc
    File = /home
    File = /opt/bin
    File = /root
    File = /usr/local/etc
  }
}

# This is the backup of the catalog
FileSet {
  Name = "Catalog"
  Include {
    Options {
      signature = MD5
    }
    File = "/var/db/bacula/bacula.sql"
  }
}

Of note I will outline the following directives:

  • Name - The client name which will be used in the Job resource directive or in the console run command.

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

    • options - The Options resource is optional, but when specified, it will contain a list of keyword=value options to be applied to the file-list.

      • signature - 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.                    
    • File - Name of file or directory to be backed up.

For more details see the FileSet Resource [19.7] in the Bacula documentation.

NOTE!: We have also included a File Set to back up the Catalog. This will be run by the catalog job, that will be discussed in the next post.

Wrapping Up

We have come a long way and only one more post to work through before we can start up Bacula.In the final post of configuring Bacula I will discuss defining the Jobs and Schedules resources. You can jump to it here.