Diving into Bareos backups

For the initial testing and familiarization, I am using burton.starp.bnl.gov (CentOS 6) as the central master.  It has a 550GB filesystem under /scratch - enough for a small number of clients with modest retention times.  Since they are not being backed up currently, I intend to start with trgscratch and sclrscratch (/etc/ and /home at a minimum), and use auteuil as the Windows testbed (with an eye on the shift-leader terminal as the first "real" client candidate).

On the master (burton), download the bareos.repo file for Yum, put it in /etc/yum.repos.d and then "yum install bareos".  That results in the installation of the following packages:

  • bareos-director-14.2.2-46.1.el6.x86_64
  • bareos-database-common-14.2.2-46.1.el6.x86_64
  • bareos-database-mysql-14.2.2-46.1.el6.x86_64
  • bareos-filedaemon-14.2.2-46.1.el6.x86_64
  • bareos-common-14.2.2-46.1.el6.x86_64
  • bareos-client-14.2.2-46.1.el6.x86_64
  • bareos-bconsole-14.2.2-46.1.el6.x86_64
  • bareos-storage-14.2.2-46.1.el6.x86_64
  • bareos-database-tools-14.2.2-46.1.el6.x86_64
  • bareos-14.2.2-46.1.el6.x86_64
  • libfastlz-0.1-6.1.el6.x86_64.rpm
(It is a mystery to me how it knew to install bareos-database-mysql instead of bareos-database-postgresq; postgresql is the default according to the docs.)

I subsequently installed bareos-bat (Bareos Admin Tool), bareos-tools and bareos-storage-tape (none of which are necessary for backups per se).  The packages are set up with an almost working set of configuration files for running all services on the install machine and backing it up. Not much needs to be adjusted in order to have a working system, but some things should be set, such as email addresses and at least one Device in the bareos-sd.conf (unless one wants to use the default, which is /var/lib/bareos/storage).  I have set the "Archive Device" to /scratch/bareos/storage, and added that path to be excluded from the "Linux All" fileset.


Later, I also added the bareos-contrib repository and installed bareos-contrib-director-python-plugin-nsca, bareos-director-python-plugin and python-pynsca, which should provide a plugin to allow sending notices to Icinga about the backup status of indivdiual jobs.  (see here: https://github.com/bareos/bareos-contrib/tree/master/dir-plugins/nagios_icinga ; I have not tried it yet...)

For just getting started, the docs are clear on what (little) needs to be touched:

http://doc.bareos.org/master/html/bareos-manual-main-reference.html#QQ2-1-62

though they do leave out that the Storage resource should be updated with a FQDN in bareos-dir.conf.  For good measure, I set the original Client resource's Address to "localhost" instead of "burton".  A nice thing to remember is that all of the Bareos config files can be tested for syntax with the -t option to the corresponding executable, ie.:

bareos-dir -t
bareos-fd -t
bareos-sd -t
bconsole -t
bat -t




Then there is the database.  The documentation covers setting up the database well, and the provided programs for doing so are straightforward:

http://doc.bareos.org/master/html/bareos-manual-main-reference.html#x1-400002.4.2 

A bit more detail about the database is available at:

http://doc.bareos.org/master/html/bareos-manual-main-reference.html#x1-30600028.1.2




The Bacula Webmin module (with obvious minor changes to the module config) appears to work with Bareos, though I have not tested if extensively.  It is somewhat limited in supported options, in filesets it is very noticeable.  For example, the use of "exclude = yes" in an option resource block cannot be represented or configured in the webmin module.  (Open question - if there are options in the configuration file that Webmin doesn't understand, will it at least preserve them upon edits of known options?



I soon hit a snag in testing backups.  I tried to backup burton's root filesystem (/).  It was clear that something was wrong pretty quick - the backups were using far more space than the files I intended to be backed up.  There were two causes:
  • The "One FS" option was set to "No" (the default is "Yes").  So the backups were backing up /scratch, which means it was going to try to back up the backups. Ack.  [a related lesson learned - when doing 'show fileset="Linux All"', apparently options which match their default value are not listed, even if explicitely set in the configuration file.]
  • The sparse file check is disabled by default.  As it happens, I was also testing Docker containers on this machine, so had at least one sparse file for a container.  100GB of sparseness to be exact.  Bareos was trying to back it up "non-sparsely".  With the "sparse = yes" option in the FileSet, this is no longer a problem, though it does take some extra time to detect such files, since it has to compare each 32KB chunk against all zeros.  (Could there be a problem with false sparse detection?)
Once those two issues were fixed in the "Linux All" FileSet, a backup was completed successfully without any additional fuss.  (Though now there is a bit of a discrepancy in the opposite direction - the backed up content is only 5.93GiB, despite 7.2GiB used in the backed-up filesystem.  The excluded directories seem to only take up a couple hundred KB, so I can't explain the difference at this time.)



As a starting point for typical Linux backups, a "Linux Typical" fileset resource has been created as /etc/bareos/bareod-dir.d/linux-typical.fileset:
FileSet {
  Name = "Linux Typical"
  Include {
    Options {
      Signature = MD5
      sparse = yes
      onefs = yes
      aclsupport = yes
      Exclude = yes
      wildfile = "*/.journal"
      wildfile = "*/.fsck"
      compression = gzip
    }
    File = /home
    File = /root
    File = /etc
    File = /var/spool/cron
    File = /opt
    File = /usr/local
  }
}

(note the default gzip compression level is 6.)




Encryption is straightforward and I have tried it (See http://doc.bareos.org/master/html/bareos-manual-main-reference.html#QQ2-1-463).  I not yet tried using the master key to make a restore however.



The Windows FileDaemon has been installed on auteuil, and a "Windows Users" FileSet defined.  Backups are successful (and actually change to a finished state, unlike prior Bacula trial).