wavedocs
8/21/2015 - 2:13 PM

Bacula concurrent jobs multiple storage devices client labeled pools debian installation configuration.

Bacula concurrent jobs multiple storage devices client labeled pools debian installation configuration.

# Time-stamp: <2012-03-30 Fri 10:28 storages.conf>

####################################
# /etc/bacula/conf.d/storages.conf #
####################################
# http://bacula.org/5.2.x-manuals/en/main/main/Basic_Volume_Management.html#SECTION003220000000000000000
# See /etc/bacula/conf.d/devices.conf
# Note: use external director address for clients to connect.

Storage {
  Name = PrimaryFileStorage
  Address = 10.0.0.10
  SDPort = 9103
  Password = Tah3rMh3          # Match /etc/bacula/bacula-sd.conf
  Device = PrimaryFileDevice   # Match /etc/bacula/bacula-sd.conf
  Media Type = PrimaryFile
  Maximum Concurrent Jobs = 10
}

Storage {
  Name = SecondaryFileStorage
  Address = 10.0.0.10
  SDPort = 9103
  Password = Tah3rMh3            # Match /etc/bacula/bacula-sd.conf
  Device = SecondaryFileDevice   # Match /etc/bacula/bacula-sd.conf
  Media Type = SecondaryFile
  Maximum Concurrent Jobs = 10
}

Storage {
  Name = TertiaryFileStorage
  Address = 10.0.0.10
  SDPort = 9103
  Password = Tah3rMh3           # Match /etc/bacula/bacula-sd.conf
  Device = TertiaryFileDevice   # Match /etc/bacula/bacula-sd.conf
  Media Type = TertiaryFile
  Maximum Concurrent Jobs = 10
}

Storage {
  Name = QuaternaryFileStorage
  Address = 10.0.0.10
  SDPort = 9103
  Password = Tah3rMh3           # Match /etc/bacula/bacula-sd.conf
  Device = QuaternaryFileDevice   # Match /etc/bacula/bacula-sd.conf
  Media Type = QuaternaryFile
  Maximum Concurrent Jobs = 10
}

# Free for restore jobs.
Storage {
  Name = RestoreFileStorage
  Address = 10.0.0.10
  SDPort = 9103
  Password = Tah3rMh3          # Match /etc/bacula/bacula-sd.conf
  Device = RestoreFileDevice   # Match /etc/bacula/bacula-sd.conf
  Media Type = RestoreFile
  Maximum Concurrent Jobs = 10
}
# Time-stamp: <2012-03-30 Fri 10:30 schedules.conf>

#####################################
# /etc/bacula/conf.d/schedules.conf #
#####################################

# Differential: files changed since the last Full backup.
# Incremental: files changed since the last backup (be that Full, Differential or Incremental).

# | Sun  | Mon | Tues | Wed | Thur | Fri | Sat |
# | Full | Inc | Inc  | Inc | Diff | Inc | Inc |

# This cycle is used in the JobDefs, and Pools.
# Level Pools are defined in /etc/bacula/conf.d/jobdefs.conf.
Schedule {
   Name = PrimaryBackupCycle
   Run = Level=Full sun at 22:00
   Run = Level=Differential thu at 22:00
   Run = Level=Incremental mon,tue,wed,fri,sat at 22:00
}
# Time-stamp: <2012-03-30 Fri 10:28 pools.conf>

#################################
# /etc/bacula/conf.d/pools.conf #
#################################
# help.: http://www.bacula.org/en/dev-manual/main/main/Automatic_Volume_Recycling.html
# kudos: http://www.davidcraddock.net/2008/10/29/linux-backups-using-bacula/


# This is the default backup stanza, which always gets overridden by one of the other Pools,
# except when a manual backup is performed via the console.
Pool {
  Name = DefaultPool
  Pool Type = Backup
  Maximum Volume Jobs = 1       # If you specify zero (the default), there is no limit.
  # Maximum Volumes = 100       # Number of volumes will be permitted.
  Maximum Volume Bytes = 10G    # Maximum Volume size, keep small for search performance.
  Use Volume Once = yes         # Mark a volume as Used and thus no longer appendable.
  Recycle = no                  # Don't recycle Volumes but prune all the Jobs on the volume, mark "Purged".
  Action On Purge = Truncate    # Truncate the volume when it is purged.
  Auto Prune = yes              # Yes (default), applies Volume Retention period when new Volume is needed and no appendable Volumes exist in the Pool.
  Volume Retention = 1 month    # Retention time of records associated with the Volume in the Catalog database.
  # Related to "LabelMedia" /etc/bacula/conf.d/storages.conf
  Label Format = "${Client}-${Pool}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}-${JobId}"
}

# NOTE: See /etc/bacula/conf.d/schedules.conf as this controls when each backup type (Full,Diff,Inc) is run.
# Maximum Volume Jobs = 1, so that client/job creates a single volume per job (another if more than 10G).
# Below defines which Pools to use for each backup type.

Pool {
  Name = FullPool
  Pool Type = Backup
  Maximum Volume Jobs = 1
  Use Volume Once = yes
  Maximum Volume Bytes = 10G
  Recycle = no
  Action On Purge = Truncate
  Auto Prune = yes
  Volume Retention = 1 month
  Label Format = "${Client}-${Pool}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}-${JobId}"
}

Pool {
  Name = DiffPool
  Pool Type = Backup
  Maximum Volume Jobs = 1
  Use Volume Once = yes
  Maximum Volume Bytes = 10G
  Recycle = no
  Action On Purge = Truncate
  Auto Prune = yes
  Volume Retention = 1 month
  Label Format = "${Client}-${Pool}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}-${JobId}"
}

Pool {
  Name = IncPool
  Pool Type = Backup
  Maximum Volume Jobs = 1
  Use Volume Once = yes
  Maximum Volume Bytes = 10G
  Recycle = no
  Action On Purge = Truncate
  Auto Prune = yes
  Volume Retention = 1 month
  Label Format = "${Client}-${Pool}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}-${JobId}"
}
# Time-stamp: <2012-03-30 Fri 10:31 messages.conf>

####################################
# /etc/bacula/conf.d/messages.conf #
####################################

# Define where error and information messages are to be sent or logged.
Messages {
        Name = Standard
        mailcommand = "/usr/sbin/bsmtp -h localhost -f bacula@bacula-dir -s \"Bacula: %t %e of %c %l\" %r"
        operatorcommand = "/usr/sbin/bsmtp -h localhost -f bacula@bacula-dir -s \"Bacula: Intervention needed for %j\" %r"
        mail = bacula-backup@example.com = all, !skipped
        operator = bacula-backup@example.com = mount
        console = all, !skipped, !saved
        catalog = all, !skipped, !saved
        mailonerror = bacula-backup@example.com = all
        append = "/var/log/bacula/log" = all, !skipped
        }

Messages {
        Name = Daemon
        mailcommand = "/usr/sbin/bsmtp -h localhost -f bacula@bacula-dir -s \"Bacula daemon message\" %r"
        mail = bacula-backup@example.com = all, !skipped
        console = all, !skipped, !saved
        append = "/var/log/bacula/log" = all, !skipped
        }
# Time-stamp: <2012-03-30 Fri 10:29 jobdefs.conf>

###################################
# /etc/bacula/conf.d/jobdefs.conf #
###################################
# 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 be mentioned in each Job.

# Standard Restore template, to be changed by Console program.
# Not JobDef but this has to exist somewhere as a template.
Job {
  Name = Restore
  Type = Restore
  Client = bacula-dir
  FileSet = StandardLinuxFileSet
  Storage = RestoreFileStorage
  Pool = FullPool
  Priority = 1
  Messages = Standard
  Where = /tmp
}

# Main job definitions used by clients /etc/bacula/clients.

JobDefs {
Name = StandardLinuxJob
Type = Backup
FileSet = StandardLinuxFileSet
Storage = PrimaryFileStorage,SecondaryFileStorage,TertiaryFileStorage,QuaternaryFileStorage
Pool = DefaultPool                         # Default Pool, overidden pools and schedules.
Full Backup Pool = FullPool                # This ties with /etc/bacula/conf.d/schedules.conf
Incremental Backup Pool = IncPool          # This ties with /etc/bacula/conf.d/schedules.conf
Differential Backup Pool = DiffPool        # This ties with /etc/bacula/conf.d/schedules.conf
Prefer Mounted Volumes = no                # Finding an unused drive, otherwise, job started will append to volume.
Write Bootstrap = "/mnt/nfs-nas-gw/bacula-backups/%c.bsr"
Schedule = PrimaryBackupCycle              # /etc/bacula/conf.d/schedules.conf
Priority = 10                              # Ten is default
Messages = Standard
}

JobDefs {
Name = StandardWindowsJob
Type = Backup
FileSet = StandardWindowsFileSet
Storage = PrimaryFileStorage,SecondaryFileStorage,TertiaryFileStorage,QuaternaryFileStorage
Pool = DefaultPool                         # Default Pool, overidden pools and schedules.
Full Backup Pool = FullPool                # This ties with /etc/bacula/conf.d/schedules.conf
Incremental Backup Pool = IncPool          # This ties with /etc/bacula/conf.d/schedules.conf
Differential Backup Pool = DiffPool        # This ties with /etc/bacula/conf.d/schedules.conf
Prefer Mounted Volumes = no                # Finding an unused drive, otherwise, job started will append to volume.
Write Bootstrap = "/mnt/nfs-nas-gw/bacula-backups/%c.bsr"
Schedule = PrimaryBackupCycle              # /etc/bacula/conf.d/schedules.conf
Priority = 10                              # Ten is default
Messages = Standard
}
# Time-stamp: <2012-03-30 Fri 10:29 filesets.conf>

####################################
# /etc/bacula/conf.d/filesets.conf #
####################################

# Standard Linux File Set.
# Not live MySQL data!
FileSet {
Name = StandardLinuxFileSet
  Include {
    Options {
      signature = MD5
      compression = GZIP
      onefs = no
      fstype = ext2
      fstype = ext3
      fstype = ext4
      fstype = reiserfs
    }
    File = /
  }
  Exclude {
    File = /home/mysql
    File = /proc
    File = /sys
    File = /tmp
    File = /var/cache/apt/archives   # Debian specific
    File = /var/tmp
    File = /var/lib/mqueue
    File = /var/lib/mysql
    File = /.fsck
    File = /.autofsck
    File = /.journal
  }
}

# Standard Windows File Set.
# Not live SQL data!
FileSet {
Name = StandardWindowsFileSet
  Enable VSS = yes
  Include {
    Options {
      signature = MD5
      compression = GZIP
      exclude = yes
      wildfile = "*.mdf"
      wildfile = "*.ldf"
      wildfile = "*.MDF"
      wildfile = "*.LDF"
    }
    File = C:/
    File = D:/
    File = D:/Microsoft SQL Server/MSSQL/BACKUP
    File = E:/
    File = F:/
    File = G:/
  }
  Exclude {
    File = D:/SQLDataRoot
    File = D:/Microsoft SQL Server/MSSQL
   }
}
# Time-stamp: <2012-03-30 Fri 10:27 devices.conf>

###################################
# /etc/bacula/conf.d/devices.conf #
###################################
# These are referenced in /etc/bacula/conf.d/storages.conf
# Multiple are defined in the jobdefs separated by commas.
# Always Open = no, Important for storage daemon to open it only when a job starts.

# Devices supported by this Storage daemon.
Device {
  Name = PrimaryFileDevice
  Media Type = PrimaryFile
  Archive Device = /mnt/nfs-nas-gw/bacula-backups/
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
}

Device {
  Name = SecondaryFileDevice
  Media Type = SecondaryFile
  Archive Device = /mnt/nfs-nas-gw/bacula-backups/
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
}

Device {
  Name = TertiaryFileDevice
  Media Type = TertiaryFile
  Archive Device = /mnt/nfs-nas-gw/bacula-backups/
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
}

Device {
  Name = QuaternaryFileDevice
  Media Type = QuaternaryFile
  Archive Device = /mnt/nfs-nas-gw/bacula-backups/
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
}

# Free for restore jobs.
Device {
  Name = RestoreFileDevice
  Media Type = RestoreFile
  Archive Device = /mnt/nfs-nas-gw/bacula-backups/
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
}
# Time-stamp: <2012-03-30 Fri 10:33 example-client2.conf>

###################################################
# /etc/bacula/conf.d/clients/example-client2.conf #
###################################################

# This can be used as the standard client config.

# Remote client name, address, and matching password with their bacula-fd.conf.
Client {
        Name = example-client2
        Address = 10.0.0.30        # Remote client address.
        FD Port = 9102             # Default.
        Password = Sh6oXsw         # Matches remote client /etc/bacula/bacula-fd.conf
        Catalog = PrimaryCatalog   # Matches in /etc/bacula/bacula-dir.conf
        # These do not affect your archive, and should be set lower than the Pool/Volume retention definitions.
        File Retention = 2 weeks   # Files are pruned from Catalog database if Files are older than File retention period.
        Job Retention =  2 weeks   # Jobs are pruned from Catalog database if Job records are older than File retention period.
        AutoPrune = yes            # Yes to enable the above.
}


# Job name for client, and JobDef. Explicitly specifying Job rules here will
# overide the defaults defined in the /etc/bacula/conf.d/jobdefs.conf
Job {
  Name = example-client2
  Client = example-client2
  JobDefs = StandardLinuxJob
  Schedule = example-client2Schedule
}

Schedule {
   Name = example-client2Schedule
   Run = Level=Full tue at 12:11
   Run = Level=Differential tue at 12:11
   Run = Level=Incremental tue at 12:11
}
# Time-stamp: <2012-03-30 Fri 10:33 example-client.conf>

##################################################
# /etc/bacula/conf.d/clients/example-client.conf #
##################################################

# This can be used as the standard client config.

# Remote client name, address, and matching password with their bacula-fd.conf.
Client {
        Name = example-client
        Address = 10.0.0.20        # Remote client address.
        FD Port = 9102             # Default.
        Password = Sh6oXsw         # Matches remote client /etc/bacula/bacula-fd.conf
        Catalog = PrimaryCatalog   # Matches in /etc/bacula/bacula-dir.conf
        # These do not affect your archive, and should be set lower than the Pool/Volume retention definitions.
        File Retention = 2 weeks   # Files are pruned from Catalog database if Files are older than File retention period.
        Job Retention =  2 weeks   # Jobs are pruned from Catalog database if Job records are older than File retention period.
        AutoPrune = yes            # Yes to enable the above.
        Heartbeat Interval = 1 Minute            # Prevents timeouts
}


# Job name for client, and JobDef. Explicitly specifying Job rules here will
# overide the defaults defined in the /etc/bacula/conf.d/jobdefs.conf
Job {
  Name = example-client
  Client = example-client
  JobDefs = "StandardLinuxJob"
}
# Time-stamp: <2012-03-30 Fri 10:34 bacula-dir.conf>

#######################################
# /etc/conf.d/clients/bacula-dir.conf #
#######################################

# This is the Director itself used to backup the catalog.
# All config is in this single file only!

# Remote client name, address, and matching password with their bacula-fd.conf.
Client {
        Name = bacula-dir
        Address = 10.0.0.10        # Remote client address.
        FD Port = 9102             # Default.
        Password = Sh6oXsw         # Matches remote client /etc/bacula/bacula-fd.conf
        Catalog = PrimaryCatalog   # Matches in /etc/bacula/bacula-dir.conf
}

# Backup the Director catalog database (after the nightly save).
Job {
  Name = CatalogBackup
  Type = Backup
  Client = bacula-dir
  FileSet = CatalogBackupFileSet
  Schedule = CatalogBackupCycle
  Storage = PrimaryFileStorage,SecondaryFileStorage,TertiaryFileStorage
  Messages = Standard
  Pool = CatalogBackupPool
  # WARNING!!! Passing the password via the command line is insecure.
  # see comments in make_catalog_backup for details.
  # Single user system so OK.
  RunBeforeJob = "/etc/bacula/scripts/make_catalog_backup bacula bacula quoh7Xai"
  RunAfterJob  = "/etc/bacula/scripts/delete_catalog_backup bacula bacula quoh7Xai"
  Write Bootstrap = "/mnt/nfs-nas-gw/%c.bsr"
}

# Pool specific for the catalog backup.
Pool {
  Name = CatalogBackupPool
  Pool Type = Backup
  Maximum Volume Jobs = 1
  Maximum Volume Bytes = 10G
  Use Volume Once = yes
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 1 month
  Label Format = "CatalogBackup"
}

# This schedule does the catalog backup after the "PrimaryBackupCycle".
Schedule {
  Name = CatalogBackupCycle
  Run = Level=Full sun-sat at 1:10
}

# This is the backup of the catalog.
FileSet {
  Name = CatalogBackupFileSet
  Include {
    Options {
      signature=MD5
    }
    File = "/var/lib/bacula/bacula.sql"
  }
}
# Time-stamp: <2012-03-30 Fri 10:27 catalogs.conf>

####################################
# /etc/bacula/conf.d/catalogs.conf #
####################################

# MySQL catalog service
Catalog {
  Name = PrimaryCatalog
  DB Address = localhost
  dbname = bacula
  dbuser = bacula
  dbpassword = quoh7Xai
}
# Time-stamp: <2012-03-30 Fri 10:28 storages.conf>

####################################
# /etc/bacula/conf.d/storages.conf #
####################################
# http://bacula.org/5.2.x-manuals/en/main/main/Basic_Volume_Management.html#SECTION003220000000000000000
# See /etc/bacula/conf.d/devices.conf
# Note: use external director address for clients to connect.

Storage {
  Name = PrimaryFileStorage
  Address = 10.0.0.10
  SDPort = 9103
  Password = Tah3rMh3          # Match /etc/bacula/bacula-sd.conf
  Device = PrimaryFileDevice   # Match /etc/bacula/bacula-sd.conf
  Media Type = PrimaryFile
  Maximum Concurrent Jobs = 10
}

Storage {
  Name = SecondaryFileStorage
  Address = 10.0.0.10
  SDPort = 9103
  Password = Tah3rMh3            # Match /etc/bacula/bacula-sd.conf
  Device = SecondaryFileDevice   # Match /etc/bacula/bacula-sd.conf
  Media Type = SecondaryFile
  Maximum Concurrent Jobs = 10
}

Storage {
  Name = TertiaryFileStorage
  Address = 10.0.0.10
  SDPort = 9103
  Password = Tah3rMh3           # Match /etc/bacula/bacula-sd.conf
  Device = TertiaryFileDevice   # Match /etc/bacula/bacula-sd.conf
  Media Type = TertiaryFile
  Maximum Concurrent Jobs = 10
}

Storage {
  Name = QuaternaryFileStorage
  Address = 10.0.0.10
  SDPort = 9103
  Password = Tah3rMh3           # Match /etc/bacula/bacula-sd.conf
  Device = QuaternaryFileDevice   # Match /etc/bacula/bacula-sd.conf
  Media Type = QuaternaryFile
  Maximum Concurrent Jobs = 10
}

# Free for restore jobs.
Storage {
  Name = RestoreFileStorage
  Address = 10.0.0.10
  SDPort = 9103
  Password = Tah3rMh3          # Match /etc/bacula/bacula-sd.conf
  Device = RestoreFileDevice   # Match /etc/bacula/bacula-sd.conf
  Media Type = RestoreFile
  Maximum Concurrent Jobs = 10
}
# Time-stamp: <2012-03-30 Fri 10:30 schedules.conf>

#####################################
# /etc/bacula/conf.d/schedules.conf #
#####################################

# Differential: files changed since the last Full backup.
# Incremental: files changed since the last backup (be that Full, Differential or Incremental).

# | Sun  | Mon | Tues | Wed | Thur | Fri | Sat |
# | Full | Inc | Inc  | Inc | Diff | Inc | Inc |

# This cycle is used in the JobDefs, and Pools.
# Level Pools are defined in /etc/bacula/conf.d/jobdefs.conf.
Schedule {
   Name = PrimaryBackupCycle
   Run = Level=Full sun at 22:00
   Run = Level=Differential thu at 22:00
   Run = Level=Incremental mon,tue,wed,fri,sat at 22:00
}
# Time-stamp: <2012-03-30 Fri 10:28 pools.conf>

#################################
# /etc/bacula/conf.d/pools.conf #
#################################
# help.: http://www.bacula.org/en/dev-manual/main/main/Automatic_Volume_Recycling.html
# kudos: http://www.davidcraddock.net/2008/10/29/linux-backups-using-bacula/


# This is the default backup stanza, which always gets overridden by one of the other Pools,
# except when a manual backup is performed via the console.
Pool {
  Name = DefaultPool
  Pool Type = Backup
  Maximum Volume Jobs = 1       # If you specify zero (the default), there is no limit.
  # Maximum Volumes = 100       # Number of volumes will be permitted.
  Maximum Volume Bytes = 10G    # Maximum Volume size, keep small for search performance.
  Use Volume Once = yes         # Mark a volume as Used and thus no longer appendable.
  Recycle = no                  # Don't recycle Volumes but prune all the Jobs on the volume, mark "Purged".
  Action On Purge = Truncate    # Truncate the volume when it is purged.
  Auto Prune = yes              # Yes (default), applies Volume Retention period when new Volume is needed and no appendable Volumes exist in the Pool.
  Volume Retention = 1 month    # Retention time of records associated with the Volume in the Catalog database.
  # Related to "LabelMedia" /etc/bacula/conf.d/storages.conf
  Label Format = "${Client}-${Pool}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}-${JobId}"
}

# NOTE: See /etc/bacula/conf.d/schedules.conf as this controls when each backup type (Full,Diff,Inc) is run.
# Maximum Volume Jobs = 1, so that client/job creates a single volume per job (another if more than 10G).
# Below defines which Pools to use for each backup type.

Pool {
  Name = FullPool
  Pool Type = Backup
  Maximum Volume Jobs = 1
  Use Volume Once = yes
  Maximum Volume Bytes = 10G
  Recycle = no
  Action On Purge = Truncate
  Auto Prune = yes
  Volume Retention = 1 month
  Label Format = "${Client}-${Pool}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}-${JobId}"
}

Pool {
  Name = DiffPool
  Pool Type = Backup
  Maximum Volume Jobs = 1
  Use Volume Once = yes
  Maximum Volume Bytes = 10G
  Recycle = no
  Action On Purge = Truncate
  Auto Prune = yes
  Volume Retention = 1 month
  Label Format = "${Client}-${Pool}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}-${JobId}"
}

Pool {
  Name = IncPool
  Pool Type = Backup
  Maximum Volume Jobs = 1
  Use Volume Once = yes
  Maximum Volume Bytes = 10G
  Recycle = no
  Action On Purge = Truncate
  Auto Prune = yes
  Volume Retention = 1 month
  Label Format = "${Client}-${Pool}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}-${JobId}"
}
# Time-stamp: <2012-03-30 Fri 10:31 messages.conf>

####################################
# /etc/bacula/conf.d/messages.conf #
####################################

# Define where error and information messages are to be sent or logged.
Messages {
        Name = Standard
        mailcommand = "/usr/sbin/bsmtp -h localhost -f bacula@bacula-dir -s \"Bacula: %t %e of %c %l\" %r"
        operatorcommand = "/usr/sbin/bsmtp -h localhost -f bacula@bacula-dir -s \"Bacula: Intervention needed for %j\" %r"
        mail = bacula-backup@example.com = all, !skipped
        operator = bacula-backup@example.com = mount
        console = all, !skipped, !saved
        catalog = all, !skipped, !saved
        mailonerror = bacula-backup@example.com = all
        append = "/var/log/bacula/log" = all, !skipped
        }

Messages {
        Name = Daemon
        mailcommand = "/usr/sbin/bsmtp -h localhost -f bacula@bacula-dir -s \"Bacula daemon message\" %r"
        mail = bacula-backup@example.com = all, !skipped
        console = all, !skipped, !saved
        append = "/var/log/bacula/log" = all, !skipped
        }
# Time-stamp: <2012-03-30 Fri 10:29 jobdefs.conf>

###################################
# /etc/bacula/conf.d/jobdefs.conf #
###################################
# 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 be mentioned in each Job.

# Standard Restore template, to be changed by Console program.
# Not JobDef but this has to exist somewhere as a template.
Job {
  Name = Restore
  Type = Restore
  Client = bacula-dir
  FileSet = StandardLinuxFileSet
  Storage = RestoreFileStorage
  Pool = FullPool
  Priority = 1
  Messages = Standard
  Where = /tmp
}

# Main job definitions used by clients /etc/bacula/clients.

JobDefs {
Name = StandardLinuxJob
Type = Backup
FileSet = StandardLinuxFileSet
Storage = PrimaryFileStorage,SecondaryFileStorage,TertiaryFileStorage,QuaternaryFileStorage
Pool = DefaultPool                         # Default Pool, overidden pools and schedules.
Full Backup Pool = FullPool                # This ties with /etc/bacula/conf.d/schedules.conf
Incremental Backup Pool = IncPool          # This ties with /etc/bacula/conf.d/schedules.conf
Differential Backup Pool = DiffPool        # This ties with /etc/bacula/conf.d/schedules.conf
Prefer Mounted Volumes = no                # Finding an unused drive, otherwise, job started will append to volume.
Write Bootstrap = "/mnt/nfs-nas-gw/bacula-backups/%c.bsr"
Schedule = PrimaryBackupCycle              # /etc/bacula/conf.d/schedules.conf
Priority = 10                              # Ten is default
Messages = Standard
}

JobDefs {
Name = StandardWindowsJob
Type = Backup
FileSet = StandardWindowsFileSet
Storage = PrimaryFileStorage,SecondaryFileStorage,TertiaryFileStorage,QuaternaryFileStorage
Pool = DefaultPool                         # Default Pool, overidden pools and schedules.
Full Backup Pool = FullPool                # This ties with /etc/bacula/conf.d/schedules.conf
Incremental Backup Pool = IncPool          # This ties with /etc/bacula/conf.d/schedules.conf
Differential Backup Pool = DiffPool        # This ties with /etc/bacula/conf.d/schedules.conf
Prefer Mounted Volumes = no                # Finding an unused drive, otherwise, job started will append to volume.
Write Bootstrap = "/mnt/nfs-nas-gw/bacula-backups/%c.bsr"
Schedule = PrimaryBackupCycle              # /etc/bacula/conf.d/schedules.conf
Priority = 10                              # Ten is default
Messages = Standard
}
# Time-stamp: <2012-03-30 Fri 10:29 filesets.conf>

####################################
# /etc/bacula/conf.d/filesets.conf #
####################################

# Standard Linux File Set.
# Not live MySQL data!
FileSet {
Name = StandardLinuxFileSet
  Include {
    Options {
      signature = MD5
      compression = GZIP
      onefs = no
      fstype = ext2
      fstype = ext3
      fstype = ext4
      fstype = reiserfs
    }
    File = /
  }
  Exclude {
    File = /home/mysql
    File = /proc
    File = /sys
    File = /tmp
    File = /var/cache/apt/archives   # Debian specific
    File = /var/tmp
    File = /var/lib/mqueue
    File = /var/lib/mysql
    File = /.fsck
    File = /.autofsck
    File = /.journal
  }
}

# Standard Windows File Set.
# Not live SQL data!
FileSet {
Name = StandardWindowsFileSet
  Enable VSS = yes
  Include {
    Options {
      signature = MD5
      compression = GZIP
      exclude = yes
      wildfile = "*.mdf"
      wildfile = "*.ldf"
      wildfile = "*.MDF"
      wildfile = "*.LDF"
    }
    File = C:/
    File = D:/
    File = D:/Microsoft SQL Server/MSSQL/BACKUP
    File = E:/
    File = F:/
    File = G:/
  }
  Exclude {
    File = D:/SQLDataRoot
    File = D:/Microsoft SQL Server/MSSQL
   }
}
# Time-stamp: <2012-03-30 Fri 10:27 devices.conf>

###################################
# /etc/bacula/conf.d/devices.conf #
###################################
# These are referenced in /etc/bacula/conf.d/storages.conf
# Multiple are defined in the jobdefs separated by commas.
# Always Open = no, Important for storage daemon to open it only when a job starts.

# Devices supported by this Storage daemon.
Device {
  Name = PrimaryFileDevice
  Media Type = PrimaryFile
  Archive Device = /mnt/nfs-nas-gw/bacula-backups/
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
}

Device {
  Name = SecondaryFileDevice
  Media Type = SecondaryFile
  Archive Device = /mnt/nfs-nas-gw/bacula-backups/
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
}

Device {
  Name = TertiaryFileDevice
  Media Type = TertiaryFile
  Archive Device = /mnt/nfs-nas-gw/bacula-backups/
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
}

Device {
  Name = QuaternaryFileDevice
  Media Type = QuaternaryFile
  Archive Device = /mnt/nfs-nas-gw/bacula-backups/
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
}

# Free for restore jobs.
Device {
  Name = RestoreFileDevice
  Media Type = RestoreFile
  Archive Device = /mnt/nfs-nas-gw/bacula-backups/
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
}
# Time-stamp: <2012-03-30 Fri 10:33 example-client2.conf>

###################################################
# /etc/bacula/conf.d/clients/example-client2.conf #
###################################################

# This can be used as the standard client config.

# Remote client name, address, and matching password with their bacula-fd.conf.
Client {
        Name = example-client2
        Address = 10.0.0.30        # Remote client address.
        FD Port = 9102             # Default.
        Password = Sh6oXsw         # Matches remote client /etc/bacula/bacula-fd.conf
        Catalog = PrimaryCatalog   # Matches in /etc/bacula/bacula-dir.conf
        # These do not affect your archive, and should be set lower than the Pool/Volume retention definitions.
        File Retention = 2 weeks   # Files are pruned from Catalog database if Files are older than File retention period.
        Job Retention =  2 weeks   # Jobs are pruned from Catalog database if Job records are older than File retention period.
        AutoPrune = yes            # Yes to enable the above.
}


# Job name for client, and JobDef. Explicitly specifying Job rules here will
# overide the defaults defined in the /etc/bacula/conf.d/jobdefs.conf
Job {
  Name = example-client2
  Client = example-client2
  JobDefs = StandardLinuxJob
  Schedule = example-client2Schedule
}

Schedule {
   Name = example-client2Schedule
   Run = Level=Full tue at 12:11
   Run = Level=Differential tue at 12:11
   Run = Level=Incremental tue at 12:11
}
# Time-stamp: <2012-03-30 Fri 10:33 example-client.conf>

##################################################
# /etc/bacula/conf.d/clients/example-client.conf #
##################################################

# This can be used as the standard client config.

# Remote client name, address, and matching password with their bacula-fd.conf.
Client {
        Name = example-client
        Address = 10.0.0.20        # Remote client address.
        FD Port = 9102             # Default.
        Password = Sh6oXsw         # Matches remote client /etc/bacula/bacula-fd.conf
        Catalog = PrimaryCatalog   # Matches in /etc/bacula/bacula-dir.conf
        # These do not affect your archive, and should be set lower than the Pool/Volume retention definitions.
        File Retention = 2 weeks   # Files are pruned from Catalog database if Files are older than File retention period.
        Job Retention =  2 weeks   # Jobs are pruned from Catalog database if Job records are older than File retention period.
        AutoPrune = yes            # Yes to enable the above.
        Heartbeat Interval = 1 Minute            # Prevents timeouts
}


# Job name for client, and JobDef. Explicitly specifying Job rules here will
# overide the defaults defined in the /etc/bacula/conf.d/jobdefs.conf
Job {
  Name = example-client
  Client = example-client
  JobDefs = "StandardLinuxJob"
}
# Time-stamp: <2012-03-30 Fri 10:27 catalogs.conf>

####################################
# /etc/bacula/conf.d/catalogs.conf #
####################################

# MySQL catalog service
Catalog {
  Name = PrimaryCatalog
  DB Address = localhost
  dbname = bacula
  dbuser = bacula
  dbpassword = quoh7Xai
}
# Time-stamp: <2012-03-30 Fri 10:30 bconsole.conf>

#############################
# /etc/bacula/bconsole.conf #
#############################

# Bacula User Agent "Console" (bconsole).
Director {
  Name = bacula-dir
  DIRport = 9101
  address = 10.0.0.10
  Password = Vao8oXh6
}
# Time-stamp: <2012-03-30 Fri 10:32 bat.conf>

########################
# /etc/bacula/bat.conf #
########################

# Bacula Administration Tool Console (bat):
# Install this GUI (bacula-console-qt) somewhere to manage the Director remotely.
Director {
  Name = bacula-dir
  DIRport = 9101
  Address = 10.0.0.10  # Director "Console {}" password.
  Password = Vao8oXh6
}
# Time-stamp: <2012-03-30 Fri 10:26 bacula-sd.conf>

##############################
# /etc/bacula/bacula-sd.conf #
##############################
# Note: use external director address for clients to connect.

Storage {
  Name = bacula-sd
  SDAddress = 10.0.0.10
  SDPort = 9103
  WorkingDirectory = /var/lib/bacula
  Pid Directory = /var/run/bacula
  Maximum Concurrent Jobs = 10
  Heartbeat Interval = 1 Minute            # Prevents timeouts
}

# Director who is permitted to contact this Storage daemon.
Director {
  Name = bacula-dir
  Password = Tah3rMh3   # Match /etc/bacula/conf.d/storages.conf
}

# Storage devices.
@/etc/bacula/conf.d/devices.conf

# Restricted Director, used by tray-monitor for Storage daemon status.
Director {
  Name = bacula-mon
  Password = guro6Ooh
  Monitor = yes
}

# Send all messages to the Director,
Messages {
  Name = Standard
  director = bacula-dir = all
}
# Time-stamp: <2012-03-30 Fri 10:32 bacula-fd.conf>

##############################
# /etc/bacula/bacula-fd.conf #
##############################

# This file should be placed and configured for each client you wish to backup.
# Note: bacula-fd does not necessarily need to be configured and run on the
# Director itself, unless you want to backup itself.

# Directors who are permitted to contact this File daemon.
Director {
  Name = bacula-dir          # Match the Director.
  Password = Sh6oXsw         # Match the /etc/bacula/conf.d/client/xyz.conf on the Director.
}

# Restricted Director, used by tray-monitor for File daemon status.
Director {
  Name = bacula-mon          # Match the Director Monitor.
  Password = Aeni4coX        # Must match the /etc/bacula/bacula-dir.conf "Console { }" Password.
  Monitor = yes
}

# "Global" File daemon configuration specifications.
FileDaemon {
  Name = bacula-dir                  # This is the client name, if it isn't then change it!
  FDport = 9102
  WorkingDirectory = /var/lib/bacula # CentOS: WorkingDirectory = /var/spool/bacula
  Pid Directory = /var/run/bacula    # CentOS: PidDirectory = /var/run
  Maximum Concurrent Jobs = 10
  FDAddress = 10.0.0.10              # This is the client (not Director!) address, if it isn't then change it!
  Heartbeat Interval = 1 Minute      # Prevents timeouts
 }

# Send all messages except skipped files back to Director.
Messages {
  Name = Standard
  director = bacula-dir = all, !skipped, !restored
}
# Time-stamp: <2012-03-30 Fri 10:34 bacula-dir.conf>

#######################################
# /etc/conf.d/clients/bacula-dir.conf #
#######################################

# This is the Director itself used to backup the catalog.
# All config is in this single file only!

# Remote client name, address, and matching password with their bacula-fd.conf.
Client {
        Name = bacula-dir
        Address = 10.0.0.10        # Remote client address.
        FD Port = 9102             # Default.
        Password = Sh6oXsw         # Matches remote client /etc/bacula/bacula-fd.conf
        Catalog = PrimaryCatalog   # Matches in /etc/bacula/bacula-dir.conf
}

# Backup the Director catalog database (after the nightly save).
Job {
  Name = CatalogBackup
  Type = Backup
  Client = bacula-dir
  FileSet = CatalogBackupFileSet
  Schedule = CatalogBackupCycle
  Storage = PrimaryFileStorage,SecondaryFileStorage,TertiaryFileStorage
  Messages = Standard
  Pool = CatalogBackupPool
  # WARNING!!! Passing the password via the command line is insecure.
  # see comments in make_catalog_backup for details.
  # Single user system so OK.
  RunBeforeJob = "/etc/bacula/scripts/make_catalog_backup bacula bacula quoh7Xai"
  RunAfterJob  = "/etc/bacula/scripts/delete_catalog_backup bacula bacula quoh7Xai"
  Write Bootstrap = "/mnt/nfs-nas-gw/%c.bsr"
}

# Pool specific for the catalog backup.
Pool {
  Name = CatalogBackupPool
  Pool Type = Backup
  Maximum Volume Jobs = 1
  Maximum Volume Bytes = 10G
  Use Volume Once = yes
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 1 month
  Label Format = "CatalogBackup"
}

# This schedule does the catalog backup after the "PrimaryBackupCycle".
Schedule {
  Name = CatalogBackupCycle
  Run = Level=Full sun-sat at 1:10
}

# This is the backup of the catalog.
FileSet {
  Name = CatalogBackupFileSet
  Include {
    Options {
      signature=MD5
    }
    File = "/var/lib/bacula/bacula.sql"
  }
}
Time-stamp: <2012-03-30 Fri 16:56 README.md>
Author....: 'Mash (Thomas Herbert)

TOSHINE-BACULA

Bacula concurrent jobs multiple storage devices client labeled pools Debian installation and configuration.
Please see http://toshine.org/etc for full article.

Bacula Debian Installation.

Install MySQL server.

root@bacula-dir:~# aptitude install mysql-server

Configure MySQL to use server resources.

root@bacula-dir:~# /usr/share/doc/mysql-server-5.1/examples# gunzip my-huge.cnf.gz
root@bacula-dir:~# /usr/share/doc/mysql-server-5.1/examples# cp my-huge.cnf /etc/mysql/
root@bacula-dir:/etc/mysql# mv my.cnf my.cnf.old
root@bacula-dir:/etc/mysql# mv my-huge.cnf my.cnf
root@bacula-dir:/etc/mysql# /etc/init.d/mysql restart

Create bacula database.

root@bacula-dir:/etc/mysql# mysql -u root -p
mysql> create database bacula;
mysql> GRANT ALL ON bacula.* TO bacula@localhost IDENTIFIED BY 'quoh7Xai';
mysql> FLUSH PRIVILEGES;

Install bacula with MySQL backend.

Follow prompts for root database user password (1st) and bacula database user password (2nd).

   root@bacula-dir:~# aptitude install bacula bacula-director-mysql bacula-sd-mysql

Check bacula table creation.

root@bacula-dir:~# mysql -u bacula -p bacula
mysql> show tables;
+------------------+
| Tables_in_bacula |
+------------------+
| BaseFiles        |
| CDImages         |
| Client           |
| Counters         |
| Device           |
| File             |
| FileSet          |
| Filename         |
| Job              |
| JobHisto         |
| JobMedia         |
| Location         |
| LocationLog      |
| Log              |
| Media            |
| MediaType        |
| Path             |
| PathHierarchy    |
| PathVisibility   |
| Pool             |
| Status           |
| Storage          |
| UnsavedFiles     |
| Version          |
+------------------+
24 rows in set (0.00 sec)

Use this only if MySQL tables are not created.

root@bacula-dir:~# cp /usr/share/bacula-director/make_mysql_tables /etc/bacula/scripts/make_mysql_tables
root@bacula-dir:/etc/bacula/scripts# ./make_mysql_tables -u root -p

Create the backup directory.

root@bacula-dir:~# mkdir -p /mnt/nfs-nas-gw/bacula-backups
root@bacula-dir:~# chown -R bacula:bacula /mnt/nfs-nas-gw/bacula-backups

Troubleshooting.

Configuration file check.

root@bacula-dir:~# bacula-dir -t /etc/bacula/bacula-dir.conf
root@bacula-dir:~# bacula-sd -t /etc/bacula/bacula-sd.conf

Database check.

root@bacula-dir:~# dbcheck /etc/bacula/bacula-dir.conf bacula bacula quoh7Xai

Waiting to mount / client pool permissions.

If you receive a message regarding 'waiting to mount' check the logs, it may most likely be a directory permission issue. The directory should have 'bacula' user permissions.

   root@bacula-dir:~# less /var/log/bacula/log
   2012-02-06 22:00:00bacula-sd JobId 35: Warning: label.c:331 Open device "PrimaryFileDevice" (/mnt/nfs-nas-gw/) Volume "webserver-FullPool-2012-02-06-35" failed: ERR=dev.c:549 Could not open: /mnt/nfs-nas-gw/webserver-FullPool-2012-02-06-35, ERR=Permission denied