Categories: LinuxSicherheit

Warum teure Backup-Software einsetzen wenn’s auch günstiger geht!? Mit Bacula!

Als vor einiger Zeit die alte Backup Lösung den Geist aufgegeben hat, habe ich mich nach einer neuen umgesehen. Auf der Suche nach einer guten und günstigen Backup Lösung bin ich dann auf Bacula gestoßen.

Aus Fachzeitschriften und vom Hörensagen war mir Bacula bereits bekannt, allerdings hatte ich noch nicht das Vergnügen Bacula zu installieren bzw. einzusetzen.

Das sollte sich aber ändern. 🙂

Unser Bacula Server läuft inzwischen doch schon ein paar Monate und bis auf kleine Problemchen bei der Konfiguration so zuverlässig wie man es von einem Backup erwartet. Unterm Strich würde ich sogar sagen dass man durch die etwas schwere Konfiguration über Konfig-Dateien wesentlich mehr Einblick in das Geschehen hat als bei den üblichen Klicki-Bunti-Oberflächen.

Als primären Backup Server nutzen wir einen Server mit Dual-Core Prozessor, 2-TB Festplattenplatz und schnellem Netzwerkanschluß. Weiters wird alles zusätzlich noch auf LTO-2 Bänder gesichert, das Sicherungslaufwerk befindet sich aber an einem eigenen Server in einem anderen Gebäude.

Wer die Hürde der Konfiguration genommen hat wird bei Bacula mit einem kostenlosen wirklich stabil laufenden Backup System belohnt!

Die Konfiguration beschränkt sich im Grunde auf folgende vier Dateien:

/etc/bacula/bacula-dir.conf
/etc/bacula/bacula-fd.conf
/etc/bacula/bacula-sd.conf
/etc/bacula/bconsole.conf

Die Datei bconsole.conf beinhaltet die Konfiguration für den Bacula User Agent:

Director {
  Name = prod12
  DIRport = 9101
  address = fqdn.vom.server
  Password = „blaaaaaaaaaaaa“
}

Ich würde sagen der Teil ist auf jeden Fall selbsterklärend. 🙂
Die bacula-sd.conf enthält die Konfiguration des Storage Daemon, der die Tape-Laufwerke oder Virtuelle Bänder verwaltet.

Storage {
  Name = FileStorage
  SDPort = 9103                  # Director’s port     
  WorkingDirectory = „/backup/bacula/wd“
  Pid Directory = „/var/run/bacula“
  Maximum Concurrent Jobs = 20
  SDAddress = fqdn.vom.server
}

Director {
  Name = server-dir
  Password = „blaaaaaaaaaaa“
}

Director {
  Name = server-mon
  Password = „blaaaaaaaaaaaaaaa“
  Monitor = yes
}

Device {
  Name = FileStorage
  Media Type = File
  Archive Device = /backup/bacula/archive/
  LabelMedia = yes;
  Random Access = Yes;
  AutomaticMount = yes;
  RemovableMedia = no;
  AlwaysOpen = no;
}

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

Hier wird also geregelt wo die Daten gesichert werden und wer darauf zugreifen darf.
Als nächstes folgt die Datei bacula-fd.conf welche den File-Daemon steuert, der File Daemon muss auf jedem Server/PC installiert werden der gesichert werden muss und regelt den Zugriff auf die Daten.

Director {
  Name = server-dir
  Password = „blaaaaaaaaaaaa“
}

Director {
  Name = server-mon
  Password = „blaaaaaaaaaaaaaaaaa“
  Monitor = yes
}

FileDaemon {
  Name = server-fd
  FDport = 9102
  WorkingDirectory = /backup/bacula/wd
  Pid Directory = /var/run/bacula
  Maximum Concurrent Jobs = 20
  FDAddress = fqdn.vom.server
}

Messages {
  Name = Standard
  director = server-dir = all, !skipped, !restored
}

Als letztes brauchts dann die zentrale Steuerdatei die sich darum kümmert wann was wohin gesichert wird, diese Daten finden sich in der bacula-dir.conf.

Director {
  Name = server-dir
  DIRport = 9101
  QueryFile = „/etc/bacula/scripts/query.sql“
  WorkingDirectory = „/backup/bacula/wd“
  PidDirectory = „/var/run/bacula“
  Maximum Concurrent Jobs = 4
  Password = „blaaaaaaaa“
  Messages = Daemon
  DirAddress = fqdn.vom.server
}

JobDefs {
  Name = „DefaultJob“
  Type = Backup
  Pool = backup-folder
  Level = Incremental
  Client = server-fd
  FileSet = „Windows Full Set“
  Schedule = „WeeklyCycle“
  Messages = Standard
  Priority = 10
  Write Bootstrap = „/backup/bacula/bootstrap/%c.bsr“
}

JobDefs {
  Name = „DefaultTapeJob“
  Type = Backup
  Pool = Tape
  Level = Incremental
  Client = server-fd
  FileSet = „Windows Full Set“
  Schedule = „WeeklyCycle“
  Messages = Standard
  Priority = 11
  Write Bootstrap = „/backup/bacula/bootstrap/%c.bsr“
}

Job {
  Name = „server35“
  Client = server-fd
  Storage = FileStorage
  JobDefs = „DefaultJob“
  Write Bootstrap = „/backup/bacula/bootstrap/server35.bsr“
}

Job {
  Name = „server35-tape“
  Client = server35-tape
  Storage = Tape
  JobDefs = „DefaultTapeJob“
  Write Bootstrap = „/backup/bacula/bootstrap/server35-tape.bsr“
}

Job {
  Name = „BackupCatalog“
  JobDefs = „DefaultJob“
  Level = Full
  FileSet=“Catalog“
  Schedule = „WeeklyCycleAfterBackup“
  Storage = FileStorage
  RunBeforeJob = „/etc/bacula/scripts/make_catalog_backup.pl MyCatalog“
  RunAfterJob  = „/etc/bacula/scripts/delete_catalog_backup“
  Write Bootstrap = „/backup/bacula/bootstrap/%n.bsr“
  Priority = 12                   # run after main backup
}

Job {
  Name = „RestoreFiles“
  Type = Restore
  Client= server-fd                
  FileSet=“Windows Full Set“                 
  Storage = FileStorage            
  Pool = backup-folder
  Messages = Standard
  Where = /backup/bacula/restores
}

FileSet {
  Name = „Full Set“
  Include {
    Options {
      signature = MD5
      onefs = no
    }
    File = /
  }
  Exclude {
    File = /proc
    File = /tmp
    File = /.journal
    File = /.fsck
    File = /sys
    File = /dev
    File = /mnt
  }
}

FileSet {
  Name = „Windows Full Set“
 Include {
  Options {
   signature = MD5
   Exclude = yes
   IgnoreCase = yes
   # Exclude Mozilla-based programs‘ file caches
   WildDir = „[A-Z]:/Documents and Settings/*/Application Data/*/Profiles/*/*/Cache“
   WildDir = „[A-Z]:/Documents and Settings/*/Application Data/*/Profiles/*/*/Cache.Trash“
   WildDir = „[A-Z]:/Documents and Settings/*/Application Data/*/Profiles/*/*/ImapMail“

   # Exclude user’s registry files – they’re always in use anyway.
   WildFile = „[A-Z]:/Documents and Settings/*/Local Settings/Application Data/Microsoft/Windows/usrclass.*“
   WildFile = „[A-Z]:/Documents and Settings/*/ntuser.*“

   # Exclude directories full of lots and lots of useless little files
   WildDir = „[A-Z]:/Documents and Settings/*/Cookies“
   WildDir = „[A-Z]:/Documents and Settings/*/Recent“
   WildDir = „[A-Z]:/Documents and Settings/*/Local Settings/History“
   WildDir = „[A-Z]:/Documents and Settings/*/Local Settings/Temp“
   WildDir = „[A-Z]:/Documents and Settings/*/Local Settings/Temporary Internet Files“

   # These are always open and unable to be backed up
   WildFile = „[A-Z]:/Documents and Settings/All Users/Application Data/Microsoft/Network/Downloader/qmgr[01].dat“

   # Some random bits of Windows we want to ignore
   WildFile = „[A-Z]:/Windows/security/logs/scepol.log“
   WildDir = „[A-Z]:/Windows/system32/config“
   WildDir = „[A-Z]:/Windows/msdownld.tmp“
   WildDir = „[A-Z]:/Windows/Internet Logs“
   WildDir = „[A-Z]:/Windows/$Nt*Uninstall*“
   WildDir = „[A-Z]:/Windows/sysvol“
   WildFile = „[A-Z]:/Windows/cluster/CLUSDB“
   WildFile = „[A-Z]:/Windows/cluster/CLUSDB.LOG“
   WildFile = „[A-Z]:/Windows/NTDS/edb.log“
   WildFile = „[A-Z]:/Windows/NTDS/ntds.dit“
   WildFile = „[A-Z]:/Windows/NTDS/temp.edb“
   WildFile = „[A-Z]:/Windows/ntfrs/jet/log/edb.log“
   WildFile = „[A-Z]:/Windows/ntfrs/jet/ntfrs.jdb“
   WildFile = „[A-Z]:/Windows/ntfrs/jet/temp/tmp.edb“
   WildFile = „[A-Z]:/Windows/system32/CPL.CFG“
   WildFile = „[A-Z]:/Windows/system32/dhcp/dhcp.mdb“
   WildFile = „[A-Z]:/Windows/system32/dhcp/j50.log“
   WildFile = „[A-Z]:/Windows/system32/dhcp/tmp.edb“
   WildFile = „[A-Z]:/Windows/system32/LServer/edb.log“
   WildFile = „[A-Z]:/Windows/system32/LServer/TLSLic.edb“
   WildFile = „[A-Z]:/Windows/system32/LServer/tmp.edb“
   WildFile = „[A-Z]:/Windows/system32/wins/j50.log“
   WildFile = „[A-Z]:/Windows/system32/wins/wins.mdb“
   WildFile = „[A-Z]:/Windows/system32/wins/winstmp.mdb“
   WildFile = „[A-Z]:/WINNT/system32/config/default“
   WildFile = „[A-Z]:/WINNT/system32/config/default.LOG“
   WildFile = „[A-Z]:/WINNT/system32/config/SAM“
   WildFile = „[A-Z]:/WINNT/system32/config/SAM.LOG“
   WildFile = „[A-Z]:/WINNT/system32/config/SECURITY“
   WildFile = „[A-Z]:/WINNT/system32/config/SECURITY.LOG“
   WildFile = „[A-Z]:/WINNT/system32/config/software“
   WildFile = „[A-Z]:/WINNT/system32/config/software.LOG“
   WildFile = „[A-Z]:/WINNT/system32/config/system“
   WildFile = „[A-Z]:/WINNT/system32/config/SYSTEM.ALT“

   # Temporary directories & files
   WildDir = „[A-Z]:/Windows/Temp“
   WildDir = „[A-Z]:/temp“
   WildFile = „*.tmp“
   WildDir = „[A-Z]:/tmp“
   WildDir = „[A-Z]:/var/tmp“

   # Recycle bins
   WildDir = „[A-Z]:/RECYCLER“

   # Swap files
   WildFile = „[A-Z]:/pagefile.sys“

  }

  File = „C:/“
 }
}

Schedule {
  Name = „WeeklyCycle“
  Run = Full sun at 13:05
  Run = Incremental mon-sat at 23:05
}

Schedule {
  Name = „WeeklyCycleAfterBackup“
  Run = Full sun-sat at 23:10
}

FileSet {
  Name = „Catalog“
  Include {
    Options {
      signature = MD5
    }
    File = „/backup/bacula/catalog/bacula.sql“
  }
}

Client {
  Name = server-fd
  Address = fqdn.vom.server
  FDPort = 9102
  Catalog = MyCatalog
  Password = „blaaaaaa“          # password for FileDaemon
  File Retention = 60 days            # 30 days
  Job Retention = 2 months            # six months
  AutoPrune = yes                     # Prune expired Jobs/Files
}

Client {
  Name = server35-fd
  Address = server35.fqdn
  FDPort = 9102
  Catalog = MyCatalog
  Password = „blaaaaaa“      # password for FileDaemon
  File Retention = 60 days            # 30 days
  Job Retention = 2 months            # six months
  AutoPrune = yes                     # Prune expired Jobs/Files
}

Client {
  Name = server35-tape
  Address = server35.fqdn
  FDPort = 9102
  Catalog = MyCatalog
  Password = „blaaaaaa“      # password for FileDaemon
  File Retention = 14 days            # 30 days
  Job Retention = 2 months            # six months
  AutoPrune = yes                     # Prune expired Jobs/Files
}

Storage {
  Name = FileStorage
  Address = fqdn.vom.server
  SDPort = 9103
  Password = „blaaaaaaaaaaaaaa“
  Device = „FileStorage“
  Media Type = File
}

Storage {
  Name = Tape
  Address = fqdn.vom.server.mit.tapelw
  SDPort = 9103
  Password = „blaaaaaaa“
  Device = „server-tape“
  Media Type = LTO-2
}

Pool {
  Name = backup-folder
  Pool Type = Backup
  Next Pool = Tape
  Recycle = yes                # Bacula can automatically recycle Volumes
  AutoPrune = yes              # Prune expired volumes
  Volume Retention = 60 days
  #Accept Any Volume = yes      # write on any volume in the pool
  Label Format = „file-“
  Maximum Volume Bytes = 50G
  Maximum Volumes = 34         # about 1 TB
  Storage = FileStorage
}

Pool {
  Name = Tape
  Pool Type = Backup
  AutoPrune = yes
  Recycle = yes
  Volume Retention = 14d
  Storage = Tape
}

Catalog {
  Name = MyCatalog
  dbname = bacula; DB Address = „127.0.0.1“; dbuser = „bacula“; dbpassword = „blaaaa“
}

Messages {
  Name = Standard

  mailcommand = „/usr/lib/bacula/bsmtp -h localhost -f „(Bacula) <%r>“ -s „Bacula: %t %e of %c %l“ %r“
  operatorcommand = „/usr/lib/bacula/bsmtp -h localhost -f „(Bacula) <%r>“ -s „Bacula: Intervention needed for %j“ %r“
  mail = admin@mailadresse = all, !skipped           
  operator = admin@mailadresse = mount
  console = all, !skipped, !saved
  append = „/var/lib/bacula/log“ = all, !skipped
  catalog = all
}

Messages {
  Name = Daemon
  mailcommand = „/usr/lib/bacula/bsmtp -h localhost -f „(Bacula) <%r>“ -s „Bacula daemon message“ %r“
  mail = admin@mailadresse = all, !skipped           
  console = all, !skipped, !saved
  append = „/var/lib/bacula/log“ = all, !skipped
}

Console {
  Name = server-mon
  Password = „blaaaaaaaaaaaaa“
  CommandACL = status, .status
}

Das ist natürlich etwas lange und beim ersten Mal sehr unübersichtlich, aber wenn man sich die paar Stunden Zeit genommen hat um das zu verstehen, dann wird man mit einem funktionierendem Backup belohnt. 🙂

Handbücher, Beispiele und natürlich auch die Software gibt auf der Webseite des Bacula Projekts!

Manfred

Recent Posts

VM – ZFS Partition online vergrößern

Man macht es nicht jeden Tag, darum schadet es nicht sich's kurz zu notieren... Hier…

10 Monaten ago

Samba Password History für einen User löschen

Meine Suche bei Google hatte mal wieder keinen vernünftigen Treffer gelandet, das Problem - ich…

10 Monaten ago

HP Eine Firma von der ich nicht mal geschenkte Drucker nehmen würde!!!

Ich muss mal eben etwas Druck ablassen, ein Kunde von mir setzt einen Drucker von…

1 Jahr ago

IRMC Console Redirection ohne Lizenz

Wer beim Server bestellen vergessen hat die erweiterte IRMC Lizenz zu ordern, der steht vor…

1 Jahr ago

WOL im BIOS aktivieren reicht nicht immer

Ich nutze seit langer Zeit ein System für meine Backups welches in der Nacht von…

1 Jahr ago

Apache Guacamole mit TOPT – funktioniert nicht

Es scheint wohl eine noch nicht so häufig genutzte Kombination zu sein - Apache Guacamole…

1 Jahr ago