Disk Backup Configuration Example

CommunityEnterprise

Now that we have covered the main points of how one devises a good backup strategy for Bacula, let’s put it all together using the assumptions at the beginning of the Configuration chapter, namely:

  • you have a big shop; 1000-2000 backups/night;

  • you have a number of large storage devices or have a number of Storage daemons attached to large storage devices;

  • you want to be able to restore a file on a daily basis for 30 days and on a monthly basis for 60 days;

  • and finally, each client machine must have its own Volumes.

Implementation Steps

The steps to take to get to where you have a good system are:

  • In the Director define one Autochanger resource for each Storage daemon you will have. It should have a sufficient number of Devices to run approximately 50-60 simultaneous Jobs, plus one or two Devices to be reserved for restores. If you put all your data for a given Client on one Volume, you will need 50-60 Device definitions plus say two reserved Devices. If you allow 10 simultaneous Jobs per Device, you will only need 5 or 6 Devices.

  • You will probably want 30 different Schedules so that your Full backups are even distributed across the different days of the month.

  • You will want two Pools per client: one for Full backups, and one for Incremental backups, because the two Pools will have different retention periods to keep storage space to a minimum.

Director configuration: bacula-dir.conf

Your Director configuration file bacula-dir.conf has the following main elements:

Director {                   # define myself
  Name = bacula-dir
  DIRport = 9101             # where we listen for UA connections
  QueryFile = "/opt/bacula/scripts/query.sql"
  WorkingDirectory = "/opt/bacula/working"
  PidDirectory = "/opt/bacula/working"
  Password = "rq6zcEBTvsKEaQ9XUjPbi"
  Messages = Daemon
  Maximum Concurrent Jobs = 50
}

JobDefs {
  Name = "DefaultJob"
  Type = Backup
  Level = Incremental
  Client = bacula-fd
  Fileset = "All"
  Schedule = "First-Sun-Full"
  Storage = File1
  Messages = Standard
  Pool = Client1-Full
  SpoolAttributes = yes
  Priority = 10
  Write Bootstrap = "/opt/bacula/bsr/%c.bsr"
  Max Full Interval = 31 days # a full once a month
  Spool Attributes = yes
}

Job {
  Name = "CatalogBackup"
  Type = Backup
  JobDefs = DefaultJob
  Priority = 11
  Schedule = EveryNight
  RunBeforeJob = "/opt/bacula/scripts/make_catalog_backup bacula bacula"
  RunScript {
    RunsWhen = After
    RunsOnClient = No
    Command = "/opt/bacula/scripts/delete_catalog_backup"
    Console = "truncate volume allpools storage=File"
  }
}

Job {
  Name = "Pruning"
  Type = Admin
  JobDefs = DefaultJob
  Priority = 12
  Schedule = EveryNight
  RunBeforeJob = "/opt/bacula/scripts/manual_prune.pl --doprune --expired"
}

Job {
  Name = Client1
  JobDefs = "DefaultJob"
  Pool = Client1-Full
  Full Backup Pool = Client1-Full
  Incremental Backup Pool = Client1-Inc
  Client = Client1
  Schedule = First-Sun-Full
}

...

Client {
  Name = Client1
  Address = Client1
  ...
}

...

Pool {
  Name = Client1-Full
  Pool Type = Backup
  Recycle = yes
  AutoPrune = no                 # Done by Pruning Job
  Volume Retention = 70d         # 60 days + a bit extra
  Label Format = Client1-Full    # Allow to auto label
  Action On Purge = Truncate     # Allow to volume truncation
  Maximum Volume Bytes = 50GB    # Limit volume size
  Maximum Volumes = 100          # allow 5TB for this Pool
  Maximum Volume Jobs = 1        # Force a Volume switch after 1 Jobs
}

Pool {
  Name = Client1-Inc
  Pool Type = Backup
  Recycle = yes
  AutoPrune = no                 # Done by Pruning Job
  Volume Retention = 70d         # 2 X 30 days + a bit extra
  Label Format = Client1-Inc     # Allow to auto label
  Action On Purge = Truncate     # Allow to volume trucation
  Maximum Volume Bytes = 50GB    # Limit volume size
  Maximum Volumes = 20
  Maximum Volume Jobs = 6        # Force a Volume switch after a week
}

...

Schedule {
  Name = "EveryNight"
  Run = Level=Full sun-sat at 5:04
}

Schedule {
  Name = First-Sun-Full
  Run = Full 1st sun at 22:00
  Run = Incremental mon-sat at 22:00
  Run = Incremental Accurate=yes 2nd-5th sun at 22:00
}

Schedule {
  Name = First-Mon-Full
  Run = Full 1st mon at 22:00
  Run = Incremental tue-sun at 22:00
  Run = Incremental Accurate=yes 2nd-5th mon at 22:00
}

...

# Definition of file Virtual Autochanger device
Autochanger {
  Name = File1
# Do not use "localhost" here
  Address = bacula-sd                 # N.B. Use a fully qualified name here
  SDPort = 9103
  Password = "a+YXY3kfS9ObgZ52ebJT3W"
  Device = FileChgr1
  Media Type = File1
  Maximum Concurrent Jobs = 10        # run up to 10 jobs a the same time
  Autochanger = File1                 # point to ourself
}

Storage {
  Name = RestoreStorage1
# Do not use "localhost" here
  Address = bacula-sd                 # N.B. Use a fully qualified name here
  SDPort = 9103
  Password = "a+YXY3kfS9ObgZ52ebJT3W"
  Device = RestoreStorage1
  Media Type = File1
  Autochanger = File1                 # point to the Autochanger
}

Storage Daemon Configuration: bacula-sd.conf

Your bacula-sd.conf has the following main elements:

Storage {                 # definition of myself
  Name = bacula-sd
  SDPort = 9103           # Director's port
  WorkingDirectory = "/opt/bacula/working"
  Pid Directory = "/opt/bacula/working"
  Maximum Concurrent Jobs = 60
}

Director {
  Name = bacula-dir
  Password = "a+YXY3kfS9ObgZ52ebJT3W"
}

Messages {
  Name = Standard
  director = bacula-dir = all
}

#
# Define a Virtual autochanger
#
Autochanger {
  Name = FileChgr1
  Device = FileChgr1-Dev1, FileChgr1-Dev2, RestoreStorage1
  Changer Command = /dev/null
  Changer Device = /dev/null
}

Device {
  Name = FileChgr1-Dev1
  Media Type = File1
  Archive Device = /bacula
  LabelMedia = yes          # lets Bacula label unlabeled media
  Random Access = Yes
  AutomaticMount = yes      # when device opened, read it
  RemovableMedia = no
  AlwaysOpen = no
  Maximum Concurrent Jobs = 5
}

Device {
  Name = FileChgr1-Dev2
  Media Type = File1
  Archive Device = /bacula
  LabelMedia = yes          # lets Bacula label unlabeled media
  Random Access = Yes
  AutomaticMount = yes      # when device opened, read it
  RemovableMedia = no
  AlwaysOpen = no
  Maximum Concurrent Jobs = 5
}

...

Device {
  Name = RestoreStorage1
  Media Type = File1
  Archive Device = /bacula
  LabelMedia = yes          # lets Bacula label unlabeled media
  Random Access = Yes
  AutomaticMount = yes      # when device opened, read it
  RemovableMedia = no
  AlwaysOpen = no
  AutoSelect = no
}

...

Go back to: Backup Policy Configuration.