Skip to content
Branch: master
Find file History
ixs Prevent BareosFdMySQL breaking if size calculation goes wrong
We did observe bacula sometimes failing with the following message:

  File "/usr/lib64/bareos/plugins/", line 42, in start_backup_file
    return bareos_fd_plugin_object.start_backup_file(context, savepkt)
  File "/usr/lib64/bareos/plugins/", line 142, in start_backup_file
    statp.size = int(size_curr_db)
ValueError: invalid literal for int() with base 10: ''

This error happened due to a legacy database being backed up that did not contain the information_schema tables.
Use exceptions to catch the size conversion error and continue executing.
Latest commit cfa5ca4 May 26, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information. Prevent BareosFdMySQL breaking if size calculation goes wrong May 25, 2017 Add 'ignore_db' options for bareos-fd-mysql plugin. Jun 9, 2016

MySQL Plugin

This plugin makes a backup of each database found in mysql in a single file. For restore select the needed database file, found in /_mysqlbackups_ in the catalog.


The mysqldump and mysql command must be installed and user root (running the fd) must have read-access to the databases. See below, if you want to use another user / password or want to restrict database access for the backup user.

You need the packages bareos-filedaemon-python-plugin installed on your client.


Activate your plugin directory in the fd resource conf on the client

FileDaemon {                          
  Name = client-fd
  Plugin Directory = /usr/lib64/bareos/plugins

Include the Plugin in the fileset definition on the director

FileSet {
    Name = "client-data"
       Include  {
                Options {
                        signature = MD5
                File = /etc
                Plugin = "python:module_path=/usr/lib64/bareos/plugins:module_name=bareos-fd-mysql"



By default all found databases (except 'performance_schema' and 'information_schema') are backuped, if the paramater 'db' is unset. You can have the plugin only certain databases saved, if you add the parameter db=db1,db2, with a comma separated list of datbases. Also you can exclude specific database from backup by 'ignore_db' option with a comma separated list ignored databases. Example plugin string:

               Plugin = "python:module_path=/usr/lib64/bareos/plugins:module_name=bareos-fd-mysql:db=test,mysql"

This will backup only the databases with name 'test' and 'mysql'.

Database host

By default the mysql connection is made to localhost. If want to connect to another host, use

mysqldump options

By default the opition string

--events --single-transaction --add-drop-database --databases

is used.

You may overwrite the whole option string with parameter dumpoptions or just supress the latter two, which are needed to include drop and create database statements into the dump. With drop_and_recreate set to 'false', these options are skipped.

defaultsfile option

This parameter allows to specify a defaultsfile that shall be used for mysql(client) and mysqldump command line utilities.

Database access / user and password

By default the root user (the user, which runs the Bareos filedaemon) is used to connect to the database. We recommend that you set a password for the user and store it in your my.cnf or use the defaultsfile option to point to another client configuration file. You can however set a user and / or password as plugin options:


Minimum privileges for the backup user are:

GRANT USAGE ON *.* TO 'bareos'@'localhost' IDENTIFIED BY 'bareos';

Command (with or without full path) to create the dumps. Default: mysqldump

You can’t perform that action at this time.