next_inactive up previous


\includegraphics{./bacula-logo.eps}


It comes in the night and sucks the essence from your computers.

Kern Sibbald








October 13, 2008
This manual documents Bacula version 2.4.3 (10 October 2008)


Copyright ©1999-2007, Free Software Foundation Europe e.V.


Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".


Contents


List of Figures

  1. Bacula Applications
  2. Bacula Objects
  3. Interaktionen zwischen den Bacula-Diensten
  4. Bacula Tray Monitor
  5. Bacula Objects
  6. Bacula CD Image Manager
  7. Bacula CD Image Burn Progress Window
  8. Bacula CD Image Burn Results
  9. Bacula CD Image Manager
  10. Bacula CD Image Brennfortschritt-Fenster
  11. Bacula CD Image Brennergebnis
  12. Win32 Client Setup Wizard
  13. Win32 Installation Type
  14. Win32 Component Selection Dialog
  15. Win32 Configure
  16. Win32 Install Progress
  17. Win32 Client Setup Completed

List of Tables

  1. Supported Tape Drives
  2. Dependency-Packages
  3. Ressource Typen
  4. Autochangers Known to Work with Bacula
  5. WinNT/2K/XP Restore Portability Status
  6. SQLite vs MySQL Database Comparison


Was ist Bacula?

Bacula ist ein System von Computerprogrammen, mit denen Sie (oder der System-Administrator) in der Lage sind, Computerdaten innerhalb eines heterogenen Netzwerkes zu sichern, die Sicherungen wiederherzustellen und diese zu überprüfen. Bacula kann auch auf einem einzigen Computer laufen und auf verschiedene Arten von Medien wie Bänder oder CDs sichern. Technisch gesprochen ist es ein netzwerkfähiges Sicherungsprogramm mit Client/Server-Architektur. Bacula ist leistungsfähig und vergleichsweise einfach zu benutzen. Dabei hat es viele anspruchsvolle Funktionen zur Verwaltung der Sicherung, die das Auffinden und die Wiederherstellung beschädigter oder verlorener Dateien erleichtern. Durch seinen modularen Aufbau lässt es sich jedem System anpassen: Vom Einzelplatzrechner bis zu einem großen System mit hunderten von Computern, die über ein weiträumiges Netzwerk verteilt sind.

Wer benötigt Bacula?

Wenn Sie momentan Programme wie tar, dump, oder bru zur Datensicherung verwenden und eine Netzwerklösung, größere Flexibilität oder einen Verzeichnis-Dienst suchen, wird Bacula wahrscheinlich die zusätzlichen Funktionen zur Verfügung stellen, die Sie suchen. Wenn Sie dagegen ein UNIX-Neuling sind oder keine weitergehenden Erfahrung mit anspruchsvollen Sicherungsprogrammen haben, raten wir von Bacula ab, da es in der Einrichtung und der Benutzung sehr viel komplizierter ist als z.B. tar oder dump.

Wenn Bacula wie die oben beschriebenen einfachen Programme funktionieren und nur ein Band in Ihrem Laufwerk beschreiben soll, wird Ihnen der Umgang mit Bacula kompliziert vorkommen. Bacula ist so entworfen, dass es Ihre Daten nach von Ihnen festgelegten Regeln sichert, was bedeutet, dass die Wiederverwendung eines Bandes nur die letzte Wahl sein kann. Natürlich ist es möglich, Bacula dazu zu bringen, jedes beliebige Band im Laufwerk zu beschreiben, jedoch ist es einfacher und wirkungsvoller hierfür ein anderes Programm zu verwenden. Wenn Sie Amanda verwenden und ein Sicherungsprogramm suchen, das auf mehrere Volumes schreiben kann (also nicht durch die Speicherkapazität Ihres Bandlaufwerkes beschränkt ist) wird Bacula wahrscheinlich Ihren Bedürfnissen entsprechen. Viele unserer Benutzer finden außerdem, dass Bacula einfacher zu konfigurieren und zu benutzen ist als entsprechende andere Programme.

Wenn Sie gegenwärtig ein anspruchsvolles kommerzielles Programm wie ``Legato'', ``Networker'', ``ARCserveIT'', ``Arkeia'', oder ``PerfectBackup+'' verwenden, könnte Sie Bacula interessieren, da es viele Eigenschaften und Funktionen dieser Programme hat, dabei aber als freie Software unter der GNU Software Lizenz Version 2 verfügbar ist.

Bacula Komponenten oder Dienste

Bacula besteht aus den folgenden fünf Hauptkomponenten bzw. Diensten:

\includegraphics{./bacula-applications.eps} (Dank an Aristedes Maniatis für diese und die folgende Grafik)


Bacula Director

Der Bacula Director-Dienst ist das Programm, das alle Sicherungs-, Wiederherstellungs-, Verifizierungs- und Archivierungsvorgänge überwacht. Der Systemadministrator verwendet den Bacula Director, um die Zeitpunkte der Sicherungen festzulegen und Dateien wiederherzustellen. Näheres hierzu im Dokument ``Director Services Daemon Design'' im ``Bacula Developer's Guide''. Der Director läuft als Dämon bzw. Dienst (also im Hintergrund).


Bacula Console

Der Bacula Console-Dienst ist jenes Programm, welches es einem Systemadministrator oder Benutzer erlaubt, mit dem Bacula Director zu kommunizieren (siehe oben). Zur Zeit ist die Bacula Console in drei Versionen75verfügbar. Die erste und einfachste ist das Consolen Programm in einer Shell zu starten (also eine TTY-Schnittstelle). Für die meisten Systemadministratoren ist dies völlig angemessen. Die zweite Möglichkeit ist ein grafisches GNOME-Interface, das weit davon entfernt ist, vollständig zu sein, aber schon ganz gut funktioniert und die meisten Möglichkeiten bietet, die auch die Shell-Konsole hat. Die dritte Version ist eine grafische wxWidgets-Benutzeroberfläche, über die Daten interaktiv wiederhergestellt werden können. Auch sie hat die meisten Funktionen der Shell-Konsole, bietet eine Befehlsvervollständigung per Tabulatorentaste und Kontexthilfe während der Befehlseingabe. Näheres hierzu im Kapitel Bacula Console Design Document.


Bacula File

Bacula File (Datei)-Dienste (bzw. Client-Programme) sind jene Programme, die auf den Rechnern installiert sind, deren Daten gesichert werden sollen. Sie sind je nach Betriebssystem verschieden, immer aber verantwortlich für die Auslieferung der Daten und deren Attribute, die der Director von ihnen anfordert. Die Datendienste sind auch für den betriebssystemabhängigen Teil der Wiederherstellung der Daten und deren Attribute im Falle einer Wiederherstellung zuständig. Näheres hierzu im Dokument ``File Services Daemon Design'' im ``Bacula Developer's Guide''. Auf dem Rechner, dessen Daten gesichert werden sollen, läuft dieses Programm als Dämonprozess. Der File-Dämon wird in dieser Dokumentation auch als ``Client'' bezeichnet (zum Beispiel in den Konfigurationsdatei von Bacula). Ausser den Unix/Linux File-Dämonen gibt es einen File-Dämon für Windows (der in der Regel als kompiliertes Programm erhältlich ist). Der File-Dämon für Windows läuft unter allen gängigen Windows-Versionen (95, 98, Me, NT, 2000, XP).


Bacula Storage

Den Bacula Storage (Sicherungs)-Dienst leisten Programme, die Sicherung und Wiederherstellung der Dateien und ihrer Attribute auf das physikalische Sicherungsmedium bzw. die Volumes leisten. Der Storage-Dämon ist also für das Beschreiben und Lesen Ihrer Bänder (oder eines anderen Sicherungsmediums wie z.B. Dateien) zuständig. Näheres hierzu im Kapitel ``Storage Services Daemon Design'' im ``Bacula Developer's Guide''. Der Sicherungsdienst läuft als Dämonprozess auf dem Rechner, der über das Datensicherungsgerät verfügt (in der Regel ein Bandlaufwerk).


Catalog

Die Catalog (Verzeichnis)-Dienste werden von Programmen geleistet, die für die Wartung der Datieindizes und Volume-Datenbanken aller gesicherten Dateien zuständig sind. Über einen Verzeichnis-Dienst kann der Systemadministrator oder Benutzer jede gewünschte Datei rasch wiederfinden und wiederherstellen. Durch den Verzeichnisdienst unterscheidet sich Bacula von einfachen Sicherungsprogrammen wie ``tar'' oder ``bru'', da dieser Dienst die Aufzeichnung aller verwendeten Volumes, aller gelaufener Sicherungen und aller gesicherter Dateien pflegt und dadurch eine effiziente Wiederherstellung und eine Verwaltung der Volumes erlaubt. Bacula unterstützt momentan drei verschiedene Datenbanksysteme, MySQL, PostgreSQL und SQLite, von denen eines vor der Kompilierung von Bacula ausgewählt sein muss.

Die drei Datenbanksysteme (MySQL, PostgreSQL und SQLite), die z.Z. unterstützt werden, haben eine ganze Reihe von Besonderheiten wie z.B. schnelle Indizierung, Baumsuche und Sicherheitsfunktionen. Wir planen die Unterstützung weiterer größerer SQL-Datenbanksysteme, doch hat die momentane Bacula-Version nur Schnittstellen zu MySQL, PostgreSQL und SQLite. Näheres hierzu im Kapitel ``Catalog Services Design Document''.

Die RPM-Archive von MySQL und PostgreSQL sind Teil der RedHat-Linux- und mehrerer anderer Distributionen, zudem ist die Erstellung der RPMs aus den Quelldateien ganz einfach. Näheres hierzu im Kapitel ``Installation und Konfiguration von MySQL'' in diesem Handbuch. Weitere Informationen zu MySQL im Internet: www.mysql.com. Zu PostgreSQL lesen Sie bitte das Kapitel ``Installation und Konfiguration von PostgreSQL'' in diesem Dokument. Weiter Informationen zu PostgreSQL finden Sie hier: www.postgresql.org.

Die Konfiguration und Installation eines SQLite-Datenbanksystems ist noch einfacher. Einzelheiten dazu im Kapitel ``Installation und Konfiguration von SQLite'' in diesem Handbuch.


Bacula Monitor

Der Bacula Monitor-Dienst ist das Programm, welches es dem Administrator oder Benutzer erlaubt, den aktuellen Zustand des Bacula Directors, der Bacula File Dämonen und der Bacula Storage Dämonen zu beobachten (siehe oben). Zur Zeit ist hierfür nur eine GTK+-Version verfügbar, die auf Gnome und KDE aufsetzt (oder jedem anderen Fenstermanager, der den Standard von FreeDesktop.org für das System-Tray unterstützt).

Um erfolgreich sichern und wiederherstellen zu können, müssen die folgenden vier Dämonprozesse konfiguriert und gestartet sein: Der Director-Dämon, der File-Dämon, der Storage-Dämon und MySQL, PostgreSQL oder SQLite.

Die Bacula Konfiguration

Damit sich Bacula in Ihrem System zurechtfindet und es weiss welche Client-Rechner wie zu sichern sind, müssen mehrere Konfigurationsdateien erstellt werden, die ``Resourcen'' (bzw. ``Objekte'') enthalten. Die folgende Abbildung gibt hierzu eine Übersicht:

\includegraphics{./bacula-objects.eps}

Die in diesem Dokument verwendeten Konventionen

Bacula ist in der Entwicklung und daher wird dieses Handbuch nicht in jedem Fall mit dem Stand des Programmcodes übereinstimmen. Steht in diesem Handbuch vor einem Abschnitt ein Stern (*), bedeutet dies, dass das Beschriebene noch nicht implementiert ist. Die Kennzeichnung durch ein Pluszeichen (+) bedeutet, dass die Funktion möglicherweise teilweise implementiert ist.

Wenn Sie dieses Handbuch als Teil eines offiziellen Release der Software lesen, ist diese Kennzeichnung verläßlich. Lesen Sie hingegen die Online-Version dieses Handbuches auf www.bacula.org, denken Sie bitte daran, dass hier die aktuelle Entwicklungsversion (wie sie im CVS vorhanden ist) beschrieben wird. In beiden Fällen wird aber das Handbuch dem Code ein Stückchen hinterherhinken.

Quick Start

Um Bacula schnell zu konfigurieren und zum Laufen zu bringen, empfehlen wir, zuerst den untenstehenden Abschnitt mit den Fachausdrücken und das nächste Kapitel ``Baculas gegenwärtiger Zustand'' durchzusehen.

Lesen Sie dann das Kapitel ``Mit Bacula beginnen'', das eine kurze Übersicht darüber gibt, wie man Bacula startet. Lesen Sie danach das Kapitel über ``Die Installation von Bacula'', dann ``Die Konfiguration von Bacula'' und schließlich das Kapitel ``Bacula in Betrieb nehmen''.

Terminologie

Um die Kommunikation über diese Projekt zu erleichtern, sind hier die verwendeten Begriffe erläutert

Administrator
Die Person bzw. die Personen, die für die Pflege des Bacula-Systems verantwortlich sind.

Backup
Wir verwenden den Ausdruck Backup (Sicherung) wenn wir von einem Bacula-Job sprechen, bei dem Dateien gesichert werden.

Bootstrap File
Das bootstrap file (Bootstrap-Datei) ist eine ASCII-Datei, die in kompakter Form jene Befehle enthält, mit denen Bacula oder das eigenständige Dateiextrahierungswerkzeug bextract den Inhalt eines oder mehrerer Volumes wiederherstellen kann, wie z.B. einen vorher gesicherten Systemzustand. Mit einer Bootstrap-Datei kann Bacula Ihr System wiederherstellen, ohne auf einen Catalog angewiesen zu sein. Aus einem Catalog kann eine Bootstrap-Datei erzeugt werden, um jede gewünschte Datei/Dateien zu entpacken.

Catalog
Der Catalog (das Verzeichnis) wird verwendet, um zusammenfassene Informationen über Jobs, Clients und Dateien zu speichern und Informationen darüber, in welchem Volume oder in welchen Volumen dies geschehen ist. Die Informationen, die im Catalog gespeichert sind, ermöglichen es dem Administrator bzw. Benutzer zu bestimmen, welche Jobs gelaufen sind, geben Auskunft über ihren Status und wichtige Eigenschaften der gesicherten Dateien. Der Catalog ist eine ``online resource'', enthält aber nicht die Daten der gesicherten Dateien. Vieles der Catalog-Informationen ist auch in den Volumes (z.B. auf den Bändern) gespeichert. Natürlich sind auf den Bändern auch die Kopien der Dateien und deren Attribute (siehe unten).

Der Catalog ist ein Besonderheit Baculas, das es von einfachen Backup- und Archiv-Programmen wie dump und tar unterscheidet.

Client
In Baculas Terminologie bezeichnet das Wort Client jenen Rechner, dessen Daten gesichert werden. Client ist auch ein anderes Wort für den File-Dienst oder File-Dämon, der oft auch nur mit FD bezeichnet wird. Clients werden in einer Resource der Konfigurationsdatei definiert.

Console
Die Console(Konsole) ist ein Programm, das die Schnittstelle zum Director bildet und über welches der Benutzer oder Systemadministrator Bacula steuern kann.

Daemon
(Dämonprozess) ist ein Unix-Fachausdruck für ein Programm, das ständig im Hintergrund läuft um spezielle Aufgaben auszuführen. Auf Windows- und manchen Linux-Systemen werden Dämonprozesse Services(Dienste) genannt.

Directive
Der Ausdruck directive (Anweisung) bezeichnet eine einzelne Angabe oder eine Niederschrift innerhalb einer Resource einer Konfigurationsdatei, welche einen speziellen Sachverhalt definiert. Beispielsweise definiert die Name-directive den Namen einer Resource.

Director
Baculas wichtigster Dämonprozess, der alle Aktivitäten des Bacula-Systems zeitlich festlegt und beaufsichtigt. Gelegentlich bezeichnen wir ihn als DIR.

Differential
Differentiell ist eine Sicherung, wenn sie alle Dateien einbezieht, die seit Beginn der letzten Vollsicherung geändert wurden. Beachten Sie bitte, dass dies von anderen Sicherungsprogrammen möglicherweise anders definiert wird.

File Attributes
File Attributes (Dateiattribute) sind all diejenigen Informationen, die nötig sind, um eine Datei zu identifizieren. Dazu gehören alle ihre Eigenschaften wie Größe, Zeitpunkt der Erzeugung, Zeitpunkt der letzten Änderung, Berechtigungen, usw. Im Normalfall wird der Umgang mit den Attributen vollständig von Bacula übernommen, so dass sich der Benutzer darüber keine Gedanken machen muss. Zu den Attributen gehört nicht der Inhalt der Datei.

File Daemon
Derjenige Dämonprozess, welcher auf dem Client-Computer läuft, dessen Daten gesichert werden sollen. Wird manchmal auch als File-Service (Datendienst), Client-Service (Client-Dienst) oder als FD bezeichnet.

FileSet
Ein FileSet (Zusammenstellung von Dateien) ist eine Resource einer Konfigurationsdatei, die festlegt, welche Dateien gesichert werden sollen. Sie besteht aus einer Liste mit eingeschlossenen Dateien oder Verzeichnissen, einer Liste mit ausgeschlossenen Dateien und Informationen darüber, wie diese Dateien zu sichern sind (komprimiert, verschlüsselt, signiert). Näheres hierzu im Abschnitt ``Definition der FileSet Resource'' im Director-Kapitel dieses Dokuments.

Incremental
Inkrementiell ist eine Sicherung dann, wenn sie alle Dateien einbezieht, die seit Beginn der letzten vollen, differentiellen oder inkrementiellen Sicherung geändert wurden. Normalerweise wird dies entweder durch die Level-Direktive innerhalb der Definition einer Job Resource oder in einer Schedule-Resource festgelegt.

Job
Ein Bacula-Job ist eine Konfigurations-Resource, die die Art und Weise definiert, in der Bacula die Daten eines bestimmten Client-Rechners sichert oder wiederherstellt. Sie besteht aus den Definitionen des Type (Sicherung, Wiederherstellung, Überprüfung, usw.), des Level (voll, inkrementiell,...), des FileSet und des Speicherorts (Storage) an welchem die Dateien gesichert werden sollen (Speichergerät, Media-Pool). Näheres hierzu im Abschnitt ``Definition der Job-Resource'' im Director-Kapitel dieses Dokuments.

Monitor
Dieses Programm hat eine Schnittstelle zu allen Dämonprozessen, um dem Benutzer oder Systemadministrator die Beobachtung von Baculas Zustand zu ermöglichen.

Resource
Eine Resource ist ein Teil einer Konfigurationsdatei, die eine bestimmte Informationseinheit definiert, die Bacula verfügbar ist. Eine Resorce enthält mehrere Direktiven (einzelne Konfigurations-Anweisungen). Die Job-Resource beispielsweise definiert alle Eigenschaften eines bestimmten Jobs: Name, Zeitplan, Volume-Pool, Art der Sicherung, Level der Sicherung...

Restore
ist eine Resource innerhalb einer Konfigurationsdatei, die den Vorgang der Wiederherstellung einer verlorenen oder beschädigten Datei von einem Sicherungsmedium beschreibt. Es ist der umgekehrte Vorgang wie bei einer Sicherung, außer dass in den meisten Fällen bei einem Restore nur einige wenige Dateien wiederhergestellt werden, während bei einer Sicherung normalerweise alle Dateien eines Systems gesichert werden. Selbstverständlich kann nach dem Ausfall einer Festplatte Bacula dazu benutzt werden, ein vollständiges Restore aller im System vorhandenen Dateien auszuführen.

Schedule
Ein Schedule (Zeitplan) ist eine Resource innerhalb einer Konfigurationsdatei, die definiert, wann ein Bacula-Job ausgeführt wird. Hierzu benutzt die Job-Resource den Namen des Schedules. Näheres hierzu im Abschnitt ``Definition der Schedule-Resource'' im ``Director''-Kapitel diese Handbuches.

Service
(Dienst) ist die Bezeichnung für einen Daemon(Dämonprozess) unter Windows (siehe oben). Diese Bezeichnung wird in letzter Zeit auch häufig in Unix-Umgebungen benutzt.

Storage Coordinates
Diejenige Information, die der Storage-Dienst zurückgibt und eine Datei eindeutig im Sicherungsmedium lokalisiert. Sie besteht aus einem Teil der zu jeder gespeicherten Datei gehört und einem Teil, der zum ganzen Job gehört. Normalerweise wird diese Information im Catalog gespeichert, so dass der Benutzer keine besonderen Kenntnisse der Storage Coordinates braucht. Zu den Storage Coordinates gehören die Dateiattribute und der eindeutige Ort der Sicherung auf dem Sicherungs-Volume.

Storage Daemon
Der Storage daemon (Speicherdämon), manchmal auch mit SD bezeichnet, ist jenes Programm, das die Attribute und die Daten auf ein Sicherungs-Volume schreibt (normalerweise ein Band oder eine Festplatte).

Session
(Sitzung) bezeichnet in der Regel die interne Kommunikation zwischen dem File-Dämon und dem Storage-Dämon. Der File-Dämon eröffnet eine Session mit dem Storage-Dämon, um ein FileSet zu sichern oder wiederherzustellen. Jede Session entspricht einem Bacula-Job (siehe oben).

Verify
Ein Verify ist ein Job, bei dem die aktuellen Dateiattribute mit jenen verglichen werden, die zuvor im Bacula-Catalog hinterlegt worden sind. Diese Funktion kann verwendet werden, um Änderungen an wichtigen Systemdateien zu erkennen und ist damit Tripwire ähnlich. Einer der größeren Vorteile dieser Funktionalität ist es, dass es genügt, auf dem Rechner, den man schützen will, den File-Dämon laufen zu haben. Director, Storage-Dämon und der Catalog sind auf einem anderen Rechner installiert. Wenn der Server dann gefährdet wird, ist es äußerst unwahrscheinlich, dass die Datenbank mit den Verifikationen davon mitbetroffen ist.

Verify kann auch zur Überprüfung benutzt werden, ob die Daten des zuletzt gelaufenen Jobs mit denen übereinstimmen, welche davon im Catalog gespeichert ist (es werden also die Dateiattribute verglichen). *Verify vergleicht auch den Inhalt eines Volumes mit den Originaldateien auf der Platte.

*Archive
Eine Archive-Funktion wird nach einer Sicherung durchgeführt. Dabei werden die Volumes, in denen die Daten gesichert sind, der aktiven Benutzung entzogen, als ``Archived'' gekennzeichnet und für weitere Sicherungen nicht mehr verwendet. Alle Dateien, die ein archiviertes Volume enthält, werden aus dem Catalog entfernt. NOCH NICHT IMPLEMENTIERT.

*Update
Mit der Update-Funktion werden die Dateien auf dem entfernten Rechner durch die entsprechenden vom Host-Rechner ersetzt. Dies entspricht der Funktionalität von rdist. NOCH NICHT IMPLEMENTIERT.

Retention Period
Bacula kennt verschiedene Arten von Retention Periods (Zeitspannen während derer etwas bewahrt wird, Aufbewahrungszeiten). Die wichtigsten sind die File Retention Period, die Job Retention Period und die Volume Retention Period. Jede dieser Retention-Periods bezieht sich auf die Zeit, während der bestimmte Aufzeichnungen in der Catalog-Datenbank gehalten werden. Dies sollte nicht mit jener Zeit verwechselt werden während der Daten eines Volume gültig sind.

Die File Retention Period bestimmt wie lange die Einträge zu den Dateien in der Catalog-Datenbank gehalten werden. Diese Zeitspanne ist wichtig, da diese Einträge bei weitem den größten Teil des Speicherplatzes in der Datenbank belegen. Daher muss gewährleistet sein, dass überflüssige oder obsolete Einträge regelmäßig aus der Datenbank entfernt werden (hierzu Näheres im Abschnitt zum Retention-Befehl in der Beschreibung der Console-Befehle).

Die Job Retention Period ist die Zeitspanne, während der Einträge zu den Jobs in der Datenbank gehalten werden. Beachten Sie, dass alle Dateieinträge mit dem Job, mit dem sie gesichert wurden, verbunden sind. Die Einträge zu den Dateien können gelöscht sein, während die Aufzeichnungen zu den Jobs erhalten bleiben. In diesem Fall wird man Informationen über gelaufene Sicherungsjobs haben, jedoch keine Einzelheiten über die Dateien, die dabei gesichert wurden. Normalerweise werden mit dem Löschen eines Job-Eintrags auch alle seine Aufzeichnungen zu den Dateien gelöscht.

Die Volume Retention Period bestimmt die Mindestzeit, während der ein bestimmtes Volume erhalten bleibt, bevor es wiederverwendet wird. Bacula wird in der Regel niemals ein Volume überschreiben, das als einziges die Sicherungskopie einer bestimmten Datei enthält. Im Idealfall wird der Catalog für alle benutzten Volume die Einträge aller gesicherten Daeien enthalten. Wenn ein Volume überschrieben wird, werden die Dateieeinträge, die zuvor in ihm gespeichert waren aus dem Catalog entfernt. Gibt es allerdings einen sehr großen Pool von Volumes oder gibt es Volumes, die nie überschrieben werden, kann die Catalog-Datenbank riesig werden. Um den Catalog in einer handhabbaren Größe zu halten, sollten Informationen zu den Sicherungen nach der definierten File Retention Period aus ihm entfernt werden. Bacula hat Mechanismen, um den Catalog entsprechend der definierten Retention Periods automatisch zu bereinigen.

Scan
Bei einer Scan-Operation wird der Inhalt eines oder mehrerer Volumes durchsucht. Diese Volumes und die Informationen über die Dateien, welche sie enthalten, werden wieder in den Bacula-Catalog eingetragen. Danach können die Dateien in diesen Volumes auf einfache Weise wiederhergestellt werden. Diese Funktion ist teilweise hilfreich, wenn bestimmte Volumes oder Jobs ihre Retention Period überschritten haben und aus dem Catalog entfernt worden sind. Um die Daten von den Volumes in die Datenbank einzulesen, wird das Programm bscan verwendet. Näheres hierzu im Abschnitt bscan im Kapitel ``Bacula Hilfsprogramme'' dieses Handbuches.

Volume
Ein Volume ist eine Einheit, auf der gesichert wird, normalerweise ein Band oder eine benannte Datei auf der Festplatte auf welche/s Bacula die Daten einer oder mehrerer Sicherungsjobs speichert. Alle Volumes erhalten von Bacula eine digitale Kennzeichnung, so dass Bacula jederzeit weiß, welches Volume es tatsächlich liest. (Normalerweise sollte es mit Dateien auf der Festplatte keine Verwechslungen geben, doch bei Bändern mountet man aus Versehen leicht das Falsche).

Was Bacula nicht ist

Bacula ist ein Sicherungs-, Wiederherstellungs- und Verifikationsprogramm, aber von sich aus noch kein komplettes Rettungsprogramm für den Katastrophenfall. Allerdings kann Bacula Teil eines Rettungsprogramms sein, falls Sie sorgfältig planen und die Anweisungen im Kapitel Disaster Recovery dieses Handbuches beachten.

Bei sorgfältiger Planung, wie sie im Kapitel ``Disaster Recovery'' dargestellt ist, kann Bacula ein wesentlicher Bestandteil eines Rettungssystems sein. Wenn Sie zum Beispiel eine Bootdiskette erstellt haben, dazu eine Bacula-Rettungs-CD, auf der sie die aktuellen Partitionsdaten Ihrer Festplatte gespeichert haben und eine komplette Bacula Sicherung vorhalten, ist es möglich, Ihr System auf einer leeren Festplatte wieder herzustellen.

Wenn Sie die den Befehl WriteBootstrap in einem Ihrer Sicherungs-Jobs verwendet oder auf irgend eine andere Art eine gültige Bootstrap-Datei gesichert haben, werden Sie damit in der Lage sein, die notwendigen Dateien zu entpacken (ohne den Catalog zu verwenden oder von Hand nach Dateien suchen zu müssen).

Interaktionen zwischen den Bacula-Diensten

Das untenstehende Diagramm zeigt typische Interaktionen zwischen den einzelnen Bacula-Diensten bei einem Sicherungs-Job. Jeder Block steht ungefähr für einen eigenen Prozess (normalerweise ein Dämon). Im großen und ganzen hat der Director den Überblick über die Aktionen und pflegt die Katalog-Datenbank.

\includegraphics{./flow.eps}


Baculas Stand

(was gegenwärtig implementiert und funktionsfähig ist und was nicht)

Was implementiert ist

Die Vorteile von Bacula gegenüber anderen Sicherungsprogrammen

Einschränkungen der aktuellen Implementierung

Grenzen und Beschränkungen des Software Design


Systemvoraussetzungen


Unterstützte Betriebssysteme


Unterstützte Bandlaufwerke

Auch wenn Ihr Bandlaufwerk in der untenstehenden Liste eingetragen ist, lesen Sie bitte im Kapitel Test der Bandlaufwerke in diesem Handbuch wie Sie sich vergewissern können, dass Ihr Bandlaufwerk mit Bacula zusammen funktionieren wird.

Wenn Ihr Laufwerk im festen Block-Modus arbeitet, könnte es zunächst so aussehen, als ob es funkioniert, bis sie dann eine Wiederherstellung machen und Bacula versucht, das Band zu positionieren. Sie können nur sicher sein, wenn sie die oben vorgeschlagenen Verfahren befolgen und testen.

Weil wir so wenige Rückmeldungen haben, ist es sehr schwierig, eine Liste der unterstützten Laufwerke oder zumindest jener zu liefern, mit denen Bacula funktioniert (wenn sie also Bacula mit einem anderen Laufwerk benutzen, melden Sie es bitte). Laut unseren Benutzern arbeiten die folgenden Laufwerke unter Bacula. Ein Strich in einer Spalte bedeutet ``unbekannt''.

BS Herst. Media Modell Kapazität
- ADIC DLT Adic Scalar 100 DLT 100GB
- ADIC DLT Adic Fastor 22 DLT -
- - DDS Compaq DDS 2,3,4 -
- Exabyte - Exabyte LWe, <10 Jahre alt -
- Exabyte - Exabyte VXA LWe -
- HP Travan 4 Colorado T4000S -
- HP DLT HP DLT LWe -
- HP LTO HP LTO Ultrium LWe -
- IBM ?? 3480, 3480XL, 3490, 3490E, 3580 and 3590 LWe -
FreeBSD 4.10 RELEASE HP DAT HP StorageWorks DAT72i -
FreeBSD 5.4-RELEASE-p1 amd64 Certance LTO AdicCertance CL400 LTO Ultrium 2 200GB
- Overland LTO LoaderXpress LTO -
SuSE 8.1 Pro Compaq AIT Compaq AIT 35 LVD 35/70GB
- Overland - Neo2000 -
- OnStream - OnStream LWe (siehe unten) -
- Quantum DLT DLT-8000 40/80GB
Linux Seagate DDS-4 Scorpio 40 20/40GB
FreeBSD 4.9 STABLE Seagate DDS-4 STA2401LW 20/40GB
FreeBSD 5.2.1, Pthreads gepatcht Seagate AIT-1 STA1701W 35/70GB
Linux Sony DDS-2,3,4 - 4-40GB
Linux Tandberg - Tandbert MLR3 -
FreeBSD Tandberg - Tandberg SLR6 -
FreeBSD 4.11-Release Quantum SDLT SDLT320 160/320GB
Solaris Tandberg - Tandberg SLR75 -

Es gibt eine Liste mit unterstützten Autochanger im Kapitel ``Unterstützte Autochanger'' in diesem Dokument, in dem noch weitere Laufwerke aufgeführt sind, die mit Bacula funktionieren.


Nicht unterstützte Bandlaufwerke

Bisher funktionierten OnStream IDE-SCSI Bandlaufwerke nicht unter Bacula. Seit der Bacula-Version 1.33 und der Version 0.9.14 des osst-Kerneldrivers funktionieren sie nun. Da sie eine feste Blockgröße einstellen müssen, beachten sie bitte das Kapitel zum Testen.

Von QIC-Bändern weiß man, dass sie einige Besonderheiten haben (feste Blockgröße, eher ein EOF als zwei zur Markierung des Bandendes). Sie müssen diese daher sehr sorgfältig konfigurieren, wenn sie korrekt mit Bacula arbeiten sollen.

Warnung für FreeBSD-Benutzer!!!

Solange die Pthreads-Bibliothek der meisten FreeBSD-Systeme nicht gepatcht ist, werden Sie Daten verlieren, wenn Sie mit Bacula Bänder vollschreiben. Die ungepatchte Pthreads-Bibliothek ist nicht in der Lage, Bacula eine Warnung zurückzugeben, wenn das Bandende naht. Beachten Sie bitte das Kapitel zum Test der Bänder in diesem Handbuch mit wichtigen Informationen, wie man das Bandlaufwerk so konfiguriert, dass es zu Bacula kompatibel ist.

Unterstützte Autochanger

Informationen zu den unterstützten Autochangern stehen im Abschnitt Autochangers Known to Work with Bacula im Kapitel ``Unterstützte Autochanger'' dieses Handbuches.

Band-Spezifikationen

Wir können Ihnen wirklich nicht sagen welche Bänder zusammen mit Bacula funktionieren werden. Wenn Sie ein Laufwerk kaufen wollen, sollten Sie versuchen, DDS-Laufwerke zu vermeiden. Deren Technologie ist relativ alt und die Laufwerke benötigen regelmäßige Reinigung. DLT-Laufwerke sind im allgemeinen viel besser (neuere Technologie) und benötigen keine regelmäßige Reinigung.

Unten ist eine Tabelle mit den Spezifikationen von DLT- und LTO-Bändern, die Ihnen einen Eindruck der Geschwindigkeit und Kapazität aktueller Bänder geben soll. Die aufgeführte Kapazität ist die reine Bandkapazität ohne Kompression. Alle modernen Laufwerke arbeiten mit Hardware-Kompression und die Hersteller geben oft eine Kompressionsrate von 2:1 an. Die tatsächliche Kompressionsrate hängt hauptsächlich von den zu sichernden Daten ab, aber ich finde 1,5:1 ist ein viel vernünftigerer Wert (multiplizieren Sie die Werte der Tabelle mit 1,5 und Sie werden ein grobes Mittel dessen erhalten, was Sie möglicherweise sehen werden). Die Transferraten sind auf den nächsten GB/hr-Wert gerundet. Die Werte wurden von verschiedenen Herstellern zur Verfügung gestellt. In der Spalte ``Medien Typ'' stehen die Benennungen der Hersteller. Es ist nicht notwendig, diese Namen in den Konfigurationsdateien von Bacula zu benutzen. Allerdings können Sie das tun.

Medien Typ Laufwerks-Type Medien Kapazität Transferrate
DDS-1 DAT 2 GB ?? GB/hr
DDS-2 DAT 4 GB ?? GB/hr
DDS-3 DAT 12 GB 5.4 GB/hr
Travan 40 Travan 20 GB ?? GB/hr
DDS-4 DAT 20 GB 11 GB/hr
VXA-1 Exabyte 33 GB 11 GB/hr
DAT-72 DAT 36 GB 13 GB/hr
DLT IV DLT8000 40 GB 22 GB/hr
VXA-2 Exabyte 80 GB 22 GB/hr
Half-high Ultrum 1 LTO 1 100 GB 27 GB/hr
Ultrium 1 LTO 1 100 GB 54 GB/hr
Super DLT 1 SDLT 220 110 GB 40 GB/hr
VXA-3 Exabyte 160 GB 43 GB/hr
Super DLT I SDLT 320 160 GB 58 GB/hr
Ultrium 2 LTO 2 200 GB 108 GB/hr
Super DLT II SDLT 600 300 GB 127 GB/hr
VXA-4 Exabyte 320 GB 86 GB/hr
Ultrium 3 LTO 3 400 GB 216 GB/hr


Mit Bacula beginnen

Wenn Sie wie ich sind, wollen Sie dass Bacula sofort läuft, damit Sie ein Gefühl für das Programm bekommen und sich erst später mit den Details befassen. Dieses Kapitel möchte genau dieses erreichen: Das Programm ohne die ganzen Einzelheiten rasch zum Laufen zu bringen. Wenn Sie den Abschnitt über Pools, Volumes und Labels überspringen wollen, können Sie ihn später immer noch nachholen, aber lesen Sie bitte bis zum Ende des Kapitels und beachten Sie die Anweisungen zum Test Ihres Bandlaufwerkes genau.

Wir gehen davon aus, dass Sie es geschafft haben, Bacula zu kompilieren und zu installieren. Wenn nicht, werfen sie vielleicht zuerst einen Blick auf die System-Anforderungen und dann auf das Kapitel Bacula kompilieren und installieren in diesem Handbuch.

Jobs und Zeitpläne verstehen

Um Bacula so anpassungsfähig wie möglich zu machen, bestehen die Anweisungen, die sein Verhalten bestimmen, aus verschiedenen Teilen. Die wichtigste Direktive ist die Job-Resource, welche jeweils eine Sicherungsaufgabe beschreibt. Ein Sicherungs-Job besteht im allgemeinen aus einem FileSet, einem (Sicherungs-)Client und einem Zeitplan mit einer oder mehreren Arten und Zeiten der Sicherung, einem Pool und zusätzlichen Instruktionen. Mit anderen Worten: Mit dem FileSet wird bestimmt was gesichert werden soll, mit dem Client, wer sichern soll, der Zeitplan bestimmt wann dies geschehen soll und der Pool wohin gesichert werden soll (z.B. auf welches Volume). Typischerweise bestimmt jeweils eine Kombination FileSet/Client einen Job. Die meisten der Direktiven wie FileSets, Pools und Zeitpläne können für mehrere Jobs verwendet werden und so beliebig kombiniert werden. Sie könnten z.B. zwei verschiedene Job-Definitionen (resources) haben, welche die Daten verschiedener Server sichern, dabei aber den gleichen Zeitplan, das gleiche FileSet (auf beiden Rechnern werden die gleichen Verzeichnisse gesichert) und vielleicht sogar die gleichen Pools nutzen. Der Zeitplan wird festlegen, welche Art der Sicherung wann läuft (z.B. Montags eine Vollsicherung, an den übrigen Wochentage inkrementielle Sicherung) und wenn mehr als ein Job den gleichen Zeitplan hat, wird die Job-Priorität bestimmen, welcher Job tatsächlich als erster läuft. Wenn Sie viele Jobs haben, werden Sie möglicherweise JobDefs benutzen wollen, in denen Sie Vorgaben für alle Jobs festlegen, die dann in den einzelnen Job-Resourcen individuell angepasst werden können, es Ihnen aber ersparen, für jeden Job die gleichen Parameter zu definieren. Zusätzlich zu den durch die FileSets festgelegten zu sichernden Dateien sollte es auch einen Job geben, der Ihre Catalog-Dateien sichert.

Schließlich gibt es neben den Sicherungs-Jobs Wiederherstellungs-Jobs, Verifikationen und administrative Jobs, die andere Direktiven erfordern.

Pools, Volumes und Labels verstehen

Wenn Sie bisher Programme wie tar zur Datensicherung verwendet haben, werden Ihnen Begriffe Pools, Volumes und Label auf den ersten Blick vielleicht etwas verwirrend vorkommen. Ein Volume ist ein einzelnes physikalisches Band (oder möglicherweise eine einzelne Datei), auf die Bacula die Daten Ihrer Sicherung schreibt. Pools sind Gruppen von Volumes, so dass eine Sicherung nicht auf die Größe eines einzelnen Volumes (die Länge eines Bandes) beschränkt ist. Daher werden Sie bei der Definition eines Job eher einen Pool anstatt einzelner Volumes spezifizieren. Bacula wird das nächste verfügbare Volume dem Pool entnehmen und Sie auffordern, es zu mounten.

Während die grundlegenden Eigenschaften eines Pools in der Pool-Resource des Directors festgelegt sind, werden die Daten der realen Pools im Bacula-Catalog gehalten. Er enthält alle Informationen der Pool-Resourcen und auch die Informationen über alle Volumes, die einem Pool zugefügt wurden. Ein Volume wird normalerweise mit dem label-Befehl des Konsolen-Proramms dem Pool hinzugefügt.

Für jedes Volume hält Bacula eine ziehmliche Menge von Catalog-Informationen vor, wie z.B. den Zeitpunkt des ersten Lesens/Beschreibens, den Zeitpunkt des letzten Lesens/Beschreibens, die Anzahl der Dateien, die es enthält, die Anzahl der Mounts, usw.

Bevor Bacula ein Volume beschreibt, muss das physikalische Volume eine digitale Kennzeichnung erhalten, damit Bacula sicher sein kann, dass das richtige Volumen gemountet ist. Dies erledigt normalerweise der label-Befehl des Konsolen-Programms.

Das Vorgehen, zuerst eine Pool zu schaffen, dann Volumes hinzuzufügen und die Volumes digital zu kennzeichnen, mag zu Anfang mühselig erscheinen, ist aber ganz einfach und erlaubt es, mehrere Volumes zu verwenden (anstatt auf die Speicherkapaziät eines Bandes beschränkt zu sein). Durch Pools wird man bei der Sicherung auch ausgesprochen flexibel. Man kann sich z.B einen ``täglichen'' Pool für inkrementielle und einen ``wöchentlichen'' Pool für Vollsicherungen anlegen. Sind bei der Definition der Sicherungsjobs die richtigen Pools angegeben, wird Bacula niemals einen Tagesjob in ein Volume des wöchentlichen Pools schreiben oder umgekehrt und Ihnen stets sagen, wann welches Band benötigt wird.

Weiteres zu Pools im Abschnitt Pool-Resource des Kapitels ``Director-Konfiguration''. Auch in diesem Kapitel werden wir später auf dieses Thema zurückkommen.


Baculas Konfigurations-Dateien einrichten

Wenn Sie Bacula zum ersten Mal verwenden, müssen Sie, nachdem Sie den entsprechenden ./configure-Befehl, ein make und ein make install ausgeführt haben, gültige Konfigurationsdateien für den Director, den File-Dämon, den Storage-Dämon und die Console erstellen. Wenn Sie sich nach unseren Empfehlungen gerichtet haben, finden Sie in Ihrem Installationsverzeichnis sowohl Vorgabe-Konfigurationsdateien als auch die ausführbaren Dateien der Dämonen. In jedem Fall sind die Programmdateien in jenem Verzeichnis, welches bei der Ausführung des ./configure-Befehls mit der Option --sbindir und die Konfigurationsdateien in jenem Verzeichnis, welches mit der --sysconfdir-Option angegeben wurde.

Wenn Sie Bacula zum ersten Mal installieren, werden Sie etwas Zeit brauchen, um die Konfigurationsdateien so zu verändern, dass Sie zu Ihrer Umgebung passen. Das wird mit sich bringen, dass Sie Bacula einige Male starten und wieder beenden müssen bis alles stimmt. Verzweifeln Sie nicht! Sind die Konfigurationsdateien einmal erstellt, werden Sie diese nur noch selten ändern und auch Bacula nicht sehr oft starten oder stoppen müssen. Die meiste Arbeit wird darin bestehen, Bänder zu wechseln, wenn sie voll sind.

Die Konfiguration des Console-Programms

Das Condsole-Programm wird vom Administrator benutzt, um mit dem Director-Prozess zu interagiern und Jobs manuell zu starten und zu beenden oder Informationen zu einzelnen Jobs zu erhalten.

Die Konfigurationsdatei der Console ist in jenem Verzeichnis, das mit der --sysconfdir-Option bei der Ausführung des ./configure-Befehl spezifiziert wurde und heißt vorgabemäßig console.conf.

Wenn Sie auch die GNOME-Console mit der --enable-gnome-Option kompiliert haben, finden Sie auch hierfür eine Vorgabe-Konfigurationsdatei die gnome-console.conf heißt.

Gleiches gilt für die wxWidgets-Console, die mit der --enable-wx-console-Option kompiliert wird und deren Vorgabe-Konfigurationdsdatei wx-console.conf ist.

Benutzen Sie Bacula zum ersten Mal, wüssen Sie diese Dateien nicht ändern, da brauchbare Vorgabewerte schon gesetzt sind

Die Konfiguration des Monitor-Programms

Das Monitor-Programm erscheint typischerweise als Icon in der Kontrollleiste. Wird dieses zu einem Fenster vergrößert, liefert es dem Administrator Informationen über den Director, den Sicherungsstatus des lokalen Rechners oder jeden anderen konfigurierten Dämon-Prozess.

\includegraphics{./Bacula-tray-monitor.eps}

Die Abbildung zeigt ein Fenster des Tray-Monitors, der für drei Dämon-Prozesse konfiguriert wurde. Wenn man auf die Schaltflächen in der oberen rechten Ecke des Fensters klickt, sieht man den Zustand jedes einzelnen Prozesses. Die Abbildung zeigt den Zustand des momentan ausgewählten Storage-Dämons (MainSD).

Die Konfigurationsdatei des Monitor-Programms befindet sich in jenem Verzeichnis, das bei Ausführung des ./configure-Befehls mit der Option --sysconfdir angegeben wurde. In der Regel müssen Sie als Erstbenutzer die Berechtigung für diese Datei ändern, um Benutzern, die keine root-Rechte haben, zu erlauben, den Monitor zu starten, da diese Anwendung unter dem gleichen Benutzer laufen muss wie die grafische Umgebung (vergessen Sie nicht, nicht-root-Benutzern die Ausführung von bacula-tray-monitor zu erlauben). Solange Sie die Vorgabewerte verwenden, ist dies kein Sicherheitsproblem.

Die Konfiguration des File-Dämon

Der File-Dämon ist ein Programm, das auf jedem (Client-)Rechner läuft. Auf Anforderung des Directors sucht er die zu sichernden Dateien und schickt sie (bzw. ihre Daten) an den Storage-Dämon.

Die Konfigurationsdatei des File-Dämon ist in jenem Verzeichnis, das bei Ausführung des ./configure-Befehls mit der Option --sysconfdir angegeben wurde. Vorgabemäßig heißt diese Datei bacula-fd.conf. Normalerweise muss für erste Versuche hier nichts geändert werden, da vernünftige Vorgabewerte gesetzt sind. Will man allerdings die Daten von mehreren Rechnern sichern, muss auf jedem dieser Rechner ein File-Dämon mit einer eigenen Konfigurationsdatei installiert sein. Die Daten aller dieser File-Dämons müssen in der Konfigurationsdatei des Directors erscheinen.

Die Konfiguration des Directors

Der Director ist das zentrale Steuerungsprogramm aller anderen Dämon-Prozesse. Er terminiert und überwacht alle Sicherungsjobs.

Die Konfigurationsdatei des Directors liegt in jenem Verzeichnis, das durch die Option --sysconfdir bei der Ausführung des ./configure-Befehls angegeben wurde. Der Name dieser Konfigurationsdatei ist normalerweise bacula-dir.conf.

Im Allgemeinen muss darin nur die Ressource ``FileSet'' geändert werden, so dass ihre Include-Direktive mindestens eine Zeile mit einem gültigen Verzeichnis (oder einer Datei) enthält, die/das zu sichern ist.

Wenn Sie kein DLT-Bandlaufwerk haben, werden Sie möglicherweise die Storage-Resource ändern wollen, so dass diese Ihrem tatsächlichen Sicherungsgerät mehr entspricht. Sie können hier immer die tatsächlichen Namen verwenden und können diese auch beliebig zuweisen, doch müssen sie mit jenen übereinstimmen, die in der Konfigurationsdatei des Storage-Dämon angegeben sind.

Möglicherweise wollen Sie auch die E-Mailadresse zur Benachrichtigung von der Vorgabe root auf Ihre eigene ändern.

Schließlich brauchen Sie, wenn Sie mehrere Rechner sichern wollen, für jedes System einen eigenen File-Dämon bzw. Client und müssen seinen Namen, seine Adresse und ein Passwort spezifizieren. Wir meinen, dass es die Fehlersuche sehr erleichtert, wenn wir den Dämonen den Namen des Rechners geben und ein -fd anhängen. Wenn Ihr Rechner also z.B. foobaz heißt, würden Sie den File-Dämon foobaz-fd nennen. Der Director könnte foobaz-dir heißen und der Storage-Dämon foobaz-sd. Jede Ihrer Bacula-Komponenten muss einen eindeutigen Namen haben. Wenn Sie alle gleich benennen, werden Sie - abgesehen davon, dass sie nicht wissen werden, welcher Dämon Ihnen welche Botschaft schickt - eigenartige Fehlermeldungen erhalten, da die Namen ihrer Temporärdateien nicht eindeutig sind, sofern sie das gleiche Arbeitsverzeichnis benutzen.

Die Konfiguration des Storage-Dämon

Auf Veranlassung des Director-Prozesses ist der Storage-Dämon für die Übernahme der Daten vom File-Dämon und ihrer Speicherung auf dem Sicherungsmedium verantwortlich, bzw. im Falle einer Wiederherstellung für das Finden und die Übergabe der Daten an den File-Dämon.

Die Konfigurationsdatei der Storage-Dämons ist in dem Verzeichnis, das bei Ausführung des ./configure-Befehls mit der --sysconfdir-Option angegeben wurde und heißt vorgabemäßig bacula-sd.conf. Bearbeiten Sie diese Datei, damit sie die korrekten Archivierungsgerätenamen für jedes Ihrer Bandgeräte enthält. Wenn bei der Konfiguration Ihr System richtig erkannt wurde, werden sie schon richtig gesetzt sein. Die Namen dieser Storage-Resourcen und der Media Type müssen mit jenen übereinstimmen, die in der Konfigurationsdatei des Directors stehen. Wenn Sie in eine Datei anstatt auf ein Band sichern wollen, muss als Archive-Gerät ein Verzeichnis angegeben sein, in dem dann die Volumes erzeugt werden und schließlich die Dateien, sobald ein Volume gelabelt wird.

Test der Konfigurationsdateien

Sie können die Konfigurationsdateien auf korrekte Syntax testen, indem sie den entsprechenden Dämon mit der -t-Option starten. Der Dämon wird die Konfigurationsdatei abarbeiten, gegebenenfalls eine Fehlermeldung ausgeben und sich dann beenden. Das folgende Beispiel geht davon aus, dass die Programm- und die Konfigurationsdateien im gleichen Verzeichnis installiert sind.

cd <installation-directory>
./bacula-dir -t -c bacula-dir.conf
./bacula-fd -t -c bacula-fd.conf
./bacula-sd -t -c bacula-sd.conf
./bconsole -t -c bconsole.conf
./gnome-console -t -c gnome-console.conf
./wx-console -t -c wx-console.conf
su <normal user> -c "./bacula-tray-monitor -t -c tray-monitor.conf"

Hiermit werden alle Konfigurationsdateien der wichtigsten Programme getestet. Sind diese in Ordnung, beendet sich das Programm, ohne irgendetwas auszugeben. Beachten sie bitte, dass je nach gewählten Konfigurationsoptionen einige oder sogar alle der letzten drei Befehle auf Ihrem System nicht verfügbar sein werden. Wenn Sie die ausführbaren Dateien in die üblichen Unix-Verzeichnisse statt in ein einziges Verzeichnis installiert haben, müssen Sie die obigen Befehle entsprechend anpassen (das ``./'' vor dem Befehlsname weglassen und den Pfad vor den Namen der Konfigurationsdatei angeben).

Test der Kompatibilität von Bacula mit Ihrem Bandlaufwerk

Bevor Sie viel Zeit mit Bacula verschwenden, um schließlich herauszufinden, dass das Programm doch nicht mit Ihrem Bandlaufwerk zusammenarbeitet, lesen Sie bitte das Kapitel btape -- Test Ihres Bandlaufwerkes in diesem Handbuch.

Wenn Sie ein neueres SCSI-Bandlaufwerk unter Linux oder Solaris benutzen, wird Bacula vermutlich funktionieren, aber probieren Sie das lieber vorher aus. Benutzer von FreeBSD (und möglicherweise andere xBSD-Varianten) müssen das oben erwähnte Kapitel lesen. Für FreeBSD gibt es unter The FreeBSD Diary eine eingehende Beschreibung, wie man Bacula auf Ihrem System zum Laufen bringt. Benutzer von FreeBSD in einer Version vor 4.9-STABLE vom Montag, dem 29.12.2003, 15:18:01, die vorhaben ein Bandlaufwerk zu verwenden, sollten ausserdem die Datei platforms/freebsd/pthreads-fix.txt in Baculas Hauptverzeichnis lesen. Darin sind wichtige Informationen zur Kompatibilität von Bacula und Ihrem System.

Das /lib/tls Verzeichnis entfernen

Die neue Pthreads-Bibliothek /lib/tls, welche standardmäßig von neueren ``RedHat''-Systemen (Kernelversion 2.4.x) installiert wird, ist fehlerhaft. Dieses Verzeichnis muss entfernt oder umbenannt werden, bevor Bacula dann nach einem Neustart lauffähig ist. Geschieht dies nicht, wird sich Bacula nach etwa einer Woche Laufzeit entweder für längere Zeitspannen oder dauerhaft blockieren. Man wird hier wohl eher die entsprechende Umgebungsvariable überschreiben, anstatt das Verzeichnis /lib/tls zu entfernen. Mehr zu diesem Problem im Kapitel Unterstützte Betriebssysteme.

Auf Systemen mit Kernel-Version 2.6.x scheint dieses Problem nicht aufzutreten.

Bacula in Betrieb

Der vielleicht wichtigste Teil beim Betrieb on Bacula ist die Fähigkeit, Dateien wiederherzustellen. Wenn Sie dies nicht wenigstens einmal ausprobiert haben, bevor Sie tatsächlich gezwungen sind, es zu tun, werden Sie viel mehr unter Druck stehen und dazu neigen, Fehler zu machen, als wenn sie diesen Vorgang schon einmal getestet haben.

Um eine Vorstellung davon zu bekommen, wie man Bacula in kurzer Zeit zum Laufen bringt empfehlen wir dringend, das Beispiel im Kapitel Running Bacula Chapter in diesem Handbuch nachzuvollziehen, wo im einzelnen erklärt wird, wie man Bacula laufen lässt.

Log Rotation

Wenn Sie die vorgegebene bacula-dir.conf oder eine Abwandlung davon benutzen, werden Sie bemerken, dass alle Ausgaben von Bacula in eine Datei gespeichert werden. Um zu verhindern, dass diese Datei ohne Grenze wächst, empfehlen wir, die Datei logrotate aus dem Verzeichnis scripts/logrotate nach /etc/logrotate.d/bacula zu kopieren. Dadurch wird die Logdatei einmal im Monat rotiert und höchstens fünf Monate lang erhalten. Um die Logrotation Ihren Wünschen anzupassen, können Sie diese Datei bearbeiten.

Log Watch

Auf manchen Systemen wie RedHat und Fedora läuft jede Nacht ein Logwatch-Programm, das Ihre Log-Dateien analysiert und per E-Mail berichtet. Wenn Sie die Ausgaben Ihrer Bacula-Sicherungsjobs diesen Berichten hinzufügen wollen, werfen sie einen Blick in das Verzeichnis scripts/logwatch. In der README-Datei in diesem Verzeichnis wird kurz erklärt, wie man es installiert und welche Ausgaben zu erwarten sind.

Disaster Recovery

Wenn sie vorhaben, Bacula eher als Werkzeug zur Wiederherstellung Ihres Systems im Notfall, als nur dazu zu verwenden, beschädigte oder verlorengegangene Dateien wiederherzustellen, werden sie vielleicht das Kapitel Disaster Recovery Using Bacula Chapter in diesem Handbuch lesen wollen.

Auf jeden Fall raten wir Ihnen dringend, die Wiederherstellung einiger gesicherte Dateien zu testen anstatt zu warten, bis ein Notfall eintritt.


Bacula installieren

Normalerweise benötigen Sie ein Release mit Baculas Quellcode und, wenn ein Windows-Client benutzt werde soll, ein ausführbares Release von Bacula für Windows. Entprechend Ihrer Konfigurationsoptionen benötigt Bacula bestimmte Pakete von Drittanbietern (wie z.B. SQLite, MySQL oder PostgreSQL) zur Kompilierung. Um Ihnen die Arbeit zu erleichtern, haben wir einige dieser Softwarepakete als zwei depkgs-Releases veröffentlicht (Dependency Packages). Dies kann Ihr Leben ungemein erleichtern, da Sie so mit allen notwendigen Pakaten versorgt anstatt gezwungen sind, sie selbst einzeln im Internet zu finden und zu installieren.

Source Release Files

Seit Baculas Version 1.38.0 ist der Quellcode in vier einzelne Tar-Dateien aufgeteilt, die jeweils einem Modul in Baculas CVS entsprechen. Im einzelnen sind dies:

bacula-1.38.0.tar.gz
Dies ist Baculas Quellcode. Mit jedem Release erhöht sich die Versionsnummer.

bacula-docs-1.38.0.tar.gz
Diese Datei enthält eine Kopie des Verzeichnisses der Dokumente im CVS. Einige Dokumente sind vorkompiliert. Für Englisch existiert ein HTML-Verzeichnis, ein einzelnes HTML-File und eine PDF-Datei. Die französische und die deutsche Übersetzung sind in Arbeit, aber nicht kompiliert.

bacula-gui-1.38.0.tar.gz
Diese Datei enthält grafische Benutzeroberflächen, die nicht Bestandteil des Hauptprogrammes sind. Momentan sind dies ``bacula-web'' zur Generierung von Verwaltungsansichten Ihrer Bacula-Jobs innerhalb eines Web-Browsers und ``bimagemgr'', ein Dateibrowser, der verwendet wird, um aus Bacula-Volumes CD-Images zu brennen.

bacula-rescue-1.8.1.tar.gz
Dies ist der Code für die Bacula Rettungs-CD. Die Versionsnummer diese Paketes ist nicht an die Versionsummer von Bacula gebunden und wird sich daher unterscheiden. Mit diesem Code können Sie eine CD brennen, die unter anderem eine Beschreibung Ihrer Systemkonfiguration und die statisch gelinkte Version des File-Dämons enthält. Damit können Sie im Falle eines Festplattenausfalles mit Hilfe von Bacula Ihre Festplatten neu partitionieren, formatieren und Ihr System auf einfache Art wiederherstellen.

Bacula upgraden

Wenn Sie Bacula von einer Version auf die nächste upgraden, sollten Sie erst die ReleaseNotes aller Versionen zwischen Ihrer laufenden und jener, auf die sie upgraden wollen, sorgfältig lesen. Wenn die Bacula Catalog-Datenbank upgegraded wurde, müssen Sie entweder ganz von vorne anfangen und Ihre Datenbank neu initialisieren oder diese als ASCII-Datei sichern und dann mit dem Upgrade fortfahren. Dies geschieht normalerweise nachdem Bacula kompiliert und installiert ist durch Eingabe von:

cd <installed-scripts-dir> (default /etc/bacula)
./update_bacula_tables

Dieses Update-Skript finden Sie auch in Baculas Quellcode im Verzeichnis ``src/cats'':

Gab es zwischen Ihrer Version und der aktuellen mehrere Datenbank-Upgrades, werden Sie jedes einzelne Datenbank Upgradeskript ausführen müssen. Um Ihnen dies zu erleichtern, sind alle alten Upgrade-Skripte im Verzeichnis upgradedb des Quellcodes. Sie werden diese Skripte den Gegebenheiten Ihrer Systemkonfiguration anpassen müssen.

Das letzte Upgrade-Skript (wenn vorhanden) wird dann so ausgeführt, wie es oben beschrieben ist.

Wenn Sie von einer Hauptversion auf die nächste upgraden, müssen alle Komponenten gleichzeitig ersetzt werden, da sich in der Regel das Übertragungs-Protokoll zwischen den Dämonen ändert. Innerhalb eines bestimmten Release (z.B. Version 1.32.x) wird sich das Dämon-Protokoll jedoch nicht ändern solange nicht ein Bug oder ein Versehen zu beheben ist. Wenn das alles für Sie verwirrend ist, lesen Sie einfach die ReleaseNotes sehr sorgfältig. Es wird hier stehen, wenn alle Dämonen gleichzeitig upgegraded werden müssen.

Beachten Sie schließlich, dass es in der Regel nicht notwendig ist, vor dem Upgrade ein make uninstall auszuführen. Tatsächlich werden Sie so sehr wahrscheinlich alle ihre Konfigurationsdateien zerstören, was verheerend sein könnte. Die normale Upgrade-Prozedur besteht einfach in der Eingabe von make install. Im allgemeinen werden dabei keine Ihrer ``.conf''- oder ``.sql''-Dateien überschrieben.

Weiteres zum Upgraden lesen sie im Abschnitt Upgrading Bacula Versions im Kapitel ``Tips'' in diesem Handbuch.


Dependency-Packages

Wie oben erwähnt, haben wir einige Pakete von Drittanbietern, die Bacula möglicherweise benötigt, in den Releases depkgs und depkgs1 zusammengefasst. Natürlich können Sie sich auch die neuesten Versionen von den Original-Autoren besorgen. Die Quellen der einzelnen Pakete stehen in der README-Datei jedes einzelnen Paketes. Beachten Sie jedoch, dass die Pakete der depkgs-Dateien von uns auf ihre Kompatibilität zu Bacula getestet wurden.

Typischerweise heißen die Dependency-Packages depkgs-ddMMMyy.tar.gz und depkgs1-ddMMyy.tar.gz wobei dd der Tag, MMM der Monat in abgekürzter Form (z.B. ``Jan'') und yy das Jahr ist, an dem es herausgegeben wurde. Ein aktuelles Beispiel ist: depkgs-07Apr02.tar.gz. Um es zu installiern und zu kompilieren (wenn es benötigt wird) gehen Sie wie folgt vor:

  1. Erstellen sie ein bacula-Verzeichnis, in das Sie sowohl die Bacula-Quelldateien als auch das Dependency-Packages legen.
  2. Entpacken Sie das depkg mit ``detar'' in das bacula-Verzeichnis.
  3. cd bacula/depkgs
  4. make

Die genaue Zusanmmensetzung der Dependency-Packages wird sich von Zeit zu Zeit ändern. Momentan sehen sie so aus:

Drittanbieterpaket depkgs depkgs1 depkgs-win32
SQLite X - -
mtx X - -
readline - X -
pthreads - - X
zlib - - X
wxWidgets - - X

Beachten Sie, dass einige dieser Pakete recht umfangreich sind, so dass ihre Compilierung einige Zeit beanspruchen kann. Mit den obigen Anweisungen werden alle Pakete im entsprechenden Verzeichnis kompiliert. Bacula wird allerdings bei seine Kompilierung nur jene Teile verwenden, die es tatsächlich benötigt.

Alternativ können Sie nur jene Pakete kompilieren, die Sie tatsächlich benötigen. Beispielsweise wird

cd bacula/depkgs
make sqlite

nur das ``SQLite''-Paket konfigurieren und kompilieren.

Sie sollten die benötigten Pakete aus depkgs und/oder depkgs1 kompilieren bevor Sie Bacula konfigurieren und kompilieren, da Bacula diese während seiner eigenen Kompilierung benötigt.

Auch wenn Sie SQLite nicht verwenden, könnte es sich für Sie lohnen mtx zu kompilieren, da das enthaltenen tapeinfo-Programm oft wertvolle Informationen über Ihr SCSI-Bandlaufwerk (z.B. Kompression, min./max. Blockgröße...) liefern kann.

Das depkgs-win32-Paket enthält den Qullcode der ``Pthreads''-, ``wxWidgets''- und ``zlib''-Bibliotheken, die das Win32-Clientprogramm verwendet. Man benötigt diese nur, wenn Sie das Win32-Programm selbst kompilieren wollen.


Unterstützte Betriebssysteme

Lesen sie bitte den Abschnitt Unterstützte Betriebssysteme im Kapitel ``QuickStart'' dieses Handbuches.


Bacula aus dem Quellcode kompilieren

Die Grundinstallation ist ziemlich einfach.

  1. Installieren und kompilieren sie alle benötgten depkgs wie oben beschrieben.
  2. Konfigurieren und installieren Sie ``MySQL'' oder ``PostgreSQL'' (wenn gewünscht) Installation und Konfiguration von MySQL Phase I oder Installation und Konfiguration von PostgreSQL Phase I. Wenn Sie für die Installation von ``MySQL'' ein RPM verwenden, müssen Sie auch mysql-devel installieren, so dass die Header-Dateien verfügbar sind, wenn Sie Bacula kompilieren. Zusätzlich erfordert die MySQL Client-Bibliothek die gzip-Kompressionsbibliotheken libz.a oder libz.so. Wenn Sie RPM-Pakete verwenden, sind diese Bibliotheken im Paket zlib1g-dev. Auf Debian-Systemen müssen Sie das zlib1g-dev-Paket laden. Wenn Sie weder RPMs noch debs verwenden, müssen Sie die passenden Pakete für Ihr System selbst finden. Wenn auf Ihrem System schon MySQL oder PostgreSQL läuft, können Sie diese Phase überspringen, wenn Sie ``thread safe''-Bibliotheken kompiliert und die oben erwähnten zusätzlichen RPMs installiert haben.

  3. Anstatt ``MySQL'' und ``PostgreSQL'' können Sie auch SQLite konfigurieren und installieren Installation und Konfiguration von SQLite. Dessen Quellcode ist Teil des depkgs-Paketes.
  4. Entpacken sie Baculas Quellcode vorzugsweise in das bacula-Verzeichnis, welches oben erwähnt wurde.
  5. Wechseln (cd) Sie in das Verzeichnis mit dem Quellcode.
  6. Führen Sie ./configure aus (mit den entsprechenden Konfigurationsoptionen, die weiter unten näher beschrieben sind.
  7. Prüfen Sie die Ausgabe des ./configure-Befehls sehr sorgfältig, besonders die Ausgaben zum Installationsverzeichnis der Programm- und der Konfigurationsdateien. Sind diese nicht korrekt, wiederholen Sie ./configure bis sie stimmen. Die Ausgabe des ./configure-Befehls ist in der Datei config.out abgespeichert und kann jederzeit wieder angesehen werden, ohne ./configure neu zu starten, indem man cat config.out eingibt.
  8. Wenn Sie Optionen ändern, nachdem ./configure gelaufen war und Sie es neu starten müssen, geben Sie vorher das folgende ein.

          make distclean
    

    Damit gehen Sie sicher, dass Sie wirklich von vorne anfangen und keine Mischung der verschiedenen Optionen haben. Dies liegt daran, dass ./configure einen Großteil der Informationen zwischenspeichert. make distclean ist auch sehr wichtig, wenn Sie die Quellverzeichnisse auf einen anderen Rechner verlagern. Schlägt der Befehl fehl, ignorieren Sie das einfach und machen mit

  9. make

    weiter.

    Wenn es hierbei Fehlermeldungen beim Linken in das Verzeichnis (src/stored) des Storage-Dämon gibt, liegt es vielleicht daran, dass sie die statischen Bibliotheken in Ihrem System nicht geladen sind. Diese Problem bemerkte ich auf einem Solaris-System. Verwenden sie den ./configure-Befehl ohne die Option --enable-static-tools um den Fehler zu beheben.

  10. make install

  11. Wenn Sie ein Bacula-Neuling sind, empfehlen wir dringend, den nächsten Schritt zu überspringen und die Vorgabe-Konfigurationsdateien zu verwenden. Probieren Sie damit das Beispiel im nächsten Kapitel aus und ändern sie danach Ihre Konfigurationsdateien, so dass sie Ihren eigenen Anforderungen entsprechen.

  12. Passen Sie die Konfigurationsdateien aller drei Dämonprozesse und die des Console-Programms an. Einzelheiten hierzu im Abschnitt Setting Up Bacula Configuration Files des Kapitels ``Konfiguration'' in diesem Handbuch. Wir empfehlen Ihnen, an den beigefügten Vorgabe-Konfigurationsdateien zunächst nur soviel zu ändern wie unbedingt notwendig ist. Eine endgültige Anpassung ist immer noch möglich, wenn Bacula zuverlässig läuft. Passen Sie bitte auf, wenn sie die (zufällig generierten) Passwörter und die Namen verändern. Aus Sicherheitsgründen müssen diese in den Konfigurationsdateien übereinstimmen.

  13. Erzeugen Sie die Datenbank und die Tabellen für Bacula in MySQL (wenn sie MySQL verwenden)(MySQL installieren und Konfigurieren Phase II, in PostgreSQL (PostgreSQL installieren und Konfigurieren Phase II) oder gegebenenfalls in SQLite (SQLite installieren und Konfigurieren Phase II).

  14. Starten Sie Bacula (./bacula start). Im nächsten Kapitel wird dies im einzelnen erklärt.
  15. Kommunizieren Sie mit Bacula über das Console-Programm.

  16. Folgen Sie für die letzten beiden Punkte den Anweisungen im Kapitel Running Bacula diese Handbuches, wo Sie eine einfache Sicherung und eine Wiederherstellung durchführen. Tun Sie dies bevor Sie die Konfiguratinsdateien in größerem Umfang verändern, so dass Sie sicher sein können, dass Bacula funktioniert und Sie damit vertraut sind. Danach wird es einfacher sein, die Konfigurationsdateien anzupassen.

  17. Wenn Sie nach der Installation beschließen, mit Bacula ``umzuziehen'', d.h. es in anderen Verzeichnissen installieren zu wollen, gehen Sie wie folgt vor:

          make uninstall
          make distclean
          ./configure (mit-den-neuen-Optionen)
          make
          make install
    

Wenn alles gut geht, wird der ./configure-Prozess Ihr laufendes Betriebssystem korrekt erkennen und den Quellcode entsprechend konfigurieren. Momentan werden FreeBSD, Linux (Red Hat) und Solaris unterstützt. Von MacOS X 10.3 wird berichtet, dass der Client nur dann darauf läuft, wenn die readline-Unterstützung deaktiviert ist.

Wenn Sie Bacula auf mehr als einem System installieren, können Sie einfach den Verzeichnisbaum des Quellcodes auf den anderen Rechner übertragen und ein ``make install'' ausführen. Gibt es jedoch Unterschiede in den Bibliotheken, den Betriebssystemversionen oder soll es auf einem anderen Betriebssystem installiert werden, sollten Sie mit der originalen tar-Datei beginnen. Wenn Sie die Verzeichnisstruktur des Quellcodes übertragen und den ./configure-Befehl schon ausgeführt haben, müssen Sie unbedingt

make distclean

ausführen, bevor Sie ``./configure'' erneut aufrufen. Dies liegt daran, dass ``GNU autoconf'' die Konfiguration zwischenspeichert und wenn Sie beispielsweise die Konfiguration eines Linux-Rechners auf einem Solaris-System wiederverwenden, können Sie sicher sein, dass die Kompilierung fehlschlägt. Um dies zu vermeiden starten Sie entweder mit der tar-Datei oder führen ``make distclean'' aus, wie oben erwähnt.

Gewöhnlich werden Sie einen etwas komplizierteren configure-Befehl absetzen wollen, um sicher zu gehen, dass die von Ihnen gewünschten Module kompiliert werden und alles in den richtigen Verzeichnissen abgelegt wird.

Auf RedHat zum Beispiel könnte ``./configure'' so aussehen:

CFLAGS="-g -Wall" \
  ./configure \
    --sbindir=$HOME/bacula/bin \
    --sysconfdir=$HOME/bacula/bin \
    --with-pid-dir=$HOME/bacula/bin/working \
    --with-subsys-dir=$HOME/bacula/bin/working \
    --with-mysql=$HOME/mysql \
    --with-working-dir=$HOME/bacula/bin/working \
    --with-dump-email=$USER

Beachten Sie bitte, dass der Vorteil der Verwendung der obigen Konfiguration für den Anfang darin liegt, dass hierbei alles in ein einziges Verzeichnis geschrieben wird, welches später gelöscht werden kann, wenn Sie die Beispiele des nächsten Kapitels ausgeführt und gelernt haben wie Bacula funktioniert. Ausserdem kann das Obige auch ohne root-Rechte installiert und ausgeführt werden.

Um den Entwicklern die Arbeit zu erleichtern, haben wir dem Verzeichnis examples ein defaultconfig-Skript beigefügt. Diese Skript enthält alle Statements, die man normalerweise benutzt und jeder Entwickler oder Benutzer kann sie nach seinen Bedürfnissen verändern. In diesem Verzeichnis sind auch andere nützliche Beispiele.

Die ./configure-Schalter --enable-conio oder --enable-readline sind nützlich, da man dadurch eine Kommandozeilen-History und ein Editorfunktionen für die Kommandozeile des Console-Programms erhält. Wenn Sie eine dieser Optionen verwenden, benötigen Sie beim Linken entweder das termcap- oder das ncurses-Paket. Auf manchen Systemen wie z.B. ``SuSE'' ist die termcap-Bibliothek nicht im Verzeichnis der Standard-Bibliotheken. Daher kann diese Option wirkungslos sein oder Sie erhalten folgende Fehlermeldung

/usr/lib/gcc-lib/i586-suse-linux/3.3.1/.../ld:
cannot find -ltermcap
collect2: ld returned 1 exit status

während Sie die Bacula-Console kompilieren. In diesem Fall müsssen Sie die LDFLAGS-Umgebungsvariable vor der Kompilierung wie folgt setzen:

export LDFLAGS="-L/usr/lib/termcap"

Die gleichen Erfordernisse an die Systembibliothek gelten, wenn sie die ``Readline''-Subroutinen für das Editieren und die History der Kommandozeile benutzen wollen oder eine MySQL-Bibliothek, die Verschlüsselung erfordert. Wenn Sie Verschlüsselung benötigen, können Sie entweder die entsprechenden zusätzlichen Bibliotheks-Pfade wie oben gezeigt setzen oder wie unten gezeigt direkt in der Befehlzeile des Befehls mit angeben.

LDFLAGS="-lssl -lcyrpto" \
   ./configure \
      <Ihre-Optionen>

Auf manchen Systemen wie Mandriva neigt ``readline'' dazu, die Eingaben zu verstümmeln, was es völlig unbrauchbar macht. Wenn das bei Ihnen geschieht, wählen Sie die Option ab oder, wenn Sie Version 1.33 oder höher verwenden, versuchen Sie mit der Option --enable-conio den eingebauten ``readline''-Ersatz zu verwenden. Auch hierzu werden Sie entweder die ``termcap''- oder ``ncurses''-Bibliothek benötigen, doch es ist unwahrscheinlich, dass das conio-Paket Ihre Eingaben dann verstümmelt.

``readline'' wird ab Version 1.34. nicht weiter unterstützt. Der Code ist noch verfügbar und wenn Benutzer dafür Patches schicken, wird es mir ein Vergnügen sein, diese einzubauen. Da jedoch jede Version von ``readline'' mit den Vorgängerversionen inkompatibel zu sein scheint und zwischen den Systemen wesentliche Unterschiede bestehen, kann ich es mir nicht mehr länger leisten, es zu unterstützen.


Welches Datenbanksystem soll verwendet werden?

Vor der Kompilierung von Bacula müssen Sie sich entscheiden, ob Sie SQLite, MySQL oder PostgreSQL verwenden werden. Wenn bei Ihnen nicht sowieso schon MySQl oder PostgrSQL läuft, empfehlen wir versuchsweise mit SQLite zu beginnen. Dies wird Ihnen die Einrichtung wesentlich erleichtern, da SQLite in Bacula hineinkompiliert wird und keine Administration erfordert. Es hat hat eine ganz ordentliche Performanz und ist für kleine bis mittlere Installationen gut geeignet (maximal 10 bis 20 Rechner). Allerdings sollten wir erwähnen, dass einige unserer Benutzer mit SQLite unerklärliche Datenbankkorruptionen hatten. Für ein Produktiv-System empfehlen wir daher die Installation von MySQL oder PostgreSQL:

Wenn Sie für den Bacula-Catalog MySQL verwenden wollen, lesen Sie bitte das Kapitel MySQL installieren und konigurieren in diesem Handbuch. Sie werden hierzu MySQL installieren müssen, bevor Sie Bacula konfigurieren. MySQL ist ein Datenbanksystem von hoher Qualität, das sehr effizient arbeitet und für Installationen jeder Größe geeignet ist. Seine Einrichtung und Administration sind ein wenig komplizierter als die von SQLite, da es einige Besonderheiten wie userids und Passwörter bietet. Es läuft als eigenständiger Prozess, ist wirklich professionell und kommt mit Datenbanken jeder Größe zurecht.

Wenn Sie PostgreSQL als Bacula-Catalog verwenden wollen, lesen Sie bitte das Kapitel PostgreSQL installieren und konfigurieren in diesem Handbuch. Bevor Bacula konfiguriert wird, muss PostgreSQl installiert sein. Es ist MySQL sehr ähnlich, dabei aber eher etwas mehr SQL92-kompatibel und hat viele Features wie ``Transaktionen'', ``Stored Procedures'' und ähnliches. Man braucht eine gewisses Erfahrung, um es zu installieren und zu warten.

Wenn Sie als Bacula Catalog SQLite verwenden wollen, lesen Sie bitte das Kapitel SQLite installieren und konfigurieren in diesem Handbuch.

Quick Start

Unten werden nun einige Optionen und wichtige Vorüberlegungen ausgeführt, die Sie jedoch für den Moment überspringen können, wenn Sie mit der vereinfachten Konfiguration, wie sie oben gezeigt wurde, keine Probleme hatten.

Falls der ``./configure''-Prozess bestimmte Bibliotheken (z.B. ``libintl'') nicht findet, vergewissern Sie sich, dass das entsprechende Paket auf Ihrem Rechner installiert ist. Wenn das Paket an einem Ort installiert ist, denn Bacula nicht erwartet, kann in der Regel mit einem der im Folgenden aufgeführten Optionsschalter ein Suchpfad übergeben werden. "./configure --help" liefert eine Liste aller Optionen. Das letzte Mittel ist, ein Feature durch einen entsprechenden Optionschalter zu deaktivieren (z.B. ``--disable-nls'').

Wenn Sie richtig loslegen wollen, empfehlen wir, zum nächsten Kapitel weitergehen und das Beispielprogramm zum Laufen zu bringen. Es wird Sie viel über Bacula lehren und kann zum Ausprobieren in ein einzelnes Verzeichnis installiert (um es auf einfache Art wieder löschen zu können) und ohne root-Rechte betrieben werden. Wenn irgendwelche Probleme auftreten oder Sie richtig installieren wollen, kehren Sie zu diesem Kapitel zurück und lesen Sie die Einzelheiten, die nun folgen.


Konfigurationsoptionen

Um Ihre Installation anzupassen, hat der configure-Befehl die folgenden Kommandozeilen-Schalter.

--sysbindir=<Pfad/zu/den/Programmdateien>
Legt fest, in welches Verzeichnis die Bacula Programmdateien bei Ausführung des make install-Befehls installiert werden.

--sysconfdir=<Pfad/zu/den/Konfigurationsdateien>
Legt fest, in welches Verzeichnis die Bacula Konfigurationsdateien bei Ausführung des make install-Befehls installiert werden.

--mandir=<path>
Vorgabemäßig installiert Bacula eine einfache Unix-manpage in ``/usr/share/man''. Soll die manpage an einen anderen Ort, können Sie mit dieser Option einen Pfad setzen. Beachten Sie bitte, dass die Bacula-Handbücher (HTML- und PDF-Dateien) Bestandteil eines eigenen tar-Files sind, das nicht Bestandteil des Quellcode-Releases ist.

--datadir=<path>
Wenn Sie Bacula oder Teile davon übersetzen wollen, können Sie die `` --datadir''-Option verwenden um den Speicherort der ``po''-Dateien festzulegen. Die ``po''-Dateien müssen ``von Hand'' installiert werden, da Bacula dies (noch) nicht automatisch tut.

--enable-smartalloc
Damit wird der ``Smartalloc orphaned buffer detection code'' mit eingebunden. Diese Option ist dringend empfohlen. Da wir nie ohne diese Option kompilieren, werden Sie vielleicht Probleme haben, wenn sie nicht gesetzt ist. Wir empfehlen dringend, diesen Schalter gesetzt zu lassen, da er hilft, Memory-Leaks zu entdecken. Dieser Konfigurationsparameter wird bei der Kompilierung von Bacula benutzt.

--enable-gnome
Ist auf Ihrem Computer GNOME installiert und wollen Sie das grafische GNOME-Interface benutzen, setzen Sie diesen Schalter. Dadurch wird alles im Verzeichnis src/gnome-console kompiliert.

--enable-wx-console
Wenn auf Ihrem Rechner wxWidgets installiert ist und sie das grafische wxWidgets Console-Interface benutzen wollen, müssen Sie diesen Schalter setzen. Hierdurch wird alles im Verzeichnis src/wx-console kompiliert. Dies kann auch für Benutzer hilfreich sein, die eine grafische Konsole benutzen, aber GNOME nicht installieren wollen, da wxWidgets mit GTK+-, Motif- und sogar X11-Bibliotheken läuft

--enable-tray-monitor
Wenn Sie auf Ihrem Rechner GTK installiert haben und eine grafische Umgebung oder einen Window-Manager benutzen, der dem Standard für die System-Tray von FreeDesktop entspricht (wie KDE oder GNOME) und wenn sie Ihre GUI benutzen wollen, um die Bacula-Dämonen zu überwachen, sollten sie diesen Schalter setzen. Ist er gesetzt, wird alles im Verzeichnis src/tray-monitor kompiliert.

--enable-static-tools
Durch Setzen dieses Schalters werden die Hilfsprogramme des Storage-Dämons (bls, bextract, and bscan) statisch gelinkt. Dadurch kann man sie auch verwenden, ohne dass die gemeinsamen Bibliotheken geladen sind. Wenn beim Linken Probleme im Verzeichnis src/stored auftreten, sollten sie sich vergewissern, dass diese Option nicht gesetzt ist. Sie können durch Setzen des Schalters --disable-static-tools das statische Linken auch explizit unterdrücken.

--enable-static-fd
Durch diese Option kompiliert der make-Prozess zusätzlich zum Standard File-Dämon einen statischen Bacula File-Dämon. Diese statische Version hat alle benötigten Bibliotheken statisch gelinkt und wird für eine Notfallwiederherstellung auf einer leeren Festplatte verwendet. Diese Option kann meistens durch den Befehl make static-bacula-fd ersetzt werden, den man im Verzeichnis src/filed ausführen kann. Daneben ist auch die unten beschriebene Option --enable-client-only nützlich, wenn man nur einen einzelnen Client kompilieren will und die übrigen Programmteile nicht.

Wird ein statisches Programm gelinkt, benötigt der Linker alle verwendeten Bibliotheken in statischen Versionen. Benutzer, die diese Option häufiger verwenden, werden auch häufiger Linker-Fehler haben. Als Erstes sollte man dann überprüfen, ob auf dem System eine statische ``glibc''-Bibliothek installiert ist. Als nächstes sollte man `./configure'' ohne die Optionen --openssl und --with-python aufrufen, da hierbei zusätzliche Bibliotheken benötigt werden. Man kann diese Optionen verwenden, doch muss man dann zusätzliche statische Bibliotheken laden.

--enable-static-sd
Damit wird zusätzlich zum Standard-Storage-Dämon ein statischer Storage-Dämon kompiliert. Die statische Version hat die Bibliotheksfunktionen fest eingebaut und ist bei der Datenwiederherstellung im Notfall hilfreich.

Wird ein statisches Programm gelinkt, benötigt der Linker alle verwendeten Bibliotheken in statischen Versionen. Benutzer, die diese Option häufiger verwenden, werden auch häufiger Linker-Fehler haben. Als Erstes sollte man dann überprüfen, ob auf dem System eine statische ``glibc''-Bibliothek installiert ist. Als nächstes sollte man `./configure'' ohne die Optionen --openssl und --with-python aufrufen, da hierbei zusätzliche Bibliotheken benötigt werden. Man kann diese Optionen verwenden, doch muss man dann zusätzliche statische Bibliotheken laden.

--enable-static-dir
Damit wird zusätzlich zum Standard-Director ein statischer Director kompiliert. Die statische Version hat die Bibliotheksfunktionen fest eingebaut und ist bei der Datenwiederherstellung im Notfall hilfreich.

Wird ein statisches Programm gelinkt, benötigt der Linker alle verwendeten Bibliotheken in statischen Versionen. Benutzer, die diese Option häufiger verwenden, werden auch häufiger Linker-Fehler haben. Als Erstes sollte man dann überprüfen, ob auf dem System eine statische ``glibc''-Bibliothek installiert ist. Als nächstes sollte man `./configure'' ohne die Optionen --openssl und --with-python aufrufen, da hierbei zusätzliche Bibliotheken benötigt werden. Man kann diese Optionen verwenden, doch muss man dann zusätzliche statische Bibliotheken laden.

--enable-static-cons
Damit werden zusätzlich zur Standard-Console eine statische Console und statische GNOME-Console kompiliert. Die statischen Versionen haben die Bibliotheksfunktionen fest eingebaut und sind bei der Datenwiederherstellung im Notfall hilfreich.

Wird ein statisches Programm gelinkt, benötigt der Linker alle verwendeten Bibliotheken in statischen Versionen. Benutzer, die diese Option häufiger verwenden, werden auch häufiger Linker-Fehler haben. Als Erstes sollte man dann überprüfen, ob auf dem System eine statische ``glibc''-Bibliothek installiert ist. Als nächstes sollte man `./configure'' ohne die Optionen --openssl und --with-python aufrufen, da hierbei zusätzliche Bibliotheken benötigt werden. Man kann diese Optionen verwenden, doch muss man dann zusätzliche statische Bibliotheken laden.

--enable-client-only
Durch Setzen dieses Schalters werden nur der File-Dämon und die von ihm benötigten Bibliotheken kompiliert. Keiner der anderen Dämonen, nicht die Sicherungswerkzeuge oder die Console werden kompiliert. Daher wird mit dem Befehl make install auch nur der File-Dämon installiert. Um alle Dämonen zu kompilieren, müssen Sie eine Konfiguration ohne diese Option verwenden. Mit dieser Option wird die Kompilierung nur eines Client-Prozesses auf einem Client-Rechner sehr erleichtert.

Wird ein statisches Programm gelinkt, benötigt der Linker alle verwendeten Bibliotheken in statischen Versionen. Benutzer, die diese Option häufiger verwenden, werden auch häufiger Linker-Fehler haben. Als Erstes sollte man dann überprüfen, ob auf dem System eine statische ``glibc''-Bibliothek installiert ist. Als nächstes sollte man `./configure'' ohne die Optionen --openssl und --with-python aufrufen, da hierbei zusätzliche Bibliotheken benötigt werden. Man kann diese Optionen verwenden, doch muss man dann zusätzliche statische Bibliotheken laden.

--enable-largefile
Mit diesem Schalter (voreingestellt) wird Bacula mit der Unterstützung für 64 Bit breite Adressen kompiliert, sofern dies Ihr Rechner unterstützt. Damit kann Bacula Dateien lesen und schreiben, die größer sind als 2 GBytes. Dieses Feature kann durch setzen des Schalters --disable-largefile abgewählt werden. Damit sind nur 32 Bit breite Adressen möglich.

--disable-nls
Vorgabemäßig verwendet Bacula ``GNU Native Language Support''-Bibliotheken (NLS). Auf manchen Rechnern sind diese Bibliotheken nicht verfügbar oder funktionieren nicht richtig (beonders auf nicht-Linux Implementierungen). In diesen Fällen kann man durch Setzen von --disable-nls die Verwendung dieser Bibliotheken unterbinden. In diesem Fall benutzt Bacula Englisch.

--with-sqlite=<Pfad/zu/SQLite>
Mit dieser Option wird die Benutzung eines SQlite-Datenbanksystems ermöglicht. Da Bacula an einem Standard-Speicherort (depkgs/sqlite) sucht, wird der Pfad sqlite-path normalerweise nicht angegeben. Näheres hierzu im Kapitel SQLite installieren and konfigurieren in diesem Handbuch. Beachten Sie auch den Hiinweis zur Option ``--with-postgresql''.

--with-sqlite3=<Pfad/zu/sqlite3>
Dies erlaubt die Verwendung von SQLite in der Version 3.x. Der Pfad (sqlite3-path) muss normalerweise nicht gesetzt werden, da Bacula die benötigten Komponenten an den Standardspeicherorten (depkgs/sqlite3) sucht. Im Kapitel SQLite installieren und konfigurieren dieses Handbuches finden sie weitere Einzelheiten.

--with-mysql=<Pfad/zu/MySQL>
Mit dieser Option werden die Catalog-Dienste für Bacula kompiliert. Sie setzt voraus, dass MySQL bereits auf Ihrem Rechner läuft, und erwartet, dass es im Verzeichnis, das Sie mit der Pfadangabe (mysql-path) angeben, installiert ist. Wenn dieser Schalter nicht gesetzt ist, wird Bacula automatisch den Code der internen Bacula-Datenbank einbeziehen. Nach Möglichkeit empfehlen wir, diesen Schalter zu setzen. Wenn Sie ihn verwenden, installieren Sie bitte zuerst MySQL und lesen das Kapitel MySQL installieren and konfigurieren in diesem Handbuch bevor Sie mit der Konfiguration fortfahren.

--with-postgresql=<Pfad/zu/PostgreSQL>
Dieser Schalter erfordert die Angabe des Pfades zum PostgreSQL-Programmverzeichnis, da Bacula ihn nicht von selbst finden kann. Zur Kompilierung mit PostgreSQL verwendet man einfach --with-postgresql.

Um Bacula richtig zu konfigurieren, muss eine der vier unterstützten Datenbank-Optionen spezifiziert sein. Entweder also ``--with-sqlite'', ``--with-sqlite3'', ``--with-mysql'' oder `--with-postgresql''. Andernfalls wird der ``./configure''-Prozess fehlschlagen.

--with-openssl=<path>
Diese Schalter wird benötigt, wenn Bacula TLS (ssl) verwenden soll. In der Regel muss der Pfad nicht spezifiziert werden, da der Konfigurationsprozess die OpenSSL-Bibliotheken an deren Standardorten sucht. Wenn OpenSSL aktiviert ist, gestattet Bacula eine sichere Kommunikation zwischen seinen Dämonprozessen. Weitere Informationen zur Verwendung von TLS im Kapitel Bacula TLS in diesem Handbuch.

--with-python=<Pfad/zu/Python>
Mit diese Option wird die Bacula-Unterstützung für Python aktiviert. Wird kein Pfad mit angegeben, sucht der Konfigurationsprozess Bibliotheken an den Standard-Installationsorten von Python 2.2., 2.3 und 2.4. Wird die Bibliothek nicht gefunden, muss die Option mit dem Pfad zum Verzeichnis Ihrer Python-Bibliotheken aufgerufen werden. Im Kapitel Python sind Einzelheiten dazu, wie man Python-Scripting verwenden kann.

--with-libintl-prefix=<DIR>
Mit dieser Option durchsucht Bacula die Verzeichnisse ``DIR/include'' und ``DIR/lib'' nach den ``libintl''-Headern und -Bibliotheken, die es für den ``Native Language Support'' (NLS) benötigt.

--enable-conio
Teilt Bacula mit, die kleine, leichtgewichtige, ``readline'' ersetzende Routine zu kompilieren. Diese ist im allgemeinen sehr viel einfacher zu konfigurieren als ``readline'', benötigt aber entweder die ``termcap''- oder ``ncurses''-Bibliothek.

--with-readline=<Pfad/zu/readline>
Teilt Bacula mit, wo readline installiert ist. Sofern es Teil der Standard-Bibliothek ist, findet Bacula normalerweise ``readline''. Wird es nicht gefunden, und ist der Schalter --with-readline gesetzt, wird readline deaktiviert. Diese Option betrifft Baculas Kompilierung. Mit Readline ist im der Console-Programm eine History und ein Editieren der Kommandozeile möglich. Readline wird nicht mehr unterstützt. Sie sind daher bei Problemen auf sich allein gestellt.

--enable-readline
Damit wird Bacula mitgeteilt, die Readline-Unterstütung zu ermöglichen. Das Paket scheint sich in inkompatibler Weise von Version zu Version zu ändern. Daher ist wegen der Vielzahl der Konfigurationsprobleme dieser Schalter normalerweise nicht gesetzt.

--with-tcp-wrappers=<Pfad/zur/TCP-Wrapper/Bibliothek>
Damit wird spezifiziert, dass Bacula mit TCP-Wrappern (man hosts_access(5)) kompiliert werden soll. Die Angabe des Pfades ist optional, da Bacula die Bibliotheken an den Standard-Speicherorten findet. Diese Option betrifft Baculas Kompilierung. Wenn Sie bei der Spezifikation der Einschränkungen in ihren /etc/hosts.allow- und /etc/hosts.deny-Dateien die twist-Option (hosts_options(5)) verwenden, wird sich der Bacula-Prozess beenden. Beachten Sie bitte, dass Sie beim Einrichten Ihrer /etc/hosts.allow- und /etc/hosts.deny-Dateien die infrage kommenden Bacula-Dämonen mit deren Namen aus der Konfigurationsdatei und nicht mit deren jeweiligen Programmnamen bezeichnen.

Weitere Informationen zur Konfiguration und zum Test der TCP-Wrapper im Abschnitt TCP Wrapper konfigurieren und testen des Kapitels zur Sicherheit.

--with-working-dir=<Pfad/zum/Arbeitsverzeichnis>
Die Angabe dieser Option ist zwingend und spezifizert das Verzeichnis, in welches Bacula zwischen seinen Ausführungen seine Dateien sichert. Wenn z.B. die interne Datenbank verwendet wird, werden deren Dateien hier abgelegt. Diese Option wird nur benutzt, um die Konfigurationsdateien der Dämonen zu verändern. Das Gleiche erreichen Sie, wenn Sie die Konfigurationsdateien nachträglich ändern. Das Arbeitsverzeichnis wird bei der Installation nicht automatisch erstellt, so dass Sie sicherstellen müssen, dass es vor der ersten Benutzung von Bacula vorhanden ist.

--with-base-port=<Port=Nummer>
Um funktioniern zu können, benötigt Bacula drei TCP/IC-Ports (einen für die Bacula-Console, einen für den Storage-Dämon und einen für den File-Dämon). Die Direktive --with-baseport weist automatisch drei Port Nummern zu, die mit der Basisadresse beginnen, die Sie spezifizieren. Auch in den sich ergebenden Konfigurationsdateien können Sie die Portnummern ändern. Sie müssen jedoch aufpassen, dass die Nummern in allen drei Konfigurationsdateien genau übereinstimmen. Der Vorgabe-Basisport hat die Nummer 9101. Damit sind die Ports 9101 bis 9103 zugewiesen. Diese Portnummern (9101, 9102, 9103) wurden von der IANA Bacula offiziell zugeteilt. Durch Setzen dieser Option verändern Sie nur die Konfigurationsdateien. Diese können Sie auch nach der Installation noch verändern.

--with-dump-email=<E-mail-Adresse>
Dieser Schalter spezifiziert die E-Mail-Adresse an die alle ``core dumps'' gesendet werden und wird normalerweise nur von Entwicklern verwendet.

--with-pid-dir=<Pfad>
Damit wird jenes Verzeichnis spezifiziert, in welchem Bacula die Datei mit den Prozess-IDs während seiner Ausführung ablegt. Vorgabemäßig ist dies /var/run. Diese Verzeichnis wird bei der Installation nicht angelegt. Daher sollten Sie sicher sein, dass es vorhanden ist, bevor Sie Bacula zum ersten Mal verwenden.

--with-subsys-dir=<Pfad>
Dieser Schalter spezifiziert den Ort, an dem Bacula die Subsystem-Lock Datei während seiner Ausführung ablegt. Vorgabe ist /var/run/subsys. Stellen Sie sicher, dass sie hierfür und das sbindir-Verzeichnis nicht das gleiche Verzeichnis spezifizieren. Dieses Verzeichnis wird nur innerhalb der Autostart-Skripten verwendet. Das ``subsys''-Verzeichnis wird bei Baculas Installation nicht erstellt, so dass Sie selbst sicherstellen müssen, dass es erstellt ist, bevor Sie Bacula verwenden.

--with-dir-password=<Passwort>
Mit diesem Schalter kann ein Passwort für den Zugang (in der Regel über das Console-Programm) zum Director spezifiziert werden. Ist der Schalter nicht gesetzt, generiert der Konfigurationsprozess ein zufälliges Passwort.

--with-fd-password=<Passwort>
Mit diesem Schalter kann ein Passwort für den Zugang zum File-Dämon spezifiziert werden (normalerweise vom Director aufgerufen). Wenn es nicht spezifiziert wurde, generiert der Konfigurationsprozess ein zufälliges Passwort.

--with-sd-password=<Passwort>
Mit diesem Schalter kann ein Passwort für den Zugang zum Storage-Dämon spezifiziert werden (normalerweise vom Director aufgerufen). Wenn es nicht spezifiziert wurde, generiert der Konfigurationsprozess ein zufälliges Passwort.

--with-dir-user=<User>

Durch Setzen dieses Schalters kann die User-ID festgelegt werden unter welcher der Director läuft. Der Director-Prozess muss als root gestartet werden, doch muss er nicht unter root laufen. Nach den ersten Initialisierungen kann er dem User übergeben werden, dessen ID Sie hier spezifizieren.

--with-dir-group=<Group>

Durch Setzen dieses Schalters kann die Group-ID festgelegt werden unter welcher der Director läuft. Der Director-Prozess muss als root gestartet werden, doch muss er nicht unter root laufen. Nach den ersten Initialisierungen kann er der Gruppe übergeben werden, deren ID Sie hier spezifizieren.

--with-sd-user=<User>
Mit diesem Schalter kann die User-ID festgelegt werden unter welcher der Storage-Dämon läuft. Der Storage-Dämon muss als root gestartet werden, doch muss er nicht unter root laufen. Nach den ersten Initialisierungen kann er dem User übergeben werden, dessen ID Sie hier spezifizieren. Wenn Sie diese Option verwenden, müssen Sie auch sicherstellen, dass der Storageprozess alle Geräte(Bandlaufwerke, usw.) verwenden darf, die er benötigt.

--with-sd-group=<Group>
Durch Setzen dieses Schalters kann die Group-ID festgelegt werden unter welcher der Storage-Dämon läuft. Der Storage-Dämon muss als root gestartet werden, doch muss er nicht unter root laufen. Nach den ersten Initialisierungen kann er der Gruppe übergeben werden, deren ID Sie hier spezifizieren.

--with-fd-user=<User>
Durch Setzen dieses Schalters kann die User-ID festgelegt werden unter welcher der File-Dämon läuft. Der File-Dämon muss als root gestartet werden und muss in den meisten Fällen auch unter root laufen. In ganz besonderen Fällen kann mit dieser Option der File-Dämon-Prozess nach den ersten Initialisierungen einem User übergeben werden, dessen ID Sie hier spezifizieren.

--with-fd-group=<Group>
Durch Setzen dieses Schalters kann die Group-ID festgelegt werden unter welcher der File-Dämon läuft. Der File-Dämon muss als root gestartet werden und muss in den meisten Fällen auch unter root laufen. Trotzdem kann der File-Dämon-Prozess nach den ersten Initialisierungen der Gruppe übergeben werden, deren ID Sie hier spezifizieren.

Beachten Sie bitte, dass durch Eingabe von ./configure --help noch viele andere Optionen angezeigt werden, diese aber bislang nicht implementiert sind.

Optionen, die wir für die meisten Systeme empfehlen

Wir empfehlen für die meisten Systeme mit folgenden Optionen zu beginnen:

./configure \
  --enable-smartalloc \
  --sbindir=$HOME/bacula/bin \
  --sysconfdir=$HOME/bacula/bin \
  --with-pid-dir=$HOME/bacula/bin/working \
  --with-subsys-dir=$HOME/bacula/bin/working \
  --with-mysql=$HOME/mysql \
  --with-working-dir=$HOME/bacula/working

Wenn Sie Bacula lieber in ein Installationsverzeichnis installieren wollen, als es aus seinem Kompilationsverzeichnis heraus zu betreiben (wie es Entwickler tun) müssen Sie den Schalter --sbindir and --sysconfdir mit den entsprechenden Pfaden verwenden. Dies ist nicht notwendig, wenn Sie ``make install'' nicht verwenden, wie es meistens bei der Programm-Entwicklung der Fall ist. Der Installationsprozess erzeugt die mit ``sbindir'' und ``sysconfdir'' angegebenen Verzeichnisse, aber nicht jene, die als ``pid-dir'', ``subsys-dir'' oder ``working-dir'' spezifiziert wurden. Sie müssen selbst sicherstellen, dass diese existieren, bevor Bacula das erste Mal läuft. Es folgt ein Beispiel dafür wie Kern das tut.

RedHat

Bei der Verwendung von SQLite:

 
CFLAGS="-g -Wall" ./configure \
  --sbindir=$HOME/bacula/bin \
  --sysconfdir=$HOME/bacula/bin \
  --enable-smartalloc \
  --with-sqlite=$HOME/bacula/depkgs/sqlite \
  --with-working-dir=$HOME/bacula/working \
  --with-pid-dir=$HOME/bacula/bin/working \
  --with-subsys-dir=$HOME/bacula/bin/working \
  --enable-gnome \
  --enable-conio

oder

 
CFLAGS="-g -Wall" ./configure \
  --sbindir=$HOME/bacula/bin \
  --sysconfdir=$HOME/bacula/bin \
  --enable-smartalloc \
  --with-mysql=$HOME/mysql \
  --with-working-dir=$HOME/bacula/working
  --with-pid-dir=$HOME/bacula/bin/working \
  --with-subsys-dir=$HOME/bacula/bin/working
  --enable-gnome \
  --enable-conio

oder, zum Schluss, eine vollständig traditionelle RedHat-Linux Installation:

CFLAGS="-g -Wall" ./configure \
  --prefix=/usr \
  --sbindir=/usr/sbin \
  --sysconfdir=/etc/bacula \
  --with-scriptdir=/etc/bacula \
  --enable-smartalloc \
  --enable-gnome \
  --with-mysql \
  --with-working-dir=/var/bacula \
  --with-pid-dir=/var/run \
  --enable-conio
Beachten Sie bitte, dass Bacula davon ausgeht, dass die Verzeichnisse /var/bacula, /var/run, und /var/lock/subsys bereits existieren und es diese während der Installation nicht automatisch erzeugt.

Beachten Sie bitte, dass bei Benutzung einer AMD64 CPU, die unter 64 bit CentOS4 läuft, mit gcc (GCC) 4.0.1 20050727 (Red Hat 4.0.1-5) ein Compiler Bug auftritt, so dass Code erzeugt wird, der eine Segmentverletzung verusacht. Typischerweise macht sich dies zuerst beim Storage-Dämon bemerkbar. Eine Lösung ist es, Bacula ohne Optimierung zu kompilieren (normalerweise ist dies -O2).

Solaris

Um Bacula aus den Quellcodedateien zu erzeugen, muss auf dem Solaris-System bereits das folgende installiert sein (das ist es standardmäßig nicht): libiconv, gcc 3.3.2, stdc++, libgcc (wegen der stdc++- und gcc_s-Bibliotheken), make 3.8 oder neuer.

Möglicherweise muss die PATH-Umgebungsvariable um ``/usr/local/bin'' und ``/usr/ccs/bin'' (wegen ar) ergänzt werden

#!/bin/sh
CFLAGS="-g" ./configure \
  --sbindir=$HOME/bacula/bin \
  --sysconfdir=$HOME/bacula/bin \
  --with-mysql=$HOME/mysql \
  --enable-smartalloc \
  --with-pid-dir=$HOME/bacula/bin/working \
  --with-subsys-dir=$HOME/bacula/bin/working \
  --with-working-dir=$HOME/bacula/working

Wie oben schon erwähnt, erzeugt der Installationsprozess die mit ``sbindir'' und ``sysconfdir'' bezeichneten Verzeichnisse, falls sie nicht schon vorhanden sind. Die Verzeichnisse ``pid-dir'', ``subsys-dir'' und ``working-dir'' werden nicht automatisch erzeugt. Vergewissern Sie sich daher, dass sie existieren, bevor Bacula zum ersten Mal laufen soll.

Beachten Sie bitte, dass Sie möglicherweise die folgenden Pakete installieren müssen, um Bacula kompilieren zu können:

SUNWbinutils,
SUNWarc,
SUNWhea,
SUNWGcc,
SUNWGnutls
SUNWGnutls-devel
SUNWGmake
SUNWgccruntime
SUNWlibgcrypt
SUNWzlib
SUNWzlibs
SUNWbinutilsS
SUNWGmakeS
SUNWlibm

export 
PATH=/usr/bin::/usr/ccs/bin:/etc:/usr/openwin/bin:/usr/local/bin:/usr/sfw/bin:/opt/sfw/bin:/usr/ucb:/usr/sbin

FreeBSD

Unter The FreeBSD Diary gibt es eine detailierte Beschreibung wie Bacula unter diesem Betriebssystem intalliert wird. Benutzer von FreeBSD, die eine Version von vor 4.9-STABLE (Montag, 29. Dezember 2003, 15:18:01 UTC) verwenden, sollten das Kapitel Test der Bandlaufwerke in diesem Handbuch lesen. Darin sind wichtige Informationen, wie man das Bandlaufwerk so konfiguriert, dass es mit Bacula zusammenarbeitet.

Wenn Sie Bacula zusammen mit MySQL verwenden, sollten Sie darauf achten, MySQL eher mit den Thread-Bibliotheken von FreeBSD als mit denen von Linux zu kompilieren, weil Bacula selbst normalerweise so kompiliert wird. Eine Mischung von Beiden wird möglicherweise nicht funktionieren.

Win32

Um die Win32-Version des File-Client zu installieren, lesen Sie bitte das Kapitel Win32 Installation in diesem Handbuch.


Windows-Systeme mit installiertem CYGWIN

Seit der Version 1.34 verwendet Bacula für den Win32-File-Dämon CYGWIN nicht mehr. Er wird allerdings immer noch in einer CYGWIN-Umgebung kompiliert - möglicherweise funktioniert das aber auch mit dem Visual C -Studio allein. Wenn Sie den Win32-File-Dämon selbst kompilieren wollen, benötigen sie Microsoft C++ in der Version 6.0 oder höher. Für Bacula in den Versionen vor 1.3 wurde CYGWIN verwendet. Einzelheiten zur Kompilierung stehen in der README-Datei im Verzeichnis ``src/win32''.

Beachten Sie, dass, obwohl sich fast alle Elemente von Bacula unter Windows kompilieren lassen, nur der File-Dämon getestet und verwendet wurde.

Beachten Sie auf jeden Fall die Installationsanweisungen des Kapitels Win32-Installation in diesem Dokument.

Kerns Konfigurations-Skript

Dieses Skript verwende ich für meinen ``produktiven'' Linux-Rechner:

#!/bin/sh
# This is Kern's configure script for Bacula
CFLAGS="-g -Wall" \
  ./configure \
    --sbindir=$HOME/bacula/bin \
    --sysconfdir=$HOME/bacula/bin \
    --enable-smartalloc \
    --enable-gnome \
    --with-pid-dir=$HOME/bacula/bin/working \
    --with-subsys-dir=$HOME/bacula/bin/working \
    --with-mysql=$HOME/mysql \
    --with-working-dir=$HOME/bacula/bin/working \
    --with-dump-email=$USER \
    --with-smtp-host=mail.your-site.com \
    --with-baseport=9101
exit 0

Beachten Sie bitte, dass ich 9101 als Basis-Port definiere. Dadurch verwendet Bacula Port 9101 für die Director-Console, Port 9102 für die File-Dämonen und Port 9103 für die Storage-Dämonen. Diese Ports müssten auf allen Systemen verfügbar sein, da sie von der IANA (Internet Assigned Numbers Authority) offiziell für Bacula reserviert wurden. Wir raten dringend, nur diese Ports zu verwenden, um Konflikte mit anderen Programmen zu vermeiden. Wenn Sie die Option --with-baseport nicht verwenden, ist dies die Voreinstellung.

Eventuell können Sie auch noch das Folgende in Ihre /etc/services-Datei eintragen, was das Erkennen der Verbindungen, die Bacula verwendet, erleichtert (z.B. mit netstat -a):

bacula-dir      9101/tcp
bacula-fd       9102/tcp
bacula-sd       9103/tcp

Bacula installieren

Bevor man die Konfigurations-Dateien bearbeitet, wird man Bacula in dessen Zielverzeichnisse installieren wollen. Dies geschieht mit:

make install

Wenn Bacula zuvor schon installiert worden war, werden die Programmdateien überschrieben werden, die Konfigurationsdateien jedoch erhalten bleiben. An die Namen der ``neuen'' Konfigurationsdateien wird ein .new angehängt. Wenn Sie Bacula bereits installiert und betrieben hatten, werden Sie diese normalerweise verwerfen wollen oder ignorieren.

Einen File-Dämon oder Client-Prozess kompilieren

Wenn der Director und Storage-Dämon bei Ihnen auf einem Rechner läuft und Sie die Daten eines anderen Rechners sichern wollen, brauchen Sie auf diesem Rechner eine Kopie des File-Dämons. Sind der Rechner und das Betriebsystem gleich, genügt es, die Programmdatei bacula-fd und die Konfigurationsdatei bacula-fd.conf zu kopieren und dann den Name und das Passwort in der Konfigurationsdatei anzupassen, sodass diese eindeutig sind. Die entsprechenden Erweiterungen muss man auch in der Konfigurationsdatei des Directors (bacula-dir.conf) machen.

Ist die Rechnerachitektur und/oder das Betriebsystem verschieden, so muss der File-Dämon auf dem Client-Rechner kompiliert werden. Man verwendet hierzu den gleichen ./configure-Befehl wie für das Hauptprogramm und beginnt in einer neuen Kopie des Quellcode-Verzeichnisses oder indem man vor dem ./configure ein make distclean ausführt.

Da der File-Dämon nicht mit der Datenbank arbeitet, können die Optionen --with-mysql oder --with-sqlite entfernt werden. Durch die Verwendung des Schalters --enable-client-only werden nur die benötigten Bibliotheken und die Client-Programme erzeugt. Dadurch ist es nicht notwendig, die Datenbank-Programme zu installieren, nur um den File-Dämon zu erzeugen. Geben Sie zum Schluss einfach make ein. Damit wird nur das Client-Programm erzeugt.

Auto-Start der Dämon-Prozesse

Sollen die Dämon-Prozesse beim Booten Ihres Systems automatisch gestartet bzw. beendet werden (was sinnvoll ist), ist ein weiterer Schritt erforderlich. Als erstes muss der ``./configure''-Prozess Ihr System erkennen - es muss also unterstützt werden und darf nicht als unknown erkannt sein. Dann müssen die plattformspezifischen Dateien wie folgt installiert werden:

(become root)
make install-autostart

Die Möglichkeit des Auto-Starts ist nur für Systeme implementiert, die wir offiziell unterstützen (momentan FreeBSD, RedHat/Fedora-Linux und Solaris) und wurde bislang nur auf Fedora-Linux vollständig getestet.

Mit dem Befehl make install-autostart werden die entsprechenden Start-Skripte zusammen mit den notwendigen symbolischen Links installiert. Unter RedHat-Linux sind diese Skripte in den Verzeichnisssen /etc/rc.d/init.d/bacula-dir, /etc/rc.d/init.d/bacula-fd und /etc/rc.d/init.d/bacula-sd. Der genaue Speicherort hängt vom verwendeten Beriebssystem ab.

Wenn nur der File-Dämon installiert werden soll, können Sie dies mit folgendem Befehl tun:

make install-autostart-fd

Weitere Hinweise zur Kompilierung

Um eine Programmdatei in einem beliebigen Verzeichnis zu erzeugen, geben Sie einfach das folgende ein:

make

Um alle Objekt- und Programmdateien (auch die mit ``1'', ``2'' oder ``3'' bezeichneten Dateien, die Kern als temporäre Dateien verwendet) geben Sie folgendes ein:

make clean

Um wirklich alles für eine Distribution zu bereinigen:

make distclean

Beachten Sie bitte, dass dies alle Makefiles löscht und normalerweise auf der obersten Verzeichnisebene ausgeführt wird, um den Quellcode für eine Distribution vorzubereiten. Um dies rückgängig zu machen, muss ./configure auch von der obersten Verzeichnisebene ausgeführt werden, da alle Makefiles gelöscht sind.

Um einem Unterverzeichnis eine neue Datei hinzuzufügen, muss die Datei ``Makefile.in'' in jenem Verzeichnis bearbeitet werden. Danach genügt es, make einzugeben. In den meisten Fällen erzeugt der make-Befehl ein neues Makefile aus ``Makefile.in''. In manchen Fällen muss der make-Befehl wiederholt werden. In extremen Fällen wechselt man in die oberste Verzeichnisebene und gibt ein: make Makefiles.

Um Abhängigkeiten hinzuzufügen:

make depend

Mit make depend werden die Abhängigkeiten der Header-Dateien aller Objekt-Dateien dem Makefile und der Datei ``Makefile.in" hinzugefügt. Dieser Befehl sollte in allen Verzeichnissen ausgeführt werden, in welchen Sie die Abhängigkeiten ändern. Normalerweise muss der Befehl nur ausgeführt werden, wenn sie Quell- oder Header-Dateien hinzufügen oder löschen. make depend wird normalerweise während des Konfigurations-Prozesses automatisch aufgerufen.

Um zu installieren:

make install

Dieser Befehl wird verwendet, wenn Sie Bacula als Backup-System installieren wollen, nicht aber wenn Sie an Bacula selbst programmieren. Nach Ausführen des Befehls make install werden die folgenden Dateien auf Ihrem System installiert (mehr oder weniger). Welche Dateien und Verzeichnisse es im einzelnen sind, hängt von Ihrem ./configure-Befehl ab (wird z.B. GNOME nicht konfiguriert, wird auch ``gnome-console'' und ``gnome-console.conf'' nicht installiert. Wenn Sie SQLite anstatt MySQL verwenden, werden einige der Dateien andere sein).

bacula
bacula-dir
bacula-dir.conf
bacula-fd
bacula-fd.conf
bacula-sd
bacula-sd.conf
bacula-tray-monitor
tray-monitor.conf
bextract
bls
bscanBacula
btape
btraceback
btraceback.gdb
bconsole
bconsole.conf
create_mysql_database
dbcheck
delete_catalog_backup
drop_bacula_tables
drop_mysql_tables
fd
gnome-console
gnome-console.conf
make_bacula_tables
make_catalog_backup
make_mysql_tables
mtx-changer
query.sql
bsmtp
startmysql
stopmysqlBacula
wx-console
wx-console.conf

Die Installation des Tray-Monitors

Wenn Sie den Konfigurationsschalter --enable-tray-monitor verwendet und make install ausgeführt haben, ist der Tray-Monitor schon installiert.

Da Sie Ihre grafische Umgebung nicht als root betreiben (wenn doch, sollten sie das abstellen), müssen Sie den Usern Leserechte auf tray-monitor.conf und Ausführungsrechte für bacula-tray-monitor geben. Dies ist kein Sicherheitsrisiko.

Melden Sie sich bei Ihrer grafischen Umgebung an (KDE, Gnome oder eine andere), starten sie den bacula-tray-monitor als gewöhnlicher Benutzer und achten Sie darauf, ob das Cassetten-Icon irgendwo auf Ihrem Bildschirm erscheint (gewöhnlich in der Task-Leiste). Tut es das nicht, werfen Sie einen Blick auf die unten aufgeführten Anweisungen entsprechend Ihrer Umgebung oder Ihres Window-Managers.

GNOME

Ein System-Tray oder einen ``Benachrichtigungs-Bereich'' (um die GNOME-Terminologie zu verwenden), wird von GNOME seit der Version 2.2 unterstützt. Um sie zu aktivieren, klicken Sie rechts auf Ihre Kontrollleiste, öffnen das Menü Add to this Panel, dann auf Utility und klicken schließlich auf Notification Area.

KDE

Seit der Version 3.1 unterstützt KDE das System-Tray. Um es zu aktivieren, klicken Sie Ihre Kontrollleiste rechts, öffnen das Menü Zur Kontrollleiste hinzufügen, dann auf Miniprogramm und klicken schließlich auf Systemabschnitt der Kontrollleiste.

Andere Fenster-Manager

Lesen Sie die Dokumentation um zu erfahren, ob der Freedesktop System-Tray-Standard von Ihrem Fenster-Manager unterstützt wird und - wenn vorhanden - wie er aktiviert wird.

Die Bacula Konfigurations-Dateien bearbeiten

Schlagen Sie im Kapitel Bacula konfigurieren dieses Handbuches nach, wie sie die Konfigurationsdateien von Bacula einrichten.


Critical Items to Implement Before Going Production

General

We recommend you take your time before implementing a Bacula backup system since Bacula is a rather complex program, and if you make a mistake, you may suddenly find that you cannot restore your files in case of a disaster. This is especially true if you have not previously used a major backup product.

If you follow the instructions in this chapter, you will have covered most of the major problems that can occur. It goes without saying that if you ever find that we have left out an important point, please inform us, so that we can document it to the benefit of everyone.

Critical Items

The following assumes that you have installed Bacula, you more or less understand it, you have at least worked through the tutorial or have equivalent experience, and that you have set up a basic production configuration. If you haven't done the above, please do so and then come back here. The following is a sort of checklist that points with perhaps a brief explanation of why you should do it. You will find the details elsewhere in the manual. The order is more or less the order you would use in setting up a production system (if you already are in production, use the checklist anyway).

Recommended Items

Although these items may not be critical, they are recommended and will help you avoid problems.

If you absolutely must implement a system where you write a different tape each night and take it offsite in the morning. We recommend that you do several things:


A Brief Tutorial

This chapter will guide you through running Bacula. To do so, we assume you have installed Bacula, possibly in a single file as shown in the previous chapter, in which case, you can run Bacula as non-root for these tests. However, we assume that you have not changed the .conf files. If you have modified the .conf files, please go back and uninstall Bacula, then reinstall it, but do not make any changes. The examples in this chapter use the default configuration files, and will write the volumes to disk in your /tmp directory, in addition, the data backed up will be the source directory where you built Bacula. As a consequence, you can run all the Bacula daemons for these tests as non-root. Please note, in production, your File daemon(s) must run as root. See the Security chapter for more information on this subject.

The general flow of running Bacula is:

  1. cd <install-directory>
  2. Start the Database (if using MySQL or PostgreSQL)
  3. Start the Daemons with ./bacula start
  4. Start the Console program to interact with the Director
  5. Run a job
  6. When the Volume fills, unmount the Volume, if it is a tape, label a new one, and continue running. In this chapter, we will write only to disk files so you won't need to worry about tapes for the moment.
  7. Test recovering some files from the Volume just written to ensure the backup is good and that you know how to recover. Better test before disaster strikes
  8. Add a second client.

Each of these steps is described in more detail below.

Before Running Bacula

Before running Bacula for the first time in production, we recommend that you run the test command in the btape program as described in the Utility Program Chapter of this manual. This will help ensure that Bacula functions correctly with your tape drive. If you have a modern HP, Sony, or Quantum DDS or DLT tape drive running on Linux or Solaris, you can probably skip this test as Bacula is well tested with these drives and systems. For all other cases, you are strongly encouraged to run the test before continuing. btape also has a fill command that attempts to duplicate what Bacula does when filling a tape and writing on the next tape. You should consider trying this command as well, but be forewarned, it can take hours (about 4 hours on my drive) to fill a large capacity tape.


Starting the Database

If you are using MySQL or PostgreSQL as the Bacula database, you should start it before you attempt to run a job to avoid getting error messages from Bacula when it starts. The scripts startmysql and stopmysql are what I (Kern) use to start and stop my local MySQL. Note, if you are using SQLite, you will not want to use startmysql or stopmysql. If you are running this in production, you will probably want to find some way to automatically start MySQL or PostgreSQL after each system reboot.

If you are using SQLite (i.e. you specified the --with-sqlite=xxx option on the ./configure command, you need do nothing. SQLite is automatically started by Bacula.


Starting the Daemons

Assuming you have built from source or have installed the rpms, to start the three daemons, from your installation directory, simply enter:

./bacula start

The bacula script starts the Storage daemon, the File daemon, and the Director daemon, which all normally run as daemons in the background. If you are using the autostart feature of Bacula, your daemons will either be automatically started on reboot, or you can control them individually with the files bacula-dir, bacula-fd, and bacula-sd, which are usually located in /etc/init.d, though the actual location is system dependent. Some distributions may do this differently.

Note, on Windows, currently only the File daemon is ported, and it must be started differently. Please see the Windows Version of Bacula Chapter of this manual.

The rpm packages configure the daemons to run as user=root and group=bacula. The rpm installation also creates the group bacula if it does not exist on the system. Any users that you add to the group bacula will have access to files created by the daemons. To disable or alter this behavior edit the daemon startup scripts:

and then restart as noted above.

The installation chapter of this manual explains how you can install scripts that will automatically restart the daemons when the system starts.

Interacting with the Director to Query or Start Jobs

To communicate with the director and to query the state of Bacula or run jobs, from the top level directory, simply enter:

./bconsole

Alternatively to running the command line console, if you have GNOME installed and used the --enable-gnome on the configure command, you may use the GNOME Console program:

./gnome-console

Another possibilty is to run the wxWidgets program wx-console.

For simplicity, here we will describe only the ./bconsole program. Most of what is described here applies equally well to ./gnome-console and to wx-console

The ./bconsole runs the Bacula Console program, which connects to the Director daemon. Since Bacula is a network program, you can run the Console program anywhere on your network. Most frequently, however, one runs it on the same machine as the Director. Normally, the Console program will print something similar to the following:

[kern@polymatou bin]$ ./bconsole
Connecting to Director lpmatou:9101
1000 OK: HeadMan Version: 1.30 (28 April 2003)
*

the asterisk is the console command prompt.

Type help to see a list of available commands:

*help
  Command    Description
  =======    ===========
  add        add media to a pool
  autodisplay autodisplay [on/off] -- console messages
  automount  automount [on/off] -- after label
  cancel     cancel job=nnn -- cancel a job
  create     create DB Pool from resource
  delete     delete [pool=<pool-name> | media volume=<volume-name>]
  estimate   performs FileSet estimate debug=1 give full listing
  exit       exit = quit
  help       print this command
  label      label a tape
  list       list [pools | jobs | jobtotals | media <pool> |
             files jobid=<nn>]; from catalog
  llist      full or long list like list command
  messages   messages
  mount      mount <storage-name>
  prune      prune expired records from catalog
  purge      purge records from catalog
  query      query catalog
  quit       quit
  relabel    relabel a tape
  release    release <storage-name>
  restore    restore files
  run        run <job-name>
  setdebug   sets debug level
  show       show (resource records) [jobs | pools | ... | all]
  sqlquery   use SQL to query catalog
  status     status [storage | client]=<name>
  time       print current time
  unmount    unmount <storage-name>
  update     update Volume or Pool
  use        use catalog xxx
  var        does variable expansion
  version    print Director version
  wait       wait until no jobs are running
*

Details of the console program's commands are explained in the Console Chapter of this manual.


Running a Job

At this point, we assume you have done the following:

Furthermore, we assume for the moment you are using the default configuration files.

At this point, enter the following command:

show filesets

and you should get something similar to:

FileSet: name=Full Set
      Inc: /home/kern/bacula/bacula-1.30
      Exc: /proc
      Exc: /tmp
      Exc: /.journal
      Exc: /.fsck
FileSet: name=Catalog
      Inc: /home/kern/bacula/testbin/working/bacula.sql

This is a pre-defined FileSet that will backup the Bacula source directory. The actual directory names printed should correspond to your system configuration. For testing purposes, we have chosen a directory of moderate size (about 40 Megabytes) and complexity without being too big. The FileSet Catalog is used for backing up Bacula's catalog and is not of interest to us for the moment. The Inc: entries are the files or directories that will be included in the backup and the Exc: are those that will be excluded. You can change what is backed up by editing bacula-dir.conf and changing the File = line in the FileSet resource.

Now is the time to run your first backup job. We are going to backup your Bacula source directory to a File Volume in your /tmp directory just to show you how easy it is. Now enter:

status dir

and you should get the following output:

rufus-dir Version: 1.30 (28 April 2003)
Daemon started 28-Apr-2003 14:03, 0 Jobs run.
Console connected at 28-Apr-2003 14:03
No jobs are running.
Level          Type     Scheduled          Name
=================================================================
Incremental    Backup   29-Apr-2003 01:05  Client1
Full           Backup   29-Apr-2003 01:10  BackupCatalog
====

where the times and the Director's name will be different according to your setup. This shows that an Incremental job is scheduled to run for the Job Client1 at 1:05am and that at 1:10, a BackupCatalog is scheduled to run. Note, you should probably change the name Client1 to be the name of your machine, if not, when you add additional clients, it will be very confusing. For my real machine, I use Rufus rather than Client1 as in this example.

Now enter:

status client

and you should get something like:

The defined Client resources are:
     1: rufus-fd
Item 1 selected automatically.
Connecting to Client rufus-fd at rufus:8102
rufus-fd Version: 1.30 (28 April 2003)
Daemon started 28-Apr-2003 14:03, 0 Jobs run.
Director connected at: 28-Apr-2003 14:14
No jobs running.
====

In this case, the client is named rufus-fd your name will be different, but the line beginning with rufus-fd Version ... is printed by your File daemon, so we are now sure it is up and running.

Finally do the same for your Storage daemon with:

status storage

and you should get:

The defined Storage resources are:
     1: File
Item 1 selected automatically.
Connecting to Storage daemon File at rufus:8103
rufus-sd Version: 1.30 (28 April 2003)
Daemon started 28-Apr-2003 14:03, 0 Jobs run.
Device /tmp is not open.
No jobs running.
====

You will notice that the default Storage daemon device is named File and that it will use device /tmp, which is not currently open.

Now, let's actually run a job with:

run

you should get the following output:

Using default Catalog name=MyCatalog DB=bacula
A job name must be specified.
The defined Job resources are:
     1: Client1
     2: BackupCatalog
     3: RestoreFiles
Select Job resource (1-3):

Here, Bacula has listed the three different Jobs that you can run, and you should choose number 1 and type enter, at which point you will get:

Run Backup job
JobName:  Client1
FileSet:  Full Set
Level:    Incremental
Client:   rufus-fd
Storage:  File
Pool:     Default
When:     2003-04-28 14:18:57
OK to run? (yes/mod/no):

At this point, take some time to look carefully at what is printed and understand it. It is asking you if it is OK to run a job named Client1 with FileSet Full Set (we listed above) as an Incremental job on your Client (your client name will be different), and to use Storage File and Pool Default, and finally, it wants to run it now (the current time should be displayed by your console).

Here we have the choice to run (yes), to modify one or more of the above parameters (mod), or to not run the job (no). Please enter yes, at which point you should immediately get the command prompt (an asterisk). If you wait a few seconds, then enter the command messages you will get back something like:

28-Apr-2003 14:22 rufus-dir: Last FULL backup time not found. Doing
                  FULL backup.
28-Apr-2003 14:22 rufus-dir: Start Backup JobId 1,
                  Job=Client1.2003-04-28_14.22.33
28-Apr-2003 14:22 rufus-sd: Job Client1.2003-04-28_14.22.33 waiting.
                  Cannot find any appendable volumes.
Please use the "label"  command to create a new Volume for:
    Storage:      FileStorage
    Media type:   File
    Pool:         Default

The first message, indicates that no previous Full backup was done, so Bacula is upgrading our Incremental job to a Full backup (this is normal). The second message indicates that the job started with JobId 1., and the third message tells us that Bacula cannot find any Volumes in the Pool for writing the output. This is normal because we have not yet created (labeled) any Volumes. Bacula indicates to you all the details of the volume it needs.

At this point, the job is BLOCKED waiting for a Volume. You can check this if you want by doing a status dir. In order to continue, we must create a Volume that Bacula can write on. We do so with:

label

and Bacula will print:

The defined Storage resources are:
     1: File
Item 1 selected automatically.
Enter new Volume name:

at which point, you should enter some name beginning with a letter and containing only letters and numbers (period, hyphen, and underscore) are also permitted. For example, enter TestVolume001, and you should get back:

Defined Pools:
     1: Default
Item 1 selected automatically.
Connecting to Storage daemon File at rufus:8103 ...
Sending label command for Volume "TestVolume001" Slot 0 ...
3000 OK label. Volume=TestVolume001 Device=/tmp
Catalog record for Volume "TestVolume002", Slot 0  successfully created.
Requesting mount FileStorage ...
3001 OK mount. Device=/tmp

Finally, enter messages and you should get something like:

28-Apr-2003 14:30 rufus-sd: Wrote label to prelabeled Volume
   "TestVolume001" on device /tmp
28-Apr-2003 14:30 rufus-dir: Bacula 1.30 (28Apr03): 28-Apr-2003 14:30
JobId:                  1
Job:                    Client1.2003-04-28_14.22.33
FileSet:                Full Set
Backup Level:           Full
Client:                 rufus-fd
Start time:             28-Apr-2003 14:22
End time:               28-Apr-2003 14:30
Files Written:          1,444
Bytes Written:          38,988,877
Rate:                   81.2 KB/s
Software Compression:   None
Volume names(s):        TestVolume001
Volume Session Id:      1
Volume Session Time:    1051531381
Last Volume Bytes:      39,072,359
FD termination status:  OK
SD termination status:  OK
Termination:            Backup OK
28-Apr-2003 14:30 rufus-dir: Begin pruning Jobs.
28-Apr-2003 14:30 rufus-dir: No Jobs found to prune.
28-Apr-2003 14:30 rufus-dir: Begin pruning Files.
28-Apr-2003 14:30 rufus-dir: No Files found to prune.
28-Apr-2003 14:30 rufus-dir: End auto prune.

If you don't see the output immediately, you can keep entering messages until the job terminates, or you can enter, autodisplay on and your messages will automatically be displayed as soon as they are ready.

If you do an ls -l of your /tmp directory, you will see that you have the following item:

-rw-r-----    1 kern     kern     39072153 Apr 28 14:30 TestVolume001

This is the file Volume that you just wrote and it contains all the data of the job just run. If you run additional jobs, they will be appended to this Volume unless you specify otherwise.

You might ask yourself if you have to label all the Volumes that Bacula is going to use. The answer for disk Volumes, like the one we used, is no. It is possible to have Bacula automatically label volumes. For tape Volumes, you will most likely have to label each of the Volumes you want to use.

If you would like to stop here, you can simply enter quit in the Console program, and you can stop Bacula with ./bacula stop. To clean up, simply delete the file /tmp/TestVolume001, and you should also re-initialize your database using:

./drop_bacula_tables
./make_bacula_tables

Please note that this will erase all information about the previous jobs that have run, and that you might want to do it now while testing but that normally you will not want to re-initialize your database.

If you would like to try restoring the files that you just backed up, read the following section.

Restoring Your Files

If you have run the default configuration and the save of the Bacula source code as demonstrated above, you can restore the backed up files in the Console program by entering:

restore all

where you will get:

First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.

To select the JobIds, you have the following choices:
     1: List last 20 Jobs run
     2: List Jobs where a given File is saved
     3: Enter list of comma separated JobIds to select
     4: Enter SQL list command
     5: Select the most recent backup for a client
     6: Select backup for a client before a specified time
     7: Enter a list of files to restore
     8: Enter a list of files to restore before a specified time
     9: Find the JobIds of the most recent backup for a client
    10: Find the JobIds for a backup for a client before a specified time
    11: Enter a list of directories to restore for found JobIds
    12: Cancel
Select item:  (1-12):

As you can see, there are a number of options, but for the current demonstration, please enter 5 to do a restore of the last backup you did, and you will get the following output:

Defined Clients:
     1: rufus-fd
Item 1 selected automatically.
The defined FileSet resources are:
     1: 1  Full Set  2003-04-28 14:22:33
Item 1 selected automatically.
+-------+-------+----------+---------------------+---------------+
| JobId | Level | JobFiles | StartTime           | VolumeName    |
+-------+-------+----------+---------------------+---------------+
| 1     | F     | 1444     | 2003-04-28 14:22:33 | TestVolume002 |
+-------+-------+----------+---------------------+---------------+
You have selected the following JobId: 1
Building directory tree for JobId 1 ...
1 Job inserted into the tree and marked for extraction.
The defined Storage resources are:
     1: File
Item 1 selected automatically.
You are now entering file selection mode where you add and
remove files to be restored. All files are initially added.
Enter "done" to leave this mode.
cwd is: /
$

where I have truncated the listing on the right side to make it more readable. As you can see by starting at the top of the listing, Bacula knows what client you have, and since there was only one, it selected it automatically, likewise for the FileSet. Then Bacula produced a listing containing all the jobs that form the current backup, in this case, there is only one, and the Storage daemon was also automatically chosen. Bacula then took all the files that were in Job number 1 and entered them into a directory tree (a sort of in memory representation of your filesystem). At this point, you can use the cd and ls ro dir commands to walk up and down the directory tree and view what files will be restored. For example, if I enter cd /home/kern/bacula/bacula-1.30 and then enter dir I will get a listing of all the files in the Bacula source directory. On your system, the path will be somewhat different. For more information on this, please refer to the Restore Command Chapter of this manual for more details.

To exit this mode, simply enter:

done

and you will get the following output:

Bootstrap records written to
   /home/kern/bacula/testbin/working/restore.bsr
The restore job will require the following Volumes:
   
   TestVolume001
1444 files selected to restore.
Run Restore job
JobName:    RestoreFiles
Bootstrap:  /home/kern/bacula/testbin/working/restore.bsr
Where:      /tmp/bacula-restores
Replace:    always
FileSet:    Full Set
Client:     rufus-fd
Storage:    File
JobId:      *None*
When:       2005-04-28 14:53:54
OK to run? (yes/mod/no):

If you answer yes your files will be restored to /tmp/bacula-restores. If you want to restore the files to their original locations, you must use the mod option and explicitly set Where: to nothing (or to /). We recommend you go ahead and answer yes and after a brief moment, enter messages, at which point you should get a listing of all the files that were restored as well as a summary of the job that looks similar to this:

28-Apr-2005 14:56 rufus-dir: Bacula 1.30 (28Apr03): 28-Apr-2003 14:56
JobId:                  2
Job:                    RestoreFiles.2005-04-28_14.56.06
Client:                 rufus-fd
Start time:             28-Apr-2005 14:56
End time:               28-Apr-2005 14:56
Files Restored:         1,444
Bytes Restored:         38,816,381
Rate:                   9704.1 KB/s
FD termination status:  OK
Termination:            Restore OK
28-Apr-2005 14:56 rufus-dir: Begin pruning Jobs.
28-Apr-2005 14:56 rufus-dir: No Jobs found to prune.
28-Apr-2005 14:56 rufus-dir: Begin pruning Files.
28-Apr-2005 14:56 rufus-dir: No Files found to prune.
28-Apr-2005 14:56 rufus-dir: End auto prune.

After exiting the Console program, you can examine the files in /tmp/bacula-restores, which will contain a small directory tree with all the files. Be sure to clean up at the end with:

rm -rf /tmp/bacula-restore

Quitting the Console Program

Simply enter the command quit.

Adding a Second Client

If you have gotten the example shown above to work on your system, you may be ready to add a second Client (File daemon). That is you have a second machine that you would like backed up. The only part you need installed on the other machine is the binary bacula-fd (or bacula-fd.exe for Windows) and its configuration file bacula-fd.conf. You can start with the same bacula-fd.conf file that you are currently using and make one minor modification to it to create the conf file for your second client. Change the File daemon name from whatever was configured, rufus-fd in the example above, but your system will have a different name. The best is to change it to the name of your second machine. For example:

...
#
# "Global" File daemon configuration specifications
#
FileDaemon {                          # this is me
  Name = rufus-fd
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /home/kern/bacula/working
  Pid Directory = /var/run
}
...

would become:

...
#
# "Global" File daemon configuration specifications
#
FileDaemon {                          # this is me
  Name = matou-fd
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /home/kern/bacula/working
  Pid Directory = /var/run
}
...

where I show just a portion of the file and have changed rufus-fd to matou-fd. The names you use are your choice. For the moment, I recommend you change nothing else. Later, you will want to change the password.

Now you should install that change on your second machine. Then you need to make some additions to your Director's configuration file to define the new File daemon or Client. Starting from our original example which should be installed on your system, you should add the following lines (essentially copies of the existing data but with the names changed) to your Director's configuration file bacula-dir.conf.

#
# Define the main nightly save backup job
#   By default, this job will back up to disk in /tmp
Job {
  Name = "Matou"
  Type = Backup
  Client = matou-fd
  FileSet = "Full Set"
  Schedule = "WeeklyCycle"
  Storage = File
  Messages = Standard
  Pool = Default
  Write Bootstrap = "/home/kern/bacula/working/matou.bsr"
}
# Client (File Services) to backup
Client {
  Name = matou-fd
  Address = matou
  FDPort = 9102
  Catalog = MyCatalog
  Password = "xxxxx"                  # password for
  File Retention = 30d                # 30 days
  Job Retention = 180d                # six months
  AutoPrune = yes                     # Prune expired Jobs/Files
}

Then make sure that the Address parameter in the Storage resource is set to the fully qualified domain name and not to something like "localhost". The address specified is sent to the File daemon (client) and it must be a fully qualified domain name. If you pass something like "localhost" it will not resolve correctly and will result in a time out when the File daemon fails to connect to the Storage daemon.

That is all that is necessary. I copied the existing resource to create a second Job (Matou) to backup the second client (matou-fd). It has the name Matou, the Client is named matou-fd, and the bootstrap file name is changed, but everything else is the same. This means that Matou will be backed up on the same schedule using the same set of tapes. You may want to change that later, but for now, let's keep it simple.

The second change was to add a new Client resource that defines matou-fd and has the correct address matou, but in real life, you may need a fully qualified machine address or an IP address. I also kept the password the same (shown as xxxxx for the example).

At this point, if you stop Bacula and restart it, and start the Client on the other machine, everything will be ready, and the prompts that you saw above will now include the second machine.

To make this a real production installation, you will possibly want to use different Pool, or a different schedule. It is up to you to customize. In any case, you should change the password in both the Director's file and the Client's file for additional security.

For some important tips on changing names and passwords, and a diagram of what names and passwords must match, please see Authorization Errors in the FAQ chapter of this manual.


When The Tape Fills

If you have scheduled your job, typically nightly, there will come a time when the tape fills up and Bacula cannot continue. In this case, Bacula will send you a message similar to the following:

rufus-sd: block.c:337 === Write error errno=28: ERR=No space left
          on device

This indicates that Bacula got a write error because the tape is full. Bacula will then search the Pool specified for your Job looking for an appendable volume. In the best of all cases, you will have properly set your Retention Periods and you will have all your tapes marked to be Recycled, and Bacula will automatically recycle the tapes in your pool requesting and overwriting old Volumes. For more information on recycling, please see the Recycling chapter of this manual. If you find that your Volumes were not properly recycled (usually because of a configuration error), please see the Manually Recycling Volumes section of the Recycling chapter.

If like me, you have a very large set of Volumes and you label them with the date the Volume was first writing, or you have not set up your Retention periods, Bacula will not find a tape in the pool, and it will send you a message similar to the following:

rufus-sd: Job kernsave.2002-09-19.10:50:48 waiting. Cannot find any
          appendable volumes.
Please use the "label"  command to create a new Volume for:
    Storage:      SDT-10000
    Media type:   DDS-4
    Pool:         Default

Until you create a new Volume, this message will be repeated an hour later, then two hours later, and so on doubling the interval each time up to a maximum interval of 1 day.

The obvious question at this point is: What do I do now?

The answer is simple: first, using the Console program, close the tape drive using the unmount command. If you only have a single drive, it will be automatically selected, otherwise, make sure you release the one specified on the message (in this case STD-10000).

Next, you remove the tape from the drive and insert a new blank tape. Note, on some older tape drives, you may need to write an end of file mark (mt -f /dev/nst0 weof) to prevent the drive from running away when Bacula attempts to read the label.

Finally, you use the label command in the Console to write a label to the new Volume. The label command will contact the Storage daemon to write the software label, if it is successful, it will add the new Volume to the Pool, then issue a mount command to the Storage daemon. See the previous sections of this chapter for more details on labeling tapes.

The result is that Bacula will continue the previous Job writing the backup to the new Volume.

If you have a Pool of volumes and Bacula is cycling through them, instead of the above message "Cannot find any appendable volumes.", Bacula may ask you to mount a specific volume. In that case, you should attempt to do just that. If you do not have the volume any more (for any of a number of reasons), you can simply mount another volume from the same Pool, providing it is appendable, and Bacula will use it. You can use the list volumes command in the console program to determine which volumes are appendable and which are not.

If like me, you have your Volume retention periods set correctly, but you have no more free Volumes, you can relabel and reuse a Volume as follows:

To manually relabel the Volume use the following additional steps:

Other Useful Console Commands

status dir
Print a status of all running jobs and jobs scheduled in the next 24 hours.

status
The console program will prompt you to select a daemon type, then will request the daemon's status.

status jobid=nn
Print a status of JobId nn if it is running. The Storage daemon is contacted and requested to print a current status of the job as well.

list pools
List the pools defined in the Catalog (normally only Default is used).

list media
Lists all the media defined in the Catalog.

list jobs
Lists all jobs in the Catalog that have run.

list jobid=nn
Lists JobId nn from the Catalog.

list jobtotals
Lists totals for all jobs in the Catalog.

list files jobid=nn
List the files that were saved for JobId nn.

list jobmedia
List the media information for each Job run.

messages
Prints any messages that have been directed to the console.

unmount storage=storage-name
Unmounts the drive associated with the storage device with the name storage-name if the drive is not currently being used. This command is used if you wish Bacula to free the drive so that you can use it to label a tape.

mount storage=storage-name
Causes the drive associated with the storage device to be mounted again. When Bacula reaches the end of a volume and requests you to mount a new volume, you must issue this command after you have placed the new volume in the drive. In effect, it is the signal needed by Bacula to know to start reading or writing the new volume.

quit
Exit or quit the console program.

Most of the commands given above, with the exception of list, will prompt you for the necessary arguments if you simply enter the command name.

Debug Daemon Output

If you want debug output from the daemons as they are running, start the daemons from the install directory as follows:

./bacula start -d100

This can be particularly helpful if your daemons do not start correctly, because direct daemon output to the console is normally directed to the NULL device, but with the debug level greater than zero, the output will be sent to the starting terminal.

To stop the three daemons, enter the following from the install directory:

./bacula stop

The execution of bacula stop may complain about pids not found. This is OK, especially if one of the daemons has died, which is very rare.

To do a full system save, each File daemon must be running as root so that it will have permission to access all the files. None of the other daemons require root privileges. However, the Storage daemon must be able to open the tape drives. On many systems, only root can access the tape drives. Either run the Storage daemon as root, or change the permissions on the tape devices to permit non-root access. MySQL and PostgreSQL can be installed and run with any userid; root privilege is not necessary.

Have Patience When Starting the Daemons or Mounting Blank Tapes

When you start the Bacula daemons, the Storage daemon attempts to open all defined storage devices and verify the currently mounted Volume (if configured). Until all the storage devices are verified, the Storage daemon will not accept connections from the Console program. If a tape was previously used, it will be rewound, and on some devices this can take several minutes. As a consequence, you may need to have a bit of patience when first contacting the Storage daemon after starting the daemons. If you can see your tape drive, once the lights stop flashing, the drive will be ready to be used.

The same considerations apply if you have just mounted a blank tape in a drive such as an HP DLT. It can take a minute or two before the drive properly recognizes that the tape is blank. If you attempt to mount the tape with the Console program during this recognition period, it is quite possible that you will hang your SCSI driver (at least on my RedHat Linux system). As a consequence, you are again urged to have patience when inserting blank tapes. Let the device settle down before attempting to access it.

Difficulties Connecting from the FD to the SD

If you are having difficulties getting one or more of your File daemons to connect to the Storage daemon, it is most likely because you have not used a fully qualified Internet address on the Address directive in the Director's Storage resource. That is the resolver on the File daemon's machine (not on the Director's) must be able to resolve the name you supply into an IP address. An example of an address that is guaranteed not to work: localhost. An example that may work: megalon. An example that is more likely to work: magalon.mydomain.com. On Win32 if you don't have a good resolver (often true on older Win98 systems), you might try using an IP address in place of a name.

If your address is correct, then make sure that no other program is using the port 9103 on the Storage daemon's machine. The Bacula port number are authorized by IANA, and should not be used by other programs, but apparently some HP printers do use these port numbers. A netstat -a on the Storage daemon's machine can determine who is using the 9103 port (used for FD to SD communications in Bacula).

Daemon Command Line Options

Each of the three daemons (Director, File, Storage) accepts a small set of options on the command line. In general, each of the daemons as well as the Console program accepts the following options:

-c <file>
Define the file to use as a configuration file. The default is the daemon name followed by .conf i.e. bacula-dir.conf for the Director, bacula-fd.conf for the File daemon, and bacula-sd for the Storage daemon.

-d nn
Set the debug level to nn. Higher levels of debug cause more information to be displayed on STDOUT concerning what the daemon is doing.

-f
Run the daemon in the foreground. This option is needed to run the daemon under the debugger.

-s
Do not trap signals. This option is needed to run the daemon under the debugger.

-t
Read the configuration file and print any error messages, then immediately exit. Useful for syntax testing of new configuration files.

-v
Be more verbose or more complete in printing error and informational messages. Recommended.

-?
Print the version and list of options.

The Director has the following additional Director specific option:

-r <job>
Run the named job immediately. This is for debugging and should not be used.

The File daemon has the following File daemon specific option:

-i
Assume that the daemon is called from inetd or xinetd. In this case, the daemon assumes that a connection has already been made and that it is passed as STDIN. After the connection terminates the daemon will exit.

The Storage daemon has no Storage daemon specific options.

The Console program has no console specific options.


Creating a Pool

Creating the Pool is automatically done when Bacula starts, so if you understand Pools, you can skip to the next section.

When you run a job, one of the things that Bacula must know is what Volumes to use to backup the FileSet. Instead of specifying a Volume (tape) directly, you specify which Pool of Volumes you want Bacula to consult when it wants a tape for writing backups. Bacula will select the first available Volume from the Pool that is appropriate for the Storage device you have specified for the Job being run. When a volume has filled up with data, Bacula will change its VolStatus from Append to Full, and then Bacula will use the next volume and so on. If no appendable Volume exists in the Pool, the Director will attempt to recycle an old Volume, if there are still no appendable Volumes available, Bacula will send a message requesting the operator to create an appropriate Volume.

Bacula keeps track of the Pool name, the volumes contained in the Pool, and a number of attributes of each of those Volumes.

When Bacula starts, it ensures that all Pool resource definitions have been recorded in the catalog. You can verify this by entering:

list pools

to the console program, which should print something like the following:

*list pools
Using default Catalog name=MySQL DB=bacula
+--------+---------+---------+---------+----------+-------------+
| PoolId | Name    | NumVols | MaxVols | PoolType | LabelFormat |
+--------+---------+---------+---------+----------+-------------+
| 1      | Default | 3       | 0       | Backup   | *           |
| 2      | File    | 12      | 12      | Backup   | File        |
+--------+---------+---------+---------+----------+-------------+
*

If you attempt to create the same Pool name a second time, Bacula will print:

Error: Pool Default already exists.
Once created, you may use the {\bf update} command to
modify many of the values in the Pool record.

Labeling Your Volumes

Bacula requires that each Volume contains a software label. There are several strategies for labeling volumes. The one I use is to label them as they are needed by Bacula using the console program. That is when Bacula needs a new Volume, and it does not find one in the catalog, it will send me an email message requesting that I add Volumes to the Pool. I then use the label command in the Console program to label a new Volume and to define it in the Pool database, after which Bacula will begin writing on the new Volume. Alternatively, I can use the Console relabel command to relabel a Volume that is no longer used providing it has VolStatus Purged.

Another strategy is to label a set of volumes at the start, then use them as Bacula requests them. This is most often done if you are cycling through a set of tapes, for example using an autochanger. For more details on recycling, please see the Automatic Volume Recycling chapter of this manual.

If you run a Bacula job, and you have no labeled tapes in the Pool, Bacula will inform you, and you can create them "on-the-fly" so to speak. In my case, I label my tapes with the date, for example: DLT-18April02. See below for the details of using the label command.

Labeling Volumes with the Console Program

Labeling volumes is normally done by using the console program.

  1. ./bconsole
  2. label

If Bacula complains that you cannot label the tape because it is already labeled, simply unmount the tape using the unmount command in the console, then physically mount a blank tape and re-issue the label command.

Since the physical storage media is different for each device, the label command will provide you with a list of the defined Storage resources such as the following:

The defined Storage resources are:
     1: File
     2: 8mmDrive
     3: DLTDrive
     4: SDT-10000
Select Storage resource (1-4):

At this point, you should have a blank tape in the drive corresponding to the Storage resource that you select.

It will then ask you for the Volume name.

Enter new Volume name:

If Bacula complains:

Media record for Volume xxxx already exists.

It means that the volume name xxxx that you entered already exists in the Media database. You can list all the defined Media (Volumes) with the list media command. Note, the LastWritten column has been truncated for proper printing.

+---------------+---------+--------+----------------+-----/~/-+------------+-----+
| VolumeName    | MediaTyp| VolStat| VolBytes       | LastWri | VolReten   | Recy|
+---------------+---------+--------+----------------+---------+------------+-----+
| DLTVol0002    | DLT8000 | Purged | 56,128,042,217 | 2001-10 | 31,536,000 |   0 |
| DLT-07Oct2001 | DLT8000 | Full   | 56,172,030,586 | 2001-11 | 31,536,000 |   0 |
| DLT-08Nov2001 | DLT8000 | Full   | 55,691,684,216 | 2001-12 | 31,536,000 |   0 |
| DLT-01Dec2001 | DLT8000 | Full   | 55,162,215,866 | 2001-12 | 31,536,000 |   0 |
| DLT-28Dec2001 | DLT8000 | Full   | 57,888,007,042 | 2002-01 | 31,536,000 |   0 |
| DLT-20Jan2002 | DLT8000 | Full   | 57,003,507,308 | 2002-02 | 31,536,000 |   0 |
| DLT-16Feb2002 | DLT8000 | Full   | 55,772,630,824 | 2002-03 | 31,536,000 |   0 |
| DLT-12Mar2002 | DLT8000 | Full   | 50,666,320,453 | 1970-01 | 31,536,000 |   0 |
| DLT-27Mar2002 | DLT8000 | Full   | 57,592,952,309 | 2002-04 | 31,536,000 |   0 |
| DLT-15Apr2002 | DLT8000 | Full   | 57,190,864,185 | 2002-05 | 31,536,000 |   0 |
| DLT-04May2002 | DLT8000 | Full   | 60,486,677,724 | 2002-05 | 31,536,000 |   0 |
| DLT-26May02   | DLT8000 | Append |  1,336,699,620 | 2002-05 | 31,536,000 |   1 |
+---------------+---------+--------+----------------+-----/~/-+------------+-----+

Once Bacula has verified that the volume does not already exist, it will prompt you for the name of the Pool in which the Volume (tape) is to be created. If there is only one Pool (Default), it will be automatically selected.

If the tape is successfully labeled, a Volume record will also be created in the Pool. That is the Volume name and all its other attributes will appear when you list the Pool. In addition, that Volume will be available for backup if the MediaType matches what is requested by the Storage daemon.

When you labeled the tape, you answered very few questions about it -- principally the Volume name, and perhaps the Slot. However, a Volume record in the catalog database (internally known as a Media record) contains quite a few attributes. Most of these attributes will be filled in from the default values that were defined in the Pool (i.e. the Pool holds most of the default attributes used when creating a Volume).

It is also possible to add media to the pool without physically labeling the Volumes. This can be done with the add command. For more information, please see the Console Chapter of this manual.


Anpassen der Konfigurations-Dateien

Jedes einzelne der Bacula Programme liest beim Starten die angegebene Konfigurations-Datei ein, falls keine angegeben wird benutzt Bacula jeweils die Standard-Konfigurations-Dateien bacula-dir.conf, bacula-fd.conf, bacula-sd.conf, oder console.conf für den Director-Dienst, den Client-Dienst, den Storage-Dienst und für das Console-Programm.

Jeder Dienst (Director,Client, Storage und Console) hat seine eigene Konfigurations-Datei die eine Reihe von Einträgen enthält. Die Einträge sind sehr ähnlich, aber die angegebenen Parameter sind von Dienst zu Dienst unterschiedlich. Zum Beispiel wird in der Director-Dienst-Konfiguration mit dem Eintrag Director der Name des Director-Dienstes, eine Reihe globaler Parameter, sowie das Director-Passwort festgelegt. Der Director-Eintrag im Client-Dienst gibt an, welcher Director-Dienst diesen Client kontaktieren darf.

Bevor Sie Bacula zum ersten mal starten, müssen Sie die Konfigurations-Dateien für jeden Dienst anpassen. Standard-Konfigurations-Dateien werden für jeden Dienst bei der Installation erzeugt, aber müssen Ihrem Computer angepasst werden. Einen Überblick über die Konfigurations-Einträge sehen Sie hier:

\includegraphics{./bacula-objects.eps}
(vielen Dank an Aristides Maniatis für diese Graphik)

Zeichensätze

Bacula wurde so entwickelt, dass es die meisten Zeichensätze der Welt versteht, US ASCII, deutsch, französich, chinesisch, ..... Allerdings tut es dies, indem es alles in UTF-8 umwandelt und Bacula erwartet, dass alle Konfigurationsdateien (auch die auf Win32-Computern) als UTF-8-Format vorliegen. Normalerweise ist UTF-8 der Standard-Zeichensatz auf Linux-Computern, aber eventuell nicht auf anderen Unix-Varianten oder auf Windows. Sie sollten also sicherstellen, dass die entsprechenden Umgebungsvariablen richtig gesetzt sind, befor Sie Bacula starten.

Damit Bacula auch Konfigurations-Dateien mit fremden Zeichen korrekt lesen kann, muss die Umgebungsvariable bf LANG mit .UTF-8 enden, zum Beispiel en_US.UTF-8. Die Schreibweise kann bei verschiedenen Betriebssystemen variieren und ebenso kann auch die Umgebungsvariable anders heißen. Auf neueren Win32-Computern können Sie beim speichern der Konfigurations-Dateien z.B. mit dem notepad angeben, dass die Datei als UTF-8 gespeichert werden soll.

Bacula nimmt an, dass alle Dateinamen auf Linux und Unix im UTF-8-Format sind. Bei Windows sind sie Unicode (UTF-16) und werden automatisch in UTF-8 umgewandelt.

Konfigurations-Parameter-Format

Auch wenn Sie nicht jedes Detail über alle Paramter wissen müssen, ist ein grundlegendes Wissen des Konfigurations-Parameter-Formats erforderlich. Jeder Konfigurations-Eintrag in einer Ressource (innerhalb der geschweiften Klammern) ist zusammengesetzt aus dem Schlüsselwort gefolgt von einem Gleichheitszeichen, dem dann ein oder mehrere Werte folgen. Das Schlüsselwort muss einem der Bacula bekannten Konfigurations-Parameter entsprechen, wobei es große oder kleine Buchstaben enthalten darf, sowie auch Leerzeichen.

Jede Ressource muss einen Paramter Name beinhalten und kann zusätzlich eine optionale Description enthalten. Der Name wird benötigt um die Ressource eindeutig zu bezeichnen. Die Description wird verwendet wenn die Ressource angezeigt wird, um eine leichtere Erkennung zu ermöglichen. Ein Beispiel:

Director {
  Name = "MeinDir"
  Description = "Bacula Director"
  WorkingDirectory = "$HOME/bacula/bin/working"
}

Diese Ressource definiert einen Director mit dem Namen "MeinDir" und dem Arbeitsverzeichnis $HOME/bacula/bin/working. Falls Sie Leerzeichen in einem Parameter verwenden wollen (rechts vom Gleichheitszeichen) müssen Sie den Eintrag in doppelte Anführungszeichen setzen. Andernfalls sind Anführungszeichen nicht nötig.

Kommentare

Wenn Bacula die Konfigurations-Dateien liest, werden leere Zeilen und alles hinter einem Rautezeichen (#) bis zum Zeilenende ignoriert. Ein Semikolon (;) wird als logisches Zeilenende interprtiert und alles hinter dem Semikolon wird als nächster Konfigurations-Eintrag betrachtet. Wenn ein Eintrag in einer eigenen Zeile steht, wird kein abschließendes Semikolon benötigt, in den Beispielen in diesem Handbuch werden Sie daher kaum Semikolons finden.

Groß/Kleinschreibung und Leerzeichen

Groß/Kleinschreibung und Leerzeichen werden beim lesen der Schlüsselwörter (dem Teil vor dem Gleichheitszeichen) komplett ignoriert.

Das bedeutet, dass die Schlüsselwörter name, Name und N a m e alle identisch sind.

Leerzeichen hinter dem Gleichheitszeichen, vor dem ersten Zeichen des Wertes werden auch ignoriert.

Generell werden Leerzeichen innerhalb eines Wertes nicht ignoriert, wenn Leerzeichen im Wert vorhanden sind, muss der Wert in doppelte Anführungszeichen gesetzt werden. Namen dürfen bis zu 127 Zeichen enthalten. Ein Name darf aus allen ASCII-Zeichen bestehen. Innerhalb eine Zeichenkette die in doppelten Anführungszeichen steht kann man mit dem Backslash (umgekehrter Schrägstrich \) ein Zeichen maskieren, damit es als es selbst dargestellt wird (praktisch um Anführungszeichen und geschweifte Klammern einzufügen).

Bitte beachten Sie, dass Bacula Ressource-Namen, sowie bestimmte andere Namen (z.B. Volume-Namen), nur aus Buchstaben, Zahlen und ein paar Sonderzeichen (Leerzeichen, Unterstrich,..) bestehen dürfen. Alle anderen Zeichen sind nicht erlaubt.

Einbinden anderer Konfigurations-Dateien

Falls Sie Ihre Konfiguration auf mehrere kleine Dateien aufteilen möchten, können Sie das tun, indem Sie andere Konfigurations-Dateien mit @Dateiname einbinden. Dabei muss @Dateiname den absoluten Pfad und Dateinamen enthalten. Die Angabe @Dateiname darf an jeder Stelle stehen, wo auch eine Konfigurationsangabe stehen kann.

grundlegende Datentypen

Beim einlesen der Konfigurations-Parameter klassifiziert Bacula die Daten gemäß den unten aufgelisteten Datentypen. Wenn Sie dass das erstemal lesen, wird es Ihnen eventuell etwas kompliziert vorkommen, aber in Wahrheit ist es ganz einfach und logisch.

name
Ein Schlüsselwort oder Name besteht aus alphanumerischen Zeichen, einschließlich Bindestrich, Unterstrich und Dollar-Zeichen. Das erste Zeichen eines Name muss ein Buchstabe sein. Ein Name hat eine maximale Länge von 127 Zeichen. Typischerweise stehen Schlüsselwörter auf der linken Seite des Gleichheitszeichens (d.h. es sind Bacula-Schlüsselwörter z.B. Konfigurations-Eintrag-Namen oder Parameter-Namen). Schlüsselwörter dürfen nicht in Anführungszeichen stehen.

name-string
Ein Name-String ist ähnlich einem Namen, außer das er in Anführungszeichen stehen darf und daher auch Lerrzeichen beinhalten kann. Ein Name-String darf 127 Zeichen lang sein und steht typischerweise auf der rechten Seite des Gleichheitszeichens (d.h. es sind Werte die zum einem Schlüsselwort gehöhren).

string
Ein String ist eine Zeichenkette die, in Anführungszeichen gestellt, jedes beliebige Zeichen enthalten darf. Ein String hat keine Längenbegrenzung. Strings sind typischerweise Werte die Dateinamen, Verzeichnisnamen oder Betriebssystem-Befehlen entsprechen. Ein Backslash (umgekehrter Schrägstrich \) maskiert das folgende Zeichen als sich selbst, dadurch kann man Anführungszeichen innerhalb des Strings verwenden, oder auch den Backslash selbst.

directory
A directory is either a quoted or non-quoted string. A directory will be passed to your standard shell for expansion when it is scanned. Thus constructs such as $HOME are interpreted to be their correct values.

password
Ist ein Bacula-Passwort und wird intern als MD5-Hash gespeichert.

integer
Eine 32-Bit Ganzzahl, positiv oder negativ.

positive integer
Eine positive 32Bit-Ganzzahl.

long integer
Eine 64-Bit Ganzzahl. Typischerweise für Werte wie Bytes die über 4 Millionen betragen können und daher 64-Bit erfordern.

yes|no
Entweder ein Ja: yes oder ein Nein: bf no.

size
Eine Größe angegeben in Bytes. Typischerweise eine Fließkommazahl in wissenschaftlicher Schreibweise, gefolgt von einem Modifikator. Intern als 64-Bit Ganzzahl gespeichert. Wenn ein Modofikator angegeben wird, muss er direkt und ohne Leerzeichen dem Wert folgen. Die folgenden Modifikatoren sind erlaubt:

k
1,024 (Kilobytes)

kb
1,000 (Kilobytes)

m
1,048,576 (Megabytes)

mb
1,000,000 (Megabytes)

g
1,073,741,824 (Gigabytes)

gb
1,000,000,000 (Gigabytes)

time
Eine Zeit oder ein Zeitraum in Sekunden. Intern als 64-Bit Ganzzahl gespeichert, allerdings in zwei Teilen: ein Nummern-Teil und ein Modifikator-Teil. Die Nummer kann eine Ganz- oder Fließkommazahl sein. Wenn sie als Fließkommazahl angegeben wird, wird auf den nächsten Ganzzahl-Wert gerundet. Der Modifikator ist zwingend erforderlich und muß dem Nummern-teil folgen (entweder durch Leerzeichen getrennt oder nicht). Die folgenden Modifikatoren sind erlaubt:

seconds
Sekunden

minutes
Minuten (60 Sekunden)

hours
Stunden (3600 Sekunden)

days
Tage (3600*24 Sekunden)

weeks
Wochen (3600*24*7 Sekunden)

months
Monate (3600*24*30 Sekunden)

quarters
Quartale (3600*24*91 Sekunden)

years
Jahre (3600*24*365 Sekunden)

Jede Abkürzung dieser Modifikatoren ist erlaubt (d.h. Sekunden können als sec oder s angegeben werden). Ein m wird als Monat angenommen.

Die Angabe einer Zeit kann so viele Modifikatoren und Nummern enthalten, wie gewünscht. Ein Beispiel:

1 week 2 days 3 hours 10 mins
1 month 2 days 30 sec

sind gültige Zeitangaben.

Ressource Typen

Die folgende Tabelle listet alle momentan von Bacula verwendeten Konfigurations-Einträge auf. Sie zeigt, welche Einträge bei welchem Dienst vorhanden sein müßen. Die Standard-Konfigurations-Dateien beinhalten bereits mindestens ein Beispiel jedes benötigten Eintrags. Sie brauchen sich also keine Sorgen zu machen, dass Sie diese Einträge alle von Hand erstellen müßen.

Ressource Director Client Storage Console
Autochanger Nein Nein Ja Nein
Catalog Ja Nein Nein Nein
Client Ja Ja Nein Nein
Console Ja Nein Nein Ja
Device Nein Nein Ja Nein
Director Ja Ja Ja Ja
FileSet Ja Nein Nein Nein
Job Ja Nein Nein Nein
JobDefs Ja Nein Nein Nein
Message Ja Ja Ja Nein
Pool Ja Nein Nein Nein
Schedule Ja Nein Nein Nein
Storage Ja Nein Ja Nein


Namen, Passwörter und Autorisation

Damit ein Dienst mir einem anderen Kontakt aufnehmen darf, muss er sich mit einem Passwort autorisieren. In den meisten Fällen gehöhrt ein Passwort zu einem bestimmten Namen, es muss also der Name und das Passwort korrekt sein, um erfolgreich autorisiert zu werden. Passwörter sind einfacher und beliebiger Text. Sie werden nicht durch einen speziellen Prozess generiert; benutzen Sie einfach zufälligen Text.

Die Standard-Konfigurations-Dateien enthalten automatisch erzeugte Passwörter, die eine erfolgreiche Autorisierung aller Dienste untereinander erlauben. Wenn Sie diese Passwörter verändern, müßen Sie das auch auf der entsprechenden Gegenseite tun.

Hier ist ein Bild, worauf Sie sehen können, welche Namen und Passwörter in welchen Dateien und Konfigurations-Einträgen übereinstimmen müßen:

\includegraphics{./Conf-Diagram.eps}

Auf der linken Seite sehen Sie die Director-, Storage- und Client-Einträge mit ihren Namen und Passwörtern, dieses steht alles in der Konfiguration des Director-Dienstes in der Datei bacula-dir.conf. Auf der rechten Seite sehen Sie die entsprechenden Einträge in den Konfigurations-Dateien des Storage- und Client-Dienstes (SD und FD).

Bitte beachten Sie, dass die Adresse fw-sd, die in der Konfiguration des Storage-Dienstes steht, dem Client-Dienst symbolisch übergeben wird. Der Client-Dienst muss diesen Namen dann in eine gültigen IP-Adresse auflösen können. Aus diesem Grund muss hier etweder eine IP-Adresse oder ein voll qualifizierter Rechnername stehen. Ein Name wie localhost ist nicht gültig und wird auf dem Client auf den Namen des localhost des Clients aufgeöst. Das Passwort des Client-Dienstes um sich am Storage-Dienst anzumelden ist temporär und wird dynamisch für jeden einzelnen Job erzeugt. Es steht also in keiner der .conf-Dateien.

detailierte Information für jeden Dienst

Die Details für jeden Konfigurations-Eintrag und die darin gültigen Parameter sind in den folgenden Kapiteln beschrieben.

Die folgenden Konfigurations-Dateien müßen definiert werden:


Configuring the Director

Of all the configuration files needed to run Bacula, the Director's is the most complicated, and the one that you will need to modify the most often as you add clients or modify the FileSets.

For a general discussion of configuration files and resources including the data types recognized by Bacula. Please see the Configuration chapter of this manual.

Director Resource Types

Director resource type may be one of the following:

Job, JobDefs, Client, Storage, Catalog, Schedule, FileSet, Pool, Director, or Messages. We present them here in the most logical order for defining them:


The Director Resource

The Director resource defines the attributes of the Directors running on the network. In the current implementation, there is only a single Director resource, but the final design will contain multiple Directors to maintain index and media database redundancy.

Director
Start of the Director resource. One and only one director resource must be supplied.

Name = <name>
The director name used by the system administrator. This directive is required.

Description = <text>
The text field contains a description of the Director that will be displayed in the graphical user interface. This directive is optional.

Password = <UA-password>
Specifies the password that must be supplied for the default Bacula Console to be authorized. The same password must appear in the Director resource of the Console configuration file. For added security, the password is never actually passed across the network but rather a challenge response hash code created with the password. This directive is required. If you have either /dev/random or bc on your machine, Bacula will generate a random password during the configuration process, otherwise it will be left blank and you must manually supply it.

Messages = <Messages-resource-name>
The messages resource specifies where to deliver Director messages that are not associated with a specific Job. Most messages are specific to a job and will be directed to the Messages resource specified by the job. However, there are a few messages that can occur when no job is running. This directive is required.

Working Directory = <Directory>
This directive is mandatory and specifies a directory in which the Director may put its status files. This directory should be used only by Bacula but may be shared by other Bacula daemons. However, please note, if this directory is shared with other Bacula daemons (the File daemon and Storage daemon), you must ensure that the Name given to each daemon is unique so that the temporary filenames used do not collide. By default the Bacula configure process creates unique daemon names by postfixing them with -dir, -fd, and -sd. Standard shell expansion of the Directory is done when the configuration file is read so that values such as $HOME will be properly expanded. This directive is required.

Pid Directory = <Directory>
This directive is mandatory and specifies a directory in which the Director may put its process Id file. The process Id file is used to shutdown Bacula and to prevent multiple copies of Bacula from running simultaneously. Standard shell expansion of the Directory is done when the configuration file is read so that values such as $HOME will be properly expanded.

Typically on Linux systems, you will set this to: /var/run. If you are not installing Bacula in the system directories, you can use the Working Directory as defined above. This directive is required.

Scripts Directory = <Directory>
This directive is optional and, if defined, specifies a directory in which the Director will look for the Python startup script DirStartup.py. This directory may be shared by other Bacula daemons. Standard shell expansion of the directory is done when the configuration file is read so that values such as $HOME will be properly expanded.

QueryFile = <Path>
This directive is mandatory and specifies a directory and file in which the Director can find the canned SQL statements for the Query command of the Console. Standard shell expansion of the Path is done when the configuration file is read so that values such as $HOME will be properly expanded. This directive is required.

Maximum Concurrent Jobs = <number>
where <number> is the maximum number of total Director Jobs that should run concurrently. The default is set to 1, but you may set it to a larger number.

Please note that the Volume format becomes much more complicated with multiple simultaneous jobs, consequently, restores can take much longer if Bacula must sort through interleaved volume blocks from multiple simultaneous jobs. This can be avoided by having each simultaneously running job write to a different volume or by using data spooling, which will first spool the data to disk simultaneously, then write each spool file to the volume in sequence.

There may also still be some cases where directives such as Maximum Volume Jobs are not properly synchronized with multiple simultaneous jobs (subtle timing issues can arise), so careful testing is recommended.

At the current time, there is no configuration parameter set to limit the number of console connections. A maximum of five simultaneous console connections are permitted.

For more details on getting concurrent jobs to run, please see Running Concurrent Jobs in the Tips chapter of this manual.

FD Connect Timeout = <time>
where time is the time that the Director should continue attempting to contact the File daemon to start a job, and after which the Director will cancel the job. The default is 30 minutes.

SD Connect Timeout = <time>
where time is the time that the Director should continue attempting to contact the Storage daemon to start a job, and after which the Director will cancel the job. The default is 30 minutes.

DirAddresses = <IP-address-specification>
Specify the ports and addresses on which the Director daemon will listen for Bacula Console connections. Probably the simplest way to explain this is to show an example:

 DirAddresses  = { ip = {
        addr = 1.2.3.4; port = 1205;}
    ipv4 = {
        addr = 1.2.3.4; port = http;}
    ipv6 = {
        addr = 1.2.3.4;
        port = 1205;
   }
    ip = {
        addr = 1.2.3.4
        port = 1205
   }
    ip = {
        addr = 1.2.3.4
   }
    ip = {
        addr = 201:220:222::2
   }
    ip = {
        addr = bluedot.thun.net
   }
}

where ip, ip4, ip6, addr, and port are all keywords. Note, that the address can be specified as either a dotted quadruple, or IPv6 colon notation, or as a symbolic name (only in the ip specification). Also, port can be specified as a number or as the mnemonic value from the /etc/services file. If a port is not specified, the default will be used. If an ip section is specified, the resolution can be made either by IPv4 or IPv6. If ip4 is specified, then only IPv4 resolutions will be permitted, and likewise with ip6.

DIRport = <port-number>
Specify the port (a positive integer) on which the Director daemon will listen for Bacula Console connections. This same port number must be specified in the Director resource of the Console configuration file. The default is 9101, so normally this directive need not be specified. This directive is not needed if you specify DirAddresses.

DirAddress = <IP-Address>
This directive is optional, but if it is specified, it will cause the Director server (for the Console program) to bind to the specified IP-Address, which is either a domain name or an IP address specified as a dotted quadruple in string or quoted string format. If this directive is not specified, the Director will bind to any available address (the default). Note, unlike the DirAddresses specification noted above, this directive only permits a single address to be specified. This directive is not needed if you specify a DirAddresses (not plural).

The following is an example of a valid Director resource definition:

Director {
  Name = HeadMan
  WorkingDirectory = "$HOME/bacula/bin/working"
  Password = UA_password
  PidDirectory = "$HOME/bacula/bin/working"
  QueryFile = "$HOME/bacula/bin/query.sql"
  Messages = Standard
}


The Job Resource

The Job resource defines a Job (Backup, Restore, ...) that Bacula must perform. Each Job resource definition contains the name of a Client and a FileSet to backup, the Schedule for the Job, where the data are to be stored, and what media Pool can be used. In effect, each Job resource must specify What, Where, How, and When or FileSet, Storage, Backup/Restore/Level, and Schedule respectively. Note, the FileSet must be specified for a restore job for historical reasons, but it is no longer used.

Only a single type (Backup, Restore, ...) can be specified for any job. If you want to backup multiple FileSets on the same Client or multiple Clients, you must define a Job for each one.

Job
Start of the Job resource. At least one Job resource is required.

Name = <name>
The Job name. This name can be specified on the Run command in the console program to start a job. If the name contains spaces, it must be specified between quotes. It is generally a good idea to give your job the same name as the Client that it will backup. This permits easy identification of jobs.

When the job actually runs, the unique Job Name will consist of the name you specify here followed by the date and time the job was scheduled for execution. This directive is required.

Type = <job-type>
The Type directive specifies the Job type, which may be one of the following: Backup, Restore, Verify, or Admin. This directive is required. Within a particular Job Type, there are also Levels as discussed in the next item.

Backup
Run a backup Job. Normally you will have at least one Backup job for each client you want to save. Normally, unless you turn off cataloging, most all the important statistics and data concerning files backed up will be placed in the catalog.

Restore
Run a restore Job. Normally, you will specify only one Restore job which acts as a sort of prototype that you will modify using the console program in order to perform restores. Although certain basic information from a Restore job is saved in the catalog, it is very minimal compared to the information stored for a Backup job -- for example, no File database entries are generated since no Files are saved.

Verify
Run a verify Job. In general, verify jobs permit you to compare the contents of the catalog to the file system, or to what was backed up. In addition, to verifying that a tape that was written can be read, you can also use verify as a sort of tripwire intrusion detection.

Admin
Run an admin Job. An Admin job can be used to periodically run catalog pruning, if you do not want to do it at the end of each Backup Job. Although an Admin job is recorded in the catalog, very little data is saved.

Level = <job-level>
The Level directive specifies the default Job level to be run. Each different Job Type (Backup, Restore, ...) has a different set of Levels that can be specified. The Level is normally overridden by a different value that is specified in the Schedule resource. This directive is not required, but must be specified either by a Level directive or as an override specified in the Schedule resource.

For a Backup Job, the Level may be one of the following:

Full
is all files in the FileSet whether or not they have changed.

Incremental
is all files specified in the FileSet that have changed since the last successful backup of the the same Job using the same FileSet and Client. If the Director cannot find a previous valid Full backup then the job will be upgraded into a Full backup. When the Director looks for a valid backup record in the catalog database, it looks for a previous Job with:

  • The same Job name.
  • The same Client name.
  • The same FileSet (any change to the definition of the FileSet such as adding or deleting a file in the Include or Exclude sections constitutes a different FileSet.
  • The Job was a Full, Differential, or Incremental backup.
  • The Job terminated normally (i.e. did not fail or was not canceled).

If all the above conditions do not hold, the Director will upgrade the Incremental to a Full save. Otherwise, the Incremental backup will be performed as requested.

The File daemon (Client) decides which files to backup for an Incremental backup by comparing start time of the prior Job (Full, Differential, or Incremental) against the time each file was last "modified" (st_mtime) and the time its attributes were last "changed"(st_ctime). If the file was modified or its attributes changed on or after this start time, it will then be backed up.

Please note that some virus scanning software may change st_ctime while doing the scan. For example, if the virus scanning program attempts to reset the access time (st_atime), which Bacula does not use, it will cause st_ctime to change and hence Bacula will backup the file during an Incremental or Differential backup. In the case of Sophos virus scanning, you can prevent it from resetting the access time (st_atime) and hence changing st_ctime by using the --no-reset-atime option. For other software, please see their manual.

When Bacula does an Incremental backup, all modified files that are still on the system are backed up. However, any file that has been deleted since the last Full backup remains in the Bacula catalog, which means that if between a Full save and the time you do a restore, some files are deleted, those deleted files will also be restored. The deleted files will no longer appear in the catalog after doing another Full save. However, to remove deleted files from the catalog during an Incremental backup is quite a time consuming process and not currently implemented in Bacula.

In addition, if you move a directory rather than copy it, the files in it do not have their modification time (st_mtime) or their attribute change time (st_ctime) changed. As a consequence, those files will probably not be backed up by an Incremental or Differential backup which depend solely on these time stamps. If you move a directory, and wish it to be properly backed up, it is generally preferable to copy it, then delete the original.

Differential
is all files specified in the FileSet that have changed since the last successful Full backup of the same Job. If the Director cannot find a valid previous Full backup for the same Job, FileSet, and Client, backup, then the Differential job will be upgraded into a Full backup. When the Director looks for a valid Full backup record in the catalog database, it looks for a previous Job with:

  • The same Job name.
  • The same Client name.
  • The same FileSet (any change to the definition of the FileSet such as adding or deleting a file in the Include or Exclude sections constitutes a different FileSet.
  • The Job was a FULL backup.
  • The Job terminated normally (i.e. did not fail or was not canceled).

If all the above conditions do not hold, the Director will upgrade the Differential to a Full save. Otherwise, the Differential backup will be performed as requested.

The File daemon (Client) decides which files to backup for a differential backup by comparing the start time of the prior Full backup Job against the time each file was last "modified" (st_mtime) and the time its attributes were last "changed" (st_ctime). If the file was modified or its attributes were changed on or after this start time, it will then be backed up. The start time used is displayed after the Since on the Job report. In rare cases, using the start time of the prior backup may cause some files to be backed up twice, but it ensures that no change is missed. As with the Incremental option, you should ensure that the clocks on your server and client are synchronized or as close as possible to avoid the possibility of a file being skipped. Note, on versions 1.33 or greater Bacula automatically makes the necessary adjustments to the time between the server and the client so that the times Bacula uses are synchronized.

When Bacula does a Differential backup, all modified files that are still on the system are backed up. However, any file that has been deleted since the last Full backup remains in the Bacula catalog, which means that if between a Full save and the time you do a restore, some files are deleted, those deleted files will also be restored. The deleted files will no longer appear in the catalog after doing another Full save. However, to remove deleted files from the catalog during a Differential backup is quite a time consuming process and not currently implemented in Bacula. It is, however, a planned future feature.

As noted above, if you move a directory rather than copy it, the files in it do not have their modification time (st_mtime) or their attribute change time (st_ctime) changed. As a consequence, those files will probably not be backed up by an Incremental or Differential backup which depend solely on these time stamps. If you move a directory, and wish it to be properly backed up, it is generally preferable to copy it, then delete the original. Alternatively, you can move the directory, then use the touch program to update the timestamps.

Every once and a while, someone asks why we need Differential backups as long as Incremental backups pickup all changed files. There are possibly many answers to this question, but the one that is the most important for me is that it effectively combines all the Incremental and Differential backups since the last Full backup into a single Differential backup. This has two effects: 1. It gives some redundancy. 2. More importantly, it reduces the number of Volumes that are needed to do a restore effectively eliminating the need to read all the volumes on which the preceding Incremental and Differential backups since the last Full are done.

For a Restore Job, no level needs to be specified.

For a Verify Job, the Level may be one of the following:

InitCatalog
does a scan of the specified FileSet and stores the file attributes in the Catalog database. Since no file data is saved, you might ask why you would want to do this. It turns out to be a very simple and easy way to have a Tripwire like feature using Bacula. In other words, it allows you to save the state of a set of files defined by the FileSet and later check to see if those files have been modified or deleted and if any new files have been added. This can be used to detect system intrusion. Typically you would specify a FileSet that contains the set of system files that should not change (e.g. /sbin, /boot, /lib, /bin, ...). Normally, you run the InitCatalog level verify one time when your system is first setup, and then once again after each modification (upgrade) to your system. Thereafter, when your want to check the state of your system files, you use a Verify level = Catalog. This compares the results of your InitCatalog with the current state of the files.

Catalog
Compares the current state of the files against the state previously saved during an InitCatalog. Any discrepancies are reported. The items reported are determined by the verify options specified on the Include directive in the specified FileSet (see the FileSet resource below for more details). Typically this command will be run once a day (or night) to check for any changes to your system files.

Please note! If you run two Verify Catalog jobs on the same client at the same time, the results will certainly be incorrect. This is because Verify Catalog modifies the Catalog database while running in order to track new files.

VolumeToCatalog
This level causes Bacula to read the file attribute data written to the Volume from the last Job. The file attribute data are compared to the values saved in the Catalog database and any differences are reported. This is similar to the Catalog level except that instead of comparing the disk file attributes to the catalog database, the attribute data written to the Volume is read and compared to the catalog database. Although the attribute data including the signatures (MD5 or SHA1) are compared, the actual file data is not compared (it is not in the catalog).

Please note! If you run two Verify VolumeToCatalog jobs on the same client at the same time, the results will certainly be incorrect. This is because the Verify VolumeToCatalog modifies the Catalog database while running.

DiskToCatalog
This level causes Bacula to read the files as they currently are on disk, and to compare the current file attributes with the attributes saved in the catalog from the last backup for the job specified on the VerifyJob directive. This level differs from the Catalog level described above by the fact that it doesn't compare against a previous Verify job but against a previous backup. When you run this level, you must supply the verify options on your Include statements. Those options determine what attribute fields are compared.

This command can be very useful if you have disk problems because it will compare the current state of your disk against the last successful backup, which may be several jobs.

Note, the current implementation (1.32c) does not identify files that have been deleted.

Verify Job = <Job-Resource-Name>
If you run a verify job without this directive, the last job run will be compared with the catalog, which means that you must immediately follow a backup by a verify command. If you specify a Verify Job Bacula will find the last job with that name that ran. This permits you to run all your backups, then run Verify jobs on those that you wish to be verified (most often a VolumeToCatalog) so that the tape just written is re-read.

JobDefs = <JobDefs-Resource-Name>
If a JobDefs-Resource-Name is specified, all the values contained in the named JobDefs resource will be used as the defaults for the current Job. Any value that you explicitly define in the current Job resource, will override any defaults specified in the JobDefs resource. The use of this directive permits writing much more compact Job resources where the bulk of the directives are defined in one or more JobDefs. This is particularly useful if you have many similar Jobs but with minor variations such as different Clients. A simple example of the use of JobDefs is provided in the default bacula-dir.conf file.

Bootstrap = <bootstrap-file>
The Bootstrap directive specifies a bootstrap file that, if provided, will be used during Restore Jobs and is ignored in other Job types. The bootstrap file contains the list of tapes to be used in a restore Job as well as which files are to be restored. Specification of this directive is optional, and if specified, it is used only for a restore job. In addition, when running a Restore job from the console, this value can be changed.

If you use the Restore command in the Console program, to start a restore job, the bootstrap file will be created automatically from the files you select to be restored.

For additional details of the bootstrap file, please see Restoring Files with the Bootstrap File chapter of this manual.

Write Bootstrap = <bootstrap-file-specification>
The writebootstrap directive specifies a file name where Bacula will write a bootstrap file for each Backup job run. Thus this directive applies only to Backup Jobs. If the Backup job is a Full save, Bacula will erase any current contents of the specified file before writing the bootstrap records. If the Job is an Incremental save, Bacula will append the current bootstrap record to the end of the file.

Using this feature, permits you to constantly have a bootstrap file that can recover the current state of your system. Normally, the file specified should be a mounted drive on another machine, so that if your hard disk is lost, you will immediately have a bootstrap record available. Alternatively, you should copy the bootstrap file to another machine after it is updated.

If the bootstrap-file-specification begins with a vertical bar (|), Bacula will use the specification as the name of a program to which it will pipe the bootstrap record. It could for example be a shell script that emails you the bootstrap record.

For more details on using this file, please see the chapter entitled The Bootstrap File of this manual.

Client = <client-resource-name>
The Client directive specifies the Client (File daemon) that will be used in the current Job. Only a single Client may be specified in any one Job. The Client runs on the machine to be backed up, and sends the requested files to the Storage daemon for backup, or receives them when restoring. For additional details, see the Client Resource section of this chapter. This directive is required.

FileSet = <FileSet-resource-name>
The FileSet directive specifies the FileSet that will be used in the current Job. The FileSet specifies which directories (or files) are to be backed up, and what options to use (e.g. compression, ...). Only a single FileSet resource may be specified in any one Job. For additional details, see the FileSet Resource section of this chapter. This directive is required.

Messages = <messages-resource-name>
The Messages directive defines what Messages resource should be used for this job, and thus how and where the various messages are to be delivered. For example, you can direct some messages to a log file, and others can be sent by email. For additional details, see the Messages Resource Chapter of this manual. This directive is required.

Pool = <pool-resource-name>
The Pool directive defines the pool of Volumes where your data can be backed up. Many Bacula installations will use only the Default pool. However, if you want to specify a different set of Volumes for different Clients or different Jobs, you will probably want to use Pools. For additional details, see the Pool Resource section of this chapter. This directive is required.

Full Backup Pool = <pool-resource-name>
The Full Backup Pool specifies a Pool to be used for Full backups. It will override any Pool specification during a Full backup. This directive is optional.

Differential Backup Pool = <pool-resource-name>
The Differential Backup Pool specifies a Pool to be used for Differential backups. It will override any Pool specification during a Differential backup. This directive is optional.

Incremental Backup Pool = <pool-resource-name>
The Incremental Backup Pool specifies a Pool to be used for Incremental backups. It will override any Pool specification during an Incremental backup. This directive is optional.

Schedule = <schedule-name>
The Schedule directive defines what schedule is to be used for the Job. The schedule in turn determines when the Job will be automatically started and what Job level (i.e. Full, Incremental, ...) is to be run. This directive is optional, and if left out, the Job can only be started manually using the Console program. Although you may specify only a single Schedule resource for any one job, the Schedule resource may contain multiple Run directives, which allow you to run the Job at many different times, and each run directive permits overriding the default Job Level Pool, Storage, and Messages resources. This gives considerable flexibility in what can be done with a single Job. For additional details, see the Schedule Resource Chapter of this manual.

Storage = <storage-resource-name>
The Storage directive defines the name of the storage services where you want to backup the FileSet data. For additional details, see the Storage Resource Chapter of this manual. This directive is required.

Max Start Delay = <time>
The time specifies the maximum delay between the scheduled time and the actual start time for the Job. For example, a job can be scheduled to run at 1:00am, but because other jobs are running, it may wait to run. If the delay is set to 3600 (one hour) and the job has not begun to run by 2:00am, the job will be canceled. This can be useful, for example, to prevent jobs from running during day time hours. The default is 0 which indicates no limit.

Max Run Time = <time>
The time specifies the maximum allowed time that a job may run, counted from when the job starts, (not necessarily the same as when the job was scheduled). This directive is implemented in version 1.33 and later.

Max Wait Time = <time>
The time specifies the maximum allowed time that a job may block waiting for a resource (such as waiting for a tape to be mounted, or waiting for the storage or file daemons to perform their duties), counted from the when the job starts, (not necessarily the same as when the job was scheduled). This directive is implemented only in version 1.33 and later.

Incremental Max Wait Time = <time>
The time specifies the maximum allowed time that an Incremental backup job may block waiting for a resource (such as waiting for a tape to be mounted, or waiting for the storage or file daemons to perform their duties), counted from the when the job starts, (not necessarily the same as when the job was scheduled). Please note that if there is a Max Wait Time it may also be applied to the job.

Differential Max Wait Time = <time>
The time specifies the maximum allowed time that a Differential backup job may block waiting for a resource (such as waiting for a tape to be mounted, or waiting for the storage or file daemons to perform their duties), counted from the when the job starts, (not necessarily the same as when the job was scheduled). Please note that if there is a Max Wait Time it may also be applied to the job.

Prefer Mounted Volumes = <yes|no>
It the Prefer Mounted Volumes directive is set to yes (default yes), it is used to inform the Storage daemon to select either an Autochanger or a drive with a valid Volume already mounted in preference to a drive that is not ready. If none is available, it will select the first available drive. If the directive is set to no, the Storage daemon will prefer finding an unused drive. This can potentially be useful for those sites that prefer to maximum backup throughput at the expense of using additional drives and Volumes.

Prune Jobs = <yes|no>
Normally, pruning of Jobs from the Catalog is specified on a Client by Client basis in the Client resource with the AutoPrune directive. If this directive is specified (not normally) and the value is yes, it will override the value specified in the Client resource. The default is no.

Prune Files = <yes|no>
Normally, pruning of Files from the Catalog is specified on a Client by Client basis in the Client resource with the AutoPrune directive. If this directive is specified (not normally) and the value is yes, it will override the value specified in the Client resource. The default is no.

Prune Volumes = <yes|no>
Normally, pruning of Volumes from the Catalog is specified on a Client by Client basis in the Client resource with the AutoPrune directive. If this directive is specified (not normally) and the value is yes, it will override the value specified in the Client resource. The default is no.

Run Before Job = <command>
The specified command is run as an external program prior to running the current Job. Any output sent by the command to standard output will be included in the Bacula job report. The command string must be a valid program name or name of a shell script. This directive is not required, but if it is defined, and if the exit code of the program run is non-zero, the current Bacula job will be canceled. In addition, the command string is parsed then fed to the execvp() function, which means that the path will be searched to execute your specified command, but there is no shell interpretation, as a consequence, if you invoke complicated commands or want any shell features such as redirection or piping, you must call a shell script and do it inside that script.

Before submitting the specified command to the operating system, Bacula performs character substitution of the following characters:

    %% = %
    %c = Client's name
    %d = Director's name
    %i = JobId
    %e = Job Exit Status
    %j = Unique Job name
    %l = Job Level
    %n = Job name
    %t = Job type
    %v = Volume name
    

The Job Exit Status code %e edits the following values:

Thus if you edit it on a command line, you will need to enclose it within some sort of quotes.

Bacula checks the exit status of the RunBeforeJob program. If it is non-zero, the job will be error terminated. Lutz Kittler has pointed out that using the RunBeforJob directive can be a simple way to modify your schedules during a holiday. For example, suppose that you normally do Full backups on Fridays, but Thursday and Friday are holidays. To avoid having to change tapes between Thursday and Friday when no one is in the office, you can create a RunBeforeJob that returns a non-zero status on Thursday and zero on all other days. That way, the Thursday job will not run, and on Friday the tape you inserted on Wednesday before leaving will be used.

Run After Job = <command>
The specified command is run as an external program after the current job terminates. This directive is not required. The command string must be a valid program name or name of a shell script. If the exit code of the program run is non-zero, the current Bacula job will terminate in error. Before submitting the specified command to the operating system, Bacula performs character substitution as described above for the Run Before Job directive.

An example of the use of this directive is given in the Tips Chapter of this manual. As of version 1.30, Bacula checks the exit status of the RunAfter program. If it is non-zero, the job will be terminated in error.

Client Run Before Job = <command>
This directive is the same as Run Before Job except that the program is run on the client machine. The same restrictions apply to Unix systems as noted above for the Run Before Job. In addition, for a Windows client on version 1.33 and above, please take careful note that you must ensure a correct path to your script. The script or program can be a .com, .exe or a .bat file. However, if you specify a path, you must also specify the full extension. Unix like commands will not work unless you have installed and properly configured Cygwin in addition to and separately from Bacula.

Special Windows Considerations The command can be anything that cmd.exe or command.com will recognize as an executable file. Specifying the executable's extension is optional, unless there is an ambiguity. (i.e. ls.bat, ls.exe)

The System %Path% will be searched for the command. (under the environment variable dialog you have have both System Environment and User Environment, we believe that only the System environment will be available to bacula-fd, if it is running as a service.)

System environment variables can be referenced with %var% and used as either part of the command name or arguments.

When specifying a full path to an executable if the path or executable name contains whitespace or special characters they will need to be quoted. Arguments containing whitespace or special characters will also have to be quoted.

ClientRunBeforeJob = "\"C:/Program Files/Software
     Vendor/Executable\" /arg1 /arg2 \"foo bar\""

The special characters &()[]{}^=;!'+,`~ will need to be quoted if they are part of a filename or argument.

If someone is logged in, a blank "command" window running the commands will be present during the execution of the command.

Some Suggestions from Phil Stracchino for running on Win32 machines with the native Win32 File daemon:

  1. You might want the ClientRunBeforeJob directive to specify a .bat file which runs the actual client-side commands, rather than trying to run (for example) regedit /e directly.
  2. The batch file should explicitly 'exit 0' on successful completion.
  3. The path to the batch file should be specified in Unix form:

    ClientRunBeforeJob = "c:/bacula/bin/systemstate.bat"

    rather than DOS/Windows form:

    ClientRunBeforeJob =

    "c:\bacula\bin\systemstate.bat" INCORRECT

The following example of the use of the Client Run Before Job directive was submitted by a user:
You could write a shell script to back up a DB2 database to a FIFO. The shell script is:

 #!/bin/sh
 # ===== backupdb.sh
 DIR=/u01/mercuryd
 
 mkfifo $DIR/dbpipe
 db2 BACKUP DATABASE mercuryd TO $DIR/dbpipe WITHOUT PROMPTING &
 sleep 1

The following line in the Job resource in the bacula-dir.conf file:

 Client Run Before Job = "su - mercuryd -c \"/u01/mercuryd/backupdb.sh '%t'
'%l'\""
When the job is run, you will get messages from the output of the script stating that the backup has started. Even though the command being run is backgrounded with &, the job will block until the "db2 BACKUP DATABASE" command, thus the backup stalls.

To remedy this situation, the "db2 BACKUP DATABASE" line should be changed to the following:

 
 db2 BACKUP DATABASE mercuryd TO $DIR/dbpipe WITHOUT PROMPTING > $DIR/backup.log
2>&1 < /dev/null &

It is important to redirect the input and outputs of a backgrounded command to /dev/null to prevent the script from blocking.

Client Run After Job = <command>
This directive is the same as Run After Job except that it is run on the client machine. Note, please see the notes above in Client Run Before Job concerning Windows clients.

Rerun Failed Levels = <yes|no>
If this directive is set to yes (default no), and Bacula detects that a previous job at a higher level (i.e. Full or Differential) has failed, the current job level will be upgraded to the higher level. This is particularly useful for Laptops where they may often be unreachable, and if a prior Full save has failed, you wish the very next backup to be a Full save rather than whatever level it is started as.

Spool Data = <yes|no>
If this directive is set to yes (default no), the Storage daemon will be requested to spool the data for this Job to disk rather than write it directly to tape. Once all the data arrives or the spool files' maximum sizes are reached, the data will be despooled and written to tape. When this directive is set to yes, the Spool Attributes is also automatically set to yes. Spooling data prevents tape shoe-shine (start and stop) during Incremental saves. This option should not be used if you are writing to a disk file.

Spool Attributes = <yes|no>
The default is set to no, which means that the File attributes are sent by the Storage daemon to the Director as they are stored on tape. However, if you want to avoid the possibility that database updates will slow down writing to the tape, you may want to set the value to yes, in which case the Storage daemon will buffer the File attributes and Storage coordinates to a temporary file in the Working Directory, then when writing the Job data to the tape is completed, the attributes and storage coordinates will be sent to the Director.

Where = <directory>
This directive applies only to a Restore job and specifies a prefix to the directory name of all files being restored. This permits files to be restored in a different location from which they were saved. If Where is not specified or is set to backslash (/), the files will be restored to their original location. By default, we have set Where in the example configuration files to be /tmp/bacula-restores. This is to prevent accidental overwriting of your files.

Replace = <replace-option>
This directive applies only to a Restore job and specifies what happens when Bacula wants to restore a file or directory that already exists. You have the following options for replace-option:

always
when the file to be restored already exists, it is deleted and then replaced by the copy that was backed up.

ifnewer
if the backed up file (on tape) is newer than the existing file, the existing file is deleted and replaced by the back up.

ifolder
if the backed up file (on tape) is older than the existing file, the existing file is deleted and replaced by the back up.

never
if the backed up file already exists, Bacula skips restoring this file.

Prefix Links=<yes|no>
If a Where path prefix is specified for a recovery job, apply it to absolute links as well. The default is No. When set to Yes then while restoring files to an alternate directory, any absolute soft links will also be modified to point to the new alternate directory. Normally this is what is desired -- i.e. everything is self consistent. However, if you wish to later move the files to their original locations, all files linked with absolute names will be broken.

Maximum Concurrent Jobs = <number>
where <number> is the maximum number of Jobs from the current Job resource that can run concurrently. Note, this directive limits only Jobs with the same name as the resource in which it appears. Any other restrictions on the maximum concurrent jobs such as in the Director, Client, or Storage resources will also apply in addition to the limit specified here. The default is set to 1, but you may set it to a larger number. We strongly recommend that you read the WARNING documented under Maximum Concurrent Jobs in the Director's resource.

Reschedule On Error = <yes|no>
If this directive is enabled, and the job terminates in error, the job will be rescheduled as determined by the Reschedule Interval and Reschedule Times directives. If you cancel the job, it will not be rescheduled. The default is no (i.e. the job will not be rescheduled).

This specification can be useful for portables, laptops, or other machines that are not always connected to the network or switched on.

Reschedule Interval = <time-specification>
If you have specified Reschedule On Error = yes and the job terminates in error, it will be rescheduled after the interval of time specified by time-specification. See the time specification formats in the Configure chapter for details of time specifications. If no interval is specified, the job will not be rescheduled on error.

Reschedule Times = <count>
This directive specifies the maximum number of times to reschedule the job. If it is set to zero (the default) the job will be rescheduled an indefinite number of times.

Run = <job-name>
The Run directive (not to be confused with the Run option in a Schedule) allows you to start other jobs or to clone jobs. By using the cloning keywords (see below), you can backup the same data (or almost the same data) to two or more drives at the same time. The job-name is normally the same name as the current Job resource (thus creating a clone). However, it may be any Job name, so one job may start other related jobs.

The part after the equal sign must be enclosed in double quotes, and can contain any string or set of options (overrides) that you can specify when entering the Run command from the console. For example storage=DDS-4 .... In addition, there are two special keywords that permit you to clone the current job. They are level=%l and since=%s. The %l in the level keyword permits entering the actual level of the current job and the %s in the since keyword permits putting the same time for comparison as used on the current job. Note, in the case of the since keyword, the %s must be enclosed in double quotes, and thus they must be preceded by a backslash since they are already inside quotes. For example:

   run = "Nightly-backup level=%s since=\"%s\" storage=DDS-4"

A cloned job will not start additional clones, so it is not possible to recurse.

Priority = <number>
This directive permits you to control the order in which your jobs run by specifying a positive non-zero number. The higher the number, the lower the job priority. Assuming you are not running concurrent jobs, all queued jobs of priority 1 will run before queued jobs of priority 2 and so on, regardless of the original scheduling order.

The priority only affects waiting jobs that are queued to run, not jobs that are already running. If one or more jobs of priority 2 are already running, and a new job is scheduled with priority 1, the currently running priority 2 jobs must complete before the priority 1 job is run.

The default priority is 10.

If you want to run concurrent jobs, which is not recommended, you should keep these points in mind:

If you have several jobs of different priority, it may not best to start them at exactly the same time, because Bacula must examine them one at a time. If by Bacula starts a lower priority job first, then it will run before your high priority jobs. If you experience this problem, you may avoid it by starting any higher priority jobs a few seconds before lower priority ones. This insures that Bacula will examine the jobs in the correct order, and that your priority scheme will be respected.

Write Part After Job = <yes|no>
This directive is only implemented in version 1.37 and later. If this directive is set to yes (default no), a new part file will be created after the job is finished.

It should be set to yes when writing to devices that require mount (for example DVD), so you are sure that the current part, containing this job's data, is written to the device, and that no data is left in the temporary file on the hard disk. However, on some media, like DVD+R and DVD-R, a lot of space (about 10Mb) is lost everytime a part is written. So, if you run several jobs each after another, you could set this directive to no for all jobs, except the last one, to avoid wasting too much space, but to ensure that the data is written to the medium when all jobs are finished.

It is ignored with tape and FIFO devices.

The following is an example of a valid Job resource definition:

Job {
  Name = "Minou"
  Type = Backup
  Level = Incremental                 # default
  Client = Minou
  FileSet="Minou Full Set"
  Storage = DLTDrive
  Pool = Default
  Schedule = "MinouWeeklyCycle"
  Messages = Standard
}


The JobDefs Resource

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 to be mentioned in each Job.


The Schedule Resource

The Schedule resource provides a means of automatically scheduling a Job as well as the ability to override the default Level, Pool, Storage and Messages resources. If a Schedule resource is not referenced in a Job, the Job can only be run manually. In general, you specify an action to be taken and when.

Schedule
Start of the Schedule directives. No Schedule resource is required, but you will need at least one if you want Jobs to be automatically started.

Name = <name>
The name of the schedule being defined. The Name directive is required.

Run = <Job-overrides> <Date-time-specification>
The Run directive defines when a Job is to be run, and what overrides if any to apply. You may specify multiple run directives within a Schedule resource. If you do, they will all be applied (i.e. multiple schedules). If you have two Run directives that start at the same time, two Jobs will start at the same time (well, within one second of each other).

The Job-overrides permit overriding the Level, the Storage, the Messages, and the Pool specifications provided in the Job resource. In addition, the FullPool, the IncrementalPool, and the DifferentialPool specifications permit overriding the Pool specification according to what backup Job Level is in effect.

By the use of overrides, you may customize a particular Job. For example, you may specify a Messages override for your Incremental backups that outputs messages to a log file, but for your weekly or monthly Full backups, you may send the output by email by using a different Messages override.

Job-overrides are specified as: keyword=value where the keyword is Level, Storage, Messages, Pool, FullPool, DifferentialPool, or IncrementalPool, and the value is as defined on the respective directive formats for the Job resource. You may specify multiple Job-overrides on one Run directive by separating them with one or more spaces or by separating them with a trailing comma. For example:

Level=Full
is all files in the FileSet whether or not they have changed.

Level=Incremental
is all files that have changed since the last backup.

Pool=Weekly
specifies to use the Pool named Weekly.

Storage=DLT_Drive
specifies to use DLT_Drive for the storage device.

Messages=Verbose
specifies to use the Verbose message resource for the Job.

FullPool=Full
specifies to use the Pool named Full if the job is a full backup, or is upgraded from another type to a full backup.

DifferentialPool=Differential
specifies to use the Pool named Differential if the job is a differential backup.

IncrementalPool=Incremental
specifies to use the Pool named Incremental if the job is an incremental backup.

SpoolData=yes|no
tells Bacula to request the Storage daemon to spool data to a disk file before putting it on tape.

WritePartAfterJob=yes|no
tells Bacula to request the Storage daemon to write the current part file to the device when the job is finished (see Write Part After Job directive in the Job resource). Please note, this directive is implemented only in version 1.37 and later.

Date-time-specification determines when the Job is to be run. The specification is a repetition, and as a default Bacula is set to run a job at the beginning of the hour of every hour of every day of every week of every month of every year. This is not normally what you want, so you must specify or limit when you want the job to run. Any specification given is assumed to be repetitive in nature and will serve to override or limit the default repetition. This is done by specifying masks or times for the hour, day of the month, day of the week, week of the month, week of the year, and month when you want the job to run. By specifying one or more of the above, you can define a schedule to repeat at almost any frequency you want.

Basically, you must supply a month, day, hour, and minute the Job is to be run. Of these four items to be specified, day is special in that you may either specify a day of the month such as 1, 2, ... 31, or you may specify a day of the week such as Monday, Tuesday, ... Sunday. Finally, you may also specify a week qualifier to restrict the schedule to the first, second, third, fourth, or fifth week of the month.

For example, if you specify only a day of the week, such as Tuesday the Job will be run every hour of every Tuesday of every Month. That is the month and hour remain set to the defaults of every month and all hours.

Note, by default with no other specification, your job will run at the beginning of every hour. If you wish your job to run more than once in any given hour, you will need to specify multiple run specifications each with a different minute.

The date/time to run the Job can be specified in the following way in pseudo-BNF:

<void-keyword>    = on
<at-keyword>      = at
<week-keyword>    = 1st | 2nd | 3rd | 4th | 5th | first |
                    second | third | forth | fifth
<wday-keyword>    = sun | mon | tue | wed | thu | fri | sat |
                    sunday | monday | tuesday | wednesday |
                    thursday | friday | saturday
<week-of-year-keyword> = w00 | w01 | ... w52 | w53
<month-keyword>   = jan | feb | mar | apr | may | jun | jul |
                    aug | sep | oct | nov | dec | january |
                    february | ... | december
<daily-keyword>   = daily
<weekly-keyword>  = weekly
<monthly-keyword> = monthly
<hourly-keyword>  = hourly
<digit>           = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0
<number>          = <digit> | <digit><number>
<12hour>          = 0 | 1 | 2 | ... 12
<hour>            = 0 | 1 | 2 | ... 23
<minute>          = 0 | 1 | 2 | ... 59
<day>             = 1 | 2 | ... 31
<time>            = <hour>:<minute> |
                    <12hour>:<minute>am |
                    <12hour>:<minute>pm
<time-spec>       = <at-keyword> <time> |
                    <hourly-keyword>
<date-keyword>    = <void-keyword>  <weekly-keyword>
<day-range>       = <day>-<day>
<month-range>     = <month-keyword>-<month-keyword>
<wday-range>      = <wday-keyword>-<wday-keyword>
<range>           = <day-range> | <month-range> |
                          <wday-range>
<date>            = <date-keyword> | <day> | <range>
<date-spec>       = <date> | <date-spec>
<day-spec>        = <day> | <wday-keyword> |
                    <day-range> | <wday-range> |
                    <daily-keyword>
<day-spec>        = <day> | <wday-keyword> |
                    <day> | <wday-range> |
                    <week-keyword> <wday-keyword> |
                    <week-keyword> <wday-range>
<month-spec>      = <month-keyword> | <month-range> |
                    <monthly-keyword>
<date-time-spec>  = <month-spec> <day-spec> <time-spec>

Note, the Week of Year specification wnn follows the ISO standard definition of the week of the year, where Week 1 is the week in which the first Thursday of the year occurs, or alternatively, the week which contains the 4th of January. Weeks are numbered w01 to w53. w00 for Bacula is the week that precedes the first ISO week (i.e. has the first few days of the year if any occur before Thursday). w00 is not defined by the ISO specification. A week starts with Monday and ends with Sunday.

An example schedule resource that is named WeeklyCycle and runs a job with level full each Sunday at 1:05am and an incremental job Monday through Saturday at 1:05am is:

Schedule {
  Name = "WeeklyCycle"
  Run = Level=Full sun at 1:05
  Run = Level=Incremental mon-sat at 1:05
}

An example of a possible monthly cycle is as follows:

Schedule {
  Name = "MonthlyCycle"
  Run = Level=Full Pool=Monthly 1st sun at 1:05
  Run = Level=Differential 2nd-5th sun at 1:05
  Run = Level=Incremental Pool=Daily mon-sat at 1:05
}

The first of every month:

Schedule {
  Name = "First"
  Run = Level=Full on 1 at 1:05
  Run = Level=Incremental on 2-31 at 1:05
}

Every 10 minutes:

Schedule {
  Name = "TenMinutes"
  Run = Level=Full hourly at 0:05
  Run = Level=Full hourly at 0:15
  Run = Level=Full hourly at 0:25
  Run = Level=Full hourly at 0:35
  Run = Level=Full hourly at 0:45
  Run = Level=Full hourly at 0:55
}

Technical Notes on Schedules

Internally Bacula keeps a schedule as a bit mask. There are six masks and a minute field to each schedule. The masks are hour, day of the month (mday), month, day of the week (wday), week of the month (wom), and week of the year (woy). The schedule is initialized to have the bits of each of these masks set, which means that at the beginning of every hour, the job will run. When you specify a month for the first time, the mask will be cleared and the bit corresponding to your selected month will be selected. If you specify a second month, the bit corresponding to it will also be added to the mask. Thus when Bacula checks the masks to see if the bits are set corresponding to the current time, your job will run only in the two months you have set. Likewise, if you set a time (hour), the hour mask will be cleared, and the hour you specify will be set in the bit mask and the minutes will be stored in the minute field.

For any schedule you have defined, you can see how these bits are set by doing a show schedules command in the Console program. Please note that the bit mask is zero based, and Sunday is the first day of the week (bit zero).

-


The FileSet Resource

The FileSet resource defines what files are to be included or excluded in a backup job. A FileSet resource is required for each backup Job. It consists of a list of files or directories to be included, a list of files or directories to be excluded and the various backup options such as compression, encryption, and signatures that are to be applied to each file.

Any change to the list of the included files will cause Bacula to automatically create a new FileSet (defined by the name and an MD5 checksum of the Include/Exclude contents). Each time a new FileSet is created, Bacula will ensure that the next backup is always a Full save.

Character Sets

Bacula is designed to handle most character sets of the world, US ASCII, German, French, Chinese, ... However, it does this by encoding everything in UTF-8, and it expects all configuration files (including those read on Win32 machines) to be in UTF-8 format. UTF-8 is typically the default on Linux machines, but not on all Unix machines, nor on Windows, so you must take some care to ensure that your locale is set properly before starting Bacula. On most modern Win32 machines, you can edit the conf files with notebook and choose output encoding UTF-8.

To ensure that Bacula configuration files can be correctly read including foreign characters the bf LANG environment variable must end in .UTF-8. An full example is en_US.UTF-8. The exact syntax may vary a bit from OS to OS, and exactly how you define it will also vary.

Bacula assumes that all filenames are in UTF-8 format on Linux and Unix machines. On Win32 they are in Unicode (UTF-16), and will be automatically converted to UTF-8 format.

FileSet
Start of the FileSet resource. One FileSet resource must be defined for each Backup job.

Name = <name>
The name of the FileSet resource. This directive is required.

Ignore FileSet Changes = <yes|no>
Normally, if you modify the FileSet Include or Exclude lists, the next backup will be forced to a Full so that Bacula can guarantee that any additions or deletions are properly saved.

If this directive is set to yes, any changes you make to the FileSet Include or Exclude lists, will not force a Full during subsequent backups.

The default is no, in which case, if you change the Include or Exclude, Bacula will force a Full backup to ensure that everything is properly backed up. We strongly recommend against setting this directive to yes, since doing so may cause you to have an incomplete set of backups.

Enable VSS = <yes|no>
If this directive is set to yes the File daemon will be notified that the user wants to use a Volume Shadow Copy Service (VSS) backup for this job. The default is yes. This directive is effective only for VSS enabled Win32 File daemons. It permits a consistent copy of open files to be made for cooperating writer applications, and for applications that are not VSS away, Bacula can at least copy open files. For more information, please see the Windows chapter of this manual.

Include { Options {<file-options>} ...; <file-list> }

Options { <file-options> }

Exclude { <file-list> }

The Include resource must contain a list of directories and/or files to be processed in the backup job. Normally, all files found in all subdirectories of any directory in the Include File list will be backed up. Note, see below for the definition of <file-list>. The Include resource may also contain one or more Options resources that specify options such as compression to be applied to all or any subset of the files found when processing the file-list for backup. Please see below for more details concerning Options resources.

There can be any number of Include resources within the FileSet, each having its own list of directories or files to be backed up and the backup options defined by one or more Options resources. The file-list consists of one file or directory name per line. Directory names should be specified without a trailing slash with Unix path notation.

Windows users, please take note to specify directories (even c:/...) in Unix path notation. If you use Windows conventions, you will most likely not be able to restore your files due to the fact that the Windows path separator was defined as an escape character long before Windows existed, and Bacula adheres to that convention (i.e.
means the next character appears as itself).

You should always specify a full path for every directory and file that you list in the FileSet. In addition, on Windows machines, you should always prefix the directory or filename with the drive specification in lower case (e.g. c:/xxx) using Unix directory name separators (forward slash).

Bacula's default for processing directories is to recursively descend in the directory saving all files and subdirectories. Bacula will not by default cross filesystems (or mount points in Unix parlance). This means that if you specify the root partition (e.g. /), Bacula will save only the root partition and not any of the other mounted filesystems. Similarly on Windows systems, you must explicitly specify each of the drives you want saved (e.g. c:/ and d:/ ...). In addition, at least for Windows systems, you will most likely want to enclose each specification within double quotes particularly if the directory (or file) name contains spaces. The df command on Unix systems will show you which mount points you must specify to save everything. See below for an example.

Take special care not to include a directory twice or Bacula will backup the same files two times wasting a lot of space on your archive device. Including a directory twice is very easy to do. For example:

  Include {
    File = /
    File = /usr
    Options { compression=GZIP }
  }

on a Unix system where /usr is a subdirectory (rather than a mounted filesystem) will cause /usr to be backed up twice. In this case, on Bacula versions prior to 1.32f-5-09Mar04 due to a bug, you will not be able to restore hard linked files that were backed up twice.

If you have used Bacula prior to version 1.36.3, you will note three things in the new FileSet syntax:

  1. There is no equal sign (=) after the Include and before the opening brace ({). The same is true for the Exclude.
  2. Each directory (or filename) to be included or excluded is preceded by a File =. Previously they were simply listed on separate lines.
  3. The options that previously appeared on the Include line now must be specified within their own Options resource.
  4. The Exclude resource does not accept Options.
  5. When using wild-cards or regular expressions, directory names are always terminated with a slash (/) and filenames have no trailing slash.

The Options resource is optional, but when specified, it will contain a list of keyword=value options to be applied to the file-list. See below for the definition of file-list. Multiple Options resources may be specified one after another. As the files are found in the specified directories, the Options will applied to the filenames to determine if and how the file should be backed up. The wildcard and regular expression pattern matching parts of the Options resources are checked in the order they are specified in the FileSet until the first one that matches. Once one matches, the compression and other flags within the Options specification will apply to the pattern matched.

A key point is that in the absence of an Option or no other Option is matched, every file is accepted for backing up. This means that if you want to exclude something, you must explicitly specify an Option with an exclude = yes and some pattern matching.

Once Bacula determines that the Options resource matches the file under consideration, that file will be saved without looking at any other Options resources that may be present. This means that any wild cards must appear before an Options resource without wild cards.

If for some reason, Bacula checks all the Options resources to a file under consideration for backup, but there are no matches (generally because of wild cards that don't match), Bacula as a default will then backup the file. This is quite logical if you consider the case of no Options clause is specified, where you want everything to be backed up, and it is important to keep in mind when excluding as mentioned above.

However, one additional point is that in the case that no match was found, Bacula will use the options found in the last Options resource. As a consequence, if you want a particular set of "default" options, you should put them in an Options resource after any other Options.

It is a good idea to put all your wild-card and regex expressions inside double quotes to prevent conf file scanning problems.

This is perhaps a bit overwhelming, so there are a number of examples included below to illustrate how this works.

The directives within an Options resource may be one of the following:

compression=GZIP
All files saved will be software compressed using the GNU ZIP compression format. The compression is done on a file by file basis by the File daemon. If there is a problem reading the tape in a single record of a file, it will at most affect that file and none of the other files on the tape. Normally this option is not needed if you have a modern tape drive as the drive will do its own compression. In fact, if you specify software compression at the same time you have hardware compression turned on, your files may actually take more space on the volume.

Software compression is very important if you are writing your Volumes to a file, and it can also be helpful if you have a fast computer but a slow network, otherwise it is generally better to rely your tape drive's hardware compression. As noted above, it is not generally a good idea to do both software and hardware compression.

Specifying GZIP uses the default compression level 6 (i.e. GZIP is identical to GZIP6). If you want a different compression level (1 through 9), you can specify it by appending the level number with no intervening spaces to GZIP. Thus compression=GZIP1 would give minimum compression but the fastest algorithm, and compression=GZIP9 would give the highest level of compression, but requires more computation. According to the GZIP documentation, compression levels greater than six generally give very little extra compression and are rather CPU intensive.

signature=SHA1
An SHA1 signature will be computed for all The SHA1 algorithm is purported to be some what slower than the MD5 algorithm, but at the same time is significantly better from a cryptographic point of view (i.e. much fewer collisions, much lower probability of being hacked.) It adds four more bytes than the MD5 signature. We strongly recommend that either this option or MD5 be specified as a default for all files. Note, only one of the two options MD5 or SHA1 can be computed for any file.

signature=MD5
An MD5 signature will be computed for all files saved. Adding this option generates about 5% extra overhead for each file saved. In addition to the additional CPU time, the MD5 signature adds 16 more bytes per file to your catalog. We strongly recommend that this option or the SHA1 option be specified as a default for all files.

verify=<options>
The options letters specified are used when running a Verify Level=Catalog as well as the DiskToCatalog level job. The options letters may be any combination of the following:

i compare the inodes

p compare the permission bits

n compare the number of links

u compare the user id

g compare the group id

s compare the size

a compare the access time

m compare the modification time (st_mtime)

c compare the change time (st_ctime)

d report file size decreases

5 compare the MD5 signature

1 compare the SHA1 signature

A useful set of general options on the Level=Catalog or Level=DiskToCatalog verify is pins5 i.e. compare permission bits, inodes, number of links, size, and MD5 changes.

onefs=yes|no
If set to yes (the default), Bacula will remain on a single file system. That is it will not backup file systems that are mounted on a subdirectory. If you are using a *nix system, you may not even be aware that there are several different filesystems as they are often automatically mounted by the OS (e.g. /dev, /net, /sys, /proc, ...). With Bacula 1.38.0 or later, it will inform you when it decides not to traverse into another filesystem. This can be very useful if you forgot to backup a particular partition. An example of the informational message in the job report is:

rufus-fd: /misc is a different filesystem. Will not descend from / into /misc
rufus-fd: /net is a different filesystem. Will not descend from / into /net
rufus-fd: /var/lib/nfs/rpc_pipefs is a different filesystem. Will not descend from /var/lib/nfs into /var/lib/nfs/rpc_pipefs
rufus-fd: /selinux is a different filesystem. Will not descend from / into /selinux
rufus-fd: /sys is a different filesystem. Will not descend from / into /sys
rufus-fd: /dev is a different filesystem. Will not descend from / into /dev
rufus-fd: /home is a different filesystem. Will not descend from / into /home

Note: in previous versions of Bacula, the above message was of the form:

Filesystem change prohibited. Will not descend into /misc

If you wish to backup multiple filesystems, you can explicitly list each filesystem you want saved. Otherwise, if you set the onefs option to no, Bacula will backup all mounted file systems (i.e. traverse mount points) that are found within the FileSet. Thus if you have NFS or Samba file systems mounted on a directory listed in your FileSet, they will also be backed up. Normally, it is preferable to set onefs=yes and to explicitly name each filesystem you want backed up. Explicitly naming the filesystems you want backed up avoids the possibility of getting into a infinite loop recursing filesystems. Another possibility is to use onefs=no and to set fstype=ext2, .... See the example below for more details.

If you think that Bacula should be backing up a particular directory and it is not, and you have onefs=no set, before you complain, please do:

  stat /
  stat <filesystem>

where you replace filesystem with the one in question. If the Device: number is different for / and for your filesystem, then they are on different filesystems. E.g.

stat /
  File: `/'
  Size: 4096            Blocks: 16         IO Block: 4096   directory
Device: 302h/770d       Inode: 2           Links: 26
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2005-11-10 12:28:01.000000000 +0100
Modify: 2005-09-27 17:52:32.000000000 +0200
Change: 2005-09-27 17:52:32.000000000 +0200

stat /net
  File: `/home'
  Size: 4096            Blocks: 16         IO Block: 4096   directory
Device: 308h/776d       Inode: 2           Links: 7
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2005-11-10 12:28:02.000000000 +0100
Modify: 2005-11-06 12:36:48.000000000 +0100
Change: 2005-11-06 12:36:48.000000000 +0100

Also be aware that even if you include /home in your list of files to backup, as you most likely should, you will get the informational message that "/home is a different filesystem" when Bacula is processing the / directory. This message does not indicate an error. This message means that while examining the File = referred to in the second part of the message, Bacula will not descend into the directory mentioned in the first part of the message. However, it is possible that the separate filesystem will be backed up despite the message. For example, consider the following FileSet:

  File = /
  File = /var

where /var is a separate filesystem. In this example, you will get a message saying that Bacula will not decend from / into /var. But it is important to realise that Bacula will descend into /var from the second File directive shown above. In effect, the warning is bogus, but it is supplied to alert you to possible omissions from your FileSet. In this example, /var will be backed up. If you changed the FileSet such that it did not specify /var, then /var will not be backed up.

portable=yes|no
If set to yes (default is no), the Bacula File daemon will backup Win32 files in a portable format, but not all Win32 file attributes will be saved and restored. By default, this option is set to no, which means that on Win32 systems, the data will be backed up using Windows API calls and on WinNT/2K/XP, all the security and ownership attributes will be properly backed up (and restored). However this format is not portable to other systems -- e.g. Unix, Win95/98/Me. When backing up Unix systems, this option is ignored, and unless you have a specific need to have portable backups, we recommend accept the default (no) so that the maximum information concerning your files is saved.

recurse=yes|no
If set to yes (the default), Bacula will recurse (or descend) into all subdirectories found unless the directory is explicitly excluded using an exclude definition. If you set recurse=no, Bacula will save the subdirectory entries, but not descend into the subdirectories, and thus will not save the files or directories contained in the subdirectories. Normally, you will want the default (yes).

sparse=yes|no
Enable special code that checks for sparse files such as created by ndbm. The default is no, so no checks are made for sparse files. You may specify sparse=yes even on files that are not sparse file. No harm will be done, but there will be a small additional overhead to check for buffers of all zero, and a small additional amount of space on the output archive will be used to save the seek address of each non-zero record read.

Restrictions: Bacula reads files in 32K buffers. If the whole buffer is zero, it will be treated as a sparse block and not written to tape. However, if any part of the buffer is non-zero, the whole buffer will be written to tape, possibly including some disk sectors (generally 4098 bytes) that are all zero. As a consequence, Bacula's detection of sparse blocks is in 32K increments rather than the system block size. If anyone considers this to be a real problem, please send in a request for change with the reason.

If you are not familiar with sparse files, an example is say a file where you wrote 512 bytes at address zero, then 512 bytes at address 1 million. The operating system will allocate only two blocks, and the empty space or hole will have nothing allocated. However, when you read the sparse file and read the addresses where nothing was written, the OS will return all zeros as if the space were allocated, and if you backup such a file, a lot of space will be used to write zeros to the volume. Worse yet, when you restore the file, all the previously empty space will now be allocated using much more disk space. By turning on the sparse option, Bacula will specifically look for empty space in the file, and any empty space will not be written to the Volume, nor will it be restored. The price to pay for this is that Bacula must search each block it reads before writing it. On a slow system, this may be important. If you suspect you have sparse files, you should benchmark the difference or set sparse for only those files that are really sparse.

readfifo=yes|no
If enabled, tells the Client to read the data on a backup and write the data on a restore to any FIFO (pipe) that is explicitly mentioned in the FileSet. In this case, you must have a program already running that writes into the FIFO for a backup or reads from the FIFO on a restore. This can be accomplished with the RunBeforeJob directive. If this is not the case, Bacula will hang indefinitely on reading/writing the FIFO. When this is not enabled (default), the Client simply saves the directory entry for the FIFO.

Unfortunately, when Bacula runs a RunBeforeJob, it waits until that script terminates, and if the script accesses the FIFO to write into the it, the Bacula job will block and everything will stall. However, Vladimir Stavrinov as supplied tip that allows this feature to work correctly. He simply adds the following to the beginning of the RunBeforeJob script:

   exec > /dev/null

noatime=yes|no
If enabled, and if your Operating System supports the O_NOATIME file open flag, Bacula will open all files to be backed up with this option. It makes it possible to read a file without updating the inode atime (and also without the inode ctime update which happens if you try to set the atime back to its previous value). It also prevents a race condition when two programs are reading the same file, but only one does not want to change the atime. It's most useful for backup programs and file integrity checkers (and bacula can fit on both categories).

This option is particularly useful for sites where users are sensitive to their MailBox file access time. It replaces both the keepatime option without the inconveniences of that option (see below).

If your Operating System does not support this option, it will be silently ignored by Bacula.

mtimeonly=yes|no
If enabled, tells the Client that the selection of files during Incremental and Differential backups should based only on the st_mtime value in the stat() packet. The default is no which means that the selection of files to be backed up will be based on both the st_mtime and the st_ctime values. In general, it is not recommended to use this option.

keepatime=yes|no
The default is no. When enabled, Bacula will reset the st_atime (access time) field of files that it backs up to their value prior to the backup. This option is not generally recommended as there are very few programs that use st_atime, and the backup overhead is increased because of the additional system call necessary to reset the times. However, for some files, such as mailboxes, when Bacula backs up the file, the user will notice that someone (Bacula) has accessed the file. In this, case keepatime can be useful. (I'm not sure this works on Win32).

Note, if you use this feature, when Bacula resets the access time, the change time (st_ctime) will automatically be modified by the system, so on the next incremental job, the file will be backed up even if it has not changed. As a consequence, you will probably also want to use mtimeonly = yes as well as keepatime (thanks to Rudolf Cejka for this tip).

checkfilechanges=yes|no
On versions 2.0.4 or greater, if enabled, the Client will checks size, age of each file after their backup to see if they have changed during backup. If time or size mismatch, an error will raise.

 zog-fd: Client1.2007-03-31_09.46.21 Error: /tmp/test mtime changed during backup.

In general, it is recommended to use this option.

hardlinks=yes|no
When enabled (default), this directive will cause hard links to be backed up. However, the File daemon keeps track of hard linked files and will backup the data only once. The process of keeping track of the hard links can be quite expensive if you have lots of them (tens of thousands or more). This doesn't occur on normal Unix systems, but if you use a program like BackupPC, it can create hundreds of thousands, or even millions of hard links. Backups become very long and the File daemon will consume a lot of CPU power checking hard links. In such a case, set hardlinks=no and hard links will not be backed up. Note, using this option will most likely backup more data and on a restore the file system will not be restored identically to the original.

wild=<string>
Specifies a wild-card string to be applied to the filenames and directory names. Note, if Exclude is not enabled, the wild-card will select which files are to be included. If Exclude=yes is specified, the wild-card will select which files are to be excluded. Multiple wild-card directives may be specified, and they will be applied in turn until the first one that matches. Note, if you exclude a directory, no files or directories below it will be matched.

You may want to test your expressions prior to running your backup by using the bwild program. Please see the Utilities chapter of this manual for more. You can also test your full FileSet definition by using the estimate command in the Console chapter of this manual. It is recommended to enclose the string in double quotes.

wilddir=<string>
Specifies a wild-card string to be applied to directory names only. No filenames will be matched by this directive. Note, if Exclude is not enabled, the wild-card will select directories files are to be included. If Exclude=yes is specified, the wild-card will select which files are to be excluded. Multiple wild-card directives may be specified, and they will be applied in turn until the first one that matches. Note, if you exclude a directory, no files or directories below it will be matched.

It is recommended to enclose the string in double quotes.

You may want to test your expressions prior to running your backup by using the bwild program. Please see the Utilities chapter of this manual for more. You can also test your full FileSet definition by using the estimate command in the Console chapter of this manual. An example of excluding with the WildDir option on Win32 machines is presented below.

wildfile=<string>
Specifies a wild-card string to be applied to non-directories. That is no directory entries will be matched by this directive. However, note that the match is done against the full path and filename, so your wild-card string must take into account that filenames are preceded by the full path. If Exclude is not enabled, the wild-card will select which files are to be included. If Exclude=yes is specified, the wild-card will select which files are to be excluded. Multiple wild-card directives may be specified, and they will be applied in turn until the first one that matches.

It is recommended to enclose the string in double quotes.

You may want to test your expressions prior to running your backup by using the bwild program. Please see the Utilities chapter of this manual for more. You can also test your full FileSet definition by using the estimate command in the Console chapter of this manual. An example of excluding with the WildFile option on Win32 machines is presented below.

regex=<string>
Specifies a POSIX extended regular expression to be applied to the filenames and directory names, which include the full path. If Exclude is not enabled, the regex will select which files are to be included. If Exclude=yes is specified, the regex will select which files are to be excluded. Multiple regex directives may be specified within an Options resource, and they will be applied in turn until the first one that matches. Note, if you exclude a directory, no files or directories below it will be matched.

It is recommended to enclose the string in double quotes.

The regex libraries differ from one operating system to another, and in addition, regular expressions are complicated, so you may want to test your expressions prior to running your backup by using the bregex program. Please see the Utilities chapter of this manual for more. You can also test your full FileSet definition by using the estimate command in the Console chapter of this manual.

regexfile=<string>
Specifies a POSIX extended regular expression to be applied to non-directories. No directories will be matched by this directive. However, note that the match is done against the full path and filename, so your regex string must take into account that filenames are preceded by the full path. If Exclude is not enabled, the regex will select which files are to be included. If Exclude=yes is specified, the regex will select which files are to be excluded. Multiple regex directives may be specified, and they will be applied in turn until the first one that matches.

It is recommended to enclose the string in double quotes.

The regex libraries differ from one operating system to another, and in addition, regular expressions are complicated, so you may want to test your expressions prior to running your backup by using the bregex program. Please see the Utilities chapter of this manual for more.

regexdir=<string>
Specifies a POSIX extended regular expression to be applied to directory names only. No filenames will be matched by this directive. Note, if Exclude is not enabled, the regex will select directories files are to be included. If Exclude=yes is specified, the regex will select which files are to be excluded. Multiple regex directives may be specified, and they will be applied in turn until the first one that matches. Note, if you exclude a directory, no files or directories below it will be matched.

It is recommended to enclose the string in double quotes.

The regex libraries differ from one operating system to another, and in addition, regular expressions are complicated, so you may want to test your expressions prior to running your backup by using the bregex program. Please see the Utilities chapter of this manual for more.

exclude=yes|no
The default is no. When enabled, any files matched within the Options will be excluded from the backup.

aclsupport=yes|no
The default is no. If this option is set to yes, and you have the POSIX libacl installed on your system, Bacula will backup the file and directory UNIX Access Control Lists (ACL) as defined in IEEE Std 1003.1e draft 17 and "POSIX.1e" (abandoned). This feature is available on UNIX only and depends on the ACL library. Bacula is automatically compiled with ACL support if the libacl library is installed on your system (shown in config.out). While restoring the files Bacula will try to restore the ACLs, if there is no ACL support available on the system, Bacula restores the files and directories but not the ACL information. Please note, if you backup an EXT3 or XFS filesystem with ACLs, then you restore them to a different filesystem (perhaps reiserfs) that does not have ACLs, the ACLs will be ignored.

ignore case=yes|no
The default is no. On Windows systems, you will almost surely want to set this to yes. When this directive is set to yes all the case of character will be ignored in wild-card and regex comparisons. That is an uppercase A will match a lowercase a.

fstype=filesystem-type
This option allows you to select files and directories by the filesystem type. The permitted filesystem-type names are:

ext2, jfs, ntfs, proc, reiserfs, xfs, usbdevfs, sysfs, smbfs, iso9660. For ext3 systems, use ext2.

You may have multiple Fstype directives, and thus permit matching of multiple filesystem types within a single Options resource. If the type specified on the fstype directive does not match the filesystem for a particular directive, that directory will not be backed up. This directive can be used to prevent backing up non-local filesystems. Normally, when you use this directive, you would also set onefs=no so that Bacula will traverse filesystems.

This option is not implemented in Win32 systems.

hfsplussupport=yes|no
This option allows you to turn on support for Mac OSX HFS plus finder information.

strippath=<integer>
This option will cause integer paths to be stripped from the front of the full path/filename being backed up. This can be useful if you are migrating data from another vendor or if you have taken a snapshot into some subdirectory. This directive can cause your filenames to be overlayed with regular backup data, so should be used only by experts and with great care.

<file-list> is a list of directory and/or filename names specified with a File = directive. To include names containing spaces, enclose the name between double-quotes. Wild-cards are not interpreted in file-lists. They can only be specified in Options resources.

There are a number of special cases when specifying directories and files in a file-list. They are:

FileSet Examples

The following is an example of a valid FileSet resource definition. Note, the first Include pulls in the contents of the file /etc/backup.list when Bacula is started (i.e. the @), and that file must have each filename to be backed up preceded by a File = and on a separate line.

FileSet {
  Name = "Full Set"
  Include {
    Options {
      Compression=GZIP
      signature=SHA1
      Sparse = yes
    }
    @/etc/backup.list
  }
  Include {
     Options {
        wildfile = "*.o"
        wildfile = "*.exe"
        Exclude = yes
     }
     File = /root/myfile
     File = /usr/lib/another_file
  }
}

In the above example, all the files contained in /etc/backup.list will be compressed with GZIP compression, an SHA1 signature will be computed on the file's contents (its data), and sparse file handling will apply.

The two directories /root/myfile and /usr/lib/another_file will also be saved without any options, but all files in those directories with the extensions .o and .exe will be excluded.

Let's say that you now want to exclude the directory /tmp. The simplest way to do so is to add an exclude directive that lists /tmp. The example above would then become:

FileSet {
  Name = "Full Set"
  Include {
    Options {
      Compression=GZIP
      signature=SHA1
      Sparse = yes
    }
    @/etc/backup.list
  }
  Include {
     Options {
        wildfile = "*.o"
        wildfile = "*.exe"
        Exclude = yes
     }
     File = /root/myfile
     File = /usr/lib/another_file
  }
  Exclude {
     File = /tmp
  }
}

You can add wild-cards to the File directives listed in the Exclude directory, but you need to take care because if you exclude a directory, it and all files and directories below it will also be excluded.

Now lets take a slight variation on the above and suppose you want to save all your whole filesystem except /tmp. The problem that comes up is that Bacula will not normally cross from one filesystem to another. Doing a df command, you get the following output:

[kern@rufus k]$ df
Filesystem      1k-blocks      Used Available Use% Mounted on
/dev/hda5         5044156    439232   4348692  10% /
/dev/hda1           62193      4935     54047   9% /boot
/dev/hda9        20161172   5524660  13612372  29% /home
/dev/hda2           62217      6843     52161  12% /rescue
/dev/hda8         5044156     42548   4745376   1% /tmp
/dev/hda6         5044156   2613132   2174792  55% /usr
none               127708         0    127708   0% /dev/shm
//minimatou/c$   14099200   9895424   4203776  71% /mnt/mmatou
lmatou:/          1554264    215884   1258056  15% /mnt/matou
lmatou:/home      2478140   1589952    760072  68% /mnt/matou/home
lmatou:/usr       1981000   1199960    678628  64% /mnt/matou/usr
lpmatou:/          995116    484112    459596  52% /mnt/pmatou
lpmatou:/home    19222656   2787880  15458228  16% /mnt/pmatou/home
lpmatou:/usr      2478140   2038764    311260  87% /mnt/pmatou/usr
deuter:/          4806936     97684   4465064   3% /mnt/deuter
deuter:/home      4806904    280100   4282620   7% /mnt/deuter/home
deuter:/files    44133352  27652876  14238608  67% /mnt/deuter/files

And we see that there are a number of separate filesystems (/ /boot /home /rescue /tmp and /usr not to mention mounted systems). If you specify only / in your Include list, Bacula will only save the Filesystem /dev/hda5. To save all filesystems except /tmp with out including any of the Samba or NFS mounted systems, and explicitly excluding a /tmp, /proc, .journal, and .autofsck, which you will not want to be saved and restored, you can use the following:

FileSet {
  Name = Include_example
  Include {
    Options {
       wilddir = /proc
       wilddir = /tmp
       wildfile = "/.journal"
       wildfile = "/.autofsck"
       exclude = yes
    }
    File = /
    File = /boot
    File = /home
    File = /rescue
    File = /usr
  }
}

Since /tmp is on its own filesystem and it was not explicitly named in the Include list, it is not really needed in the exclude list. It is better to list it in the Exclude list for clarity, and in case the disks are changed so that it is no longer in its own partition.

Now, lets assume you only want to backup .Z and .gz files and nothing else. This is a bit trickier because Bacula by default will select everything to backup, so we must exclude everything but .Z and .gz files. If we take the first example above and make the obvious modifications to it, we might come up with a FileSet that looks like this:

FileSet {
  Name = "Full Set"
  Include {                    !!!!!!!!!!!!
     Options {                    This
        wildfile = "*.Z"          example
        wildfile = "*.gz"         doesn't
                                  work
     }                          !!!!!!!!!!!!
     File = /myfile
  }
}

The *.Z and *.gz files will indeed be backed up, but all other files that are not matched by the Options directives will automatically be backed up too (i.e. that is the default rule).

To accomplish what we want, we must explicitly exclude all other files. We do this with the following:

FileSet {
  Name = "Full Set"
  Include {
     Options {
        wildfile = "*.Z"
        wildfile = "*.gz"
     }
     Options {
        Exclude = yes
        RegexFile = ".*"
     }
     File = /myfile
  }
}

The "trick" here was to add a RegexFile expression that matches all files. It does not match directory names, so all directories in /myfile will be backed up (the directory entry) and any *.Z and *.gz files contained in them. If you know that certain directories do not contain any *.Z or *.gz files and you do not want the directory entries backed up, you will need to explicitly exclude those directories. Backing up a directory entries is not very expensive.

Bacula uses the system regex library and some of them are different on different OSes. The above has been reported not to work on FreeBSD. This can be tested by using the estimate job=job-name listing command in the console and adapting the RegexFile expression appropriately. In a future version of Bacula, we will supply our own Regex code to avoid such system dependencies.

Please be aware that allowing Bacula to traverse or change file systems can be very dangerous. For example, with the following:

FileSet {
  Name = "Bad example"
  Include {
    Options { onefs=no }
    File = /mnt/matou
  }
}

you will be backing up an NFS mounted partition (/mnt/matou), and since onefs is set to no, Bacula will traverse file systems. Now if /mnt/matou has the current machine's file systems mounted, as is often the case, you will get yourself into a recursive loop and the backup will never end.

As a final example, let's say that you have only one or two subdirectories of /home that you want to backup. For example, you want to backup only subdirectories beginning with the letter a and the letter b -- i.e. /home/a* and /home/b*. Now, you might first try:

FileSet {
  Name = "Full Set"
  Include {
     Options {
        wilddir = "/home/a*"
        wilddir = "/home/b*"
     }
     File = /home
  }
}

The problem is that the above will include everything in /home. To get things to work correctly, you need to start with the idea of exclusion instead of inclusion. So, you could simply exclude all directories except the two you want to use:

FileSet {
  Name = "Full Set"
  Include {
     Options {
        RegexDir = "^/home/[c-z]"
        exclude = yes
     }
     File = /home
  }
}

And assuming that all subdirectories start with a lowercase letter, this would work.

An alternative would be to include the two subdirectories desired and exclude everything else:

FileSet {
  Name = "Full Set"
  Include {
     Options {
        wilddir = "/home/a*"
        wilddir = "/home/b*"
     }
     Options {
        RegexDir = ".*"
        exclude = yes
     }
     File = /home
  }
}

Backing up Raw Partitions

The following FileSet definition will backup a raw partition:

FileSet {
  Name = "RawPartition"
  Include {
    Options { sparse=yes }
    File = /dev/hda2
  }
}

While backing up and restoring a raw partition, you should ensure that no other process including the system is writing to that partition. As a precaution, you are strongly urged to ensure that the raw partition is not mounted or is mounted read-only. If necessary, this can be done using the RunBeforeJob directive.

Excluding Files and Directories

You may also include full filenames or directory names in addition to using wild-cards and Exclude=yes in the Options resource as specified above by simply including the files to be excluded in an Exclude resource within the FileSet. For example:

FileSet {
  Name = Exclusion_example
  Include {
    Options {
      Signature = SHA1
    }
    File = /
    File = /boot
    File = /home
    File = /rescue
    File = /usr
  }
  Exclude {
    File = /proc
    File = /tmp
    File = .journal
    File = .autofsck
  }
}

Windows FileSets

If you are entering Windows file names, the directory path may be preceded by the drive and a colon (as in c:). However, the path separators must be specified in Unix convention (i.e. forward slash (/)). If you wish to include a quote in a file name, precede the quote with a backslash (\). For example you might use the following for a Windows machine to backup the "My Documents" directory:

FileSet {
  Name = "Windows Set"
  Include {
    Options {
       WildFile = "*.obj"
       WildFile = "*.exe"
       exclude = yes
     }
     File = "c:/My Documents"
  }
}

For exclude lists to work correctly on Windows, you must observe the following rules:

Thanks to Thiago Lima for summarizing the above items for us. If you are having difficulties getting includes or excludes to work, you might want to try using the estimate job=xxx listing command documented in the Console chapter of this manual.

On Win32 systems, if you move a directory or file or rename a file into the set of files being backed up, and a Full backup has already been made, Bacula will not know there are new files to be saved during an Incremental or Differential backup (blame Microsoft, not me). To avoid this problem, please copy any new directory or files into the backup area. If you do not have enough disk to copy the directory or files, move them, but then initiate a Full backup.

A Windows Example FileSet

The following example was contributed by Russell Howe. Please note that for presentation purposes, the lines beginning with Data and Internet have been wrapped and should included on the previous line with one space.

This is my Windows 2000 fileset:
FileSet {
 Name = "Windows 2000"
 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]:/WINNT/security/logs/scepol.log"
   WildDir = "[A-Z]:/WINNT/system32/config"
   WildDir = "[A-Z]:/WINNT/msdownld.tmp"
   WildDir = "[A-Z]:/WINNT/Internet Logs"
   WildDir = "[A-Z]:/WINNT/$Nt*Uninstall*"
   WildDir = "[A-Z]:/WINNT/sysvol"
   WildFile = "[A-Z]:/WINNT/cluster/CLUSDB"
   WildFile = "[A-Z]:/WINNT/cluster/CLUSDB.LOG"
   WildFile = "[A-Z]:/WINNT/NTDS/edb.log"
   WildFile = "[A-Z]:/WINNT/NTDS/ntds.dit"
   WildFile = "[A-Z]:/WINNT/NTDS/temp.edb"
   WildFile = "[A-Z]:/WINNT/ntfrs/jet/log/edb.log"
   WildFile = "[A-Z]:/WINNT/ntfrs/jet/ntfrs.jdb"
   WildFile = "[A-Z]:/WINNT/ntfrs/jet/temp/tmp.edb"
   WildFile = "[A-Z]:/WINNT/system32/CPL.CFG"
   WildFile = "[A-Z]:/WINNT/system32/dhcp/dhcp.mdb"
   WildFile = "[A-Z]:/WINNT/system32/dhcp/j50.log"
   WildFile = "[A-Z]:/WINNT/system32/dhcp/tmp.edb"
   WildFile = "[A-Z]:/WINNT/system32/LServer/edb.log"
   WildFile = "[A-Z]:/WINNT/system32/LServer/TLSLic.edb"
   WildFile = "[A-Z]:/WINNT/system32/LServer/tmp.edb"
   WildFile = "[A-Z]:/WINNT/system32/wins/j50.log"
   WildFile = "[A-Z]:/WINNT/system32/wins/wins.mdb"
   WildFile = "[A-Z]:/WINNT/system32/wins/winstmp.mdb"

   # Temporary directories & files
   WildDir = "[A-Z]:/WINNT/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"

   # These are programs and are easier to reinstall than restore from
   # backup
   WildDir = "[A-Z]:/cygwin"
   WildDir = "[A-Z]:/Program Files/Grisoft"
   WildDir = "[A-Z]:/Program Files/Java"
   WildDir = "[A-Z]:/Program Files/Java Web Start"
   WildDir = "[A-Z]:/Program Files/JavaSoft"
   WildDir = "[A-Z]:/Program Files/Microsoft Office"
   WildDir = "[A-Z]:/Program Files/Mozilla Firefox"
   WildDir = "[A-Z]:/Program Files/Mozilla Thunderbird"
   WildDir = "[A-Z]:/Program Files/mozilla.org"
   WildDir = "[A-Z]:/Program Files/OpenOffice*"
  }

  # Our Win2k boxen all have C: and D: as the main hard drives.
  File = "C:/"
  File = "D:/"
 }
}

Note, the three line of the above Exclude were split to fit on the document page, they should be written on a single line in real use.

Windows NTFS Naming Considerations

NTFS filenames containing Unicode characters should now be supported as of version 1.37.30 or later.

Testing Your FileSet

If you wish to get an idea of what your FileSet will really backup or if your exclusion rules will work correctly, you can test it by using the estimate command in the Console program. See the estimate in the Console chapter of this manual.

As an example, suppose you add the following test FileSet:

FileSet {
  Name = Test
  Include {
    File = /home/xxx/test
    Options {
       regex = ".*\.c$"
    }
  }
}

You could then add some test files to the directory /home/xxx/test and use the following command in the console:

estimate job=<any-job-name> listing client=<desired-client> fileset=Test

to give you a listing of all files that match.


The Client Resource

The Client resource defines the attributes of the Clients that are served by this Director; that is the machines that are to be backed up. You will need one Client resource definition for each machine to be backed up.

Client (or FileDaemon)
Start of the Client directives.

Name = <name>
The client name which will be used in the Job resource directive or in the console run command. This directive is required.

Address = <address>
Where the address is a host name, a fully qualified domain name, or a network address in dotted quad notation for a Bacula File server daemon. This directive is required.

FD Port = <port-number>
Where the port is a port number at which the Bacula File server daemon can be contacted. The default is 9102.

Catalog = <Catalog-resource-name>
This specifies the name of the catalog resource to be used for this Client. This directive is required.

Password = <password>
This is the password to be used when establishing a connection with the File services, so the Client configuration file on the machine to be backed up must have the same password defined for this Director. This directive is required. If you have either /dev/random bc on your machine, Bacula will generate a random password during the configuration process, otherwise it will be left blank.

File Retention = <time-period-specification>
The File Retention directive defines the length of time that Bacula will keep File records in the Catalog database. When this time period expires, and if AutoPrune is set to yes Bacula will prune (remove) File records that are older than the specified File Retention period. Note, this affects only records in the catalog database. It does not affect your archive backups.

File records may actually be retained for a shorter period than you specify on this directive if you specify either a shorter Job Retention or a shorter Volume Retention period. The shortest retention period of the three takes precedence. The time may be expressed in seconds, minutes, hours, days, weeks, months, quarters, or years. See the Configuration chapter of this manual for additional details of time specification.

The default is 60 days.

Job Retention = <time-period-specification>
The Job Retention directive defines the length of time that Bacula will keep Job records in the Catalog database. When this time period expires, and if AutoPrune is set to yes Bacula will prune (remove) Job records that are older than the specified File Retention period. As with the other retention periods, this affects only records in the catalog and not data in your archive backup.

If a Job record is selected for pruning, all associated File and JobMedia records will also be pruned regardless of the File Retention period set. As a consequence, you normally will set the File retention period to be less than the Job retention period. The Job retention period can actually be less than the value you specify here if you set the Volume Retention directive in the Pool resource to a smaller duration. This is because the Job retention period and the Volume retention period are independently applied, so the smaller of the two takes precedence.

The Job retention period is specified as seconds, minutes, hours, days, weeks, months, quarters, or years. See the Configuration chapter of this manual for additional details of time specification.

The default is 180 days.

AutoPrune = <yes|no>
If AutoPrune is set to yes (default), Bacula (version 1.20 or greater) will automatically apply the File retention period and the Job retention period for the Client at the end of the Job. If you set AutoPrune = no, pruning will not be done, and your Catalog will grow in size each time you run a Job. Pruning affects only information in the catalog and not data stored in the backup archives (on Volumes).

Maximum Concurrent Jobs = <number>
where <number> is the maximum number of Jobs with the current Client that can run concurrently. Note, this directive limits only Jobs for Clients with the same name as the resource in which it appears. Any other restrictions on the maximum concurrent jobs such as in the Director, Job, or Storage resources will also apply in addition to any limit specified here. The default is set to 1, but you may set it to a larger number. We strongly recommend that you read the WARNING documented under Maximum Concurrent Jobs in the Director's resource.

*Priority = <number>
The number specifies the priority of this client relative to other clients that the Director is processing simultaneously. The priority can range from 1 to 1000. The clients are ordered such that the smaller number priorities are performed first (not currently implemented).

The following is an example of a valid Client resource definition:

Client {
  Name = Minimatou
  Address = minimatou
  Catalog = MySQL
  Password = very_good
}


The Storage Resource

The Storage resource defines which Storage daemons are available for use by the Director.

Storage
Start of the Storage resources. At least one storage resource must be specified.

Name = <name>
The name of the storage resource. This name appears on the Storage directive specified in the Job directive and is required.

Address = <address>
Where the address is a host name, a fully qualified domain name, or an IP address. Please note that the <address> as specified here will be transmitted to the File daemon who will then use it to contact the Storage daemon. Hence, it is not, a good idea to use localhost as the name but rather a fully qualified machine name or an IP address. This directive is required.

SD Port = <port>
Where port is the port to use to contact the storage daemon for information and to start jobs. This same port number must appear in the Storage resource of the Storage daemon's configuration file. The default is 9103.

Password = <password>
This is the password to be used when establishing a connection with the Storage services. This same password also must appear in the Director resource of the Storage daemon's configuration file. This directive is required. If you have either /dev/random bc on your machine, Bacula will generate a random password during the configuration process, otherwise it will be left blank.

Device = <device-name>
This directive specifies the name of the device to be used for the storage. This name is not the physical device name, but the logical device name as defined on the Name directive contained in the Device resource definition of the Storage daemon configuration file or if the device is an Autochanger, you must put the name as defined on the Name directive contained in the Autochanger resource definition of the Storage daemon. You can specify any name you would like (even the device name if you prefer) up to a maximum of 127 characters in length. The physical device name associated with this device is specified in the Storage daemon configuration file (as Archive Device). Please take care not to define two different Storage resource directives in the Director that point to the same Device in the Storage daemon. Doing so may cause the Storage daemon to block (or hang) attempting to open the same device that is already open. This directive is required.

Media Type = <MediaType>
This directive specifies the Media Type to be used to store the data. This is an arbitrary string of characters up to 127 maximum that you define. It can be anything you want. However, it is best to make it descriptive of the storage media (e.g. File, DAT, "HP DLT8000", 8mm, ...). In addition, it is essential that you make the Media Type specification unique for each storage media type. If you have two DDS-4 drives that have incompatible formats, or if you have a DDS-4 drive and a DDS-4 autochanger, you almost certainly should specify different Media Types. During a restore, assuming a DDS-4 Media Type is associated with the Job, Bacula can decide to use any Storage daemon that supports Media Type DDS-4 and on any drive that supports it.

If you want to tie Bacula to using a single Storage daemon or drive, you must specify a unique Media Type for that drive. This is an important point that should be carefully understood. Note, this applies equally to Disk Volumes. If you define more than one disk Device resource in your Storage daemon's conf file, the Volumes on thoes two devices are in fact incompatible because one can not be mounted on the other device since they are found in different directories. For this reason, you probably should use two different Media Types for your two disk Devices (even though you might think of them as both being File types). You can find more on this subject in the Basic Volume Management chapter of this manual.

The MediaType specified here, must correspond to the Media Type specified in the Device resource of the Storage daemon configuration file. This directive is required, and it is used by the Director and the Storage daemon to ensure that a Volume automatically selected from the Pool corresponds to the physical device. If a Storage daemon handles multiple devices (e.g. will write to various file Volumes on different partitions), this directive allows you to specify exactly which device.

As mentioned above, the value specified in the Director's Storage resource must agree with the value specified in the Device resource in the Storage daemon's configuration file. It is also an additional check so that you don't try to write data for a DLT onto an 8mm device.

Autochanger = <yes|no>
If you specify yes for this command (the default is no), when you use the label command or the add command to create a new Volume, Bacula will also request the Autochanger Slot number. This simplifies creating database entries for Volumes in an autochanger. If you forget to specify the Slot, the autochanger will not be used. However, you may modify the Slot associated with a Volume at any time by using the update volume command in the console program. When autochanger is enabled, the algorithm used by Bacula to search for available volumes will be modified to consider only Volumes that are known to be in the autochanger's magazine. If no in changer volume is found, Bacula will attempt recycling, pruning, ..., and if still no volume is found, Bacula will search for any volume whether or not in the magazine. By privileging in changer volumes, this procedure minimizes operator intervention. The default is no.

For the autochanger to be used, you must also specify Autochanger = yes in the Device Resource in the Storage daemon's configuration file as well as other important Storage daemon configuration information. Please consult the Using Autochangers manual of this chapter for the details of using autochangers.

Maximum Concurrent Jobs = <number>
where <number> is the maximum number of Jobs with the current Storage resource that can run concurrently. Note, this directive limits only Jobs for Jobs using this Storage daemon. Any other restrictions on the maximum concurrent jobs such as in the Director, Job, or Client resources will also apply in addition to any limit specified here. The default is set to 1, but you may set it to a larger number. We strongly recommend that you read the WARNING documented under Maximum Concurrent Jobs in the Director's resource.

While it is possible to set the Director's, Job's, or Client's maximum concurrent jobs greater than one, you should take great care in setting the Storage daemon's greater than one. By keeping this directive set to one, you will avoid having two jobs simultaneously write to the same Volume. Although this is supported, it is not currently recommended.

The following is an example of a valid Storage resource definition:

# Definition of tape storage device
Storage {
  Name = DLTDrive
  Address = lpmatou
  Password = storage_password # password for Storage daemon
  Device = "HP DLT 80"    # same as Device in Storage daemon
  Media Type = DLT8000    # same as MediaType in Storage daemon
}


The Pool Resource

The Pool resource defines the set of storage Volumes (tapes or files) to be used by Bacula to write the data. By configuring different Pools, you can determine which set of Volumes (media) receives the backup data. This permits, for example, to store all full backup data on one set of Volumes and all incremental backups on another set of Volumes. Alternatively, you could assign a different set of Volumes to each machine that you backup. This is most easily done by defining multiple Pools.

Another important aspect of a Pool is that it contains the default attributes (Maximum Jobs, Retention Period, Recycle flag, ...) that will be given to a Volume when it is created. This avoids the need for you to answer a large number of questions when labeling a new Volume. Each of these attributes can later be changed on a Volume by Volume basis using the update command in the console program. Note that you must explicitly specify which Pool Bacula is to use with each Job. Bacula will not automatically search for the correct Pool.

Most often in Bacula installations all backups for all machines (Clients) go to a single set of Volumes. In this case, you will probably only use the Default Pool. If your backup strategy calls for you to mount a different tape each day, you will probably want to define a separate Pool for each day. For more information on this subject, please see the Backup Strategies chapter of this manual.

To use a Pool, there are three distinct steps. First the Pool must be defined in the Director's configuration file. Then the Pool must be written to the Catalog database. This is done automatically by the Director each time that it starts, or alternatively can be done using the create command in the console program. Finally, if you change the Pool definition in the Director's configuration file and restart Bacula, the pool will be updated alternatively you can use the update pool console command to refresh the database image. It is this database image rather than the Director's resource image that is used for the default Volume attributes. Note, for the pool to be automatically created or updated, it must be explicitly referenced by a Job resource.

Next the physical media must be labeled. The labeling can either be done with the label command in the console program or using the btape program. The preferred method is to use the label command in the console program.

Finally, you must add Volume names (and their attributes) to the Pool. For Volumes to be used by Bacula they must be of the same Media Type as the archive device specified for the job (i.e. if you are going to back up to a DLT device, the Pool must have DLT volumes defined since 8mm volumes cannot be mounted on a DLT drive). The Media Type has particular importance if you are backing up to files. When running a Job, you must explicitly specify which Pool to use. Bacula will then automatically select the next Volume to use from the Pool, but it will ensure that the Media Type of any Volume selected from the Pool is identical to that required by the Storage resource you have specified for the Job.

If you use the label command in the console program to label the Volumes, they will automatically be added to the Pool, so this last step is not normally required.

It is also possible to add Volumes to the database without explicitly labeling the physical volume. This is done with the add console command.

As previously mentioned, each time Bacula starts, it scans all the Pools associated with each Catalog, and if the database record does not already exist, it will be created from the Pool Resource definition. Bacula probably should do an update pool if you change the Pool definition, but currently, you must do this manually using the update pool command in the Console program.

The Pool Resource defined in the Director's configuration file (bacula-dir.conf) may contain the following directives:

Pool
Start of the Pool resource. There must be at least one Pool resource defined.

Name = <name>
The name of the pool. For most applications, you will use the default pool name Default. This directive is required.

Maximum Volumes = <number>
This directive specifies the maximum number of volumes (tapes or files) contained in the pool. This directive is optional, if omitted or set to zero, any number of volumes will be permitted. In general, this directive is useful for Autochangers where there is a fixed number of Volumes, or for File storage where you wish to ensure that the backups made to disk files do not become too numerous or consume too much space.

Pool Type = <type>
This directive defines the pool type, which corresponds to the type of Job being run. It is required and may be one of the following:

Backup
*Archive
*Cloned
*Migration
*Copy
*Save

Use Volume Once = <yes|no>
This directive if set to yes specifies that each volume is to be used only once. This is most useful when the Media is a file and you want a new file for each backup that is done. The default is no (i.e. use volume any number of times). This directive will most likely be phased out (deprecated), so you are recommended to use Maximum Volume Jobs = 1 instead.

The value defined by this directive in the bacula-dir.conf file is the default value used when a Volume is created. Once the volume is created, changing the value in the bacula-dir.conf file will not change what is stored for the Volume. To change the value for an existing Volume you must use the update command in the Console.

Maximum Volume Jobs = <positive-integer>
This directive specifies the maximum number of Jobs that can be written to the Volume. If you specify zero (the default), there is no limit. Otherwise, when the number of Jobs backed up to the Volume equals positive-integer the Volume will be marked Used. When the Volume is marked Used it can no longer be used for appending Jobs, much like the Full status but it can be recycled if recycling is enabled, and thus used again. By setting MaximumVolumeJobs to one, you get the same effect as setting UseVolumeOnce = yes.

The value defined by this directive in the bacula-dir.conf file is the default value used when a Volume is created. Once the volume is created, changing the value in the bacula-dir.conf file will not change what is stored for the Volume. To change the value for an existing Volume you must use the update command in the Console.

Maximum Volume Files = <positive-integer>
This directive specifies the maximum number of files that can be written to the Volume. If you specify zero (the default), there is no limit. Otherwise, when the number of files written to the Volume equals positive-integer the Volume will be marked Used. When the Volume is marked Used it can no longer be used for appending Jobs, much like the Full status but it can be recycled if recycling is enabled and thus used again. This value is checked and the Used status is set only at the end of a job that writes to the particular volume.

The value defined by this directive in the bacula-dir.conf file is the default value used when a Volume is created. Once the volume is created, changing the value in the bacula-dir.conf file will not change what is stored for the Volume. To change the value for an existing Volume you must use the update command in the Console.

Maximum Volume Bytes = <size>
This directive specifies the maximum number of bytes that can be written to the Volume. If you specify zero (the default), there is no limit except the physical size of the Volume. Otherwise, when the number of bytes written to the Volume equals size the Volume will be marked Used. When the Volume is marked Used it can no longer be used for appending Jobs, much like the Full status but it can be recycled if recycling is enabled, and thus the Volume can be re-used after recycling. This value is checked and the Used status set while the job is writing to the particular volume.

The value defined by this directive in the bacula-dir.conf file is the default value used when a Volume is created. Once the volume is created, changing the value in the bacula-dir.conf file will not change what is stored for the Volume. To change the value for an existing Volume you must use the update command in the Console.

Volume Use Duration = <time-period-specification>
The Volume Use Duration directive defines the time period that the Volume can be written beginning from the time of first data write to the Volume. If the time-period specified is zero (the default), the Volume can be written indefinitely. Otherwise, when the time period from the first write to the volume (the first Job written) exceeds the time-period-specification, the Volume will be marked Used, which means that no more Jobs can be appended to the Volume, but it may be recycled if recycling is enabled. Once the Volume is recycled, it will be available for use again.

You might use this directive, for example, if you have a Volume used for Incremental backups, and Volumes used for Weekly Full backups. Once the Full backup is done, you will want to use a different Incremental Volume. This can be accomplished by setting the Volume Use Duration for the Incremental Volume to six days. I.e. it will be used for the 6 days following a Full save, then a different Incremental volume will be used. Be careful about setting the duration to short periods such as 23 hours, or you might experience problems of Bacula waiting for a tape over the weekend only to complete the backups Monday morning when an operator mounts a new tape.

The use duration is checked and the Used status is set only at the end of a job that writes to the particular volume, which means that even though the use duration may have expired, the catalog entry will not be updated until the next job that uses this volume is run.

Please note that the value defined by this directive in the bacula-dir.conf file is the default value used when a Volume is created. Once the volume is created, changing the value in the bacula-dir.conf file will not change what is stored for the Volume. To change the value for an existing Volume you must use the update volume command in the Console.

Catalog Files = <yes|no>
This directive defines whether or not you want the names of the files that were saved to be put into the catalog. The default is yes. The advantage of specifying Catalog Files = No is that you will have a significantly smaller Catalog database. The disadvantage is that you will not be able to produce a Catalog listing of the files backed up for each Job (this is often called Browsing). Also, without the File entries in the catalog, you will not be able to use the Console restore command nor any other command that references File entries.

AutoPrune = <yes|no>
If AutoPrune is set to yes (default), Bacula (version 1.20 or greater) will automatically apply the Volume Retention period when new Volume is needed and no appendable Volumes exist in the Pool. Volume pruning causes expired Jobs (older than the Volume Retention period) to be deleted from the Catalog and permits possible recycling of the Volume.

Volume Retention = <time-period-specification>
The Volume Retention directive defines the length of time that Bacula will keep Job records associated with the Volume in the Catalog database. When this time period expires, and if AutoPrune is set to yes Bacula may prune (remove) Job records that are older than the specified Volume Retention period if it is necessary to free up a Volume. Recycling will not occur until it is absolutely necessary to free up a volume. All File records associated with pruned Jobs are also pruned. The time may be specified as seconds, minutes, hours, days, weeks, months, quarters, or years. The Volume Retention is applied independently of the Job Retention and the File Retention periods defined in the Client resource. This means that all the retentions periods are applied in turn and that the shorter period is the one that effectively takes precedence. Note, that when the Volume Retention period has been reached, and it is necessary to obtain a new volume, Bacula will prune both the Job and the File records.

It is important to know that when the Volume Retention period expires, Bacula does not automatically recycle a Volume. It attempts to keep the Volume data intact as long as possible before over writing the Volume.

The default Volume retention period is 365 days. Note, this directive sets the default value for each Volume entry in the Catalog when the Volume is created. The value in the catalog may be later individually changed for each Volume using the Console program.

By defining multiple Pools with different Volume Retention periods, you may effectively have a set of tapes that is recycled weekly, another Pool of tapes that is recycled monthly and so on. However, one must keep in mind that if your Volume Retention period is too short, it may prune the last valid Full backup, and hence until the next Full backup is done, you will not have a complete backup of your system, and in addition, the next Incremental or Differential backup will be promoted to a Full backup. As a consequence, the minimum Volume Retention period should be at twice the interval of your Full backups. This means that if you do a Full backup once a month, the minimum Volume retention period should be two months.

Please note that the value defined by this directive in the bacula-dir.conf file is the default value used when a Volume is created. Once the volume is created, changing the value in the bacula-dir.conf file will not change what is stored for the Volume. To change the value for an existing Volume you must use the update command in the Console.

Recycle = <yes|no>
This directive specifies whether or not Purged Volumes may be recycled. If it is set to yes (default) and Bacula needs a volume but finds none that are appendable, it will search for and recycle (reuse) Purged Volumes (i.e. volumes with all the Jobs and Files expired and thus deleted from the Catalog). If the Volume is recycled, all previous data written to that Volume will be overwritten. If Recycle is set to no, the Volume will not be recycled, and hence, the data will remain valid. If you want to reuse (re-write) the Volume, and the recycle flag is no (0 in the catalog), you may manually set the recycle flag (update command) for a Volume to be reused.

Please note that the value defined by this directive in the bacula-dir.conf file is the default value used when a Volume is created. Once the volume is created, changing the value in the bacula-dir.conf file will not change what is stored for the Volume. To change the value for an existing Volume you must use the update command in the Console.

Recycle Oldest Volume = <yes|no>
This directive instructs the Director to search for the oldest used Volume in the Pool when another Volume is requested by the Storage daemon and none are available. The catalog is then pruned respecting the retention periods of all Files and Jobs written to this Volume. If all Jobs are pruned (i.e. the volume is Purged), then the Volume is recycled and will be used as the next Volume to be written. This directive respects any Job, File, or Volume retention periods that you may have specified, and as such it is much better to use this directive than the Purge Oldest Volume.

This directive can be useful if you have a fixed number of Volumes in the Pool and you want to cycle through them and you have specified the correct retention periods.

However, if you use this directive and have only one Volume in the Pool, you will immediately recycle your Volume if you fill it and Bacula needs another one. Thus your backup will be totally invalid. Please use this directive with care. The default is no.

Recycle Current Volume = <yes|no>
If Bacula needs a new Volume, this directive instructs Bacula to Prune the volume respecting the Job and File retention periods. If all Jobs are pruned (i.e. the volume is Purged), then the Volume is recycled and will be used as the next Volume to be written. This directive respects any Job, File, or Volume retention periods that you may have specified, and thus it is much better to use it rather than the Purge Oldest Volume directive.

This directive can be useful if you have: a fixed number of Volumes in the Pool, you want to cycle through them, and you have specified retention periods that prune Volumes before you have cycled through the Volume in the Pool.

However, if you use this directive and have only one Volume in the Pool, you will immediately recycle your Volume if you fill it and Bacula needs another one. Thus your backup will be totally invalid. Please use this directive with care. The default is no.

Purge Oldest Volume = <yes|no>
This directive instructs the Director to search for the oldest used Volume in the Pool when another Volume is requested by the Storage daemon and none are available. The catalog is then purged irrespective of retention periods of all Files and Jobs written to this Volume. The Volume is then recycled and will be used as the next Volume to be written. This directive overrides any Job, File, or Volume retention periods that you may have specified.

This directive can be useful if you have a fixed number of Volumes in the Pool and you want to cycle through them and reusing the oldest one when all Volumes are full, but you don't want to worry about setting proper retention periods. However, by using this option you risk losing valuable data.

Please be aware that Purge Oldest Volume disregards all retention periods. If you have only a single Volume defined and you turn this variable on, that Volume will always be immediately overwritten when it fills! So at a minimum, ensure that you have a decent number of Volumes in your Pool before running any jobs. If you want retention periods to apply do not use this directive. To specify a retention period, use the Volume Retention directive (see above).

We highly recommend against using this directive, because it is sure that some day, Bacula will recycle a Volume that contains current data. The default is no.

Cleaning Prefix = <string>
This directive defines a prefix string, which if it matches the beginning of a Volume name during labeling of a Volume, the Volume will be defined with the VolStatus set to Cleaning and thus Bacula will never attempt to use this tape. This is primarily for use with autochangers that accept barcodes where the convention is that barcodes beginning with CLN are treated as cleaning tapes.

Label Format = <format>
This directive specifies the format of the labels contained in this pool. The format directive is used as a sort of template to create new Volume names during automatic Volume labeling.

The format should be specified in double quotes, and consists of letters, numbers and the special characters hyphen (-), underscore (_), colon (:), and period (.), which are the legal characters for a Volume name. The format should be enclosed in double quotes (").

In addition, the format may contain a number of variable expansion characters which will be expanded by a complex algorithm allowing you to create Volume names of many different formats. In all cases, the expansion process must resolve to the set of characters noted above that are legal Volume names. Generally, these variable expansion characters begin with a dollar sign ($) or a left bracket ([). If you specify variable expansion characters, you should always enclose the format with double quote characters ("). For more details on variable expansion, please see the Variable Expansion Chapter of this manual.

If no variable expansion characters are found in the string, the Volume name will be formed from the format string appended with the number of volumes in the pool plus one, which will be edited as four digits with leading zeros. For example, with a Label Format = "File-", the first volumes will be named File-0001, File-0002, ...

With the exception of Job specific variables, you can test your LabelFormat by using the var command the Console Chapter of this manual.

In almost all cases, you should enclose the format specification (part after the equal sign) in double quotes. Please note that this directive is deprecated and is replaced in version 1.37 and greater with a Python script for creating volume names.

In order for a Pool to be used during a Backup Job, the Pool must have at least one Volume associated with it. Volumes are created for a Pool using the label or the add commands in the Bacula Console, program. In addition to adding Volumes to the Pool (i.e. putting the Volume names in the Catalog database), the physical Volume must be labeled with a valid Bacula software volume label before Bacula will accept the Volume. This will be automatically done if you use the label command. Bacula can automatically label Volumes if instructed to do so, but this feature is not yet fully implemented.

The following is an example of a valid Pool resource definition:

 
Pool {
  Name = Default
  Pool Type = Backup
}

The Scratch Pool

In general, you can give your Pools any name you wish, but there is one important restriction: the Pool named Scratch, if it exists behaves like a scratch pool of Volumes in that when Bacula needs a new Volume for writing and it cannot find one, it will look in the Scratch pool, and if it finds an available Volume, it will move it out of the Scratch pool into the Pool currently being used by the job.


The Catalog Resource

The Catalog Resource defines what catalog to use for the current job. Currently, Bacula can only handle a single database server (SQLite, MySQL, PostgreSQL) that is defined when configuring Bacula. However, there may be as many Catalogs (databases) defined as you wish. For example, you may want each Client to have its own Catalog database, or you may want backup jobs to use one database and verify or restore jobs to use another database.

Catalog
Start of the Catalog resource. At least one Catalog resource must be defined.

Name = <name>
The name of the Catalog. No necessary relation to the database server name. This name will be specified in the Client resource directive indicating that all catalog data for that Client is maintained in this Catalog. This directive is required.

password = <password>
This specifies the password to use when logging into the database. This directive is required.

DB Name = <name>
This specifies the name of the database. If you use multiple catalogs (databases), you specify which one here. If you are using an external database server rather than the internal one, you must specify a name that is known to the server (i.e. you explicitly created the Bacula tables using this name. This directive is required.

user = <user>
This specifies what user name to use to log into the database. This directive is required.

DB Socket = <socket-name>
This is the name of a socket to use on the local host to connect to the database. This directive is used only by MySQL and is ignored by SQLite. Normally, if neither DB Socket or DB Address are specified, MySQL will use the default socket.

DB Address = <address>
This is the host address of the database server. Normally, you would specify this instead of DB Socket if the database server is on another machine. In that case, you will also specify DB Port. This directive is used only by MySQL and is ignored by SQLite if provided. This directive is optional.

DB Port = <port>
This defines the port to be used in conjunction with DB Address to access the database if it is on another machine. This directive is used only by MySQL and is ignored by SQLite if provided. This directive is optional.

the different

The following is an example of a valid Catalog resource definition:

Catalog
{
  Name = SQLite
  dbname = bacula;
  user = bacula;
  password = ""                       # no password = no security
}

or for a Catalog on another machine:

Catalog
{
  Name = MySQL
  dbname = bacula
  user = bacula
  password = ""
  DB Address = remote.acme.com
  DB Port = 1234
}


The Messages Resource

For the details of the Messages Resource, please see the Messages Resource Chapter of this manual.


The Console Resource

As of Bacula version 1.33 and higher, there are three different kinds of consoles, which the administrator or user can use to interact with the Director. These three kinds of consoles comprise three different security levels.

The Console resource is optional and need not be specified. The following directives are permitted within the Director's configuration resource:

Name = <name>
The name of the console. This name must match the name specified in the Console's configuration resource (much as is the case with Client definitions).

Password = <password>
Specifies the password that must be supplied for a named Bacula Console to be authorized. The same password must appear in the Console resource of the Console configuration file. For added security, the password is never actually passed across the network but rather a challenge response hash code created with the password. This directive is required. If you have either /dev/random bc on your machine, Bacula will generate a random password during the configuration process, otherwise it will be left blank.

JobACL = <name-list>
This directive is used to specify a list of Job resource names that can be accessed by the console. Without this directive, the console cannot access any of the Director's Job resources. Multiple Job resource names may be specified by separating them with commas, and/or by specifying multiple JobACL directives. For example, the directive may be specified as:

    JobACL = kernsave, "Backup client 1", "Backup client 2"
    JobACL = "RestoreFiles"

With the above specification, the console can access the Director's resources for the four jobs named on the JobACL directives, but for no others.

ClientACL = <name-list>
This directive is used to specify a list of Client resource names that can be accessed by the console.

StorageACL = <name-list>
This directive is used to specify a list of Storage resource names that can be accessed by the console.

ScheduleACL = <name-list>
This directive is used to specify a list of Schedule resource names that can be accessed by the console.

PoolACL = <name-list>
This directive is used to specify a list of Pool resource names that can be accessed by the console.

FileSetACL = <name-list>
This directive is used to specify a list of FileSet resource names that can be accessed by the console.

CatalogACL = <name-list>
This directive is used to specify a list of Catalog resource names that can be accessed by the console.

CommandACL = <name-list>
This directive is used to specify a list of of console commands that can be executed by the console.

Aside from Director resource names and console command names, the special keyword *all* can be specified in any of the above access control lists. When this keyword is present, any resource or command name (which ever is appropriate) will be accepted. For an example configuration file, please see the Console Configuration chapter of this manual.


The Counter Resource

The Counter Resource defines a counter variable that can be accessed by variable expansion used for creating Volume labels with the LabelFormat directive. See the LabelFormat directive in this chapter for more details.

Counter
Start of the Counter resource. Counter directives are optional.

Name = <name>
The name of the Counter. This is the name you will use in the variable expansion to reference the counter value.

Minimum = <integer>
This specifies the minimum value that the counter can have. It also becomes the default. If not supplied, zero is assumed.

Maximum = <integer>
This is the maximum value value that the counter can have. If not specified or set to zero, the counter can have a maximum value of 2,147,483,648 (2 to the 31 power). When the counter is incremented past this value, it is reset to the Minimum.

*WrapCounter = <counter-name>
If this value is specified, when the counter is incremented past the maximum and thus reset to the minimum, the counter specified on the WrapCounter is incremented. (This is not currently implemented).

Catalog = <catalog-name>
If this directive is specified, the counter and its values will be saved in the specified catalog. If this directive is not present, the counter will be redefined each time that Bacula is started.


Example Director Configuration File

An example Director configuration file might be the following:

#
# Default Bacula Director Configuration file
#
#  The only thing that MUST be changed is to add one or more
#   file or directory names in the Include directive of the
#   FileSet resource.
#
#  For Bacula release 1.15 (5 March 2002) -- redhat
#
#  You might also want to change the default email address
#   from root to your address.  See the "mail" and "operator"
#   directives in the Messages resource.
#
Director {                            # define myself
  Name = rufus-dir
  QueryFile = "/home/kern/bacula/bin/query.sql"
  WorkingDirectory = "/home/kern/bacula/bin/working"
  PidDirectory = "/home/kern/bacula/bin/working"
  Password = "XkSfzu/Cf/wX4L8Zh4G4/yhCbpLcz3YVdmVoQvU3EyF/"
}
# Define the backup Job
Job {
  Name = "NightlySave"
  Type = Backup
  Level = Incremental                 # default
  Client=rufus-fd
  FileSet="Full Set"
  Schedule = "WeeklyCycle"
  Storage = DLTDrive
  Messages = Standard
  Pool = Default
}
Job {
  Name = "Restore"
  Type = Restore
  Client=rufus-fd
  FileSet="Full Set"
  Where = /tmp/bacula-restores
  Storage = DLTDrive
  Messages = Standard
  Pool = Default
}
   
# List of files to be backed up
FileSet {
  Name = "Full Set"
  Include {
    Options { signature=SHA1 }
#
#  Put your list of files here, one per line or include an
#    external list with:
#
#    @file-name
#
#  Note: / backs up everything
  File = /
 }
  Exclude {}
}
# When to do the backups
Schedule {
  Name = "WeeklyCycle"
  Run = Full sun at 1:05
  Run = Incremental mon-sat at 1:05
}
# Client (File Services) to backup
Client {
  Name = rufus-fd
  Address = rufus
  Catalog = MyCatalog
  Password = "MQk6lVinz4GG2hdIZk1dsKE/LxMZGo6znMHiD7t7vzF+"
  File Retention = 60d      # sixty day file retention
  Job Retention = 1y        # 1 year Job retention
  AutoPrune = yes           # Auto apply retention periods
}
# Definition of DLT tape storage device
Storage {
  Name = DLTDrive
  Address = rufus
  Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
  Device = "HP DLT 80"      # same as Device in Storage daemon
  Media Type = DLT8000      # same as MediaType in Storage daemon
}
# Definition for a DLT autochanger device
Storage {
  Name = Autochanger
  Address = rufus
  Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
  Device = "Autochanger"    # same as Device in Storage daemon
  Media Type = DLT-8000     # Different from DLTDrive
  Autochanger = yes
}
# Definition of DDS tape storage device
Storage {
  Name = SDT-10000
  Address = rufus
  Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
  Device = SDT-10000        # same as Device in Storage daemon
  Media Type = DDS-4        # same as MediaType in Storage daemon
}
# Definition of 8mm tape storage device
Storage {
  Name = "8mmDrive"
  Address = rufus
  Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
  Device = "Exabyte 8mm"
  MediaType = "8mm"
}
# Definition of file storage device
Storage {
  Name = File
  Address = rufus
  Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
  Device = FileStorage
  Media Type = File
}
# Generic catalog service
Catalog {
  Name = MyCatalog
  dbname = bacula; user = bacula; password = ""
}
# Reasonable message delivery -- send most everything to
#   the email address and to the console
Messages {
  Name = Standard
  mail = root@localhost = all, !skipped, !terminate
  operator = root@localhost = mount
  console = all, !skipped, !saved
}
    
# Default pool definition
Pool {
  Name = Default
  Pool Type = Backup
  AutoPrune = yes
  Recycle = yes
}
#
# Restricted console used by tray-monitor to get the status of the director
#
Console {
  Name = Monitor
  Password = "GN0uRo7PTUmlMbqrJ2Gr1p0fk0HQJTxwnFyE4WSST3MWZseR"
  CommandACL = status, .status
}


Client/File daemon Configuration

General

The Client (or File Daemon) Configuration is one of the simpler ones to specify. Generally, other than changing the Client name so that error messages are easily identified, you will not need to modify the default Client configuration file.

For a general discussion of configuration file and resources including the data types recognized by Bacula, please see the Configuration chapter of this manual. The following Client Resource definitions must be defined:


The Client Resource

The Client Resource (or FileDaemon) resource defines the name of the Client (as used by the Director) as well as the port on which the Client listens for Director connections.

Client (or FileDaemon)
Start of the Client records. There must be one and only one Client resource in the configuration file, since it defines the properties of the current client program.

Name = <name>
The client name that must be used by the Director when connecting. Generally, it is a good idea to use a name related to the machine so that error messages can be easily identified if you have multiple Clients. This directive is required.

Working Directory = <Directory>
This directive is mandatory and specifies a directory in which the File daemon may put its status files. This directory should be used only by Bacula, but may be shared by other Bacula daemons provided the daemon names on the Name definition are unique for each daemon. This directive is required.

On Win32 systems, in some circumstances you may need to specify a drive letter in the specified working directory path. Also, please be sure that this directory is writable by the SYSTEM user otherwise restores may fail (the bootstrap file that is transferred to the File daemon from the Director is temporarily put in this directory before being passed to the Storage daemon).

Pid Directory = <Directory>
This directive is mandatory and specifies a directory in which the Director may put its process Id file files. The process Id file is used to shutdown Bacula and to prevent multiple copies of Bacula from running simultaneously. This record is required. Standard shell expansion of the Directory is done when the configuration file is read so that values such as $HOME will be properly expanded.

Typically on Linux systems, you will set this to: /var/run. If you are not installing Bacula in the system directories, you can use the Working Directory as defined above.

Heartbeat Interval = <time-interval>
This record defines an interval of time. For each heartbeat that the File daemon receives from the Storage daemon, it will forward it to the Director. In addition, if no heartbeat has been received from the Storage daemon and thus forwarded the File daemon will send a heartbeat signal to the Director and to the Storage daemon to keep the channels active. The default interval is zero which disables the heartbeat. This feature is particularly useful if you have a router such as 3Com that does not follow Internet standards and times out a valid connection after a short duration despite the fact that keepalive is set. This usually results in a broken pipe error message.

If you continue getting broken pipe error messages despite using the Heartbeat Interval, and you are using Windows, you should consider upgrading your ethernet driver. This is a known problem with NVidia NForce 3 drivers (4.4.2 17/05/2004), or try the following workaround suggested by Thomas Simmons for Win32 machines:

Browse to: Start > Control Panel > Network Connections

Right click the connection for the nvidia adapter and select properties. Under the General tab, click "Configure...". Under the Advanced tab set "Checksum Offload" to disabled and click OK to save the change.

Lack of communications, or communications that get interrupted can also be caused by Linux firewalls where you have a rule that throttles connections or traffic.

Maximum Concurrent Jobs = <number>
where <number> is the maximum number of Jobs that should run concurrently. The default is set to 2, but you may set it to a larger number. Each contact from the Director (e.g. status request, job start request) is considered as a Job, so if you want to be able to do a status request in the console at the same time as a Job is running, you will need to set this value greater than 1.

FDAddresses = <IP-address-specification>
Specify the ports and addresses on which the Director daemon will listen for Bacula Console connections. Probably the simplest way to explain is to show an example:

 FDAddresses  = { ip = {
        addr = 1.2.3.4; port = 1205; }
    ipv4 = {
        addr = 1.2.3.4; port = http; }
    ipv6 = {
        addr = 1.2.3.4;
        port = 1205;
    }
    ip = {
        addr = 1.2.3.4
        port = 1205
    }
    ip = {
        addr = 1.2.3.4
    }
    ip = {
        addr = 201:220:222::2
    }
    ip = {
        addr = bluedot.thun.net
    }
 }

where ip, ip4, ip6, addr, and port are all keywords. Note, that the address can be specified as either a dotted quadruple, or IPv6 colon notation, or as a symbolic name (only in the ip specification). Also, port can be specified as a number or as the mnemonic value from the /etc/services file. If a port is not specified, the default will be used. If an ip section is specified, the resolution can be made either by IPv4 or IPv6. If ip4 is specified, then only IPv4 resolutions will be permitted, and likewise with ip6.

FDPort = <port-number>
This specifies the port number on which the Client listens for Director connections. It must agree with the FDPort specified in the Client resource of the Director's configuration file. The default is 9102.

FDAddress = <IP-Address>
This record is optional, and if it is specified, it will cause the File daemon server (for Director connections) to bind to the specified IP-Address, which is either a domain name or an IP address specified as a dotted quadruple. If this record is not specified, the File daemon will bind to any available address (the default).

SDConnectTimeout = <time-interval>
This record defines an interval of time that the File daemon will try to connect to the Storage daemon. The default is 30 minutes. If no connection is made in the specified time interval, the File daemon cancels the Job.

Maximum Network Buffer Size = <bytes>
where <bytes> specifies the initial network buffer size to use with the File daemon. This size will be adjusted down if it is too large until it is accepted by the OS. Please use care in setting this value since if it is too large, it will be trimmed by 512 bytes until the OS is happy, which may require a large number of system calls. The default value is 32,768 bytes.

The following is an example of a valid Client resource definition:

Client {                              # this is me
  Name = rufus-fd
  WorkingDirectory = $HOME/bacula/bin/working
  Pid Directory = $HOME/bacula/bin/working
}


The Director Resource

The Director resource defines the name and password of the Directors that are permitted to contact this Client.

Director
Start of the Director records. There may be any number of Director resources in the Client configuration file. Each one specifies a Director that is allowed to connect to this Client.

Name = <name>
The name of the Director that may contact this Client. This name must be the same as the name specified on the Director resource in the Director's configuration file. This record is required.

Password = <password>
Specifies the password that must be supplied for a Director to be authorized. This password must be the same as the password specified in the Client resource in the Director's configuration file. This record is required.

Monitor = <yes|no>
If Monitor is set to no (default), this director will have full access to this Client. If Monitor is set to yes, this director will only be able to fetch the current status of this Client.

Please note that if this director is being used by a Monitor, we highly recommend to set this directive to yes to avoid serious security problems.

Thus multiple Directors may be authorized to use this Client's services. Each Director will have a different name, and normally a different password as well.

The following is an example of a valid Director resource definition:

#
# List Directors who are permitted to contact the File daemon
#
Director {
  Name = HeadMan
  Password = very_good                # password HeadMan must supply
}
Director {
  Name = Worker
  Password = not_as_good
  Monitor = Yes
}


The Message Resource

Please see the Messages Resource Chapter of this manual for the details of the Messages Resource.

There must be at least one Message resource in the Client configuration file.


Example Client Configuration File

An example File Daemon configuration file might be the following:

#
# Default  Bacula File Daemon Configuration file
#
#  For Bacula release 1.35.2 (16 August 2004) -- gentoo 1.4.16
#
# There is not much to change here except perhaps to
#   set the Director's name and File daemon's name
#   to something more appropriate for your site.
#
#
# List Directors who are permitted to contact this File daemon
#
Director {
  Name = rufus-dir
  Password = "/LqPRkX++saVyQE7w7mmiFg/qxYc1kufww6FEyY/47jU"
}
#
# Restricted Director, used by tray-monitor to get the
#   status of the file daemon
#
Director {
  Name = rufus-mon
  Password = "FYpq4yyI1y562EMS35bA0J0QC0M2L3t5cZObxT3XQxgxppTn"
  Monitor = yes
}
#
# "Global" File daemon configuration specifications
#
FileDaemon {                          # this is me
  Name = rufus-fd
  WorkingDirectory = $HOME/bacula/bin/working
  Pid Directory = $HOME/bacula/bin/working
}
# Send all messages except skipped files back to Director
Messages {
  Name = Standard
  director = rufus-dir = all, !skipped
}


Storage Daemon Configuration

General

The Storage Daemon configuration file has relatively few resource definitions. However, due to the great variation in backup media and system capabilities, the storage daemon must be highly configurable. As a consequence, there are quite a large number of directives in the Device Resource definition that allow you to define all the characteristics of your Storage device (normally a tape drive). Fortunately, with modern storage devices, the defaults are sufficient, and very few directives are actually needed.

Examples of Device resource directives that are known to work for a number of common tape drives can be found in the <bacula-src>/examples/devices directory, and most will also be listed here.

For a general discussion of configuration file and resources including the data types recognized by Bacula, please see the Configuration chapter of this manual. The following Storage Resource definitions must be defined:


Storage Resource

In general, the properties specified under the Storage resource define global properties of the Storage daemon. Each Storage daemon configuration file must have one and only one Storage resource definition.

Name = <Storage-Daemon-Name>
Specifies the Name of the Storage daemon. This directive is required.

Working Directory = <Directory>
This directive is mandatory and specifies a directory in which the Storage daemon may put its status files. This directory should be used only by Bacula, but may be shared by other Bacula daemons provided the names given to each daemon are unique. This directive is required

Pid Directory = <Directory>
This directive is mandatory and specifies a directory in which the Director may put its process Id file files. The process Id file is used to shutdown Bacula and to prevent multiple copies of Bacula from running simultaneously. This directive is required. Standard shell expansion of the Directory is done when the configuration file is read so that values such as $HOME will be properly expanded.

Typically on Linux systems, you will set this to: /var/run. If you are not installing Bacula in the system directories, you can use the Working Directory as defined above.

Heartbeat Interval = <time-interval>
This directive defines an interval of time. When the Storage daemon is waiting for the operator to mount a tape, each time interval, it will send a heartbeat signal to the File daemon. The default interval is zero which disables the heartbeat. This feature is particularly useful if you have a router such as 3Com that does not follow Internet standards and times out an valid connection after a short duration despite the fact that keepalive is set. This usually results in a broken pipe error message.

Maximum Concurrent Jobs = <number>
where <number> is the maximum number of Jobs that should run concurrently. The default is set to 10, but you may set it to a larger number. Each contact from the Director (e.g. status request, job start request) is considered as a Job, so if you want to be able to do a status request in the console at the same time as a Job is running, you will need to set this value greater than 1. To run simultaneous Jobs, you will need to set a number of other directives in the Director's configuration file. Which ones you set depend on what you want, but you will almost certainly need to set the Maximum Concurrent Jobs in the Storage resource in the Director's configuration file and possibly those in the Job and Client resources.

SDAddresses = <IP-address-specification>
Specify the ports and addresses on which the Storage daemon will listen for Director connections. Normally, the default is sufficient and you do not need to specify this directive. Probably the simplest way to explain how this directive works is to show an example:

 SDAddresses  = { ip = {
        addr = 1.2.3.4; port = 1205; }
    ipv4 = {
        addr = 1.2.3.4; port = http; }
    ipv6 = {
        addr = 1.2.3.4;
        port = 1205;
    }
    ip = {
        addr = 1.2.3.4
        port = 1205
    }
    ip = {
        addr = 1.2.3.4
    }
    ip = {
        addr = 201:220:222::2
    }
    ip = {
        addr = bluedot.thun.net
    }
}

where ip, ip4, ip6, addr, and port are all keywords. Note, that the address can be specified as either a dotted quadruple, or IPv6 colon notation, or as a symbolic name (only in the ip specification). Also, port can be specified as a number or as the mnemonic value from the /etc/services file. If a port is not specified, the default will be used. If an ip section is specified, the resolution can be made either by IPv4 or IPv6. If ip4 is specified, then only IPv4 resolutions will be permitted, and likewise with ip6.

Using this directive, you can replace both the SDPort and SDAddress directives shown below.

SDPort = <port-number>
Specifies port number on which the Storage daemon listens for Director connections. The default is 9103.

SDAddress = <IP-Address>
This directive is optional, and if it is specified, it will cause the Storage daemon server (for Director and File daemon connections) to bind to the specified IP-Address, which is either a domain name or an IP address specified as a dotted quadruple. If this directive is not specified, the Storage daemon will bind to any available address (the default).

The following is a typical Storage daemon Storage definition.

#
# "Global" Storage daemon configuration specifications appear
# under the Storage resource.
#
Storage {
  Name = "Storage daemon"
  Address = localhost
  WorkingDirectory = "~/bacula/working"
  Pid    Directory = "~/bacula/working"
}


Director Resource

The Director resource specifies the Name of the Director which is permitted to use the services of the Storage daemon. There may be multiple Director resources. The Director Name and Password must match the corresponding values in the Director's configuration file.

Name = <Director-Name>
Specifies the Name of the Director allowed to connect to the Storage daemon. This directive is required.

Password = <Director-password>
Specifies the password that must be supplied by the above named Director. This directive is required.

Monitor = <yes|no>
If Monitor is set to no (default), this director will have full access to this Storage daemon. If Monitor is set to yes, this director will only be able to fetch the current status of this Storage daemon.

Please note that if this director is being used by a Monitor, we highly recommend to set this directive to yes to avoid serious security problems.

The following is an example of a valid Director resource definition:

Director {
  Name = MainDirector
  Password = my_secret_password
}

Device Resource

The Device Resource specifies the details of each device (normally a tape drive) that can be used by the Storage daemon. There may be multiple Device resources for a single Storage daemon. In general, the properties specified within the Device resource are specific to the Device.

Name = Device-Name
Specifies the Name that the Director will use when asking to backup or restore to or from to this device. This is the logical Device name, and may be any string up to 127 characters in length. It is generally a good idea to make it correspond to the English name of the backup device. The physical name of the device is specified on the Archive Device directive described below. The name you specify here is also used in your Director's conf file on the Device directive in its Storage resource.

Archive Device = name-string
The specified name-string gives the system file name of the storage device managed by this storage daemon. This will usually be the device file name of a removable storage device (tape drive), for example " /dev/nst0" or "/dev/rmt/0mbn". For a DVD-writer, it will be for example /dev/hdc. It may also be a directory name if you are archiving to disk storage. In this case, you must supply the full absolute path to the directory. When specifying a tape device, it is preferable that the "non-rewind" variant of the device file name be given. In addition, on systems such as Sun, which have multiple tape access methods, you must be sure to specify to use Berkeley I/O conventions with the device. The b in the Solaris (Sun) archive specification /dev/rmt/0mbn is what is needed in this case. Bacula does not support SysV tape drive behavior.

As noted above, normally the Archive Device is the name of a tape drive, but you may also specify an absolute path to an existing directory. If the Device is a directory Bacula will write to file storage in the specified directory, and the filename used will be the Volume name as specified in the Catalog. If you want to write into more than one directory (i.e. to spread the load to different disk drives), you will need to define two Device resources, each containing an Archive Device with a different directory.

In addition to a tape device name or a directory name, Bacula will accept the name of a FIFO. A FIFO is a special kind of file that connects two programs via kernel memory. If a FIFO device is specified for a backup operation, you must have a program that reads what Bacula writes into the FIFO. When the Storage daemon starts the job, it will wait for MaximumOpenWait seconds for the read program to start reading, and then time it out and terminate the job. As a consequence, it is best to start the read program at the beginning of the job perhaps with the RunBeforeJob directive. For this kind of device, you never want to specify AlwaysOpen, because you want the Storage daemon to open it only when a job starts, so you must explicitly set it to No. Since a FIFO is a one way device, Bacula will not attempt to read a label of a FIFO device, but will simply write on it. To create a FIFO Volume in the catalog, use the add command rather than then label command to avoid attempting to write a label.

During a restore operation, if the Archive Device is a FIFO, Bacula will attempt to read from the FIFO, so you must have an external program that writes into the FIFO. Bacula will wait MaximumOpenWait seconds for the program to begin writing and will then time it out and terminate the job. As noted above, you may use the RunBeforeJob to start the writer program at the beginning of the job.

The Archive Device directive is required.

Media Type = name-string
The specified name-string names the type of media supported by this device, for example, "DLT7000". Media type names are arbitrary in that you set it to anything you want, but must be known to the volume database to keep track of which storage daemons can read which volumes. The same name-string must appear in the appropriate Storage resource definition in the Director's configuration file.

Even though the names you assign are arbitrary (i.e. you choose the name you want), you should take care in specifying them because the Media Type is used to determine which storage device Bacula will select during restore. Thus you should probably use the same Media Type specification for all drives where the Media can be freely interchanged. This is not generally an issue if you have a single Storage daemon, but it is with multiple Storage daemons, especially if they have incompatible media.

For example, if you specify a Media Type of "DDS-4" then during the restore, Bacula will be able to choose any Storage Daemon that handles "DDS-4". If you have an autochanger, you might want to name the Media Type in a way that is unique to the autochanger, unless you wish to possibly use the Volumes in other drives. You should also ensure to have unique Media Type names if the Media is not compatible between drives. This specification is required for all devices.

Autochanger = Yes|No
If Yes, this device belongs to an automatic tape changer, and you should also specify a Changer Device as well as a Changer Command. If No (default), the volume must be manually changed. You should also have an identical directive to the Storage resource in the Director's configuration file so that when labeling tapes you are prompted for the slot.

Changer Device = name-string
The specified name-string must be the generic SCSI device name of the autochanger that corresponds to the normal read/write Archive Device specified in the Device resource. This gemeric SCSI device name should be specified if you have an autochanger or if you have a standard tape drive and want to use the Alert Command (see below). For example, on Linux systems, for an Archive Device name of /dev/nst0, you would specify /dev/sg0 for the Changer Device name. Depending on your exact configuration, and the number of autochangers or the type of autochanger, what you specify here can vary. This directive is optional. See the Using Autochangers chapter of this manual for more details of using this and the following autochanger directives.

Changer Command = name-string
The name-string specifies an external program to be called that will automatically change volumes as required by Bacula. Most frequently, you will specify the Bacula supplied mtx-changer script as follows:

Changer Command = "/path/mtx-changer %c %o %S %a %d"

and you will install the mtx on your system (found in the depkgs release). An example of this command is in the default bacula-sd.conf file. For more details on the substitution characters that may be specified to configure your autochanger please see the Autochangers chapter of this manual. For FreeBSD users, you might want to see one of the several chio scripts in examples/autochangers.

Alert Command = name-string
The name-string specifies an external program to be called at the completion of each Job after the device is released. The purpose of this command is to check for Tape Alerts, which are present when something is wrong with your tape drive (at least for most modern tape drives). The same substitution characters that may be specified in the Changer Command may also be used in this string. For more information, please see the Autochangers chapter of this manual.

Note, it is not necessary to have an autochanger to use this command. The example below uses the tapeinfo program that comes with the mtx package, but it can be used on any tape drive. However, you will need to specify a Changer Device directive in your Device resource (see above) so that the generic SCSI device name can be edited into the command (with the %c).

An example of the use of this command to print Tape Alerts in the Job report is:

Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert'"
      

and an example output when there is a problem could be:

bacula-sd  Alert: TapeAlert[32]: Interface: Problem with SCSI interface
                  between tape drive and initiator.

Drive Index = number
The Drive Index that you specify is passed to the mtx-changer script and is thus passed to the mtx program. By default, the Drive Index is zero, so if you have only one drive in your autochanger, everything will work normally. However, if you have multiple drives, you may specify two Bacula Device resources. The first will either set Drive Index to zero, or leave it unspecified, and the second Device Resource should contain a Drive Index set to 1. This will then permit you to use two or more drives in your autochanger. However, you must ensure that Bacula does not request the same Volume on both drives at the same time. You may also need to modify the mtx-changer script to do locking so that two jobs don't attempt to use the autochanger at the same time. An example script can be found in examples/autochangers/locking-mtx-changer.

Autoselect = Yes|No
If this directive is set to yes (default), and the Device belongs to an autochanger, then when the Autochanger is referenced by the Director, this device can automatically be selected. If this directive is set to no, then the Device can only be referenced by directly using the Device name in the Director. This is useful for reserving a drive for something special such as a high priority backup or restore operations.

Maximum Changer Wait = seconds
This directive specifies the maximum time in seconds for Bacula to wait for an autochanger to change the volume. If this time is exceeded, Bacula will invalidate the Volume slot number stored in the catalog and try again. If no additional changer volumes exist, Bacula will ask the operator to intervene. The default is 5 minutes.

Please note that if you want to set your changer wait time to 10 minutes, you must specify:

Maximum Changer Wait = 600

This directive will not accept qualifiers (such as "minutes").

Maximum Rewind Wait = seconds
This directive specifies the maximum time in seconds for Bacula to wait for a rewind before timing out. If this time is exceeded, Bacula will cancel the job. The default is 5 minutes.

Maximum Open Wait = seconds
This directive specifies the maximum time in seconds for Bacula to wait for a open before timing out. If this time is exceeded, Bacula will cancel the job. The default is 5 minutes.

Always Open = Yes|No
If Yes (default), Bacula will always keep the device open unless specifically unmounted by the Console program. This permits Bacula to ensure that the tape drive is always available. If you set AlwaysOpen to no Bacula will only open the drive when necessary, and at the end of the Job if no other Jobs are using the drive, it will be freed. The next time Bacula wants to append to a tape on a drive that was freed, Bacula must rewind the tape and position to the end. To avoid unnecessary tape positioning and to minimize unnecessary operator intervention, it is highly recommended that Always Open = yes. This also ensures that the drive is available when Bacula needs it.

If you have Always Open = yes (recommended) and you want to use the drive for something else, simply use the unmount command in the Console program to release the drive. However, don't forget to remount the drive with mount when the drive is available or the next Bacula job will block.

For File storage, this directive is ignored. For a FIFO storage device, you must set this to No.

Please note that if you set this directive to No Bacula will release the tape drive between each job, and thus the next job will rewind the tape and position it to the end of the data. This can be a very time consuming operation.

Volume Poll Interval = time
If the time specified on this directive is non-zero, after asking the operator to mount a new volume Bacula will periodically poll (or read) the drive at the specified interval to see if a new volume has been mounted. If the time interval is zero (the default), no polling will occur. This directive can be useful if you want to avoid operator intervention via the console. Instead, the operator can simply remove the old volume and insert the requested one, and Bacula on the next poll will recognize the new tape and continue. Please be aware that if you set this interval too small, you may excessively wear your tape drive if the old tape remains in the drive, since Bacula will read it on each poll. This can be avoided by ejecting the tape using the Offline On Unmount and the Close on Poll directives. However, if you are using a Linux 2.6 kernel or other OSes such as FreeBSD or Solaris, the Offline On Unmount will leave the drive with no tape, and Bacula will not be able to properly open the drive and may fail the job. For more information on this problem, please see the description of Offline On Unmount in the Tape Testing chapter.

Close on Poll= Yes|No
If Yes, Bacula close the device (equivalent to an unmount except no mount is required) and reopen it at each poll. Normally this is not too useful unless you have the Offline on Unmount directive set, in which case the drive will be taken offline preventing wear on the tape during any future polling. Once the operator inserts a new tape, Bacula will recognize the drive on the next poll and automatically continue with the backup. Please see above more more details.

Maximum Open Wait = seconds
This directive specifies the maximum amount of time in seconds that Bacula will wait for a device that is busy. The default is 5 minutes. If the device cannot be obtained, the current Job will be terminated in error. Bacula will re-attempt to open the drive the next time a Job starts that needs the the drive.

Removable media = Yes|No
If Yes, this device supports removable media (for example, tapes or CDs). If No, media cannot be removed (for example, an intermediate backup area on a hard disk).

Random access = Yes|No
If Yes, the archive device is assumed to be a random access medium which supports the lseek (or lseek64 if Largefile is enabled during configuration) facility.

Minimum block size = size-in-bytes
On most modern tape drives, you will not need or wamt to specify this directive, and if you do so, it will be to make Bacula use fixed block sizes. This statement applies only to non-random access devices (e.g. tape drives). Blocks written by the storage daemon to a non-random archive device will never be smaller than the given size-in-bytes. The Storage daemon will attempt to efficiently fill blocks with data received from active sessions but will, if necessary, add padding to a block to achieve the required minimum size.

To force the block size to be fixed, as is the case for some non-random access devices (tape drives), set the Minimum block size and the Maximum block size to the same value (zero included). The default is that both the minimum and maximum block size are zero and the default block size is 64,512 bytes. If you wish the block size to be fixed and different from the default, specify the same value for both Minimum block size and Maximum block size.

For example, suppose you want a fixed block size of 100K bytes, then you would specify:

 
    Minimum block size = 100K
    Maximum block size = 100K

Please note that if you specify a fixed block size as shown above, the tape drive must either be in variable block size mode, or if it is in fixed block size mode, the block size (generally defined by mt) must be identical to the size specified in Bacula -- otherwise when you attempt to re-read your Volumes, you will get an error.

If you want the block size to be variable but with a 64K minimum and 200K maximum (and default as well), you would specify:

 
    Minimum block size = 64K
    Maximum blocksize = 200K

Maximum block size = size-in-bytes
On most modern tape drives, you will not need to specify this directive. If you do so, it will most likely be to use fixed block sizes (see Minimum block size above). The Storage daemon will aways attempt to write blocks of the specified size-in-bytes to the archive device. As a consequence, this statement specifies both the default block size and the maximum block size. The size written never exceed the given size-in-bytes. If adding data to a block would cause it to exceed the given maximum size, the block will be written to the archive device, and the new data will begin a new block.

If no value is specified or zero is specified, the Storage daemon will use a default block size of 64,512 bytes (126 * 512).

Hardware End of Medium = Yes|No
If No, the archive device is not required to support end of medium ioctl request, and the storage daemon will use the forward space file function to find the end of the recorded data. If Yes, the archive device must support the ioctl MTEOM call, which will position the tape to the end of the recorded data. In addition, your SCSI driver must keep track of the file number on the tape and report it back correctly by the MTIOCGET ioctl. Note, some SCSI drivers will correctly forward space to the end of the recorded data, but they do not keep track of the file number. On Linux machines, the SCSI driver has a fast-eod option, which if set will cause the driver to lose track of the file number. You should ensure that this option is always turned off using the mt program.

Default setting for Hardware End of Medium is Yes. This function is used before appending to a tape to ensure that no previously written data is lost. We recommend if you have a non-standard or unusual tape drive that you use the btape program to test your drive to see whether or not it supports this function. All modern (after 1998) tape drives support this feature.

Fast Forward Space File = Yes|No
If No, the archive device is not required to support keeping track of the file number (MTIOCGET ioctl) during forward space file. If Yes, the archive device must support the ioctl MTFSF call, which virtually all drivers support, but in addition, your SCSI driver must keep track of the file number on the tape and report it back correctly by the MTIOCGET ioctl. Note, some SCSI drivers will correctly forward space, but they do not keep track of the file number or more seriously, they do not report end of meduim.

Default setting for Fast Forward Space File is Yes.

Use MTIOCGET = Yes|No
If No, the operating system is not required to support keeping track of the file number and reporting it in the (MTIOCGET ioctl). The default is Yes. If you must set this to No, Bacula will do the proper file position determination, but it is very unfortunate because it means that tape movement is very inefficient. Fortunately, this operation system deficiency seems to be the case only on a few *BSD systems. Operating systems known to work correctly are Solaris, Linux and FreeBSD.

BSF at EOM = Yes|No
If No, the default, no special action is taken by Bacula with the End of Medium (end of tape) is reached because the tape will be positioned after the last EOF tape mark, and Bacula can append to the tape as desired. However, on some systems, such as FreeBSD, when Bacula reads the End of Medium (end of tape), the tape will be positioned after the second EOF tape mark (two successive EOF marks indicated End of Medium). If Bacula appends from that point, all the appended data will be lost. The solution for such systems is to specify BSF at EOM which causes Bacula to backspace over the second EOF mark. Determination of whether or not you need this directive is done using the test command in the btape program.

TWO EOF = Yes|No
If Yes, Bacula will write two end of file marks when terminating a tape -- i.e. after the last job or at the end of the medium. If No, the default, Bacula will only write one end of file to terminate the tape.

Backward Space Record = Yes|No
If Yes, the archive device supports the MTBSR ioctl to backspace records. If No, this call is not used and the device must be rewound and advanced forward to the desired position. Default is Yes for non random-access devices. This function if enabled is used at the end of a Volume after writing the end of file and any ANSI/IBM labels to determine whether or not the last block was written correctly. If you turn this function off, the test will not be done. This causes no harm as the re-read process is precautionary rather than required.

Backward Space File = Yes|No
If Yes, the archive device supports the MTBSF and MTBSF ioctls to backspace over an end of file mark and to the start of a file. If No, these calls are not used and the device must be rewound and advanced forward to the desired position. Default is Yes for non random-access devices.

Forward Space Record = Yes|No
If Yes, the archive device must support the MTFSR ioctl to forward space over records. If No, data must be read in order to advance the position on the device. Default is Yes for non random-access devices.

Forward Space File = Yes|No
If Yes, the archive device must support the MTFSF ioctl to forward space by file marks. If No, data must be read to advance the position on the device. Default is Yes for non random-access devices.

Offline On Unmount = Yes|No
The default for this directive is No. If Yes the archive device must support the MTOFFL ioctl to rewind and take the volume offline. In this case, Bacula will issue the offline (eject) request before closing the device during the unmount command. If No Bacula will not attempt to offline the device before unmounting it. After an offline is issued, the cassette will be ejected thus requiring operator intervention to continue, and on some systems require an explicit load command to be issued (mt -f /dev/xxx load) before the system will recognize the tape. If you are using an autochanger, some devices require an offline to be issued prior to changing the volume. However, most devices do not and may get very confused.

If you are using a Linux 2.6 kernel or other OSes such as FreeBSD or Solaris, the Offline On Unmount will leave the drive with no tape, and Bacula will not be able to properly open the drive and may fail the job. For more information on this problem, please see the description of Offline On Unmount in the Tape Testing chapter.

Maximum Volume Size = size
No more than size bytes will be written onto a given volume on the archive device. This directive is used mainly in testing Bacula to simulate a small Volume. It can also be useful if you wish to limit the size of a File Volume to say less than 2GB of data. In some rare cases of really antiquated tape drives that do not properly indicate when the end of a tape is reached during writing (though I have read about such drives, I have never personally encountered one). Please note, this directive is deprecated (being phased out) in favor of the Maximum Volume Bytes defined in the Director's configuration file.

Maximum File Size = size
No more than size bytes will be written into a given logical file on the volume. Once this size is reached, an end of file mark is written on the volume and subsequent data are written into the next file. Breaking long sequences of data blocks with file marks permits quicker positioning to the start of a given stream of data and can improve recovery from read errors on the volume. The default is one Gigabyte.

Block Positioning = yes|no
This directive is not normally used (and has not yet been tested). It will tell Bacula not to use block positioning when it is reading tapes. This can cause Bacula to be extremely slow when restoring files. You might use this directive if you wrote your tapes with Bacula in variable block mode (the default), but your drive was in fixed block mode. If it then works as I hope, Bacula will be able to re-read your tapes.

Maximum Network Buffer Size = bytes
where bytes specifies the initial network buffer size to use with the File daemon. This size will be adjusted down if it is too large until it is accepted by the OS. Please use care in setting this value since if it is too large, it will be trimmed by 512 bytes until the OS is happy, which may require a large number of system calls. The default value is 32,768 bytes.

The default size was chosen to be relatively large but not too big in the case that you are transmitting data over Internet. It is clear that on a high speed local network, you can increase this number and improve performance. For example, some users have found that if you use a value of 65,536 bytes they get 5-10 times the throughput. Larger values for most users don't seem to improve performance. If you are interested in improving your backup speeds, this is definitely a place to experiment. You will probably also want to make the corresponding change in each of your File daemons conf files.

Maximum Spool Size = bytes
where the bytes specify the maximum spool size for all jobs that are running. The default is no limit.

Maximum Job Spool Size = bytes
where the bytes specify the maximum spool size for any one job that is running. The default is no limit. This directive is implemented only in version 1.37 and later.

Spool Directory = directory
specifies the name of the directory to be used to store the spool files for this device. This directory is also used to store temporary part files when writing to a device that requires mount (DVD). The default is to use the working directory.

Maximum Part Size = bytes
This is the maximum size of a volume part file. The default is no limit. This directive is implemented only in version 1.37 and later.

If the device requires mount, it is transfered to the device when this size is reached. In this case, you must take care to have enough disk space left in the spool directory.

Otherwise, it is left on the hard disk.

It is ignored for tape and FIFO devices.

Devices that require a mount (DVD)

All the directives in this section are implemented only in Bacula version 1.37 and later.

Requires Mount = Yes|No
You must set this directive to yes for DVD-writers, and to no for all other devices (tapes/files). This directive indicates if the device requires to be mounted to be read, and if it must be written in a special way. If it set, Mount Point, Mount Command, Unmount Command and Write Part Command directives must also be defined.

Mount Point = directory
Directory where the device can be mounted.

Mount Command = name-string
Command that must be executed to mount the device. Before the command is executed, %a is replaced with the Archive Device, and %m with the Mount Point.

Most frequently, you will define it as follows:

  Mount Command = "/bin/mount -t iso9660 -o ro %a %m"

Unmount Command = name-string
Command that must be executed to unmount the device. Before the command is executed, %a is replaced with the Archive Device, and %m with the Mount Point.

Most frequently, you will define it as follows:

  Unmount Command = "/bin/umount %m"

Write Part Command = name-string
Command that must be executed to write a part to the device. Before the command is executed, %a is replaced with the Archive Device, %m with the Mount Point, %e is replaced with 1 if we are writing the first part, and with 0 otherwise, and %v with the current part filename.

For a DVD, you will most frequently specify the Bacula supplied dvd-writepart script as follows:

  Write Part Command = "/path/dvd-writepart %e %a %v"

Where /path is the path to your scripts install directory, and dvd-writepart is the Bacula supplied script file. This command will already be present, but commented out, in the default bacula-sd.conf file. To use it, simply remove the comment (#) symbol.

Free Space Command = name-string
Command that must be executed to check how much free space is left on the device. Before the command is executed,%a is replaced with the Archive Device, %m with the Mount Point, %e is replaced with 1 if we are writing the first part, and with 0 otherwise, and %v with the current part filename.

For a DVD, you will most frequently specify the Bacula supplied dvd-freespace script as follows:

  Free Space Command = "/path/dvd-freespace %a"

Where /path is the path to your scripts install directory, and dvd-freespace is the Bacula supplied script file. If you want to specify your own command, please look at the code of dvd-freespace to see what output Bacula expects from this command. This command will already be present, but commented out, in the default bacula-sd.conf file. To use it, simply remove the comment (#) symbol.

If you do not set it, Bacula will expect there is always free space on the device.


Autochanger-Konfiguration

In der Autochanger-Konfiguration können Autochanger mit einzelnen oder mehreren Laufwerken angelegt werden, indem eine oder mehrere Gerätekonfigurationen zu einer Einheit, die Bacula Autochanger nennt, gruppiert werden. (Autochangerherrsteller nennen so etwas auch "Tape Library")

Damit Ihr Autochanger korrekt funktioniert, müssen Sie eine Autochanger-Konfiguration in der Konfigurationsdatei des Storage-Dienstes erstellen und in der Konfiguration des Director-Dienstes muss ein entsprechender Storage-Eintrag auf den Autochanger-Namen in der Storage-Dienst-Konfiguration verweisen. In früheren Bacula-Versionen verwies die Autochanger-Konfiguration des Director-Dienstes direkt auf Geräte-Konfigurationen des Storage-Dienstes. Seit Version 1.38.0 ist es nicht mehr möglich, aus einer Autochanger-Konfiguration des Director-Dienstes, direkt auf die Autochanger-Geräte zu verweisen.

Name = <Autochanger-Name>
die Angabe des Autochanger-Namens. Dieser Name wird in der Director-Storage-Definition benutzt um auf den Autochanger zu verweisen. Die Konfiguration des Namens ist zwingend erforderlich.

Device = <Device-name1, device-name2, ...>
die Angabe eines oder mehrerer Geräte-Namen, die den Device-Einträgen der Laufwerke des Autochangers entsprechen. Wenn Ihr Autochanger mehrere Laufwerke hat, müssen Sie auch mehrere Geräte-Namen angeben, jeweils einen für jede Geräte-Konfiguration, die einem Laufwerk des Autochangers entspricht. Sie können mehrere Geräte-Namen durch Kommas getrennt in einer Zeile, oder mehrere Device-Einträge angeben. Die Konfiguration der Geräte-Namen ist zwingend erforderlich.

Changer Device = Bezeichner
der angegebene Bezeichner entspricht dem Geräte-Namen des Autochangers (nicht der Laufwerke) der durch das Betriebssystem vergeben wird. Wenn der Geräte-Name hier konfiguriert wird, braucht er nicht mehr in den Device-Einträgen der Laufwerke angegeben werden. Wenn der Geräte-Name auch in den Device-Einträgen angegeben wird, hat der dortige Eintrag Vorrang vor der Angabe in der Autochanger-Konfiguration.

Changer Command = Bezeichner
der angegebene Bezeichner gibt das zu verwendende externe Programm an, dass Bacula aufruft, um automatisch Volumes zu wechseln. Meistens wird hier das mit Bacula zur Verfügung gestellte mtx-changer angegeben. Wenn der Kommando-Name hier konfiguriert wird, braucht er nicht mehr in den Device-Einträgen der Laufwerke angegeben werden. Wenn der Kommando-Name auch in den Device-Einträgen angegeben wird, hat der dortige Eintrag Vorrang vor der Angabe in der Autochanger-Konfiguration.

Das Folgende ist ein Beispiel einer gültigen Autochanger-Konfiguration:

Autochanger {
  Name = "DDS-4-changer"
  Device = DDS-4-1, DDS-4-2, DDS-4-3
  Changer Device = /dev/sg0
  Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"
}
Device {
  Name = "DDS-4-1"
  Drive Index = 0
  Autochanger = yes
  ...
}
Device {
  Name = "DDS-4-2"
  Drive Index = 1
  Autochanger = yes
  ...
Device {
  Name = "DDS-4-3"
  Drive Index = 2
  Autochanger = yes
  Autoselect = no
  ...
}

Bitte beachten Sie dass es wichtig ist, dass Autochanger = yes in allen Device-Einträgen angegeben wird die zum Autochanger gehören. Ein Device-Eintrag darf nie zu mehr als einem Autochanger gehören. Außerdem darf die Storage-Konfiguration des Director-Dienstes nur auf die Autochanger-Konfiguration zeigen und nicht auf die Device-Einträge.

Wenn Sie ein Laufwerk des Autochangers nicht automatisch durch Bacula benutzen lassen wollen, z.B. um immer ein freies Laufwerk für Rücksicherungen zu haben, können Sie folgendes dem entsprechenden Device-Eintrag hinzufügen:

Autoselect = no

In diesem Fall wird Bacula das Laufwerk nicht mehr automatisch auswählen, wenn es auf den Autochanger zugreift. Sie können das Laufwerk weiterhin benutzen, indem Sie direkt den Device-Namen ansprechen, anstatt des Autochangers. Ein Beispiel einer solchen Konfiguration sehen Sie oben bei dem Device-Eintrag DDS-4-3. Diese Laufwerk wird nicht benutzt werden, wenn der Autochanger-Name DDS-4-changer als Storage-Definition genutzt wird, es lässt sich aber direkt, mit entsprechenden Storage-Konfigurations-Eintrag im Director-Dienst, als Storage DDS-4-3 ansprechen.

Capabilities

Label media = Yes|No
If Yes, permits this device to automatically label blank media without an explicit operator command. It does so by using an internal algorithm as defined on the Label Format record in each Pool resource. If this is No as by default, Bacula will label tapes only by specific operator command (label in the Console) or when the tape has been recycled. The automatic labeling feature is most useful when writing to disk rather than tape volumes.

Automatic mount = Yes|No
If Yes (the default), permits the daemon to examine the device to determine if it contains a Bacula labeled volume. This is done initially when the daemon is started, and then at the beginning of each job. If the This directive is particularly important if you have set Always Open = no because it permits Bacula to attempt to read the device before asking the system operator to mount a tape. However, please note that the tape must be mounted before the job begins.


Messages Resource

For a description of the Messages Resource, please see the Messages Resource Chapter of this manual.


Sample Storage Daemon Configuration File

A example Storage Daemon configuration file might be the following:

#
# Default Bacula Storage Daemon Configuration file
#
#  For Bacula release 1.37.2 (07 July 2005) -- gentoo 1.4.16
#
# You may need to change the name of your tape drive
#   on the "Archive Device" directive in the Device
#   resource.  If you change the Name and/or the
#   "Media Type" in the Device resource, please ensure
#   that bacula-dir.conf has corresponding changes.
#
Storage {                               # definition of myself
  Name = rufus-sd
  Address = rufus
  WorkingDirectory = "$HOME/bacula/bin/working"
  Pid Directory = "$HOME/bacula/bin/working"
  Maximum Concurrent Jobs = 20
}
#
# List Directors who are permitted to contact Storage daemon
#
Director {
  Name = rufus-dir
  Password = "ZF9Ctf5PQoWCPkmR3s4atCB0usUPg+vWWyIo2VS5ti6k"
}
#
# Restricted Director, used by tray-monitor to get the
#   status of the storage daemon
#
Director {
  Name = rufus-mon
  Password = "9usxgc307dMbe7jbD16v0PXlhD64UVasIDD0DH2WAujcDsc6"
  Monitor = yes
}
#
# Devices supported by this Storage daemon
# To connect, the Director's bacula-dir.conf must have the
#  same Name and MediaType.
#
Autochanger {
  Name = Autochanger
  Device = Drive-1
  Device = Drive-2
  Changer Command = "/home/kern/bacula/bin/mtx-changer %c %o %S %a %d"
  Changer Device = /dev/sg0
}

Device {
  Name = Drive-1                      #
  Drive Index = 0 
  Media Type = DLT-8000
  Archive Device = /dev/nst0
  AutomaticMount = yes;               # when device opened, read it
  AlwaysOpen = yes;
  RemovableMedia = yes;
  RandomAccess = no;
  AutoChanger = yes
  Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
}

Device {
  Name = Drive-2                      #
  Drive Index = 1
  Media Type = DLT-8000
  Archive Device = /dev/nst1
  AutomaticMount = yes;               # when device opened, read it
  AlwaysOpen = yes;
  RemovableMedia = yes;
  RandomAccess = no;
  AutoChanger = yes
  Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
}

Device {
  Name = "HP DLT 80"
  Media Type = DLT8000
  Archive Device = /dev/nst0
  AutomaticMount = yes;                 # when device opened, read it
  AlwaysOpen = yes;
  RemovableMedia = yes;
}
#Device {
#  Name = SDT-7000                     #
#  Media Type = DDS-2
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#}
#Device {
#  Name = Floppy
#  Media Type = Floppy
#  Archive Device = /mnt/floppy
#  RemovableMedia = yes;
#  Random Access = Yes;
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = no;
#}
#Device {
#  Name = FileStorage
#  Media Type = File
#  Archive Device = /tmp
#  LabelMedia = yes;                   # lets Bacula label unlabeled media
#  Random Access = Yes;
#  AutomaticMount = yes;               # when device opened, read it
#  RemovableMedia = no;
#  AlwaysOpen = no;
#}
#Device {
#  Name = "NEC ND-1300A"
#  Media Type = DVD
#  Archive Device = /dev/hda
#  LabelMedia = yes;                   # lets Bacula label unlabeled media
#  Random Access = Yes;
#  AutomaticMount = yes;               # when device opened, read it
#  RemovableMedia = yes;
#  AlwaysOpen = no;
#  MaximumPartSize = 800M;
#  RequiresMount = yes;
#  MountPoint = /mnt/cdrom;
#  MountCommand = "/bin/mount -t iso9660 -o ro %a %m";
#  UnmountCommand = "/bin/umount %m";
#  SpoolDirectory = /tmp/backup;
#  WritePartCommand = "/etc/bacula/dvd-writepart %e %a %v"
#  FreeSpaceCommand = "/etc/bacula/dvd-freespace %a"
#}
#
# A very old Exabyte with no end of media detection
#
#Device {
#  Name = "Exabyte 8mm"
#  Media Type = "8mm"
#  Archive Device = /dev/nst0
#  Hardware end of medium = No;
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = Yes;
#  RemovableMedia = yes;
#}
#
# Send all messages to the Director,
# mount messages also are sent to the email address
#
Messages {
  Name = Standard
  director = rufus-dir = all
  operator = root = mount
}


Messages Resource


The Messages Resource

The Messages resource defines how messages are to be handled and destinations to which they should be sent.

Even though each daemon has a full message handler, within the File daemon and the Storage daemon, you will normally choose to send all the appropriate messages back to the Director. This permits all the messages associated with a single Job to be combined in the Director and sent as a single email message to the user, or logged together in a single file.

Each message that Bacula generates (i.e. that each daemon generates) has an associated type such as INFO, WARNING, ERROR, FATAL, etc. Using the message resource, you can specify which message types you wish to see and where they should be sent. In addition, a message may be sent to multiple destinations. For example, you may want all error messages both logged as well as sent to you in an email. By defining multiple messages resources, you can have different message handling for each type of Job (e.g. Full backups versus Incremental backups).

In general, messages are attached to a Job and are included in the Job report. There are some rare cases, where this is not possible, e.g. when no job is running, or if a communications error occurs between a daemon and the director. In those cases, the message may remain in the system, and should be flushed at the end of the next Job. However, since such messages are not attached to a Job, any that are mailed will be sent to /usr/lib/sendmail. On some systems, such as FreeBSD, if your sendmail is in a different place, you may want to link it to the the above location.

The records contained in a Messages resource consist of a destination specification followed by a list of message-types in the format:

destination = message-type1, message-type2, message-type3, ...

or for those destinations that need and address specification (e.g. email):

destination = address = message-type1, message-type2, message-type3, ...

Where destination is one of a predefined set of keywords that define where the message is to be sent (stdout, file, ...), message-type is one of a predefined set of keywords that define the type of message generated by Bacula (ERROR, WARNING, FATAL, ...), and address varies according to the destination keyword, but is typically an email address or a filename.

The following are the list of the possible record definitions that can be used in a message resource.

Messages
Start of the Messages records.

Name = <name>
The name of the Messages resource. The name you specify here will be used to tie this Messages resource to a Job and/or to the daemon.

MailCommand = <command>
In the absence of this resource, Bacula will send all mail using the following command:

mail -s "Bacula Message" <recipients>

In many cases, depending on your machine, this command may not work. Using the MailCommand, you can specify exactly how to send the mail. During the processing of the command, normally specified as a quoted string, the following substitutions will be used:

The following is the command I (Kern) use. Note, the whole command should appear on a single line in the configuration file rather than split as is done here for presentation:

mailcommand = "/home/kern/bacula/bin/bsmtp -h mail.example.com -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"

Note, the bsmtp program is provided as part of Bacula. For additional details, please see the bsmtp -- Customizing Your Email Messages section of the Bacula Utility Programs chapter of this manual. Please test any mailcommand that you use to ensure that your bsmtp gateway accepts the addressing form that you use. Certain programs such as Exim can be very selective as to what forms are permitted particularly in the from part.

OperatorCommand = <command>
This resource specification is similar to the MailCommand except that it is used for Operator messages. The substitutions performed for the MailCommand are also done for this command. Normally, you will set this command to the same value as specified for the MailCommand.

Debug = <debug-level>
This sets the debug message level to the debug level, which is an integer. Higher debug levels cause more debug information to be produced. You are requested not to use this record since it will be deprecated.

<destination> = <message-type1>, <message-type2>, ...

Where destination may be one of the following:

stdout
Send the message to standard output.

stderr
Send the message to standard error.

console
Send the message to the console (Bacula Console). These messages are held until the console program connects to the Director.

<destination> = <address> = <message-type1>, <message-type2>, ...

Where address depends on the destination, which may be one of the following:

director
Send the message to the Director whose name is given in the address field. Note, in the current implementation, the Director Name is ignored, and the message is sent to the Director that started the Job.

file
Send the message to the filename given in the address field. If the file already exists, it will be overwritten.

append
Append the message to the filename given in the address field. If the file already exists, it will be appended to. If the file does not exist, it will be created.

syslog
Send the message to the system log (syslog) using the facility specified in the address field. Note, for the moment, the address field is ignored and the message is always sent to the LOG_ERR facility.

mail
Send the message to the email addresses that are given as a comma separated list in the address field. Mail messages are grouped together during a job and then sent as a single email message when the job terminates. The advantage of this destination is that you are notified about every Job that runs. However, if you backup 5 or 10 machines every night, the volume of email messages can be important. Some users use filter programs such as procmail to automatically file this email based on the Job termination code (see mailcommand).

mail on error
Send the message to the email addresses that are given as a comma separated list in the address field if the Job terminates with an error condition. MailOnError messages are grouped together during a job and then sent as a single email message when the job terminates. This destination differs from the mail destination in that if the Job terminates normally, the message is totally discarded (for this destination). If the Job terminates in error, it is emailed. By using other destinations such as append you can ensure that even if the Job terminates normally, the output information is saved.

operator
Send the message to the email addresses that are specified as a comma separated list in the address field. This is similar to mail above, except that each message is sent as received. Thus there is one email per message. This is most useful for mount messages (see below).

For any destination, the message-type field is a comma separated list of the following types or classes of messages:

info
General information messages.

warning
Warning messages. Generally this is some unusual condition but not expected to be serious.

error
Non-fatal error messages. The job continues running. Any error message should be investigated as it means that something went wrong.

fatal
Fatal error messages. Fatal errors cause the job to terminate.

terminate
Message generated when the daemon shuts down.

saved
Files saved normally.

notsaved
Files not saved because of some error. Usually because the file cannot be accessed (i.e. it does not exist or is not mounted).

skipped
Files that were skipped because of a user supplied option such as an incremental backup or a file that matches an exclusion pattern. This is not considered an error condition such as the files listed for the notsaved type because the configuration file explicitly requests these types of files to be skipped. For example, any unchanged file during an incremental backup, or any subdirectory if the no recursion option is specified.

mount
Volume mount or intervention requests from the Storage daemon. These requests require a specific operator intervention for the job to continue.

restored
The ls style listing generated for each file restored is sent to this message class.

all
All message types.

*security
Security info/warning messages (not currently implemented).

The following is an example of a valid Messages resource definition, where all messages except files explicitly skipped or daemon termination messages are sent by email to enforcement@sec.com. In addition all mount messages are sent to the operator (i.e. emailed to enforcement@sec.com). Finally all messages other than explicitly skipped files and files saved are sent to the console:

Messages {
  Name = Standard
  mail = enforcement@sec.com = all, !skipped, !terminate
  operator = enforcement@sec.com = mount
  console = all, !skipped, !saved
}

With the exception of the email address (changed to avoid junk mail from robot's), Kern's Director's Messages resource is as follows. Note, the mailcommand and operatorcommand are on a single line -- they had to be split for this manual:

Messages {
  Name = Standard
  mailcommand = "bacula/bin/bsmtp -h mail.example.com \
    -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
  operatorcommand = "bacula/bin/bsmtp -h mail.example.com \
    -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed \
        for %j\" %r"
  MailOnError = security@example.com = all, !skipped, \
                !terminate
  append = "bacula/bin/log" = all, !skipped, !terminate
  operator = security@example.com = mount
  console = all, !skipped, !saved
}


Console Konfiguration

Allgemein

Die Console-Konfigurations-Datei ist die einfachste Konfigurations-Datei von allen. Normalerweise müßen Sie in dieser Datei nicht außer dem Passwort ändern. Diese Datei enthält alle Informationen die nötig sind, damit sich das Console-Programm zu dem Director-Dienst verbinden kann und darf.

Für eine allgemeine Übersicht der Syntax der Konfigurations-Dateien, sowie der verschiedenen Einträge, einschließlich der Datentypen, sehen Sie sich bitte das Kapitel Konfiguration an.

Die folgenden Console-Konfigurations-Parameter müssen definiert werden:


Der Director-Eintrag

Der Director-Eintrag enthält die notwendigen Parameter, um über das Console-Programm Zugriff auf den Director-Dienst zu haben. Sie können mehrere Director-Dienste in dieser Datei angeben, in dem Fall werden Sie beim starten der Console gefragt, zu welchem Director-Dienst Sie sich verbinden wollen.

Director
Beginn des Director-Eintrags.

Name = <name>
Der Name des Directors, wird nur zur Unterscheidung benutzt, wenn Sie mehrere Director-Dienste konfiguriert haben.

DIRPort = <port-number>
gibt den Port an, auf dem der Director-Dienst läuft. Wenn Sie die ./configure Option --with-base-port angegeben haben, wird dieser Wert schon entsprechend gesetzt sein. Der Port muß mit dem in der Director-Konfiguration angegebenen DIRport identisch sein. Standardmäßig wird der Port 9101 verwendet, so dass dieser Parameter normalerweise nicht gesetzt ist.

Address = <address>
die Adresse ist ein Rechnername, eine absolute Adresse (FQDN) oder die IP-Adresse auf der der Director-Dienst läuft.

Password = <password>
das Passwort, dass benutzt wird um die Console beim Director-Dienst zu autorisieren. Das Passwort muss mit dem in der Director-Konfiguration gesetzten Passwort identisch sein.

Ein Beispiel eines Director-Eintrags in der Console-Konfigurations-Datei:

Director {
  Name = HeadMan
  address = rufus.cats.com
  password = xyz1erploit
}

Der ConsoleFont-Eintrag

Der ConsoleFont-Konfigurations-Eintrag ist nur in der GNOME-Version des Console-Programms verfügbar. Er erlaubt Ihnen, die im Hauptfenster verwendete Schriftart auszuwählen.

ConsoleFont
Beginn des ConsoleFont-Eintrags.

Name = <name>
Der Name des ConsoleFont-Eintrags.

Font = <Pango Font Name>
Dieser Wert gibt den Namen der Schriftart im Pango-Format an. Ein Beispiel:

Font = "LucidaTypewriter 9"

Vielen Dank an Phil Stracchino der diese Funktion in Bacula implementiert hat.

Hier noch ein zweites Beispiel:

ConsoleFont {
  Name = Default
  Font = "Monospace 10"
}


Der Console-Eintrag

Seit der Bacula-Version 1.33 gibt es drei verschiedene Console-Typen, die der Administrator oder Benutzer zur Verwaltung des Director-Dienstes verwenden kann. Diese drei verschiedenen Typen umfassen drei unterschiedliche Sicherheitslevel.

Der Consolen-Konfigurations-Eintrag ist optional, wenn er angegeben wird, haben Sie allerdings die Möglichkeit, Zugriffskontrolllisten anzulegen, um die entsprechende Console in ihren Rechten einzuschränken. Damit können Sie z.B. dem Benutzer nur Zugriff auf die Backup-Jobs seines Clients erlauben.

Sie können beliebig viele Console-Einträge in Ihrer Consolen-Konfiguration anlegen. Im allgemeinen wird dann immer der erste Eintrag verwendet. Wenn Sie allerdings mehrere Director-Dienste, mit entsprechenden Einträgen in Ihrer Consolen-Konfiguration, haben, müssen Sie beim starten der Console einen der Director-Dienste auswählen. Lesen Sie bitte auch die Beschreibung des "Director"-Parameters in der Console-Konfiguration, der weiter unten beschrieben wird.

Console
Beginn des Console-Eintrags.

Name = <name>
Der Name der Console. Er wird benutzt um dieser Console in der Director-Konfiguration eine Zugriffskontrollliste zuzuweisen.

Password = <password>
Wenn Sie hier ein Passwort angegeben, wird das Passwort aus dem Director-Eintrag ignoriert. Weiter unten finden Sie dazu Details.

Director = <director-resource-name>
Falls dieser Parameter angegeben wird, kann dieser Consolen-Eintrag über ein Auswahlmenü beim ersten starten der Console selektiert werden. Er bestimmt dann, mit welchen Namen und Passwort sich das Console-Programm bei welchen Director-Dienst anmeldet.

Heartbeat Interval = <time-interval>
Dieser Parameter ist optional. Falls Sie ihn angeben, wird im Abstand des konfigurierten Intervalls (in Sekunden) ein keepalive zum Director-Dienst geschickt. Es ist nur auf Betriebssystemen implementiert, die die setsockopt TCP_KEEPIDLE unterstützen (Linux, ...). Der Standardwert ist null, d.h. es werden keine keepalives gesendet.

Ein Beispiel, wenn Sie folgendes in Ihrer Consolen-Konfigurations-Datei, bconsole.conf oder bwx-console.conf, definieren:

Director {
   Name = MyDirector
   DIRport = 9101
   Address = myserver
   Password = "XXXXXXXXXXX"    # das dient hier nicht der Unkenntlichmachung.
}

 
Console {
   Name = restricted-user
   Password = "UntrustedUser"
}

wobei das Passwort im Director-Konfigurations-Eintrag bewußt falsch gesetzt ist und der Consolen-Eintrag einen Name besitzt, hier restricted-user. Danach erstellen Sie in der Konfiguration des Director-Dienstes, auf die der Benutzer keinen Zugriff hat, folgende Consolen:

Console {
  Name = restricted-user
  Password = "UntrustedUser"
  JobACL = "Restricted Client Save"
  ClientACL = restricted-client
  StorageACL = main-storage
  ScheduleACL = *all*
  PoolACL = *all*
  FileSetACL = "Restricted Client's FileSet"
  CatalogACL = DefaultCatalog
  CommandACL = run
}

dann wird der Benutzer beim Anmelden an den Director-Dienst als restricted-user angemeldet. Der Benutzer wird nur Zugriff auf Jobs mit dem Namen Restricted Client Save, auf den Client restricted-client, auf den Storage main-storage, auf jeden Zeitplan (Schedule) und auf jeden Pool, ein FileSet namens Restricted Client's FileSet, den Katalog DefaultCatalog, sowie einzig und allein das Kommando run haben. Mit anderen Worten, dieser Benutzer ist sehr eingeschränkt in dem, was er mit der Console sehen und tun kann.

Das folgende Beispiel zeigt eine bconsole.conf-Datei, in der mehrere Director-Dienste, sowie verschiedene Consolen-Einträge, abhängig vom Director, zu sehen sind:

Director {
   Name = MyDirector
   DIRport = 9101
   Address = myserver
   Password = "XXXXXXXXXXX"    # das dient hier nicht der Unkenntlichmachung.
}

Director {
   Name = SecondDirector
   DIRport = 9101
   Address = secondserver
   Password = "XXXXXXXXXXX"    # das dient hier nicht der Unkenntlichmachung.
}

Console {
   Name = restricted-user
   Password = "UntrustedUser"
   Director = MyDirector
}

Console {
   Name = restricted-user
   Password = "A different UntrustedUser"
   Director = SecondDirector
}

Der zweite Director-Dienst, benannt als "secondserver", könnte diese Konfiguration besitzen:

Console {
  Name = restricted-user
  Password = "A different UntrustedUser"
  JobACL = "Restricted Client Save"
  ClientACL = restricted-client
  StorageACL = second-storage
  ScheduleACL = *all*
  PoolACL = *all*
  FileSetACL = "Restricted Client's FileSet"might
  CatalogACL = RestrictedCatalog
  CommandACL = run, restore
  WhereACL = "/"
}

Im Unterschied zum ersten Director-Dienst, darf der Benutzer hier, neben einem anderem Storage, auch das Consolen-Kommando restore ausführen (wobei er als Where allerdings nur "/" angeben darf).

Console-Kommandos

Für mehr Details zum arbeiten mit der Console und ihrer Kommandos, lesen Sie bitte das Kapitel Bacula Console in diesem Handbuch.


Beispiel Console-Konfigurations-Datei

Dies könnte ein Beispiel für eine Console-Konfigurations-Datei sein:

#
# Bacula Console Configuration File
#
Director {
  Name = HeadMan
  address = "my_machine.my_domain.com"
  Password = Console_password
}


Monitor Configuration

General

The Monitor configuration file is a stripped down version of the Director configuration file, mixed with a Console configuration file. It simply contains the information necessary to contact Directors, Clients, and Storage daemons you want to monitor.

For a general discussion of configuration file and resources including the data types recognized by Bacula, please see the Configuration chapter of this manual.

The following Monitor Resource definition must be defined:


The Monitor Resource

The Monitor resource defines the attributes of the Monitor running on the network. The parameters you define here must be configured as a Director resource in Clients and Storages configuration files, and as a Console resource in Directors configuration files.

Monitor
Start of the Monitor records.

Name = <name>
Specify the Director name used to connect to Client and Storage, and the Console name used to connect to Director. This record is required.

Password = <password>
Where the password is the password needed for Directors to accept the Console connection. This password must be identical to the Password specified in the Console resource of the Director's configuration file. This record is required if you wish to monitor Directors.

Refresh Interval = <time>
Specifies the time to wait between status requests to each daemon. It can't be set to less than 1 second, or more than 10 minutes, and the default value is 5 seconds.


The Director Resource

The Director resource defines the attributes of the Directors that are monitored by this Monitor.

As you are not permitted to define a Password in this resource, to avoid obtaining full Director privileges, you must create a Console resource in the Director's configuration file, using the Console Name and Password defined in the Monitor resource. To avoid security problems, you should configure this Console resource to allow access to no other daemons, and permit the use of only two commands: status and .status (see below for an example).

You may have multiple Director resource specifications in a single Monitor configuration file.

Director
Start of the Director records.

Name = <name>
The Director name used to identify the Director in the list of monitored daemons. It is not required to be the same as the one defined in the Director's configuration file. This record is required.

DIRPort = <port-number>
Specify the port to use to connect to the Director. This value will most likely already be set to the value you specified on the --with-base-port option of the ./configure command. This port must be identical to the DIRport specified in the Director resource of the Director's configuration file. The default is 9101 so this record is not normally specified.

Address = <address>
Where the address is a host name, a fully qualified domain name, or a network address used to connect to the Director. This record is required.


The Client Resource

The Client resource defines the attributes of the Clients that are monitored by this Monitor.

You must create a Director resource in the Client's configuration file, using the Director Name defined in the Monitor resource. To avoid security problems, you should set the Monitor directive to Yes in this Director resource.

You may have multiple Director resource specifications in a single Monitor configuration file.

Client (or FileDaemon)
Start of the Client records.

Name = <name>
The Client name used to identify the Director in the list of monitored daemons. It is not required to be the same as the one defined in the Client's configuration file. This record is required.

Address = <address>
Where the address is a host name, a fully qualified domain name, or a network address in dotted quad notation for a Bacula File daemon. This record is required.

FD Port = <port-number>
Where the port is a port number at which the Bacula File daemon can be contacted. The default is 9102.

Password = <password>
This is the password to be used when establishing a connection with the File services, so the Client configuration file on the machine to be backed up must have the same password defined for this Director. This record is required.


The Storage Resource

The Storage resource defines the attributes of the Storages that are monitored by this Monitor.

You must create a Director resource in the Storage's configuration file, using the Director Name defined in the Monitor resource. To avoid security problems, you should set the Monitor directive to Yes in this Director resource.

You may have multiple Director resource specifications in a single Monitor configuration file.

Storage
Start of the Storage records.

Name = <name>
The Storage name used to identify the Director in the list of monitored daemons. It is not required to be the same as the one defined in the Storage's configuration file. This record is required.

Address = <address>
Where the address is a host name, a fully qualified domain name, or a network address in dotted quad notation for a Bacula Storage daemon. This record is required.

SD Port = <port>
Where port is the port to use to contact the storage daemon for information and to start jobs. This same port number must appear in the Storage resource of the Storage daemon's configuration file. The default is 9103.

Password = <password>
This is the password to be used when establishing a connection with the Storage services. This same password also must appear in the Director resource of the Storage daemon's configuration file. This record is required.

Tray Monitor Security

There is no security problem in relaxing the permissions on tray-monitor.conf as long as FD, SD and DIR are configured properly, so the passwords contained in this file only gives access to the status of the daemons. It could be a security problem if you consider the status information as potentially dangereous (I don't think it is the case).

Concerning Director's configuration:
In tray-monitor.conf, the password in the Monitor resource must point to a restricted console in bacula-dir.conf (see the documentation). So, if you use this password with bconsole, you'll only have access to the status of the director (commands status and .status). It could be a security problem if there is a bug in the ACL code of the director.

Concerning File and Storage Daemons' configuration:
In tray-monitor.conf, the Name in the Monitor resource must point to a Director resource in bacula-fd/sd.conf, with the Monitor directive set to Yes (once again, see the documentation). It could be a security problem if there is a bug in the code which check if a command is valid for a Monitor (this is very unlikely as the code is pretty simple).


Sample Tray Monitor configuration

An example Tray Monitor configuration file might be the following:

#
# Bacula Tray Monitor Configuration File
#
Monitor {
  Name = rufus-mon        # password for Directors
  Password = "GN0uRo7PTUmlMbqrJ2Gr1p0fk0HQJTxwnFyE4WSST3MWZseR"
  RefreshInterval = 10 seconds
}
   
Client {
  Name = rufus-fd
  Address = rufus
  FDPort = 9102           # password for FileDaemon
  Password = "FYpq4yyI1y562EMS35bA0J0QC0M2L3t5cZObxT3XQxgxppTn"
}
Storage {
  Name = rufus-sd
  Address = rufus
  SDPort = 9103           # password for StorageDaemon
  Password = "9usxgc307dMbe7jbD16v0PXlhD64UVasIDD0DH2WAujcDsc6"
}
Director {
  Name = rufus-dir
  DIRport = 9101
  address = rufus
}

Sample File daemon's Director record.

Click here to see the full example.

#
# Restricted Director, used by tray-monitor to get the
#   status of the file daemon
#
Director {
  Name = rufus-mon
  Password = "FYpq4yyI1y562EMS35bA0J0QC0M2L3t5cZObxT3XQxgxppTn"
  Monitor = yes
}

Sample Storage daemon's Director record.

Click here to see the full example.

#
# Restricted Director, used by tray-monitor to get the
#   status of the storage daemon
#
Director {
  Name = rufus-mon
  Password = "9usxgc307dMbe7jbD16v0PXlhD64UVasIDD0DH2WAujcDsc6"
  Monitor = yes
}

Sample Director's Console record.

Click here to see the full example.

#
# Restricted console used by tray-monitor to get the status of the director
#
Console {
  Name = Monitor
  Password = "GN0uRo7PTUmlMbqrJ2Gr1p0fk0HQJTxwnFyE4WSST3MWZseR"
  CommandACL = status, .status
}


Bacula Console

Die Bacula Console (manchmal auch das BenutzerInterface genannt) ist ein Programm, dass es dem Anwender oder System Aministrator erlaub, den Bacula-Director-Dienst im laufenden Betrieb zu kontrollieren.

Momentan gibt es zwei Versionen des Console-Programms: eine Shell- (TTY) und eine GNOME GUI-Version. Beide erlauben es dem Administrator oder autorisierten Benutzern Bacula zu steuern. Sie können sich den Status eines bestimmten Jobs bzw. den Inhalt des Katalogs anzeigen lassen, oder bestimmte Aktionen mit Tapes und Autochangern durchführen.

Zusätzlich gibt es noch die bwx-Console, die auf wxWidgets aufbaut, und eine Möglichkeit bietet, den Wiederherstellungsprozeß graphisch zu steuern. Die bwx-Console befindet sich in einem frühen Entwicklungsstadium und wurde leider seit einiger Zeit nicht weiterentwickelt. (Trotzdem kann sie sehr hilfreich sein.)

Da sich alle Bacula-Consolen über das Netzwerk mit dem Director-Dienst verbinden, ist es nicht notwendig sie auf dem selben Computer laufen zu lassen.

Ein gewisses, minimales Grundwissen über die Console ist schon dann notwendig, wenn Bacula auf mehr als einem Tape schreiben soll. Bacula wird nämlich nach einem leeren Band fragen, falls keines mehr verfügbar ist, und erst nach dem mounten eines neuen Tapes mittels der Console, wird Bacula weiterarbeiten können.

Console Konfiguration

Wenn Sie die Bacula-Console starten, liest sie ihre Standard-Konfigurations-Datei namens bconsole.conf, bzw. bgnome-console.conf für die GNOME-Console, ein. Im einfachsten Fall enthällt diese Datei nur den Namen und die Adresse des Director-Dienstes sowie das Passwort, dass für die Verbindung zum Director-Dienst benötigt wird. Für weitere Informationen zu dieser Datei, lesen Sie bitte das Kapitel über die Console-Konfiguration-Datei in diesem Handbuch.

Benutzung des Console-Programms

Das Console-Programm kann mit den folgenden Optionen gestartet werden:

Usage: bconsole [-s] [-c Konfigurations-Datei] [-d Debug-Level]
       -c <Datei>  gibt die zu verwendene Konfigurations-Datei an
       -dnn        setzt den Debug-Lavel auf nn
       -n          kein conio
       -s          keine Signale (*)
       -t          test - list die Konfigurations-Datei und beendet sich dann
       -?          gibt diese Hilfe aus.

(*) Signale

Nach dem Start des Console-Programms zeigt es durch sein Prompt (*) an, dass es auf Benutzereingaben wartet. (in der GNOME-Console gibt es kein Prompt, geben Sie die Befehle bitte einfach in der Textbox unten im Fenster ein.) Sie können in jeder Console einfach nur das Kommando eingeben, wenn weitere Parameter erforderlich sind, wird das Programm Sie danach fragen. Alternativ können Sie natürlich auch das komplette Kommando mit allen benötigten Parametern eingeben und ausführen. Das normale Befehlsformat ist dieses:

 <Kommando> <Parameter1>[=<Argument1>] <Parameter2>[=<Argument2>] ...

wobei Kommando einer der unten aufgeführten Console-Befehle und Parameter eines der unten aufgelisteten Schlüsselwörter ist, dem dann meistens ein Argument folgt. Alle Befehle können in der kürzesten eindeutigen Form eingegeben werden. Falls zwei Befehle mit identischen Buchstaben anfangen, wird der ausgeführt, der in der Ausgabe des help-Kommandos am weitesten oben steht. Wenn Sie das andere Kommando ausführen möchten müssen Sie dementsprechend mehr Buchstaben eingeben, um es eindeutig anzugeben. Keiner der Parameter darf abgekürzt werden.

Ein Beispiel:

list files jobid=23

zeigt alle gesicherten Dateien mit der JobID 23 an.

show pools

zeigt alle Pool-Konfigurations-Einträge an.

Die maximale Länge der eingegebenen Befehle, mit Parametern, ist 511 Zeichen. Falls Sie die Console über ein Script ansprechen, denken Sie bitte daran, dass Sie dieses Limit nicht überschreiten.

Beenden des Console-Programs

Normalerweise beenden Sie das Console-Programm durch die Eingabe von quit oder exit. Allerdings wartet die Console bis der Director-Dienst das Kommando bestätigt. Wenn der Director bereits ein länger laufendes Kommando ausführt, kann es sein, dass das Beenden der Console einen Moment dauert. Falls Sie die Console sofort verlassen wollen, können Sie in dem Fall das Kommando .quit verwenden.

Momentan gibt es keinen Weg ein laufendes Kommando nach dem Starten abzubrechen (z.B. mit STRG+C). Allerdings können Sie jederzeit, wenn die Console Sie nach einer weiteren Eingabe fragt, das aktuelle Kommmando beenden, indem Sie einen Punkt . eingeben. Nach der Eingabe des Punktes, werden Sie automatisch zum Hauptprompt oder bei verschachtelten Abfragen zum passenden letzten Prompt zurückgeleitet. Bei einigen Eingaben, wie zum Beispiel der Frage nach einem Volume-Namen, wird der Punkt als Eingabe gewertet und Sie haben beim nächsten Prompt die Möglichkeit, das Kommando abzubrechen.

Alphabetische Liste der Console-Schlüsselwörter

Wenn es nicht anders angegeben ist, benötigt jedes der folgenden Schlüsselwörter (Parameter der Console-Befehle) ein Argument, welches dem Schlüsselwort, getrennt durch ein Gleichheitszeichen, folgt. Ein Beispiel:
jobid=536

Bitte beachten Sie, dass diese Liste durch die ständig weitergehende Entwicklung eventuell weder komplett, noch in der Richtigen alphabetischen Reihenfolge sein kann.

restart
Parameter des python-Kommandos, dadurch wird der python-Interpreter neu gestartet. Benötigt keine Argumente.
all
Parameter des status und show-Kommandos, dadurch werden alle Komponenten oder Einträge ausgewählt
allfrompool
Parameter des update-Kommandos, gibt an das alle Volumes des (im Parameter pool angegebenen) Pools aktualisiert werden sollen.
allfrompools
Parameter des update-Kommandos, gibt an das alle Volumes aller Pools aktualisiert werden sollen.
before
Parameter des restore-Kommandos.
bootstrap
Parameter des restore-Kommandos.
catalog
im use-Kommando erlaubt, um den zu benutzenden Katalog auszuwählen
catalogs
Parameter des show-Kommandos. Benötigt keine Argumente.
client | fd
clients
Parameter des show, list und llist-Kommandos, bezeichnet alle Clients. Benötigt keine Argumente.
counters
im show-Kommando erlaubt. Benötigt keine Argumente.
current
Parameter des restore-Kommandos. Benötigt keine Argumente.
days
definiert die Anzahl der Tage, die das "list nextvol"-Kommando in Betracht ziehen soll. Der Parameter days kann auch im Kommando "status director" verwendet werden, um die geplanten Jobs für die angegebene Anzahl Tage zu zeigen.
devices
Parameter des show-Kommandos. Benötigt keine Argumente.
dir | director
directors
Parameter des show-Kommandos. Benötigt keine Argumente.
directory
Parameter des restore-Kommandos. Das Argument gibt das wiederherzustellende Verzeichnis an.
enabled
Dieser Parameter kann bei den Kommandos "update volumes" und "update slots" verwendet werden. Das Argument kann yes, true, no, false, archived, 0,1 oder 2 sein. 0 ist identisch mit no oder false, 1 mit yes oder true und 2 mit archived. Archived Volumes werden weder benutzt noch automatisch aus dem Katalog gelöscht. Volumes die nicht enabled sind, werden nicht für das Backup oder die Wiederherstellung benutzt.
done
wird im restore-Kommando benutzt. Benötigt keine Argumente.
file
Parameter des restore-Kommandos.
files
Parameter des list und llist-Kommandos. Benötigt keine Argumente.
fileset
filesets
Parameter des show-Kommandos. Benötigt keine Argumente.
help
Parameter des show-Kommandos. Benötigt keine Argumente.
jobs
Parameter des show, list und llist-Kommandos. Benötigt keine Argumente.
jobmedia
Parameter des list und llist-Kommandos. Benötigt keine Argumente.
jobtotals
Parameter des list und llist-Kommandos. Benötigt keine Argumente.
jobid
Parameter des list und llist-Kommandos. Die jobid ist die numerische Jobid, die im Job-Report angezeigt wird. Sie ist der Index für die Datenbankeinträge des entsprechenden Jobs. Da sie für alle in der Datenbank existierenden Jobs einzigartig ist, kann sie erst wiederverwendet werden, wenn der vorherige Job mit dieser Jobid aus der Datenbank gelöscht wurde.
job | jobname
Parameter des list und llist-Kommandos. Der Job oder JobName entspricht dem Namen den Sie im Job-Einträg angegeben haben, somit bezieht er sich auf alle Jobs dieses Namens, die jemals gelaufen sind und deren Einträge noch im Katalog existieren.
level
listing
Parameter des estimate-Kommandos. Benötigt keine Argumente.
limit
messages
Parameter des show-Kommandos. Benötigt keine Argumente.
media
Parameter des list und llist-Kommandos. Benötigt keine Argumente.
nextvol | nextvolume
Parameter des list und llist-Kommandos. Benötigt keine Argumente.
on
Benötigt keine Argumente.
off
Benötigt keine Argumente.
pool
pools
Parameter des show, list und llist-Kommandos. Benötigt keine Argumente.
select
Parameter des restore-Kommandos. Benötigt keine Argumente.
storages
Parameter des show-Kommandos. Benötigt keine Argumente.
schedules
Parameter des show-Kommandos. Benötigt keine Argumente.
sd | store | storage
ujobid
Parameter des list-Kommandos. Die ujobid ist eine Möglichkeit einen Job eindeutig zu identifizieren. Momentan besteht die ujobid aus dem JobNamen und der Uhrzeit wann der Job gelaufen ist.
volume
volumes
Parameter des list und llist-Kommandos. Benötigt keine Argumente.
where
Parameter des restore-Kommandos.
yes
Parameter des restore-Kommandos. Benötigt keine Argumente.

Alphabetische Liste der Console-Kommandos

Die folgenden Kommandos sind derzeit verfügbar:

add [pool=<pool-name> storage=<storage> jobid=<JobId>]
Das add-Kommando wird benutzt um Volumes zu einem bestehenden Pool hinzuzufügen. Dazu wird der Volume-Eintrag in der Datenbank erzeugt und das Volume dem Pool zugeordnet. Dabei erfolgt kein physikalischer Zugriff auf das Volume. Nach dem hinzufügen zu einem Pool, geht Bacula davon aus, dass das Volume wirklich existiert und auch bereits gelabelt ist. Dises Kommando wird normalerweise nicht benutzt, da Bacula die Volumes automatisch beim labeln einem Pool hinzufügt. Allerdings ist es hilfreich, falls Sie ein Volume aus dem Katalog gelöscht haben und es später wieder hinzufügen wollen.

Typischerweise wird das label-Kommando anstelle des add-Kommandos benutzt, da es außer dem labeln des physikalischen Volumes, die identischen Schritte wie das add-Kommando ausführt. Das add-Kommando ändert nur die Katalog-Einträge und nicht die physikalischen Volumes. Die physikalischen Volumes müssen vorhanden und gelabelt sein (normalerweise mit dem label-Kommando). Trotzdem kann das add-Kommando sinnvoll sein, wenn Sie zum Beispiel eine bestimmte Anzahl von Volumes einem Pool hinzufügen wollen, wobei die Volumes erst zu einem späteren Zeitpunkt gelabelt werden. Auch um ein Volume eines anderen Bacula-Systems (bzw. anderen Director-Dienstes) zu importieren, kann das add-Kommando benutzt werden. Die erlaubten Zeichen für einen Volume-Namen finden Sie weiter unten in der Beschreibung des label-Kommandos.

autodisplay on/off
Das autodisplay-Kommando kennt zwei Parameter: on und off, wodurch die automatische Anzeige von Nachrichten in der Console entsprechend ein- oder ausgeschaltet wird. Der Standardwert ist off, was bedeutet, dass Sie über neue Meldungen benachrichtigt werden, sie aber nicht automatisch angezeigt werden. In der GNOME-Console ist das automatische Anzeigen dagegen standardmäßig aktiviert, d.h. neue Meldungen werden automatisch ausgegeben, wenn sie vom Director-Dienst empfangen wurden (typischerweise innerhalb von ca. 5 Sekunden nachdem sie generiert wurden).

Wenn autodisplay auf off steht, müssen Sie neu Nachrichten mit dem messages-Kommando abrufen, um sie sich anzeigen zu lassen. Wenn autodiplay auf on steht, werden die Nachrichten angezeigt, sobald die Console sie empfangen hat.

automount on/off
Das automount-Kommando kennt zwei Parameter: on und off, die entsprechend das automatische mounten nach dem labeln (label-Kommando) an- oder ausschalten. Der Standardwert ist on. Wenn automount ausgeschaltet ist, müssen Sie nach dem labeln eines Volumes dieses explizit mounten (mount-Kommando), um es benutzen zu können.

cancel [jobid=<number> job=<job-name> ujobid=<unique-jobid>]
Das cancel-Kommande wird benutzt um einen Job abzubrechen und kennt die Parameter jobid=nnn or job=xxx, wober jobid die numerische JobID ist und job der Job-Name. Wenn Sie weder job noch jobid angeben, listet die Console alle in Frage kommenden Jobs auf und erlaubt Ihnen aus dieser Liste den abzubrechenden Job auszuwählen.

Wenn ein Job als abzubrechen gekennzeichnet wurde, kann es einige Zeit dauern, bis er tatsächlich beendet wird (normalerweise innerhalb einer Minute). Dise Zeit ist aber abhängig davon, was der Job gerade tut.

create [pool=<pool-name>]
Das create-Kommando wird normalerweise nicht benutzt, da die Pool-Einträge im Katalog automatisch angelegt werden, wenn der Director-Dienst startet und er seine Pool-Konfiguration aus den Konfigurations-Dateien einliest. Falls benötigt, kann mit diesem Kommando ein Pool-Eintrag in der Katalog-Datenbank erstellt werden, der auf einem Pool-Konfigurations-Eintrag basiert, der in der Director-Dienst-Konfiguration enthalten ist. Einfach gesagt übernimmt dieses Kommando nur den Pool-Eintrag aus der Konfiguration in die Datenbank. Normalerweise wird diese Kommando automatisch ausgeführt, wenn der Pool zum ersten mal in einem Job-Eintrag benutzt wird. Wenn Sie dieses Kommando auf einem bestehenden Pool ausführen, wird der Katalog sofort aktualisiert und enthält dann die identische Pool-Konfiguration, wie die Konfigurations-Dateien. Nach dem Erstellen eines Pool in den Konfigurations-Dateien werden Sie allerdings höchstwahrscheinlich das label-Kommando benutzen, um ein oder mehrere Volumes dem neuen Pool hinzuzufügen und die entsprechenden Einträge im Katalog zu erzeugen, anstatt des create-Kommandos.

Wenn ein Job gestartet wird und Bacula bemerkt, dass keine passender Pool-Eintrag im Katalog ist aber in den Konfigurations-Dateien, dann wird der Pool im Katalog automatisch angelegt. Wenn Sie möchten, dass der Pool-Eintrag sofort (ohne das ein Job mit diesem Pool gestartet wurde) im Katalog erscheint, können Sie einfach diese Kommando ausführen, um diesen Vorgang zu erzwingen.

delete [volume=<vol-name> pool=<pool-name> job jobid=<id>]
Das delete-Kommando wird benutzt um ein Volume, einen Pool oder einen Job-Eintrag, sowie jeweils alle dazugehörigen Datenbank-Einträge, aus dem Katalog zu entfernen. Das Kommando ändert nur die Katalog-Datenbank, es hat keine Auswirkungen auf die Konfigurations-Dateien oder die Daten auf den Volumes. Wir empfehlen Ihnen dieses Kommando nur zu benutzen, wenn Sie wirklich wissen was Sie tun.

Wenn der Parameter Volume angegeben wird, wird das entsprechende Volume aus dem Katalog gelöscht, wenn ein Pool angeben wird, der entsprechende Pool und bei Angabe des Parameters Job der entsprechende Job, sowie alle zu diesem Job gehöhrenden JobMedia- und Datei-Einträge. Das delete-Kommando kann folgendermaßen aufgerufen werden:

delete pool=<pool-name>  oder

delete volume=>volume-name> pool=>pool-name>  oder

delete JobId=>job-id> JobId=>job-id2> ...  oder

delete Job JobId=n,m,o-r,t ...

Das erste Beispiel löscht einen Pool-Eintrag aus der Katalog-Datenbank. Das zweite löscht einen Volume-Eintrag aus dem angegebenen Pool und das dritte Beispiel löscht die genannten JobID-Einträge aus dem Katalog. Es werden die JobIDs n, m, o, p, q, r und t gelöscht, wobei die JobID's n, m, o ... natürlich Zahlen entsprechen müssen. Wie Sie sehen kann das delete-Kommando Listen von JobIDs und auch Bereiche (z.B. o-r) verarbeiten.

disable job<job-name>
Das disable-Kommando erlaubt es Ihnen, zu verhindern das ein Job automatisch durch den Director-Dienst ausgeführt wird. Wenn Sie den Director-Dienst neu starten, wird der Status des Jobs wieder auf den Wert gesetzt, der im Job-Eintrag der Director-Konfiguration eingetragen ist.

enable job<job-name>
Das enable-Kommando erlaubt es Ihnen, einen Job der durch das disable-Kommando aus der automatischen Job-Planung entfernt wurde, wieder zu aktivieren. Wenn Sie den Director-Dienst neu starten, wird der Status des Jobs wieder auf den Wert gesetzt, der im Job-Eintrag der Director-Konfiguration eingetragen ist.

estimate
Mit dem estimate-Kommando können Sie sich anzeigen lassen, welche Dateien durch einen bestimmten Job gesichert werden, ohne diesen Job ausführen zu müssen. Standardmäßig wird dabei ein Voll-Backup angenommen. Sie können das aber durch den Parameter level entsprechend anpassen, indem Sie zum Beispiel level=Incremental oder level=Differential an das estimate-Kommando mit übergeben. Wenn Sie im Aufruf des Kommandos keinen Job-Name angegeben, wird die Console Ihnen ein Auswahlliste der möglichen Jobs anzeigen. Zusätzlich können Sie noch die Parameter Client und FileSet angeben. Nach dem Starten des Kommandos wird der Director-Dienst den Client kontaktieren der daraufhin eine Liste der zu sichernden Dateien mit ihrer Größe zurückgibt. Bitte beachten Sie, dass das estimate-Kommando nur die Anzahl der von der Datei belegten Blöcke zur Bestimmung der Dateigröße einbezieht, so dass die Datenmenge die das estimate-Kommando anzeigt immer etwas größer sein wird, als das echte Backup.

Wahlweise können Sie noch den Parameter listing mit übergeben, dann wird eine Liste aller zu sichernden Dateien ausgegeben. Abhängig vom FileSet kann diese Liste sehr lang sein und es daher einige Zeit dauern, alle Dateien anzuzeigen. Das estimate-Kommando kann folgendermaßen aufgerufen werden:

estimate job=<job-name> listing client=<client-name> 
       fileset=<fileset-name> level=<level-name>

die Angabe des Jobs ist ausreichend, aber Sie können durch Angabe des Clients, FileSets und/oder des Backup-Levels die entsprechenden Werte überschreiben.

Zum Beispiel können Sie folgendes eingeben:

     @output /tmp/listing
     estimate job=NightlySave listing level=Incremental
     @output

durch das erste Kommando wird die Ausgabe der Console in die Datei /tmp/listing umgeleitet. Dann wird durch das estimate-Kommando eine Liste aller Dateien erstellt, die beim nächsten inkrementellen Backup des Jobs NightlySave gesichert werden. Die Console gibt dabei keine Meldungen aus, da die Ausgabe ja auf die Datei /tmp/listing zeigt. Durch das dritte Kommando @output wird die Umleitung der Ausgabe wieder aufgehoben. Beachten Sie bitte, dass die angezeigten Bytes in der Ausgabe des estimate-Kommandos über die Angabe der Dateigröße im Verzeichnis-Eintrag bestimmt wird. Das kann zu großen Abweichungen bei der ermittelten Backup-Größe führen, falls im FileSet sparse-Dateien vorhanden sind. sparse-Dateien finden sich oft auf 64-Bit-Maschinen, wo sie für bestimmte Systemdateien benutzt werden. Die angezeigten Bytes sind die Gesammtgröße der gesicherten Dateien, wenn die FileSet-Option "sparse" nicht gesetzt ist. Momentan gibt es keinen Weg, um mit dem estimate-Kommando die echte Backup-Größe für ein FileSet anzuzeigen, bei dem die sparse-Option gesetzt ist.

help
Das help-Kommando zeigt alle verfügbaren Kommandos mit einer kurzen Beschreibung an.

label
Das label-Kommando wird benutzt um physikalische Volumes zu labeln. Das label-Kommando kann folgendermaßen aufgerufen werden:

label storage=>storage-name> volume=>volume-name> slot=>slot>

Wenn Sie einen der Parameter storage, volume oder slot nicht angeben, werden Sie von der Console danach gefragt. Der Media-Typ wird automatisch anhand des Storage-Eintrags in der Director-Konfiguration gesetzt. Wenn alle benötigten Informationen vorliegen, kontaktiert die Console den angegebenen Storage-Dienst und sendet das label-Kommando. Wenn das labeln erfolgreich war, wird ein entsprechender Volume-Eintrag im passenden Pool erzeugt.

Im Volume-Name dürfen Buchstaben, Zahlen und folgende Sonderzeichen verwendet werden: Binde- (-) und Unterstrich (_), Doppelpunkt (:) und Punkt (.). Alle anderen Zeichen, einschließlich des Leerzeichens, sind nicht erlaubt. Durch diese Einschränkung soll sichergestellt werden, dass die Volume-Namen gut lesbar sind und es nicht zu Benutzerfehlern aufgrund von Sonderzeichen im Namen kommt.

Bitte beachten Sie, dass Bacula einen Ein-/Ausgabefehler meldet, wenn ein neues bzw. komplett leeres Volume gelabelt wird. Bacula versucht den ersten Block des Volumes zu lesen, um ein eventuell schon vorhandenes label nicht zu überschreiben, dieser Versuch erzeugt den oben genannten Fehler. Um diesen Fehler zu vermeiden, können Sie mit den folgenden Shell-Kommandos ein EOF am den Anfang des Volumes schreiben:

       mt rewind
       mt weof

Das label-Kommando kann aufgrund verschiedener Gründe fehlschlagen:

  1. Der angegebene Volume-Name existiert schon in der Katalog-Datenbank

  2. Der Storage-Dienst hat schon ein Tape oder anderes Volume in dem benötigten Gerät gemountet. In diesem Fall müssen Sie das Gerät erst mit dem unmount-Kommando freigeben und dann ein leeres Volume zum labeln einlegen.

  3. Das Volume ist bereits gelabelt. Bacula wird niemals ein bestehendes label überschreiben, solange das Volume nicht abgelaufen ist und Sie das relabel-Kommando verwenden.

  4. Es ist kein Volume im Gerät.

Es gibt zwei Möglichkeiten ein bestehendes Bacula-label zu überschreiben. Die brutale Methode ist es, einfach ein EOF an den Anfang des Volumes zu schreiben (dabei wird das bestehende label durch das EOF überschrieben). Mit dem Programm mt können Sie das zum Beispiel so tun:

 [user@host]$  mt -f /dev/st0 rewind
 [user@host]$  mt -f /dev/st0 weof

Ein Festplatten-Volume können Sie auch manuell löschen.

Danach benutzten Sie das label-Kommando, um ein neues label zu erzeugen. Allerdings kann diese Vorgehensweise Spuren des alten Volumes in der Katalog-Datenbank hinterlassen.

Die bevorzugte Methode ein Volume neu zu labeln sollte es sein, zuerst das Volume als bereinigt (purged) zu markieren. Das passiert entweder automatisch, wenn die Aufbewahrungszeit (Volume-Retention) für das Volume abläuft, oder kann aber auch mit dem purge-Kommando erzwungen werden. Danach können Sie das relabel-Kommando, wie weiter unten beschrieben, verwenden.

Falls Ihr Autochanger Barcode-Labels unterstützt, können Sie alle Volumes im Autochanger, eins nach dem anderen, mit dem Kommando label barcodes labeln. Dabei wird jedes Tape mit Barcode nacheinander im Laufwerk gemountet und mit der auf dem Barcode enthaltenen Zeichenfolge als Namen gelabelt. Ein entsprechender Katalog-Eintrag wird automatisch mit erzeugt. Jedes Volume mit einem Barcode der mit den Zeichen beginnt, die im Pool-Eintrag als CleaningPrefix konfiguriert sind, wird wie ein Reinigungsband behandelt und nicht gelabelt. Allerdings wird dabei auch ein Katalog-Eintrag für das Reinigungsband erstellt.

Als Beispiel, mit dem Eintrag:

        Pool {
          Name ...
          Cleaning Prefix = "CLN"
       }

wird jedes Tape, dessen Barcode mit CLN beginnt, als Reinigungsband betrachtet und nicht automatisch gemountet. Das label-Kommando kann folgendermaßen aufgerufen werden:

label storage=xxx pool=yyy slots=1-5,10 barcodes

list
Das list-Kommando zeigt den angegebenen Inhalt der Katalog-Datenbank an. Die verschiedenen Felder jedes Eintrags werden in einer Zeile ausgegeben. Die verschiedenen Möglichkeiten sind:
   list jobs
   
   list jobid=<id>           (zeigt jobid <id> an)

   list ujobid<unique job name> (zeigt den job mit dem Namen <unique job name> an)
   
   list job=<job-name>   (zeigt alle Jobs mit dem Namen <job-name> an)

   list jobname=<job-name>  (identisch mit dem oberen)

                Im oberen Beispiel k\"{o}nnen Sie auch den Parameter limit=nn
                hinzuf\"{u}gen, um die Ausgabe des Kommandos auf nn Jobs zu begrenzen
   
   list jobmedia
   
   list jobmedia jobid=<id>
   
   list jobmedia job=<job-name>
   
   list files jobid=<id>
   
   list files job=<job-name>
   
   list pools
   
   list clients
   
   list jobtotals
   
   list volumes
   
   list volumes jobid=<id>
   
   list volumes pool=<pool-name>
   
   list volumes job=<job-name>
   
   list volume=<volume-name>  

   list nextvolume job=<job-name>
   
   list nextvol job=<job-name>

   list nextvol job=<job-name> days=nnn

Die meisten der oben genannten Parameter sollten selbsterklärend sein. Üblicherweise werden Sie, falls Sie nicht genügend Parameter angeben, von der Console nach den fehlenden Informationen gefragt.

Das list nextvol-Kommando gibt den Volume-Namen aus, der von dem angegebenen Job beim nächsten Backup benutzt werden wird. Allerdings sollten Sie beachten, dass das tatsächlich benutzte Volume von einer Reihe von Faktoren, wie zum Beispiel von den vorher laufenden Jobs oder der Zeit wann der Job läuft, abhängen kann. Eventuell wird ein Tape schon voll sein, das aber noch freien Platz hatte, als Sie das Kommando ausführten. Dieses Kommando gibt Ihnen also nur einen Hinweis darauf, welches Tape benutzt werden könnte, aber es kann keine definitive Aussage darüber treffen. Zusätzlich kann dieses Kommando mehrere Seiteneffekte haben, da es den selben Algorithmus durchläuft, wie ein echter Backup-Job. Das bedeutet, dass es dazu führen kann, dass aufgrund dieses Kommandos Volumes automatisch recycled oder gelöscht (purged) werden. Standardmäßig muss der angegebene Job innerhalb der nächsten zwei Tage laufen, ansonsten wird kein Volume für den Job gefunden. Allerdings können Sie durch Angabe des Parameters days=nnn bis zu 50 Tage in die Zukunft angeben, die das Kommando in die Berechnung mit einbeziehen soll. Falls Sie, zum Beispiel, Freitags sehen wollen, welches Volume am Montag vorrausssichtlich benutzt wird, können Sie folgendes Kommando benutzen: list nextvol job=MyJob days=3.

Wenn Sie bestimmte, von Ihnen öfter benötigte, eigene Kommandos anlegen wollen um sich bestimmte Inhalte der Katalog-Datenbank anzeigen zu lassen, können Sie diese der Datei query.sql hinzuügen. Allerdings erfordert das einiges an Wissen über SQL-Kommandos. Lesen Sie dazu bitte den Abschnitt über das query-Kommando in diesem Kapitel.

Weiter unten finden Sie auch eine Beispiel-Ausgabe des llist-Kommandos, das Ihnen den kompletten Inhalt des Katalogs zu einem bestimmten Konfigurations-Eintrag anzeigt.

Als ein Beispiel, kann Ihnen der Aufruf des Kommandos list pools die folgenden Ausgaben anzeigen:

+------+---------+---------+---------+----------+-------------+
| PoId | Name    | NumVols | MaxVols | PoolType | LabelFormat |
+------+---------+---------+---------+----------+-------------+
|    1 | Default |       0 |       0 | Backup   | *           |
|    2 | Recycle |       0 |       8 | Backup   | File        |
+------+---------+---------+---------+----------+-------------+

As mentioned above, the list command lists what is in the database. Some things are put into the database immediately when Bacula starts up, but in general, most things are put in only when they are first used, which is the case for a Client as with Job records, etc.

Bacula should create a client record in the database the first time you run a job for that client. Doing a status will not cause a database record to be created. The client database record will be created whether or not the job fails, but it must at least start. When the Client is actually contacted, additional info from the client will be added to the client record (a "uname -a" output).

If you want to see what Client resources you have available in your conf file, you use the Console command show clients.

llist
The llist or "long list" command takes all the same arguments that the list command described above does. The difference is that the llist command list the full contents of each database record selected. It does so by listing the various fields of the record vertically, with one field per line. It is possible to produce a very large number of output lines with this command.

If instead of the list pools as in the example above, you enter llist pools you might get the following output:

          PoolId: 1
            Name: Default
         NumVols: 0
         MaxVols: 0
         UseOnce: 0
      UseCatalog: 1
 AcceptAnyVolume: 1
    VolRetention: 1,296,000
  VolUseDuration: 86,400
      MaxVolJobs: 0
     MaxVolBytes: 0
       AutoPrune: 0
         Recycle: 1
        PoolType: Backup
     LabelFormat: *

          PoolId: 2
            Name: Recycle
         NumVols: 0
         MaxVols: 8
         UseOnce: 0
      UseCatalog: 1
 AcceptAnyVolume: 1
    VolRetention: 3,600
  VolUseDuration: 3,600
      MaxVolJobs: 1
     MaxVolBytes: 0
       AutoPrune: 0
         Recycle: 1
        PoolType: Backup
     LabelFormat: File

messages
This command causes any pending console messages to be immediately displayed.

mount
The mount command is used to get Bacula to read a volume on a physical device. It is a way to tell Bacula that you have mounted a tape and that Bacula should examine the tape. This command is normally used only after there was no Volume in a drive and Bacula requests you to mount a new Volume or when you have specifically unmounted a Volume with the unmount console command, which causes Bacula to close the drive. If you have an autoloader, the mount command will not cause Bacula to operate the autoloader unless you specify a slot and possibly a drive. The various forms of the mount command are:

mount storage=<storage-name> [ slot=<num> ] [ drive=<num> ]

mount [ jobid=<id> | job=<job-name> ]

If you have specified Automatic Mount = yes in the Storage daemon's Device resource, under most circumstances, Bacula will automatically access the Volume unless you have explicitly unmounted it in the Console program.

python
The python command takes a single argument restart:

python restart

This causes the Python interpreter in the Director to be reinitialized. This can be helpful for testing because once the Director starts and the Python interpreter is initialized, there is no other way to make it accept any changes to the startup script DirStartUp.py. For more details on Python scripting, please see the Python Scripting chapter of this manual.

prune
The Prune command allows you to safely remove expired database records from Jobs and Volumes. This command works only on the Catalog database and does not affect data written to Volumes. In all cases, the Prune command applies a retention period to the specified records. You can Prune expired File entries from Job records; you can Prune expired Job records from the database, and you can Prune both expired Job and File records from specified Volumes.

prune files|jobs|volume client=<client-name> volume=<volume-name>

For a Volume to be pruned, the VolStatus must be Full, Used, or Append, otherwise the pruning will not take place.

purge
The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing. The permitted forms of purge are:

purge files jobid=<jobid>|job=<job-name>|client=<client-name>

purge jobs client=<client-name> (of all jobs)

purge volume|volume=<vol-name> (of all jobs)

For the purge command to work on Volume Catalog database records the VolStatus must be Append, Full, Used, or Error.

The actual data written to the Volume will be unaffected by this command.

relabel
This command is used to label physical volumes. The full form of this command is:

relabel storage=<storage-name> oldvolume=<old-volume-name> volume=<newvolume-name>

If you leave out any part, you will be prompted for it. In order for the Volume (old-volume-name) to be relabeled, it must be in the catalog, and the volume status must be marked Purged or Recycle. This happens automatically as a result of applying retention periods, or you may explicitly purge the volume using the purge command.

Once the volume is physically relabeled, the old data previously written on the Volume is lost and cannot be recovered.

release
This command is used to cause the Storage daemon to rewind (release) the current tape in the drive, and to re-read the Volume label the next time the tape is used.

release storage=<storage-name>

After a release command, the device is still kept open by Bacula (unless Always Open is set to No in the Storage Daemon's configuration) so it cannot be used by another program. However, with some tape drives, the operator can remove the current tape and to insert a different one, and when the next Job starts, Bacula will know to re-read the tape label to find out what tape is mounted. If you want to be able to use the drive with another program (e.g. mt), you must use the unmount command to cause Bacula to completely release (close) the device.

reload
The reload command causes the Director to re-read its configuration file and apply the new values. The new values will take effect immediately for all new jobs. However, if you change schedules, be aware that the scheduler pre-schedules jobs up to two hours in advance, so any changes that are to take place during the next two hours may be delayed. Jobs that have already been scheduled to run (i.e. surpassed their requested start time) will continue with the old values. New jobs will use the new values. Each time you issue a reload command while jobs are running, the prior config values will queued until all jobs that were running before issuing the reload terminate, at which time the old config values will be released from memory. The Directory permits keeping up to ten prior set of configurations before it will refuse a reload command. Once at least one old set of config values has been released it will again accept new reload commands.

While it is possible to reload the Director's configuration on the fly, even while jobs are executing, this is a complex operation and not without side effects. Accordingly, if you have to reload the Director's configuration while Bacula is running, it is advisable to restart the Director at the next convenient opportunity.

restore
The restore command allows you to select one or more Jobs (JobIds) to be restored using various methods. Once the JobIds are selected, the File records for those Jobs are placed in an internal Bacula directory tree, and the restore enters a file selection mode that allows you to interactively walk up and down the file tree selecting individual files to be restored. This mode is somewhat similar to the standard Unix restore program's interactive file selection mode.

restore storage=<storage-name> client=<backup-client-name> where=<path> pool=<pool-name> fileset=<fileset-name> restoreclient=<restore-client-name> select current all done

Where current, if specified, tells the restore command to automatically select a restore to the most current backup. If not specified, you will be prompted. The all specification tells the restore command to restore all files. If it is not specified, you will be prompted for the files to restore. For details of the restore command, please see the Restore Chapter of this manual.

The client keyword initially specifies the client from which the backup was made and the client to which the restore will be make. However, if the restoreclient keyword is specified, then the restore is written to that client.

run
This command allows you to schedule jobs to be run immediately. The full form of the command is:

run job=<job-name> client=<client-name> fileset=<FileSet-name> level=<level-keyword> storage=<storage-name> where=<directory-prefix> when=<universal-time-specification> yes

Any information that is needed but not specified will be listed for selection, and before starting the job, you will be prompted to accept, reject, or modify the parameters of the job to be run, unless you have specified yes, in which case the job will be immediately sent to the scheduler.

On my system, when I enter a run command, I get the following prompt:

A job name must be specified.
The defined Job resources are:
     1: Matou
     2: Polymatou
     3: Rufus
     4: Minimatou
     5: Minou
     6: PmatouVerify
     7: MatouVerify
     8: RufusVerify
     9: Watchdog
Select Job resource (1-9):

If I then select number 5, I am prompted with:

Run Backup job
JobName:  Minou
FileSet:  Minou Full Set
Level:    Incremental
Client:   Minou
Storage:  DLTDrive
Pool:     Default
When:     2003-04-23 17:08:18
OK to run? (yes/mod/no):

If I now enter yes, the Job will be run. If I enter mod, I will be presented with the following prompt.

Parameters to modify:
     1: Level
     2: Storage
     3: Job
     4: FileSet
     5: Client
     6: When
     7: Pool
Select parameter to modify (1-7):

If you wish to start a job at a later time, you can do so by setting the When time. Use the mod option and select When (no. 6). Then enter the desired start time in YYYY-MM-DD HH:MM:SS format.

setdebug
This command is used to set the debug level in each daemon. The form of this command is:

setdebug level=nn [trace=0/1 client=<client-name> | dir | director | storage=<storage-name> | all]

If trace=1 is set, then tracing will be enabled, and the daemon will be placed in trace mode, which means that all debug output as set by the debug level will be directed to the file bacula.trace in the current directory of the daemon. Normally, tracing is needed only for Win32 clients where the debug output cannot be written to a terminal or redirected to a file. When tracing, each debug output message is appended to the trace file. You must explicitly delete the file when you are done.

show
The show command will list the Director's resource records as defined in the Director's configuration file (normally bacula-dir.conf). This command is used mainly for debugging purposes by developers. The following keywords are accepted on the show command line: catalogs, clients, counters, devices, directors, filesets, jobs, messages, pools, schedules, storages, all, help. Please don't confuse this command with the list, which displays the contents of the catalog.

sqlquery
The sqlquery command puts the Console program into SQL query mode where each line you enter is concatenated to the previous line until a semicolon (;) is seen. The semicolon terminates the command, which is then passed directly to the SQL database engine. When the output from the SQL engine is displayed, the formation of a new SQL command begins. To terminate SQL query mode and return to the Console command prompt, you enter a period (.) in column 1.

Using this command, you can query the SQL catalog database directly. Note you should really know what you are doing otherwise you could damage the catalog database. See the query command below for simpler and safer way of entering SQL queries.

Depending on what database engine you are using (MySQL, PostgreSQL or SQLite), you will have somewhat different SQL commands available. For more detailed information, please refer to the MySQL, PostgreSQL or SQLite documentation.

status
This command will display the status of the next jobs that are scheduled during the next 24 hours as well as the status of currently running jobs. The full form of this command is:

status [all | dir=<dir-name> | director | client=<client-name> | storage=<storage-name> | days=nnn]

If you do a status dir, the console will list any currently running jobs, a summary of all jobs scheduled to be run in the next 24 hours, and a listing of the last ten terminated jobs with their statuses. The scheduled jobs summary will include the Volume name to be used. You should be aware of two things: 1. to obtain the volume name, the code goes through the same code that will be used when the job runs, but it does not do pruning nor recycling of Volumes; 2. The Volume listed is at best a guess. The Volume actually used may be different because of the time difference (more durations may expire when the job runs) and another job could completely fill the Volume requiring a new one.

In the Running Jobs listing, you may find the following types of information:

2507 Catalog MatouVerify.2004-03-13_05.05.02 is waiting execution
5349 Full    CatalogBackup.2004-03-13_01.10.00 is waiting for higher
             priority jobs to finish
5348 Differe Minou.2004-03-13_01.05.09 is waiting on max Storage jobs
5343 Full    Rufus.2004-03-13_01.05.04 is running

Looking at the above listing from bottom to top, obviously JobId 5343 (Rufus) is running. JobId 5348 (Minou) is waiting for JobId 5343 to finish because it is using the Storage resource, hence the "waiting on max Storage jobs". JobId 5349 has a lower priority than all the other jobs so it is waiting for higher priority jobs to finish, and finally, JobId 2508 (MatouVerify) is waiting because only one job can run at a time, hence it is simply "waiting execution"

If you do a status dir, it will by default list the first occurrence of all jobs that are scheduled today and tomorrow. If you wish to see the jobs that are scheduled in the next three days (e.g. on Friday you want to see the first occurrence of what tapes are scheduled to be used on Friday, the weekend, and Monday), you can add the days=3 option. Note, a days=0 shows the first occurrence of jobs scheduled today only. If you have multiple run statements, the first occurrence of each run statement for the job will be displayed for the period specified.

If your job seems to be blocked, you can get a general idea of the problem by doing a status dir, but you can most often get a much more specific indication of the problem by doing a status storage=xxx. For example, on an idle test system, when I do status storage=File, I get:

status storage=File
Connecting to Storage daemon File at 192.168.68.112:8103

rufus-sd Version: 1.39.6 (24 March 2006) i686-pc-linux-gnu redhat (Stentz)
Daemon started 26-Mar-06 11:06, 0 Jobs run since started.

Running Jobs:
No Jobs running.
====

Jobs waiting to reserve a drive:
====

Terminated Jobs:
 JobId  Level   Files          Bytes Status   Finished        Name 
======================================================================
    59  Full        234      4,417,599 OK       15-Jan-06 11:54 kernsave
====

Device status:
utochanger "DDS-4-changer" with devices:
   "DDS-4" (/dev/nst0)
Device "DDS-4" (/dev/nst0) is mounted with Volume="TestVolume002"
Pool="*unknown*"
    Slot 2 is loaded in drive 0.
    Total Bytes Read=0 Blocks Read=0 Bytes/block=0
    Positioned at File=0 Block=0
Device "Dummy" is not open or does not exist.
No DEVICE structure.

Device "DVD-Writer" (/dev/hdc) is not open.
Device "File" (/tmp) is not open.
====

In Use Volume status:
====

Now, what this tells me is that no jobs are running and that none of the devices are in use. Now, if I unmount the autochanger, which will not be used in this example, and then start a Job that uses the File device, the job will block. When I re-issue the status storage command, I get for the Device status:

status storage=File
...
Device status:
Autochanger "DDS-4-changer" with devices:
   "DDS-4" (/dev/nst0)
Device "DDS-4" (/dev/nst0) is not open.
    Device is BLOCKED. User unmounted.
    Drive 0 is not loaded.
Device "Dummy" is not open or does not exist.
No DEVICE structure.

Device "DVD-Writer" (/dev/hdc) is not open.
Device "File" (/tmp) is not open.
    Device is BLOCKED waiting for media.
====
...

Now, here it should be clear that if a job were running that wanted to use the Autochanger (with two devices), it would block because the user unmounted the device. The real problem for the Job I started using the "File" device is that the device is blocked waiting for media -- that is Bacula needs you to label a Volume.

unmount
This command causes the indicated Bacula Storage daemon to unmount the specified device. The forms of the command are the same as the mount command:
unmount storage=<storage-name> [ drive=<num> ]

unmount [ jobid=<id> | job=<job-name> ]

Once you unmount a storage device, Bacula will no longer be able to use it until you issue a mount command for that device. If Bacula needs to access that device, it will block and issue mount requests periodically to the operator.

If the device you are unmounting is an autochanger, it will unload the drive you have specified on the command line. If no drive is specified, it will assume drive 1.

update
This command will update the catalog for either a specific Pool record, a Volume record, or the Slots in an autochanger with barcode capability. In the case of updating a Pool record, the new information will be automatically taken from the corresponding Director's configuration resource record. It can be used to increase the maximum number of volumes permitted or to set a maximum number of volumes. The following main keywords may be specified:
   media, volume, pool, slots

In the case of updating a Volume, you will be prompted for which value you wish to change. The following Volume parameters may be changed:

 
   Volume Status
   Volume Retention Period
   Volume Use Duration
   Maximum Volume Jobs
   Maximum Volume Files
   Maximum Volume Bytes
   Recycle Flag
   Recycle Pool
   Slot
   InChanger Flag
   Pool
   Volume Files
   Volume from Pool
   All Volumes from Pool
   All Volumes from all Pools

For slots update slots, Bacula will obtain a list of slots and their barcodes from the Storage daemon, and for each barcode found, it will automatically update the slot in the catalog Media record to correspond to the new value. This is very useful if you have moved cassettes in the magazine, or if you have removed the magazine and inserted a different one. As the slot of each Volume is updated, the InChanger flag for that Volume will also be set, and any other Volumes in the Pool that were last mounted on the same Storage device will have their InChanger flag turned off. This permits Bacula to know what magazine (tape holder) is currently in the autochanger.

If you do not have barcodes, you can accomplish the same thing in version 1.33 and later by using the update slots scan command. The scan keyword tells Bacula to physically mount each tape and to read its VolumeName.

For Pool update pool, Bacula will move the Volume record from its existing pool to the pool specified.

For Volume from Pool, All Volumes from Pool and All Volumes from all Pools, the following values are updated from the Pool record: Recycle, RecyclePool, VolRetention, VolUseDuration, MaxVolJobs, MaxVolFiles, and MaxVolBytes. (RecyclePool feature is available with bacula 2.1.4 or higher.)

The full form of the update command with all command line arguments is:

       update volume=xxx pool=yyy slots volstatus=xxx VolRetention=ddd
         VolUse=ddd MaxVolJobs=nnn MaxVolBytes=nnn Recycle=yes|no
         slot=nnn enabled=n recyclepool=zzz

use
This command allows you to specify which Catalog database to use. Normally, you will be using only one database so this will be done automatically. In the case that you are using more than one database, you can use this command to switch from one to another.

use <database-name>

var
This command takes a string or quoted string and does variable expansion on it the same way variable expansion is done on the LabelFormat string. Thus, for the most part, you can test your LabelFormat strings. The difference between the var command and the actual LabelFormat process is that during the var command, no job is running so "dummy" values are used in place of Job specific variables. Generally, however, you will get a good idea of what is going to happen in the real case.

version
The command prints the Director's version.

quit
This command terminates the console program. The console program sends the quit request to the Director and waits for acknowledgment. If the Director is busy doing a previous command for you that has not terminated, it may take some time. You may quit immediately by issuing the .quit command (i.e. quit preceded by a period).

query
This command reads a predefined SQL query from the query file (the name and location of the query file is defined with the QueryFile resource record in the Director's configuration file). You are prompted to select a query from the file, and possibly enter one or more parameters, then the command is submitted to the Catalog database SQL engine.

The following queries are currently available (version 1.24):

Available queries:
  1: List Job totals:
  2: List where a file is saved:
  3: List where the most recent copies of a file are saved:
  4: List total files/bytes by Job:
  5: List total files/bytes by Volume:
  6: List last 20 Full Backups for a Client:
  7: List Volumes used by selected JobId:
  8: List Volumes to Restore All Files:
  9: List where a File is saved:
Choose a query (1-9):

exit
This command terminates the console program.

wait
The wait command causes the Director to pause until there are no jobs running. This command is useful in a batch situation such as regression testing where you wish to start a job and wait until that job completes before continuing. This command now has the following options:
   wait [jobid=nn] [jobuid=unique id] [job=job name]
If specified with a specific JobId, ... the wait command will wait for that particular job to terminate before continuing.

Special dot Commands

There is a list of commands that are prefixed with a period (.). These commands are intended to be used either by batch programs or graphical user interface front-ends. They are not normally used by interactive users. Once GUI development begins, this list will be considerably expanded. The following is the list of dot commands:

.backups job=xxx      list backups for specified job
.clients              list all client names
.defaults client=xxx fileset=yyy  list defaults for specified client
.die                  cause the Director to segment fault (for debugging)
.dir                  when in tree mode prints the equivalent to the dir command,
                        but with fields separated by commas rather than spaces.
.exit                 quit
.filesets             list all fileset names
.help                 help command output
.jobs                 list all job names
.levels               list all levels
.messages             get quick messages
.msgs                 return any queued messages
.pools                list all pool names
.quit                 quit
.status               get status output
.storage              return storage resource names
.types                list job types

Special At (@) Commands

Normally, all commands entered to the Console program are immediately forwarded to the Director, which may be on another machine, to be executed. However, there is a small list of at commands, all beginning with an at character (@), that will not be sent to the Director, but rather interpreted by the Console program directly. Note, these commands are implemented only in the tty console program and not in the GNOME Console. These commands are:

@input <filename>
Read and execute the commands contained in the file specified.

@output <filename> w/a
Send all following output to the filename specified either overwriting the file (w) or appending to the file (a). To redirect the output to the terminal, simply enter @output without a filename specification. WARNING: be careful not to overwrite a valid file. A typical example during a regression test might be:

    @output /dev/null
    commands ...
    @output

@tee <filename> w/a
Send all subsequent output to both the specified file and the terminal. It is turned off by specifying @tee or @output without a filename.

@sleep <seconds>
Sleep the specified number of seconds.

@time
Print the current time and date.

@version
Print the console's version.

@quit
quit

@exit
quit

@# anything
Comment

Running the Console from a Shell Script

You can automate many Console tasks by running the console program from a shell script. For example, if you have created a file containing the following commands:

 ./bconsole -c ./bconsole.conf <<END_OF_DATA
 unmount storage=DDS-4
 quit
 END_OF_DATA

when that file is executed, it will unmount the current DDS-4 storage device. You might want to run this command during a Job by using the RunBeforeJob or RunAfterJob records.

It is also possible to run the Console program from file input where the file contains the commands as follows:

./bconsole -c ./bconsole.conf <filename

where the file named filename contains any set of console commands.

As a real example, the following script is part of the Bacula regression tests. It labels a volume (a disk volume), runs a backup, then does a restore of the files saved.

bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
@output /dev/null
messages
@output /tmp/log1.out
label volume=TestVolume001
run job=Client1 yes
wait
messages
@#
@# now do a restore
@#
@output /tmp/log2.out
restore current all
yes
wait
messages
@output
quit
END_OF_DATA

The output from the backup is directed to /tmp/log1.out and the output from the restore is directed to /tmp/log2.out. To ensure that the backup and restore ran correctly, the output files are checked with:

grep "^Termination: *Backup OK" /tmp/log1.out
backupstat=$?
grep "^Termination: *Restore OK" /tmp/log2.out
restorestat=$?

Adding Volumes to a Pool

If you have used the label command to label a Volume, it will be automatically added to the Pool, and you will not need to add any media to the pool.

Alternatively, you may choose to add a number of Volumes to the pool without labeling them. At a later time when the Volume is requested by Bacula you will need to label it.

Before adding a volume, you must know the following information:

  1. The name of the Pool (normally "Default")
  2. The Media Type as specified in the Storage Resource in the Director's configuration file (e.g. "DLT8000")
  3. The number and names of the Volumes you wish to create.

For example, to add media to a Pool, you would issue the following commands to the console program:

*add
Enter name of Pool to add Volumes to: Default
Enter the Media Type: DLT8000
Enter number of Media volumes to create. Max=1000: 10
Enter base volume name: Save
Enter the starting number: 1
10 Volumes created in pool Default
*

To see what you have added, enter:

*list media pool=Default
+-------+----------+---------+---------+-------+------------------+
| MedId | VolumeNa | MediaTyp| VolStat | Bytes | LastWritten      |
+-------+----------+---------+---------+-------+------------------+
|    11 | Save0001 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    12 | Save0002 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    13 | Save0003 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    14 | Save0004 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    15 | Save0005 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    16 | Save0006 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    17 | Save0007 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    18 | Save0008 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    19 | Save0009 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    20 | Save0010 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
+-------+----------+---------+---------+-------+------------------+
*

Notice that the console program automatically appended a number to the base Volume name that you specify (Save in this case). If you don't want it to append a number, you can simply answer 0 (zero) to the question "Enter number of Media volumes to create. Max=1000:", and in this case, it will create a single Volume with the exact name you specify.


The Restore Command

General

Below, we will discuss restoring files with the Console restore command, which is the recommended way of doing restoring files. It is not possible to restore files by automatically starting a job as you do with Backup, Verify, ... jobs. However, in addition to the console restore command, there is a standalone program named bextract, which also permits restoring files. For more information on this program, please see the Bacula Utility Programs chapter of this manual. We don't particularly recommend the bextract program because it lacks many of the features of the normal Bacula restore, such as the ability to restore Win32 files to Unix systems, and the ability to restore access control lists (ACL). As a consequence, we recommend, wherever possible to use Bacula itself for restores as described below.

You may also want to look at the bls program in the same chapter, which allows you to list the contents of your Volumes. Finally, if you have an old Volume that is no longer in the catalog, you can restore the catalog entries using the program named bscan, documented in the same Bacula Utility Programs chapter.

In general, to restore a file or a set of files, you must run a restore job. That is a job with Type = Restore. As a consequence, you will need a predefined restore job in your bacula-dir.conf (Director's config) file. The exact parameters (Client, FileSet, ...) that you define are not important as you can either modify them manually before running the job or if you use the restore command, explained below, Bacula will automatically set them for you. In fact, you can no longer simply run a restore job. You must use the restore command.

Since Bacula is a network backup program, you must be aware that when you restore files, it is up to you to ensure that you or Bacula have selected the correct Client and the correct hard disk location for restoring those files. Bacula will quite willingly backup client A, and restore it by sending the files to a different directory on client B. Normally, you will want to avoid this, but assuming the operating systems are not too different in their file structures, this should work perfectly well, if so desired. By default, Bacula will restore data to the same Client that was backed up, and those data will be restored not to the original places but to /tmp/bacula-restores. You may modify any of these defaults when the restore command prompts you to run the job by selecting the mod option.

The Restore Command

Since Bacula maintains a catalog of your files and on which Volumes (disk or tape), they are stored, it can do most of the bookkeeping work, allowing you simply to specify what kind of restore you want (current, before a particular date), and what files to restore. Bacula will then do the rest.

This is accomplished using the restore command in the Console. First you select the kind of restore you want, then the JobIds are selected, the File records for those Jobs are placed in an internal Bacula directory tree, and the restore enters a file selection mode that allows you to interactively walk up and down the file tree selecting individual files to be restored. This mode is somewhat similar to the standard Unix restore program's interactive file selection mode.

If a Job's file records have been pruned from the catalog, the restore command will be unable to find any files to restore. See below for more details on this.

Within the Console program, after entering the restore command, you are presented with the following selection prompt:

First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
To select the JobIds, you have the following choices:
     1: List last 20 Jobs run
     2: List Jobs where a given File is saved
     3: Enter list of comma separated JobIds to select
     4: Enter SQL list command
     5: Select the most recent backup for a client
     6: Select backup for a client before a specified time
     7: Enter a list of files to restore
     8: Enter a list of files to restore before a specified time
     9: Find the JobIds of the most recent backup for a client
    10: Find the JobIds for a backup for a client before a specified time
    11: Enter a list of directories to restore for found JobIds
    12: Cancel
Select item:  (1-12):

There are a lot of options, and as a point of reference, most people will want to slect item 5 (the most recent backup for a client). The details of the above options are:

As an example, suppose that we select item 5 (restore to most recent state). If you have not specified a client=xxx on the command line, it it will then ask for the desired Client, which on my system, will print all the Clients found in the database as follows:

Defined clients:
     1: Rufus
     2: Matou
     3: Polymatou
     4: Minimatou
     5: Minou
     6: MatouVerify
     7: PmatouVerify
     8: RufusVerify
     9: Watchdog
Select Client (File daemon) resource (1-9):

You will probably have far fewer Clients than this example, and if you have only one Client, it will be automatically selected. In this case, I enter Rufus to select the Client. Then Bacula needs to know what FileSet is to be restored, so it prompts with:

The defined FileSet resources are:
     1: Full Set
     2: Other Files
Select FileSet resource (1-2):

If you have only one FileSet defined for the Client, it will be selected automatically. I choose item 1, which is my full backup. Normally, you will only have a single FileSet for each Job, and if your machines are similar (all Linux) you may only have one FileSet for all your Clients.

At this point, Bacula has all the information it needs to find the most recent set of backups. It will then query the database, which may take a bit of time, and it will come up with something like the following. Note, some of the columns are truncated here for presentation:

+-------+------+----------+-------------+-------------+------+-------+----------
--+
| JobId | Levl | JobFiles | StartTime   | VolumeName  | File | SesId |
VolSesTime |
+-------+------+----------+-------------+-------------+------+-------+----------
--+
| 1,792 | F    |  128,374 | 08-03 01:58 | DLT-19Jul02 |   67 |    18 |
1028042998 |
| 1,792 | F    |  128,374 | 08-03 01:58 | DLT-04Aug02 |    0 |    18 |
1028042998 |
| 1,797 | I    |      254 | 08-04 13:53 | DLT-04Aug02 |    5 |    23 |
1028042998 |
| 1,798 | I    |       15 | 08-05 01:05 | DLT-04Aug02 |    6 |    24 |
1028042998 |
+-------+------+----------+-------------+-------------+------+-------+----------
--+
You have selected the following JobId: 1792,1792,1797
Building directory tree for JobId 1792 ...
Building directory tree for JobId 1797 ...
Building directory tree for JobId 1798 ...
cwd is: /
$

Depending on the number of JobFiles for each JobId, the Building directory tree ..." can take a bit of time. If you notice ath all the JobFiles are zero, your Files have probably been pruned and you will not be able to select any individual files -- it will be restore everything or nothing.

In our example, Bacula found four Jobs that comprise the most recent backup of the specified Client and FileSet. Two of the Jobs have the same JobId because that Job wrote on two different Volumes. The third Job was an incremental backup to the previous Full backup, and it only saved 254 Files compared to 128,374 for the Full backup. The fourth Job was also an incremental backup that saved 15 files.

Next Bacula entered those Jobs into the directory tree, with no files marked to be restored as a default, tells you how many files are in the tree, and tells you that the current working directory (cwd) is /. Finally, Bacula prompts with the dollar sign ($) to indicate that you may enter commands to move around the directory tree and to select files.

If you want all the files to automatically be marked when the directory tree is built, you could have entered the command restore all, or at the $ prompt, you can simply enter mark *.

Instead of choosing item 5 on the first menu (Select the most recent backup for a client), if we had chosen item 3 (Enter list of JobIds to select) and we had entered the JobIds 1792,1797,1798 we would have arrived at the same point.

One point to note, if you are manually entering JobIds, is that you must enter them in the order they were run (generally in increasing JobId order). If you enter them out of order and the same file was saved in two or more of the Jobs, you may end up with an old version of that file (i.e. not the most recent).

Directly entering the JobIds can also permit you to recover data from a Job that wrote files to tape but that terminated with an error status.

While in file selection mode, you can enter help or a question mark (?) to produce a summary of the available commands:

 Command    Description
  =======    ===========
  cd         change current directory
  count      count marked files in and below the cd
  dir        long list current directory, wildcards allowed
  done       leave file selection mode
  estimate   estimate restore size
  exit       same as done command
  find       find files, wildcards allowed
  help       print help
  ls         list current directory, wildcards allowed
  lsmark     list the marked files in and below the cd
  mark       mark dir/file to be restored recursively in dirs
  markdir    mark directory name to be restored (no files)
  pwd        print current working directory
  unmark     unmark dir/file to be restored recursively in dir
  unmarkdir  unmark directory name only no recursion
  quit       quit and do not do restore
  ?          print help

As a default no files have been selected for restore (unless you added all to the command line. If you want to restore everything, at this point, you should enter mark *, and then done and Bacula will write the bootstrap records to a file and request your approval to start a restore job.

If you do not enter the above mentioned mark * command, you will start with an empty slate. Now you can simply start looking at the tree and mark particular files or directories you want restored. It is easy to make a mistake in specifying a file to mark or unmark, and Bacula's error handling is not perfect, so please check your work by using the ls or dir commands to see what files are actually selected. Any selected file has its name preceded by an asterisk.

To check what is marked or not marked, enter the count command, which displays:

128401 total files. 128401 marked to be restored.

Each of the above commands will be described in more detail in the next section. We continue with the above example, having accepted to restore all files as Bacula set by default. On entering the done command, Bacula prints:

Bootstrap records written to /home/kern/bacula/working/restore.bsr
The job will require the following   
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================

   DLT-19Jul02               Tape                      DLT8000
   DLT-04Aug02               Tape                      DLT8000

128401 files selected to restore.
Run Restore job
JobName:    kernsrestore
Bootstrap:  /home/kern/bacula/working/restore.bsr
Where:      /tmp/bacula-restores
Replace:    always
FileSet:    Other Files
Client:     Rufus
Storage:    Tape
When:       2006-12-11 18:20:33
Catalog:    MyCatalog
Priority:   10
OK to run? (yes/mod/no):

Please examine each of the items very carefully to make sure that they are correct. In particular, look at Where, which tells you where in the directory structure the files will be restored, and Client, which tells you which client will receive the files. Note that by default the Client which will receive the files is the Client that was backed up. These items will not always be completed with the correct values depending on which of the restore options you chose. You can change any of these default items by entering mod and responding to the prompts.

The above assumes that you have defined a Restore Job resource in your Director's configuration file. Normally, you will only need one Restore Job resource definition because by its nature, restoring is a manual operation, and using the Console interface, you will be able to modify the Restore Job to do what you want.

An example Restore Job resource definition is given below.

Returning to the above example, you should verify that the Client name is correct before running the Job. However, you may want to modify some of the parameters of the restore job. For example, in addition to checking the Client it is wise to check that the Storage device chosen by Bacula is indeed correct. Although the FileSet is shown, it will be ignored in restore. The restore will choose the files to be restored either by reading the Bootstrap file, or if not specified, it will restore all files associated with the specified backup JobId (i.e. the JobId of the Job that originally backed up the files).

Finally before running the job, please note that the default location for restoring files is not their original locations, but rather the directory /tmp/bacula-restores. You can change this default by modifying your bacula-dir.conf file, or you can modify it using the mod option. If you want to restore the files to their original location, you must have Where set to nothing or to the root, i.e. /.

If you now enter yes, Bacula will run the restore Job. The Storage daemon will first request Volume DLT-19Jul02 and after the appropriate files have been restored from that volume, it will request Volume DLT-04Aug02.

Selecting Files by Filename

If you have a small number of files to restore, and you know the filenames, you can either put the list of filenames in a file to be read by Bacula, or you can enter the names one at a time. The filenames must include the full path and filename. No wild cards are used.

To enter the files, after the restore, you select item number 7 from the prompt list:

To select the JobIds, you have the following choices:
     1: List last 20 Jobs run
     2: List Jobs where a given File is saved
     3: Enter list of comma separated JobIds to select
     4: Enter SQL list command
     5: Select the most recent backup for a client
     6: Select backup for a client before a specified time
     7: Enter a list of files to restore
     8: Enter a list of files to restore before a specified time
     9: Find the JobIds of the most recent backup for a client
    10: Find the JobIds for a backup for a client before a specified time
    11: Enter a list of directories to restore for found JobIds
    12: Cancel
Select item:  (1-12):

which then prompts you for the client name:

Defined Clients:
     1: Timmy
     2: Tibs
     3: Rufus
Select the Client (1-3): 3

Of course, your client list will be different, and if you have only one client, it will be automatically selected. And finally, Bacula requests you to enter a filename:

Enter filename:

At this point, you can enter the full path and filename

Enter filename: /home/kern/bacula/k/Makefile.in
Enter filename:

as you can see, it took the filename. If Bacula cannot find a copy of the file, it prints the following:

Enter filename: junk filename
No database record found for: junk filename
Enter filename:

If you want Bacula to read the filenames from a file, you simply precede the filename with a less-than symbol (<). When you have entered all the filenames, you enter a blank line, and Bacula will write the bootstrap file, tells you what tapes will be used, and proposes a Restore job to be run:

Enter filename:
Automatically selected Storage: DDS-4
Bootstrap records written to /home/kern/bacula/working/restore.bsr
The restore job will require the following Volumes:
   
   test1
1 file selected to restore.
Run Restore job
JobName:    kernsrestore
Bootstrap:  /home/kern/bacula/working/restore.bsr
Where:      /tmp/bacula-restores
Replace:    always
FileSet:    Other Files
Client:     Rufus
Storage:    DDS-4
When:       2003-09-11 10:20:53
Priority:   10
OK to run? (yes/mod/no):

It is possible to automate the selection by file by putting your list of files in say /tmp/file-list, then using the following command:

restore client=Rufus file=</tmp/file-list

If in modifying the parameters for the Run Restore job, you find that Bacula asks you to enter a Job number, this is because you have not yet specified either a Job number or a Bootstrap file. Simply entering zero will allow you to continue and to select another option to be modified.

Command Line Arguments

If all the above sounds complicated, you will probably agree that it really isn't after trying it a few times. It is possible to do everything that was shown above, with the exception of selecting the FileSet, by using command line arguments with a single command by entering:

restore client=Rufus select current all done yes

The client=Rufus specification will automatically select Rufus as the client, the current tells Bacula that you want to restore the system to the most current state possible, and the yes suppresses the final yes/mod/no prompt and simply runs the restore.

The full list of possible command line arguments are:

Using File Relocation

Introduction

The where= option is simple, but not very powerful. With file relocation, Bacula can restore a file to the same directory, but with a different name, or in an other directory without recreating the full path.

You can also do filename and path manipulations, implemented in Bacula 2.1.8 or later, such as adding a suffix to all your files, renaming files or directories, etc. Theses options will overwrite where= option.

For example, many users use OS snapshot features so that file /home/eric/mbox will be backed up from the directory /.snap/home/eric/mbox, which can complicate restores. If you use where=/tmp, the file will be restored to /tmp/.snap/home/eric/mbox and you will have to move the file to /home/eric/mbox.bkp by hand. In this case, you could use strip_prefix=/.snap and add_suffix=.bkp options and Bacula will restore the file to its original location -- that is /home/eric/mbox.

To use this feature, there are command line options as described in the restore section of this manual; you can modify your restore job before running it; or you can add options to your restore job in as described in bacula-dir.conf.

Parameters to modify:
     1: Level
     2: Storage
..
    10: File Relocation
..
Select parameter to modify (1-12):


This will replace your current Where value
     1: Strip prefix
     2: Add prefix
     3: Add file suffix
     4: Enter a regexp
     5: Test filename manipulation
     6: Use this ?
Select parameter to modify (1-6):

RegexWhere format

The format is very close to that used by sed or Perl (s/replace this/by that/) operator. A valid regexwhere expression has three fields :

Each field is delimited by a separator specified by the user as the first character of the expression. The separator can be one of the following:

<separator-keyword> = / ! ; % : , ~ # = &

You can use several expressions separated by a commas.

Examples

Orignal filename Computed filename RegexWhere Comments
c:/system.ini c:/system.old.ini /.ini$/.old.ini/ use $ as end of filename
/prod/u01/pdata/ /rect/u01/rdata /prod/rect/,/pdata/rdata/ using two regexp
/prod/u01/pdata/ /rect/u01/rdata !/prod/!/rect/!,/pdata/rdata/ using ! instead of /
C:/WINNT d:/WINNT /c:/d:/i using case-insensitive pattern matching

Restoring Directory Attributes

Depending how you do the restore, you may or may not get the directory entries back to their original state. Here are a few of the problems you can encounter, and for same machine restores, how to avoid them.

Restoring on Windows

If you are restoring on WinNT/2K/XP systems, Bacula will restore the files with the original ownerships and permissions as would be expected. This is also true if you are restoring those files to an alternate directory (using the Where option in restore). However, if the alternate directory does not already exist, the Bacula File daemon (Client) will try to create it. In some cases, it may not create the directories, and if it does since the File daemon runs under the SYSTEM account, the directory will be created with SYSTEM ownership and permissions. In this case, you may have problems accessing the newly restored files.

To avoid this problem, you should create any alternate directory before doing the restore. Bacula will not change the ownership and permissions of the directory if it is already created as long as it is not one of the directories being restored (i.e. written to tape).

The default restore location is /tmp/bacula-restores/ and if you are restoring from drive E:, the default will be /tmp/bacula-restores/e/, so you should ensure that this directory exists before doing the restore, or use the mod option to select a different where directory that does exist.

Some users have experienced problems restoring files that participate in the Active Directory. They also report that changing the userid under which Bacula (bacula-fd.exe) runs, from SYSTEM to a Domain Admin userid, resolves the problem.

Restoring Files Can Be Slow

Restoring files is generally much slower than backing them up for several reasons. The first is that during a backup the tape is normally already positioned and Bacula only needs to write. On the other hand, because restoring files is done so rarely, Bacula keeps only the start file and block on the tape for the whole job rather than on a file by file basis which would use quite a lot of space in the catalog.

Bacula will forward space to the correct file mark on the tape for the Job, then forward space to the correct block, and finally sequentially read each record until it gets to the correct one(s) for the file or files you want to restore. Once the desired files are restored, Bacula will stop reading the tape.

Finally, instead of just reading a file for backup, during the restore, Bacula must create the file, and the operating system must allocate disk space for the file as Bacula is restoring it.

For all the above reasons the restore process is generally much slower than backing up (sometimes it takes three times as long).

Problems Restoring Files

The most frequent problems users have restoring files are error messages such as:

04-Jan 00:33 z217-sd: RestoreFiles.2005-01-04_00.31.04 Error:
block.c:868 Volume data error at 20:0! Short block of 512 bytes on
device /dev/tape discarded.

or

04-Jan 00:33 z217-sd: RestoreFiles.2005-01-04_00.31.04 Error:
block.c:264 Volume data error at 20:0! Wanted ID: "BB02", got ".".
Buffer discarded.

Both these kinds of messages indicate that you were probably running your tape drive in fixed block mode rather than variable block mode. Fixed block mode will work with any program that reads tapes sequentially such as tar, but Bacula repositions the tape on a block basis when restoring files because this will speed up the restore by orders of magnitude when only a few files are being restored. There are several ways that you can attempt to recover from this unfortunate situation.

Try the following things, each separately, and reset your Device resource to what it is now after each individual test:

  1. Set "Block Positioning = no" in your Device resource and try the restore. This is a new directive and untested.

  2. Set "Minimum Block Size = 512" and "Maximum Block Size = 512" and try the restore. If you are able to determine the block size your drive was previously using, you should try that size if 512 does not work. This is a really horrible solution, and it is not at all recommended to continue backing up your data without correcting this condition. Please see the Tape Testing chapter for more on this.

  3. Try editing the restore.bsr file at the Run xxx yes/mod/no prompt before starting the restore job and remove all the VolBlock statements. These are what causes Bacula to reposition the tape, and where problems occur if you have a fixed block size set for your drive. The VolFile commands also cause repositioning, but this will work regardless of the block size.

  4. Use bextract to extract the files you want -- it reads the Volume sequentially if you use the include list feature, or if you use a .bsr file, but remove all the VolBlock statements after the .bsr file is created (at the Run yes/mod/no) prompt but before you start the restore.

Restore Errors

There are a number of reasons why there may be restore errors or warning messages. Some of the more common ones are:

file count mismatch
This can occur for the following reasons:

file size error
When Bacula restores files, it checks that the size of the restored file is the same as the file status data it saved when starting the backup of the file. If the sizes do not agree, Bacula will print an error message. This size mismatch most often occurs because the file was being written as Bacula backed up the file. In this case, the size that Bacula restored will be greater than the status size. This often happens with log files.

If the restored size is smaller, then you should be concerned about a possible tape error and check the Bacula output as well as your system logs.

Example Restore Job Resource

Job {
  Name = "RestoreFiles"
  Type = Restore
  Client = Any-client
  FileSet = "Any-FileSet"
  Storage = Any-storage
  Where = /tmp/bacula-restores
  Messages = Standard
  Pool = Default
}

If Where is not specified, the default location for restoring files will be their original locations.

File Selection Commands

After you have selected the Jobs to be restored and Bacula has created the in-memory directory tree, you will enter file selection mode as indicated by the dollar sign ($) prompt. While in this mode, you may use the commands listed above. The basic idea is to move up and down the in memory directory structure with the cd command much as you normally do on the system. Once you are in a directory, you may select the files that you want restored. As a default no files are marked to be restored. If you wish to start with all files, simply enter: cd / and mark *. Otherwise proceed to select the files you wish to restore by marking them with the mark command. The available commands are:

cd
The cd command changes the current directory to the argument specified. It operates much like the Unix cd command. Wildcard specifications are not permitted.

Note, on Windows systems, the various drives (c:, d:, ...) are treated like a directory within the file tree while in the file selection mode. As a consequence, you must do a cd c: or possibly in some cases a cd C: (note upper case) to get down to the first directory.

dir
The dir command is similar to the ls command, except that it prints it in long format (all details). This command can be a bit slower than the ls command because it must access the catalog database for the detailed information for each file.

estimate
The estimate command prints a summary of the total files in the tree, how many are marked to be restored, and an estimate of the number of bytes to be restored. This can be useful if you are short on disk space on the machine where the files will be restored.

find
The find command accepts one or more arguments and displays all files in the tree that match that argument. The argument may have wildcards. It is somewhat similar to the Unix command find / -name arg.

ls
The ls command produces a listing of all the files contained in the current directory much like the Unix ls command. You may specify an argument containing wildcards, in which case only those files will be listed. Any file that is marked to be restored will have its name preceded by an asterisk (*). Directory names will be terminated with a forward slash (/) to distinguish them from filenames.

lsmark
The lsmark command is the same as the ls except that it will print only those files marked for extraction. The other distinction is that it will recursively descend into any directory selected.

mark
The mark command allows you to mark files to be restored. It takes a single argument which is the filename or directory name in the current directory to be marked for extraction. The argument may be a wildcard specification, in which case all files that match in the current directory are marked to be restored. If the argument matches a directory rather than a file, then the directory and all the files contained in that directory (recursively) are marked to be restored. Any marked file will have its name preceded with an asterisk (*) in the output produced by the ls or dir commands. Note, supplying a full path on the mark command does not work as expected to select a file or directory in the current directory. Also, the mark command works on the current and lower directories but does not touch higher level directories.

After executing the mark command, it will print a brief summary:

    No files marked.

If no files were marked, or:

    nn files marked.

if some files are marked.

unmark
The unmark is identical to the mark command, except that it unmarks the specified file or files so that they will not be restored. Note: the unmark command works from the current directory, so it does not unmark any files at a higher level. First do a cd / before the unmark * command if you want to unmark everything.

pwd
The pwd command prints the current working directory. It accepts no arguments.

count
The count command prints the total files in the directory tree and the number of files marked to be restored.

done
This command terminates file selection mode.

exit
This command terminates file selection mode (the same as done).

quit
This command terminates the file selection and does not run the restore job.

help
This command prints a summary of the commands available.

?
This command is the same as the help command.

Restoring When Things Go Wrong

This and the following sections will try to present a few of the kinds of problems that can come up making restoring more difficult. We will try to provide a few ideas how to get out of these problem situations. In addition to what is presented here, there is more specific information on restoring a Client and your Server in the Disaster Recovery Using Bacula chapter of this manual.

Problem
My database is broken.
Solution
For SQLite, use the vacuum command to try to fix the database. For either MySQL or PostgreSQL, see the vendor's documentation. They have specific tools that check and repair databases, see the database repair sections of this manual for links to vendor information.

Assuming the above does not resolve the problem, you will need to restore or rebuild your catalog. Note, if it is a matter of some inconsistencies in the Bacula tables rather than a broken database, then running dbcheck might help, but you will need to ensure that your database indexes are properly setup. Please see the Database Performance Issues sections of this manual for more details.

Problem
How do I restore my catalog?
Solution with a Catalog backup
If you have backed up your database nightly (as you should) and you have made a bootstrap file, you can immediately load back your database (or the ASCII SQL output). Make a copy of your current database, then re-initialize it, by running the following scripts:
   ./drop_bacula_tables
   ./make_bacula_tables
After re-initializing the database, you should be able to run Bacula. If you now try to use the restore command, it will not work because the database will be empty. However, you can manually run a restore job and specify your bootstrap file. You do so by entering the bf run command in the console and selecting the restore job. If you are using the default bacula-dir.conf, this Job will be named RestoreFiles. Most likely it will prompt you with something such as:

Run Restore job
JobName:    RestoreFiles
Bootstrap:  /home/kern/bacula/working/restore.bsr
Where:      /tmp/bacula-restores
Replace:    always
FileSet:    Full Set
Client:     rufus-fd
Storage:    File
When:       2005-07-10 17:33:40
Catalog:    MyCatalog
Priority:   10
OK to run? (yes/mod/no):

A number of the items will be different in your case. What you want to do is: to use the mod option to change the Bootstrap to point to your saved bootstrap file; and to make sure all the other items such as Client, Storage, Catalog, and Where are correct. The FileSet is not used when you specify a bootstrap file. Once you have set all the correct values, run the Job and it will restore the backup of your database, which is most likely an ASCII dump.

You will then need to follow the instructions for your database type to recreate the database from the ASCII backup file. See the Catalog Maintenance chapter of this manual for examples of the command needed to restore a database from an ASCII dump (they are shown in the Compacting Your XXX Database sections).

Also, please note that after you restore your database from an ASCII backup, you do NOT want to do a make_bacula_tables command, or you will probably erase your newly restored database tables.

Solution with a Job listing
If you did save your database but did not make a bootstrap file, then recovering the database is more difficult. You will probably need to use bextract to extract the backup copy. First you should locate the listing of the job report from the last catalog backup. It has important information that will allow you to quickly find your database file. For example, in the job report for the CatalogBackup shown below, the critical items are the Volume name(s), the Volume Session Id and the Volume Session Time. If you know those, you can easily restore your Catalog.

22-Apr 10:22 HeadMan: Start Backup JobId 7510,
Job=CatalogBackup.2005-04-22_01.10.0
22-Apr 10:23 HeadMan: Bacula 1.37.14 (21Apr05): 22-Apr-2005 10:23:06
  JobId:                  7510
  Job:                    CatalogBackup.2005-04-22_01.10.00
  Backup Level:           Full
  Client:                 Polymatou
  FileSet:                "CatalogFile" 2003-04-10 01:24:01
  Pool:                   "Default"
  Storage:                "DLTDrive"
  Start time:             22-Apr-2005 10:21:00
  End time:               22-Apr-2005 10:23:06
  FD Files Written:       1
  SD Files Written:       1
  FD Bytes Written:       210,739,395
  SD Bytes Written:       210,739,521
  Rate:                   1672.5 KB/s
  Software Compression:   None
  Volume name(s):         DLT-22Apr05
  Volume Session Id:      11
  Volume Session Time:    1114075126
  Last Volume Bytes:      1,428,240,465
  Non-fatal FD errors:    0
  SD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Termination:            Backup OK

From the above information, you can manually create a bootstrap file, and then follow the instructions given above for restoring your database. A reconstructed bootstrap file for the above backup Job would look like the following:

Volume="DLT-22Apr05"
VolSessionId=11
VolSessionTime=1114075126
FileIndex=1-1

Where we have inserted the Volume name, Volume Session Id, and Volume Session Time that correspond to the values in the job report. We've also used a FileIndex of one, which will always be the case providing that there was only one file backed up in the job.

The disadvantage of this bootstrap file compared to what is created when you ask for one to be written, is that there is no File and Block specified, so the restore code must search all data in the Volume to find the requested file. A fully specified bootstrap file would have the File and Blocks specified as follows:

Volume="DLT-22Apr05"
VolSessionId=11
VolSessionTime=1114075126
VolFile=118-118
VolBlock=0-4053
FileIndex=1-1

Once you have restored the ASCII dump of the database, you will then to follow the instructions for your database type to recreate the database from the ASCII backup file. See the Catalog Maintenance chapter of this manual for examples of the command needed to restore a database from an ASCII dump (they are shown in the Compacting Your XXX Database sections).

Also, please note that after you restore your database from an ASCII backup, you do NOT want to do a make_bacula_tables command, or you will probably erase your newly restored database tables.

Solution without a Job Listing
If you do not have a job listing, then it is a bit more difficult. Either you use the bscan program to scan the contents of your tape into a database, which can be very time consuming depending on the size of the tape, or you can use the bls program to list everything on the tape, and reconstruct a bootstrap file from the bls listing for the file or files you want following the instructions given above.

There is a specific example of how to use bls below.

Problem
I try to restore the last known good full backup by specifying item 3 on the restore menu then the JobId to restore. Bacula then reports:

   1 Job 0 Files
and restores nothing.

Solution
Most likely the File records were pruned from the database either due to the File Retention period expiring or by explicitly purging the Job. By using the "llist jobid=nn" command, you can obtain all the important information about the job:

llist jobid=120
           JobId: 120
             Job: save.2005-12-05_18.27.33
        Job.Name: save
     PurgedFiles: 0
            Type: B
           Level: F
    Job.ClientId: 1
     Client.Name: Rufus
       JobStatus: T
       SchedTime: 2005-12-05 18:27:32
       StartTime: 2005-12-05 18:27:35
         EndTime: 2005-12-05 18:27:37
        JobTDate: 1133803657
    VolSessionId: 1
  VolSessionTime: 1133803624
        JobFiles: 236
       JobErrors: 0
 JobMissingFiles: 0
      Job.PoolId: 4
       Pool.Name: Full
   Job.FileSetId: 1
 FileSet.FileSet: BackupSet

Then you can find the Volume(s) used by doing:

sql
select VolumeName from JobMedia,Media where JobId=1 and JobMedia.MediaId=Media.MediaId;

Finally, you can create a bootstrap file as described in the previous problem above using this information.

If you are using Bacula version 1.38.0 or greater, when you select item 3 from the menu and enter the JobId, it will ask you if you would like to restore all the files in the job, and it will collect the above information and write the bootstrap file for you.

Problem
You don't have a bootstrap file, and you don't have the Job report for the backup of your database, but you did backup the database, and you know the Volume to which it was backed up.

Solution
Either bscan the tape (see below for bscanning), or better use bls to find where it is on the tape, then use bextract to restore the database. For example,

./bls -j -V DLT-22Apr05 /dev/nst0
Might produce the following output:
bls: butil.c:258 Using device: "/dev/nst0" for reading.
21-Jul 18:34 bls: Ready to read from volume "DLT-22Apr05" on device "DLTDrive"
(/dev/nst0).
Volume Record: File:blk=0:0 SessId=11 SessTime=1114075126 JobId=0 DataLen=164
...
Begin Job Session Record: File:blk=118:0 SessId=11 SessTime=1114075126
JobId=7510
   Job=CatalogBackup.2005-04-22_01.10.0 Date=22-Apr-2005 10:21:00 Level=F Type=B
End Job Session Record: File:blk=118:4053 SessId=11 SessTime=1114075126
JobId=7510
   Date=22-Apr-2005 10:23:06 Level=F Type=B Files=1 Bytes=210,739,395 Errors=0
Status=T
...
21-Jul 18:34 bls: End of Volume at file 201 on device "DLTDrive" (/dev/nst0),
Volume "DLT-22Apr05"
21-Jul 18:34 bls: End of all volumes.
Of course, there will be many more records printed, but we have indicated the essential lines of output. From the information on the Begin Job and End Job Session Records, you can reconstruct a bootstrap file such as the one shown above.

Problem
How can I find where a file is stored.
Solution
Normally, it is not necessary, you just use the restore command to restore the most recently saved version (menu option 5), or a version saved before a given date (menu option 8). If you know the JobId of the job in which it was saved, you can use menu option 3 to enter that JobId.

If you would like to know the JobId where a file was saved, select restore menu option 2.

You can also use the query command to find information such as:

*query
Available queries:
     1: List up to 20 places where a File is saved regardless of the
directory
     2: List where the most recent copies of a file are saved
     3: List last 20 Full Backups for a Client
     4: List all backups for a Client after a specified time
     5: List all backups for a Client
     6: List Volume Attributes for a selected Volume
     7: List Volumes used by selected JobId
     8: List Volumes to Restore All Files
     9: List Pool Attributes for a selected Pool
    10: List total files/bytes by Job
    11: List total files/bytes by Volume
    12: List Files for a selected JobId
    13: List Jobs stored on a selected MediaId
    14: List Jobs stored for a given Volume name
    15: List Volumes Bacula thinks are in changer
    16: List Volumes likely to need replacement from age or errors
Choose a query (1-16):

Problem
I didn't backup my database. What do I do now?
Solution
This is probably the worst of all cases, and you will probably have to re-create your database from scratch and then bscan in all your Volumes, which is a very long, painful, and inexact process.

There are basically three steps to take:

  1. Ensure that your SQL server is running (MySQL or PostgreSQL) and that the Bacula database (normally bacula) exists. See the Installation chapter of the manual.
  2. Ensure that the Bacula databases are created. This is also described at the above link.
  3. Start and stop the Bacula Director using the propriate bacula-dir.conf file so that it can create the Client and Storage records which are not stored on the Volumes. Without these records, scanning is unable to connect the Job records to the proper client.

When the above is complete, you can begin bscanning your Volumes. Please see the bscan section of the Volume Utility Tools of this chapter for more details.


GUI Programs

This document briefly describes the GUI programs that work with Bacula. The GUI programs that are currently available are:

bimagemgr
Bimagemgr is a web based interface written in Perl that monitors disk Volumes intended to be written to CDROM.

For more information on bimagemgr, please see below.

wx-console
wx-console is a graphical console interface written in wxWidgets and available on all client platforms. wx-console allows you to do anything you can do in the standard tty console and in addition has a graphic tree based point and click restore feature.

gnome-console
The gnome-console is a graphical console interface available on systems that support Gnome 2.x. Although it runs in its own graphical window and permits all the standard console commands, it has almost no additional graphical features implemented.

For more information on gnome-console, please consult the Console Chapter of this manual.

tray-monitor
The tray-monitor is a daemon monitoring program that resides in the system tray on Gnome and KDE systems. It is a monitor program that will show you the status of any daemon. It is not a program for interfacing to the console.

For more information, please see Configuring the Monitor Program chapter this manual.

bacula-web
Bacula-web is a php based web program that provides you a summarized output of jobs that have already run. It obtains its information from your catalog database. Aside from a nice graphical display, it provides summaries of your jobs, as well as graphs of job usage. This is a fairly high level bacula management tool.


bimagemgr

bimagemgr is a utility for those who backup to disk volumes in order to commit them to CDR disk, rather than tapes. It is a web based interface written in Perl and is used to monitor when a volume file needs to be burned to disk. It requires:

SQLite databases and DVD burning are not supported by bimagemgr at this time, but both are planned for future releases.

bimagemgr installation

Please see the README file in the bimagemgr directory of the distribution for instructions.

bimagemgr usage

Calling the program in your web browser, e.g. http://localhost/cgi-bin/bimagemgr.pl will produce a display as shown below in Figure 1. The program will query the bacula database and display all volume files with the date last written and the date last burned to disk. If a volume needs to be burned (last written is newer than last burn date) a "Burn" button will be displayed in the rightmost column.

\includegraphics{./bimagemgr1.eps}
Figure 1

Place a blank CDR disk in your recorder and click the "Burn" button. This will cause a pop up window as shown in Figure 2 to display the burn progress.

\includegraphics{./bimagemgr2.eps}
Figure 2

When the burn finishes the pop up window will display the results of cdrecord as shown in Figure 3. Close the pop up window and refresh the main window. The last burn date will be updated and the "Burn" button for that volume will disappear. Should you have a failed burn you can reset the last burn date of that volume by clicking its "Reset" link.

\includegraphics{./bimagemgr3.eps}
Figure 3

In the bottom row of the main display window are two more buttons labeled "Burn Catalog" and "Blank CDRW". "Burn Catalog" will place a copy of your bacula catalog on a disk. If you use CDRW disks rather than CDR then "Blank CDRW" allows you to erase the disk before re-burning it. Regularly committing your backup volume files and your catalog to disk with bimagemgr ensures that you can rebuild easily in the event of some disaster on the bacula server itself.


bimagemgr

bimagemgr ist ein Hilfsmittel für diejenigen, die Ihre Backups auf Festplatten-Volumes speichern und diese Volumes auf CDR brennen wollen. Es hat eine Web-basierte Bedienoberfläche und ist in Perl programmiert. Es wird benutzt, um zu kontrollieren, wann die Notwendigkeit besteht, eine Volume-Datei auf eine CD zu brennen. Es benötigt:

DVD-Brenner werden von bimagemgr zur Zeit nicht unterstützt, das ist aber für zukünftige Versionen geplant.

bimagemgr Installation

Installation aus dem tar.gz: 1. Prüfen und anpassen des Makefile, um es auf Ihre Computer-Konfiguration abzustimmen. 2. Editieren der Datei config.pm ,um sie auf Ihre Konfiguration abzustimmen. 3. Führen Sie 'make install' als root aus. 4. Passen Sie in Ihrer httpd.conf das Timeout an. Der Web-Server darf die Verbindung nicht schliessen, solange der Brennvorgang nicht abgeschlossen ist. Der benötigte Wert, den Sie als Timeout konfigurieren müssen, hängt von der Geschwindigkeit Ihres CD-Brenners ab, oder ob Sie über das Netzwerk brennen. In den meisten Fällen reichen 1000 Sekunden als Timeout. Den httpd neu starten. 5. Stellen Sie sicher, dass das Kommando cdrecord als "setuid root" installiert ist.

Installation eines rpm-Paketes: 1. Installieren Sie das rpm-Paket für Ihre Plattform. 2. Editieren Sie die Datei /cgi-bin/config.pm, um sie an Ihre Konfiguration abzupassen. 3. Passen Sie in Ihrer httpd.conf das Timeout an. Der Web-Server darf die Verbindung nicht schliessen, solange der Brennvorgang nicht abgeschlossen ist. Der benötigte Wert, den Sie als Timeout konfigurieren müssen, hängt von der Geschwindigkeit Ihres CD-Brenners ab, oder ob Sie über das Netzwerk brennen. In den meisten Fällen reichen 1000 Sekunden als Timeout. Den httpd neu starten. 4. Stellen Sie sicher, dass das Kommando cdrecord als "setuid root" installiert ist.

Zugriff auf die Volume-Dateien: Die Volume-Dateien haben standardmäßig die Zugriffsrechte 640 gesetzt und können nur von Benutzer root gelesen werden. Die empfohlene Methode ist die folgende (das funktioniert nur, wenn bacula und bimagemgr auf demselben Computer laufen wie der Web-Server):

Für Bacula-Versionen 1.34 oder 1.36 installiert aus dem tar.gz - 1. Erstellen Sie eine neu Gruppe namens bacula und fügen Sie den Benutzer apache dieser Gruppe hinzu (bei RedHat und Mandrake, bei SuSE ist es der Benutzer wwwrun, bei debian www-data) 2. Ändern Sie den Eigentümer aller Volume-Dateien auf root.bacula. 3. Passen Sie das Script /etc/init.d/bacula an und setzen Sie SD_USER=root und SD_GROUP=bacula. Starten Sie Bacula neu.

Anmerkung: Schritt Nr. 3 sollte auch in /etc/init.d/bacula-sd gemacht werden, aber die Dateien aus Bacula-Versionen vor 1.36 unterstützen dies nicht. In diesem Fall kann es nötig sein den Computer neu zu starten, um '/etc/bacula/bacula restart' auszuführen.

Für Bacula-Versionen 1.38 installiert aus dem tar.gz 1. Ihr configure-Aufruf sollte dies beinhalten: --with-dir-user=bacula --with-dir-group=bacula --with-sd-user=bacula --with-sd-group=disk --with-fd-user=root --with-fd-group=bacula 2. Fügen Sie den Benutzer apache der Gruppe bacula hinzu (bei RedHat und Mandrake, bei SuSE ist es der Benutzer wwwrun, bei debian www-data) 3. Kontrollieren/Ändern Sie den Eigentümer aller Volume-Dateien auf root.bacula

Für Bacul-Versionen 1.36 oder 1.38 mit rpm installiert - 1. Fügen Sie den Benutzer apache der Gruppe bacula hinzu (bei RedHat und Mandrake, bei SuSE ist es der Benutzer wwwrun, bei debian www-data) 2. Kontrollieren/Ändern Sie den Eigentümer aller Volume-Dateien auf root.bacula

Wenn bimagemgr mit einem rpm-Paket Version größer 1.38.9 installiert wird, wird der Web-Server-Benutzer automatisch der Gruppe bacula hinzugefügt. Stellen Sie sicher, dass Sie die Datei config.pm nach der Installation anpassen.

bimagemgr kann jetzt alle Volume-Dateien lesen, aber sie sind nicht durch alle Benutzer lesbar.

Wenn Sie bimagemgr auf einen anderen Computer installieren (nicht empfohlen), müssen Sie die Zugriffsrechte aller Volume-Dateien auf 644 ändern, damit Sie über nfs oder andere Mittel darauf zugreifen können. Beachten Sie, dass bei diesem Vorgehen die Volume-Dateien für alle Benutzer lesbar sind und Sie den Schutz der Dateien anders sicherstellen.

bimagemgr Benutzung

Rufen Sie das Programm mit Ihrem Web-Browser auf, z.B. http://localhost/cgi-bin/bimagemgr.pl, dann sollten Sie eine Darstellung ähnlich der unten im Bild 1 abgebildeten sehen. Das Programm wird die Bacula-Datenbank abfragen und alle Volume-Dateien mit dem Datum des letzten Schreibvorgangs und dem Zeitpunkt darstellen, wo das Volume zum letzten Mal auf CD gebrannt wurde. Wenn ein Volume auf CD gebrannt werden muss (letzter Schreibvorgang ist neuer als der letzte Brennvorgang), wird ein "Brennen"-Knopf in der rechten Spalte angezeigt.

\includegraphics{./bimagemgr1.eps}
Figure 1

Legen Sie eine leere CD in Ihren CD-Brenner und klicken Sie auf den "Brennen"-Knopf. Dann öffnet sich ein PopUp-Fenster, wie im Bild 2, das den Brennvorgang anzeigt.

\includegraphics{./bimagemgr2.eps}
Figure 2

Wenn der Brennvorgang abgeschloßen ist, zeigt das PopUp-Fenster die Ausgaben von cdrecord an (siehe Bild 3). Schließen Sie das PopUp-Fenster und laden Sie die Hauptseite neu. Das Datum des letzten Brennvorgangs wird aktualisiert und der "Brennen"-Knopf verschwindet. Sollte das Brennen fehlgeschlagen sein, können Sie das Datum des letzten Brennvorgangs zurücksetzen, indem Sie auf den Link "Reset" des Volumes klicken.

\includegraphics{./bimagemgr3.eps}
Figure 3

In der untersten Zeile des Hauptfensters sind zwei weitere Knöpfe, mit "Burn Catalog" und "Blank CDRW" beschriftet. "Burn Catalog" schreibt eine Kopie Ihrer Katalog-Datenbank auf eine CD. Falls Sie CDRW-Medien benutzen, können Sie mit "Blank CDRW" ein Medium löschen bevor Sie es wiederverwenden. Regelmässiges speichern Ihrer Volume-Dateien und Ihrer Katalog-Datenbank mit bimagemgr auf CD's stellt sicher, dass Sie jederzeit im Falle eines Datenverlustes auf Ihrem Bacula-Server diesen einfach wiederherstellen können.


Katalog Verwaltung

Ohne eine ordnungsgemäße Einrichtung und Verwaltung kann es sein, dass Ihr Katalog immer größer wird wenn Jobs laufen und Daten gesichert werden. Zudem kann der Katalog ineffizient und langsam werden. Wie schnell der Katalog wächst, hängt von der Anzahl der Jobs und der Menge der dabei gesicherten Dateien ab. Durch das Löschen von Einträgen im Katalog kann Platz geschaffen werden für neue Einträge der folgenden Jobs. Durch regelmäßiges löschen alter abgelaufener Daten (älter als durch die Aufbewahrungszeiträume (Retention Periods) angegeben), wird dafür gesorgt, dass die Katalog-Datenbank eine konstante Größe beibehält.

Sie können mit der vorgegebenen Konfiguration beginnen, sie enthält bereits sinnvolle Vorgaben für eine kleine Anzahl von Clients (kleiner 5), in diesem Fall wird die Katalogwartung, wenn Sie einige hundert Megabyte freien Plattenplatz haben, nicht dringlich sein. Was aber auch immer der Fall ist, einiges Wissen über die Retention Periods/Aufbewahrungszeiträume der Daten im Katalog und auf den Volumes ist hilfreich.


Einstellung der Aufbewahrungszeiträume

Bacula benutzt drei verschiedene Aufbewahrungszeiträume: die File Retention: der Aufbewahrungszeitraum für Dateien, die Job Retention: der Aufbewahrungszeitraum für Jobs und die Volume Retention: der Aufbewahrungszeitraum für Volumes. Von diesen drei ist der Aufbewahrungszeitraum für Dateien der entscheidende, wenn es darum geht, wie groß die Datenbank werden wird.

Die File Retention und die Job Retention werden in der Client-Konfiguration, wie unten gezeigt, angegeben. Die Volume Retention wird in der Pool-Konfiguration angegeben, genauere Informationen dazu finden Sie im nächsten Kapitel dieses Handbuchs.

File Retention = <time-period-specification>
Der Aufbewahrungszeitraum für Dateien gibt die Zeitspanne an, die die Datei-Einträge in der Katalog-Datenbank aufbewahrt werden. Wenn AutoPrune in der Client-Konfiguration auf yes gesetzt ist, wird Bacula die Katalog-Einträge der Dateien löschen, die älter als dieser Zeitraum sind. Das Löschen erfolgt nach Beendigung eines Jobs des entsprechenden Clients. Bitte beachten Sie, dass die Client-Datenbank-Einträge eine Kopie der Aufbewahrungszeiträume für Dateien und Jobs enthalten, Bacula aber die Zeiträume aus der aktuellen Client-Konfiguration des Director-Dienstes benutzt um alte Katalog-Einträge zu löschen.

Da die Datei-Einträge ca. 80 Prozent der Katalog-Datenbankgröße ausmachen, sollten Sie sorgfälltig ermitteln über welchen Zeitraum Sie die Einträge aufbewahren wollen. Nachdem die Datei-Einträge gelöscht wurden, ist es nicht mehr möglich einzelne dieser Dateien mit einem Rücksicherungs-Job wiederherzustellen, aber die Bacula-Versionen 1.37 und später sind in der Lage, aufgrund des Job-Eintrags im Katalog, alle Dateien des Jobs zurückzusichern solange der Job-Eintrag im Katalog vorhanden ist.

Aufbewahrungszeiträume werden in Sekunden angegeben, aber der Einfachheit halber sind auch eine Reihe von Hilfsangaben möglich, so dass man Minuten, Stunden, Tage, Wochen, Monate, Quartale und Jahre konfigurieren kann. Lesen Sie bitte das Konfigurations-Kapitel dieses Handbuchs um mehr über diese Hilfsangaben zu erfahren.

Der Standardwert der Aufbewahrungszeit für Dateien ist 60 Tage.

Job Retention = <time-period-specification>
Der Aufbewahrungszeitraum für Jobs gibt die Zeitspanne an, die die Job-Einträge in der Katalog-Datenbank aufbewahrt werden. Wenn AutoPrune in der Client-Konfiguration auf yes gesetzt ist, wird Bacula die Katalog-Einträge der Jobs löschen, die älter als dieser Zeitraum sind. Beachten Sie, dass wenn ein Job-Eintrag gelöscht wird, auch alle zu diesem Job gehörenden Datei- und JobMedia-Einträge aus dem Katalog gelöscht werden. Dies passiert unabhängig von der Aufbewahrungszeit für Dateien, infolge dessen wird die Aufbewahrungszeit für Dateien normalerweise kürzer sein als für Jobs.

Wie oben erwähnt, sind Sie nicht mehr in der Lage einzelne Dateien eines Jobs zurückzusichern, wenn die Datei-Einträge aus der Katalog-Datenbank entfernt wurden. Jedoch, solange der Job-Eintrag im Katalog vorhanden ist, können Sie immer noch den kompletten Job mit allen Dateien wiederherstellen (ab Bacula-Version 1.37 und größer). Daher ist es eine gute Idee, die Job-Einträge im Katalog länger als die Datei-Einträge aufzubewahren.

Aufbewahrungszeiträume werden in Sekunden angegeben, aber der Einfachheit halber sind auch eine Reihe von Hilfsangaben möglich, so dass man Minuten, Stunden, Tage, Wochen, Monate, Quartale und Jahre konfigurieren kann. Lesen Sie bitte das Konfigurations-Kapitel dieses Handbuchs um mehr über diese Hilfsangaben zu erfahren.

Der Standardwert der Aufbewahrungszeit für Jobs ist 180 Tage.

AutoPrune = <yes/no>
Wenn AutoPrune auf yes (Standard) gesetzt ist, wird Bacula nach jedem Job automatisch überprüfen, ob die Aufbewahrungszeit für bestimmte Dateien und/oder Jobs des gerade gesicherten Clients abgelaufen ist und diese aus dem Katalog entfernen. Falls Sie AutoPrune durch das Setzen auf no ausschalten, wird Ihre Katalog-Datenbank mit jedem gelaufenen Job immer größer werden.

Komprimieren Ihrer MySQL Datenbank

Mit der Zeit, wie oben schon angemerkt, wird Ihre Datenbank dazu neigen zu wachsen. Auch wenn Bacula regelmäßig Datei-Einträge löscht, wird die MySQL-Datenbank ständig größer werden. Um dies zu vermeiden, muss die Datenbank komprimiert werden. Normalerweise kennen große kommerzielle Datenbanken, wie Oracle, bestimmte Kommandos um den verschwendeten Festplattenplatz wieder freizugeben. MySQL hat das OPTIMIZE TABLE Kommando und bei SQLite (Version 2.8.4 und größer) können Sie das VACUUM Kommando zu diesem Zweck benutzen. Wir überlassen es Ihnen, die Nützlichkeit von OPTIMIZE TABLE oder VACUUM zu ermitteln.

Alle Datenbanken haben Hilfsmittel, um die enthaltenen Daten im ASCII-Format in eine Datei zu schreiben und diese Datei dann auch wieder einzulesen. Wenn man das tut, wird die Datenbank erneut erzeugt, was ein sehr kompaktes Datenbank-Format als Ergebnis hat. Weiter unten zeigen wir Ihnen, wie Sie das bei MySQL, SQLite und PostgreSQL durchführen können.

Bei einer MySQL Datenbank können Sie den Inhalt der Katalog-Datenbank mit den folgenden Kommandos in eine ASCII-Datei (bacula.sql) schreiben und neu in die Datenbank importieren:

mysqldump -f --opt bacula > bacula.sql
mysql bacula < bacula.sql
rm -f bacula.sql

Abhängig von der Größe Ihrer Datenbank, wird dies mehr oder weniger Zeit und auch Festplattenplatz benötigen. Zum Beispiel, wenn ich in das Verzeichnis wechsle, wo meine MySQL-Datenbank liegt (typischerweise /var/lib/mysql) und dieses Kommando ausführe:

du bacula

bekomme ich die Ausgabe 620,644, was bedeutet dass das Verzeichnis bacula 620.644 Blöcke von 1024 Bytes auf der Festplatte belegt, meine Datenbank enthält also ca. 635 MB an Daten. Nachdem ich das mysqldump ausgeführt habe, ist die dabei entstandene Datei bacula.sql 174.356 Blöcke groß, wenn diese Datei mit dem Kommando mysql bacula < bacula.sql wieder in die Datenbank importiert wird, ergibt sich eine Datenbankgröße von nur noch 210.464 Blöcken. Mit anderen Worten, die komprimierte Version meiner Datenbank, die seit ca. 1 Jahr in Benutzung ist, ist ungefähr nur noch ein Drittel so groß wie vorher.

Als Konsequenz wird empfohlen, auf die Größe der Datenbank zu achten und sie von Zeit zu Zeit (alle sechs Monate oder jährlich) zu komprimieren.

Reparatur Ihrer MySQL Datenbank

Wenn Sie bemerken, dass das Schreiben der MySQL-Datenbank zu Fehlern führt, oder das der Director-Dienst hängt, wenn er auf die Datenbank zugreift, sollten Sie sich die MySQL Datenbanküberprüfungs- und Reparaturprogramme ansehen. Welches Programm Sie laufen lassen sollten, hängt mit der von Ihnen benutzten Datenbank- Indizierung zusammen. Wenn Sie das Standardverfahren nutzen, werden Sie vermutlich myisamchk laufen lassen. Fär nähere Information lesen Sie bitte auch: http://dev.mysql.com/doc/refman/5.1/de/client-utility-programs.html.

Falls die auftretenden Fehler einfache SQL-Warnungen sind, sollten Sie zuerst das von Bacula mitgelieferte dbcheck-Programm ausführen, bevor Sie die MySQL-Datenbank-Reparaturprogramme nutzen. Dieses Programm kann verwaiste Datenbankeinträge finden und andere Inkonsistenzen in der Katalog-Datenbank beheben.

Eine typische Ursache von Datenbankproblemen ist das Volllaufen einer Partition. In solch einem Fall muss entweder zusätzlicher Platz geschaffen werden, oder belegter Platz freigegeben werden, bevor die Datenbank mit myisamchk repariert werden kann.

Hier ist ein Beispiel, wie man eine korrupte Datenbank reparieren könnte, falls nach dem Vollaufen einer Partition die Datenbankprobleme mit myisamchk -r nicht behoben werden können:

kopieren Sie folgende Zeilen in ein Shell-Script names repair:

#!/bin/sh
for i in *.MYD ; do
  mv $i x${i}
  t=`echo $i | cut -f 1 -d '.' -`
  mysql bacula <<END_OF_DATA
set autocommit=1;
truncate table $t;
quit
END_OF_DATA
  cp x${i} ${i}
  chown mysql:mysql ${i}
  myisamchk -r ${t}
done

dieses Shell-Script, wird dann wie folgt aufgerufen:

cd /var/lib/mysql/bacula
./repair

nachdem sichergestellt ist, dass die Datenbank wieder korrekt funktioniert, kann man die alten Datenbank-Dateien löschen:

cd /var/lib/mysql/bacula
rm -f x*.MYD

MySQL-Tabelle ist voll

Falls ein Fehler wie The table 'File' is full ... auftritt, passiert das vermutlich, weil bei den MySQL-Versionen 4.x die Tabellengröße standardmäßig auf 4 GB begrenzt ist und Sie dieses Limit erreicht haben. Hinweise zu der maximal möglichen Tabellengröße gibt es auf http://dev.mysql.com/doc/refman/5.1/de/table-size.html

Sie können sich die maximale Tabellengröße mit:

mysql bacula
SHOW TABLE STATUS FROM bacula like "File";

anzeigen lassen. Wenn die Spalte max_data_length ca. 4 GB entspricht, dann ist dass das Problem. Sie können die maximale Größe aber mit:

mysql bacula
ALTER TABLE File MAX_ROWS=281474976710656;

anpassen. Alternativ können Sie auch die /etc/my.cnf editieren, bevor Sie die Bacula-Tabellen erstellen, setzen Sie im Abschnitt [mysqld]:

set-variable = myisam_data_pointer_size=6

Die myisam Data-Pointer-Größe muss vor dem Anlegen der Bacula-Katalog-Datenbank oder ihrer Tabellen gesetzt werden, um wirksam zu sein.

Die MAX_ROWS und Pointer-Anpassungen sollten bei MySQL-Versionen größer 5.x nicht nötig sein, somit sind diese Änderungen nur bei MySQL 4.x, in Abhägigkeit von Ihrer Katalog-Datenbank-Größe, notwendig.

MySQL-Server Has Gone Away-Fehler

Fall Sie Probleme damit haben, dass Ihr MySQL-Server nicht mehr erreichbar ist, oder Meldungen wie "MySQL server has gone away" erscheinen, dann lesen Sie bitte die MySQL-Dokumentation auf:

http://dev.mysql.com/doc/refman/5.1/de/gone-away.html

Reparatur Ihrer PostgreSQL Datenbank

Dieselben Überlegungen, wie oben für MySQL angeführt, sind auch hier gültig. Lesen Sie die PostgreSQL-Dokumentation um zu erfahren, wie Sie Ihre Datenbank reparieren können. Erwägen Sie auch den Einsatz von Bacula's dbcheck-Programm, falls es sinnvoll erscheint (siehe oben).

Datenbank-Leistung

Es gibt viele Wege, die verschiedenen von Bacula unterstützten Datenbanken abzustimmen, um ihre Leistung zu erhöhen. Zwischen einer schlecht und gut abgestimmten Datenbank kann ein Geschwindigkeitsunterschied von 100 und mehr liegen, wenn es darum geht Datenbankeinträge zu schreiben oder zu suchen.

Bei jeder der Datenbanken, können Sie erhebliche Verbesserungen erwarten, wenn Sie weitere Indexe hinzufügen. Die Kommentare in den Bacula make_xxx_tables-Scripts (z.B. make_postgres_tables) geben einige Hinweise, wofür Indexe geeignet sind. Sehen Sie bitte auch unten für genaue Informationen, wie Sie Ihre Indexe überprüfen können.

Für MySQL ist es sehr wichtig, die my.cnf-Datei durchzusehen (gwöhnlich /etc/my.cnf) Eventuell können Sie die Leistung wesentlich erhöhen, wenn Sie die Konfigurationsdateien my-large.cnf oder my-huge.cnf aus dem MySQL-Quellcode verwenden.

Für SQLite3 ist ein wichtiger Punkt, dass in der Konfiguration die Angabe "PRAGMA synchronous = NORMAL;" vorhanden ist. Dadurch werden die Zeitabstände vergrößert, in denen die Datenbank ihren RAM-Zwischenspeicher auf die Festplatte schreibt. Es gibt noch andere Einstellungen für PRAGMA die die Effizienz steigern können, aber auch das Risiko einer Datenbankbeschädigung beim Absturz des Systems erhöhen.

Bei PostgreSQL sollten Sie eventuell in Betracht ziehen "fsync'' abzuschalten, aber auch das kann bei Systemabstürzen zu Datenbankprobleme führen. Es gibt viele Wege die Leistungsfähigkeit von PostgreSQL zu steigern, diese Internetseiten erklären ein paar von ihnen (auf englisch): http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html.

Auch in den PostgreSQL FAQ's finden sich Hinweise die Performanz zu verbessern: http://www.postgresql.org/docs/faqs.FAQ.html.

Bei PostgreSQL sollten Sie auch auf die "effective_cache_size" achten. Für ein System mit 2GB Arbeitsspeicher können Sie sie auf 131072 setzen, aber setzen Sie sie nicht zu hoch. Zusätzlich sind "work_mem = 256000" und "maintenance_work_mem = 256000", für Systeme mit 2GB Speicher, sinnvolle Werte. Stellen Sie sicher das "checkpoint_segments" auf mindestens 8 gesetzt ist.

Datenbank-Leistung und Indexe

Eine der wichtigsten Aspekte die Leistungsfähigkeit der Bacula-Datenbank sicherzustellen ist zu überprüfen, ob alle Indexe richtig sind. Mehrere Benutzer haben angemerkt, dass ihre Datenbank in der Standardkonfiguration nicht alle notwendigen Indexe hatte. Auch werden Sie eventuell, abhängig von Ihrem Anwendungszweck, zusätzlich Indexe benötigen.

Die wichtigsten Indexe für eine schnelle Datenbank sind die drei Indexe auf der File-Tabelle. Der erste Index ist auf der FileId und wird automatisch anglegt, da es der eindeutige Schlüssel ist, um auf die Tabelle zuzugreifen. Die anderen beiden sind der JobId-Index und der Filename, PathId-Index. Wenn einer dieser Indexe fehlt, verliert Ihre Datenbank enorm an Performance.

PostgreSQL Indexe

Bei PostgreSQL können Sie mit dem folgenden Kommandos überprüfen ob Sie alle Indexe haben:

psql bacula
select * from pg_indexes where tablename='file';

Wenn Sie keine Ausgaben sehen die anzeigen das alle drei Indexe vorhanden sind, können Sie die beiden zusätzlichen Indexe mit:

psql bacula
CREATE INDEX file_jobid_idx on file (jobid);
CREATE INDEX file_fp_idx on file (filenameid, pathid);

anlegen.

MySQL Indexes

Bei MySQL können Sie die Indexe mit:

mysql bacula
show index from File;

überprüfen. Wenn Indexe fehlen, besonders der JobId-Index, kann er mit:

mysql bacula
CREATE INDEX file_jobid_idx on File (JobId);
CREATE INDEX file_jpf_idx on File (Job, FilenameId, PathId);

erzeugt werden.

Obgleich das normalerweise kein Problem darstellt, sollten Sie sicherstellen, dass Ihre Indexe für Filename und PathId beide auf 255 Zeichen gesetzt sind. Einige Benutzer berichten von Problemen mit Indexen die auf 50 Zeichen gesetzt sind. Um das zu kontrollieren, führen Sie:

mysql bacula
show index from Filename;
show index from Path;

aus. Fü die Dateinamen ist es wichtig, dass Sie einen Index haben mit dem Key_name "Name" und dem Sub_part "255". Fü den Pfad müssen Sie einen Index mit dem Key_name "Path" und dem Sub_part "255" haben. Wenn einer der Indexe nicht existiert oder der Sub_part kleiner 255 ist, können Sie den Index neu anlegen indem Sie die folgende Kommandos benutzen:

mysql bacula
DROP INDEX Path on Path;
CREATE INDEX Path on Path (Path(255);

DROP INDEX Name on Filename;
CREATE INDEX Name on Filename (Name(255));

SQLite Indexes

Bei SQLite können Sie so die Indexe überprüfen:

sqlite <path>bacula.db
select * from sqlite_master where type='index' and tbl_name='File';

Falls ein Index fehlt, im besonderen der JobId-Index, können Sie ihn mit den folgenden Befehlen erstellen:

mysql bacula
CREATE INDEX file_jobid_idx on File (JobId);
CREATE INDEX file_jfp_idx on File (Job, FilenameId, PathId);

Komprimieren Ihrer PostgreSQL Datenbank

Über die Zeit, wie schon oben angemerkt, wird Ihre Datenbank wachsen. Auch wenn Bacula regelmäßig alte Daten löscht, wird das PostgreSQL Kommando VACUUM Ihnen helfen die Datenbank zu komprimieren. Alternativ wollen Sie eventuell das vacuumdb-Kommando nutzen, das vom cron-Dienst gestartet werden kann.

Alle Datenbanken haben Hilfsmittel, um die Daten in eine ASCII-Datei zu schreiben um sie dann erneut einzulesen. Wenn Sie das tun, wird die Datenbank komplett neu aufgebaut und so eine kompaktere Version entstehen. Wie Sie so etwas tun können, zeigt Ihnen das folgende PostgreSQL Beispiel.

Bei einer PostgreSQL-Datenbank lassen Sie die Daten in eine ASCII-Datei schreiben und neu einlesen, wenn Sie diese Kommandos ausführen:

pg_dump -c bacula > bacula.sql
cat bacula.sql | psql bacula
rm -f bacula.sql

Abhägig von Ihrer Datenabnkgröße wird dieser Vorgang mehr oder weniger Zeit und Festplattenplatz in Anspruch nehmen. Sie sollten vorher in das Arbeitsverzeichnis Ihrer Datenbank wechseln (typischerweise /var/lib/postgres/data) und die Größe überprüfen.

Bestimmte PostgreSQL-Nutzer empfehlen nicht die oben genannte Prozedur, sie sind der Meinung: bei PostgreSQL ist es nicht notwendig, die Daten zu exportieren um sie dann wieder einzulesen. Das normale Ausführen des VACUUM-Kommandos reicht, um die Datenbank performant zu halten. Wenn Sie es ganz genau machen wollen, benutzen Sie speziellen Kommandos VACUUM FULL, REINDEX und CLUSTER um sich den Umweg über das exportieren und wiedereinlesen der Daten zu ersparen.

Zum Schluß wollen Sie vielleicht noch einen Blick auf die zugehörige PostgreSQL-Dokumentation werfen, Sie finden sie (auf englisch) unter: http://www.postgresql.org/docs/8.2/interactive/maintenance.html.

Komprimieren Ihrer SQLite Datenbank

Lesen Sie bitte zuerst die vorherigen Abschnitte die erklären, warum es erforderlich ist, eine Datenbank zu komprimieren. SQLite-Versionen größer 2.8.4 haben das Vacuum-Kommando um die Datenbank zu komprimieren:

cd {\bf working-directory}
echo 'vacuum;' | sqlite bacula.db

Als Alternative können Sie auch die folgenden Kommandos (auf Ihr System angepasst) benutzen:

cd {\bf working-directory}
echo '.dump' | sqlite bacula.db > bacula.sql
rm -f bacula.db
sqlite bacula.db < bacula.sql
rm -f bacula.sql

Wobei working-directory das Verzeichnis ist, dass Sie in Ihrer Director-Dienst-Konfiguration angegeben haben. Beachten Sie bitte, dass es im Fall von SQLite erforderlich ist, die alte Datenbank komplett zu löschen, bevor die komprimierte Version angelegt werden kann.

Migration von SQLite zu MySQL

Wenn Sie Bacula anfangs mit SQLite zusammen benutzt haben, gibt es später eine Reihe von Gründen, weshalb Sie eventuell auf MySQL umsteigen wollen: SQLite belegt mehr Festplattenplatz für dieselbe Datenmenge als MySQL; falls die Datenbank beschädigt wird, ist es mit SQLite problematischer als bei MySQL oder PostgreSQL, sie wiederherzustellen. Viele Benutzer sind erfolgreich von SQLite auf MySQL umgestiegen, indem sie zuerst die Daten exportiert haben und sie dann mit einem z.B. Perl-Script in ein passendes Format konvertiert haben, um sie in die MySQL-Datenbank zu importieren. Dies ist aber kein sehr einfacher Vorgang.

Sichern Ihrer Bacula Datenbank

Falls jemals der Rechner auf dem Ihre Bacula-Installation läuft abstürzt, und Sie diesen wiederherstellen müssen, wird es einer der ersten Schritte sein, die Datenbank zurückzusichern. Obwohl Bacula fröhlich die Datenbank sichert, wenn sie im FileSet angegeben ist, ist das kein sehr guter Weg, da Bacula die Datenbank ändert, während sie gesichert wird. Dadurch ist die gesicherte Datenbank wahrscheinlich in einem inkonsistenten Zustand. Noch schlimmer ist, dass die Datenbank gesichert wird, bevor Bacula alle Aktualisierungen durchführen kann.

Um diese Problem zu umgehen, müssen Sie die Datenbank sichern nachdem alle Backup-Jobs gelaufen sind. Zusätzlich werden Sie wohl eine Kopie der Datenbank erstellen wollen, während Bacula keine Aktualisierungen vornimmt. Um das zu erreichen, können Sie die beiden Scripte make_catalog_backup und delete_catalog_backup benutzen, die Ihrer Bacula-Version beiliegen. Diese Dateien werden, zusammen mit den anderen Bacula-Scripts, automatisch erzeugt. Das erste Script erzeugt eine ASCII-Kopie Ihrer Datenbank namens bacula.sql in dem Arbeitsverzeichnis, dass Sie in der Konfiguration angegeben haben. Das zweite Script löscht die Datei bacula.sql wieder.

Die grundlegenden Arbeitsschritte damit alles korrekt funktioniert, sind folgende:

Angenommen Sie starten alle Ihre Backup-Jobs nachts um 01:05, können Sie das Catalog-Backup mit der folgenden zusätzlichen Director-Dienst-Konfiguration ausführen lassen:

# Catalog-Datenbank-Backup (nach der n\"{a}chtlichen Sicherung)
Job {
  Name = "BackupCatalog"
  Type = Backup
  Client=rufus-fd
  FileSet="Catalog"
  Schedule = "WeeklyCycleAfterBackup"
  Storage = DLTDrive
  Messages = Standard
  Pool = Default
  # Achtung!!! Das Passwort auf der Kommandozeile zu \"{u}bergeben ist nicht sicher.
  # Lesen Sie bitte die Kommentare in der Datei make_catalog_backup.
  RunBeforeJob = "/home/kern/bacula/bin/make_catalog_backup"
  RunAfterJob  = "/home/kern/bacula/bin/delete_catalog_backup"
  Write Bootstrap = "/home/kern/bacula/working/BackupCatalog.bsr"
}
# Diese Schedule starten das Catalog-Backup nach den anderen Sicherungen
Schedule {
  Name = "WeeklyCycleAfterBackup
  Run = Level=Full sun-sat at 1:10
}
# Das FileSet f\"{u}r die ASCII-Kopie der Datenbank
FileSet {
  Name = "Catalog"
  Include {
    Options {
      signature=MD5
    }
    File = \lt{}working_directory\gt{}/bacula.sql
  }
}

Stellen Sie sicher, dass, wie in dem Beispiel, eine Bootstrap-Datei geschrieben wird. Bevorzugterweise wird eine Kopie dieser Bootstrap-Datei auf einem andern Computer gespeichert. Dies erlaubt eine schnelle Wiederherstellung der Datenbank, falls erforderlich. Wenn Sie keine Bootstrap-Datei haben, ist es trotzdem möglich, erfordert aber mehr Arbeit und dauert länger.

Sicherheitsaspekte

Das Script make_catalog_backup wird als Beispiel bereitgestellt, wie Sie Ihre Bacula Datenbank sichern können. Wir erwarten das Sie, entsprechend Ihrer Situation, Vorsichtsmaßnahmen treffen. make_catalog_backup ist so ausgelegt, dass das Passwort auf der Kommandozeile übergeben wird. Das ist in Ordnung, solange sich nur vertrauenswürdige Benutzer am System anmelden können, ansonsten ist es inakzeptabel. Die meisten Datenbanksysteme bieten eine alternative Methode an, um das Passwort nicht auf der Kommandozeile übergeben zu müssen.

Das Script make_catalog_backup enthält einige Warnungen dies betreffend. Bitte lesen Sie die Kommentare im Script.

Bei PostgreSQL können Sie z.B. eine Passwort-Datei verwenden, siehe .pgpass, und MySQL hat die .my.cnf.

Wir hoffen, dass wir Ihnen damit etwas helfen konnten, aber nur Sie könenn beurteilen, was in Ihrer Situation erforderlich ist.

Sicherung anderer Datenbanken

Wie oben schon erwähnt wurde, führt das Sichern von Datenbank-Dateien im laufenden Betrieb dazu, dass die gesicherten Dateien sich wahrscheinlich in einem inkonsistenten Zustand befinden.

Die beste Lösung dafür ist, die Datenbank vor der Sicherung zu stoppen, oder datenbankspezifische Hilfsprogramme zu verwenden, um eine gültige Sicherungsdatei zu erstellen, die Bacula dann auf die Volumes schreiben kann. Wenn Sie unsicher sind, wie Sie das am besten mit der von Ihnen benutzten Datenbank erreichen können, hilft Ihnen eventuell die Webseite von Backup Central weiter. Auf Free Backup and Recovery Software finden Sie Links zu Scripts die zeigen, wie man die meisten größeren Datenbanken sichern kann.

Datenbank Größe

Wenn Sie nicht automatisch alte Datensätze aus Ihrer Katalog-Datenbank löschen lassen, wird Ihre Datenbank mit jedem gelaufenen Backup-Job wachsen (siehe auch weiter oben). Normalerweise sollten Sie sich entscheiden, wie lange Sie die Datei-Einträge im Katalog aufbewaren wollen und die File Retention entsprechend konfigurieren. Dann können Sie entweder abwarten wie groß Ihre Katalog-Datenbank werden wird, oder es aber auch ungeähr berechnen. Dazu müssen Sie wissen, dass für jede gesicherte Datei in etwa 154 Bytes in der Katalog-Datenbank belegt werden und wieviele Dateien Sie auf wievielen Computern sichern werden.

Ein Beispiel: angenommen Sie sichern zwei Computer, jeder mit 100.000 Dateien. Weiterhin angenommen, Sie machen ein wöchentliches Full-Backup und ein inkrementelles jeden Tag, wobei bei einem inkrementellen Backup typischerweise 4.000 Dateien gesichert werden. Die ungefähre Größe Ihrer Datenbank nach einem Monat kann dann so berechnet werden:

   Gr\"{o}{\ss}e = 154 * Anzahl Computer * (100.000 * 4 + 10.000 * 26)

wenn ein Monat mit 4 Wochen angenommen wird, werden also 26 inkrementelle Backups im Monat laufen. Das ergibt das folgende:

   Gr\"{o}{\ss}e = 154 * 2 * (100.000 * 4 + 10.000 * 26)
or
   Gr\"{o}{\ss}e = 308 * (400.000 + 260.000)
or
   Gr\"{o}{\ss}e = 203.280.000 Bytes

für die beiden oben angenommen Computer können wir also davon ausgehen, dass die Datenbank in etwa 200 Megabytes groß wird. Natürlich hängt dieser Wert davon ab, wieviele Dateien wirklich gesichert werden.

Unten sehen Sie ein paar Statistiken für eine MySQL-Datenbank die Job-Einträge für 5 Clients über 8.5 Monate und Datei-Einträge über 80 Tage enthält (ältere Datei-Einträge wurden schon gelöscht). Bei diesen 5 Clients wurden nur die Benutzer- und System-Dateien gesichert, die sich ständig ändern. Bei allen anderen Dateien wird angenommen, dass sie leicht aus den Software-Paketen des Betriebssystems wiederherstellbar sind.

In der Liste sind die Dateien (die den MySQL-Tabellen entsprechen) mit der Endung .MYD die, die die eigentlichen Daten enthalten und die mit der Endung .MYI enthalten die Indexe.

Sie werden bemerken, dass die meisten Einträge in der Datei File.MYD (die die Datei-Attribute enthält) enthalten sind und diese auch den meisten Platz auf der Festplatte belegt. Die File Retention (der Aufbewahrungszeitraum für Dateien) ist also im wesentlichen dafür verantwortlich, wie groß die Datenbank wird. Eine kurze Berechnung zeigt, dass die Datenbank mit jeder gesicherten Datei ungefähr um 154 Bytes wächst.

Gr\"{o}{\ss}e
  in Bytes   Eintr\"{a}ge   Dateiname 
 ============  =========  ===========
          168          5  Client.MYD
        3,072             Client.MYI
  344,394,684  3,080,191  File.MYD
  115,280,896             File.MYI
    2,590,316    106,902  Filename.MYD
    3,026,944             Filename.MYI
          184          4  FileSet.MYD
        2,048             FileSet.MYI
       49,062      1,326  JobMedia.MYD
       30,720             JobMedia.MYI
      141,752      1,378  Job.MYD
       13,312             Job.MYI
        1,004         11  Media.MYD
        3,072             Media.MYI
    1,299,512     22,233  Path.MYD
      581,632             Path.MYI
           36          1  Pool.MYD
        3,072             Pool.MYI
            5          1  Version.MYD
        1,024             Version.MYI

Die Datenbank hat eine Größe von ca. 450 Megabytes..

Hätten wir SQLite genommen, wäre die Bestimmung der Datenbankgröße viel einfacher gewesen, da SQLite alle Daten in einer einzigen Datei speichert, dann aber hätten wir nicht so einfach erkennen können, welche der Tabellen den meisten Speicherplatz benötigt.

SQLite Datenbanken können bis zu 50 % größer sein als MySQL-Datenbanken (bei gleichem Datenbestand), weil bei SQLite alle Daten als ASCII-Zeichenketten gespeichert werden. Sogar binäre Daten werden als ASCII-Zeichenkette dargestellt, und das scheint den Speicherverbrauch zu erhöhen.


Automatic Volume Recycling

By default, once Bacula starts writing a Volume, it can append to the volume, but it will not overwrite the existing data thus destroying it. However when Bacula recycles a Volume, the Volume becomes available for being reused, and Bacula can at some later time over write the previous contents of that Volume. Thus all previous data will be lost. If the Volume is a tape, the tape will be rewritten from the beginning. If the Volume is a disk file, the file will be truncated before being rewritten.

You may not want Bacula to automatically recycle (reuse) tapes. This would require a large number of tapes though, and in such a case, it is possible to manually recycle tapes. For more on manual recycling, see the section entitled Manually Recycling Volumes below in this chapter.

Most people prefer to have a Pool of tapes that are used for daily backups and recycled once a week, another Pool of tapes that are used for Full backups once a week and recycled monthly, and finally a Pool of tapes that are used once a month and recycled after a year or two. With a scheme like this, the number of tapes in your pool or pools remains constant.

By properly defining your Volume Pools with appropriate Retention periods, Bacula can manage the recycling (such as defined above) automatically.

Automatic recycling of Volumes is controlled by three records in the Pool resource definition in the Director's configuration file. These three records are:

Automatic recycling of Volumes is performed by Bacula only when it wants a new Volume and no appendable Volumes are available in the Pool. It will then search the Pool for any Volumes with the Recycle flag set and whose Volume Status is Full. At that point, the recycling occurs in two steps. The first is that the Catalog for a Volume must be purged of all Jobs and Files contained on that Volume, and the second step is the actual recycling of the Volume. The Volume will be purged if the VolumeRetention period has expired. When a Volume is marked as Purged, it means that no Catalog records reference that Volume, and the Volume can be recycled. Until recycling actually occurs, the Volume data remains intact. If no Volumes can be found for recycling for any of the reasons stated above, Bacula will request operator intervention (i.e. it will ask you to label a new volume).

A key point mentioned above, that can be a source of frustration, is that Bacula will only recycle purged Volumes if there is no other appendable Volume available, otherwise, it will always write to an appendable Volume before recycling even if there are Volume marked as Purged. This preserves your data as long as possible. So, if you wish to "force" Bacula to use a purged Volume, you must first ensure that no other Volume in the Pool is marked Append. If necessary, you can manually set a volume to Full. The reason for this is that Bacula wants to preserve the data on your old tapes (even though purged from the catalog) as long as absolutely possible before overwriting it.

Automatic Pruning

As Bacula writes files to tape, it keeps a list of files, jobs, and volumes in a database called the catalog. Among other things, the database helps Bacula to decide which files to back up in an incremental or differential backup, and helps you locate files on past backups when you want to restore something. However, the catalog will grow larger and larger as time goes on, and eventually it can become unacceptably large.

Bacula's process for removing entries from the catalog is called Pruning. The default is Automatic Pruning, which means that once an entry reaches a certain age (e.g. 30 days old) it is removed from the catalog. Once a job has been pruned, you can still restore it from the backup tape, but one additional step is required: scanning the volume with bscan. The alternative to Automatic Pruning is Manual Pruning, in which you explicitly tell Bacula to erase the catalog entries for a volume. You'd usually do this when you want to reuse a Bacula volume, because there's no point in keeping a list of files that USED TO BE on a tape. Or, if the catalog is starting to get too big, you could prune the oldest jobs to save space. Manual pruning is done with the prune command in the console. (thanks to Bryce Denney for the above explanation).

Prunning Directives

There are three pruning durations. All apply to catalog database records and not to the actual data in a Volume. The pruning (or retention) durations are for: Volumes (Media records), Jobs (Job records), and Files (File records). The durations inter-depend a bit because if Bacula prunes a Volume, it automatically removes all the Job records, and all the File records. Also when a Job record is pruned, all the File records for that Job are also pruned (deleted) from the catalog.

Having the File records in the database means that you can examine all the files backed up for a particular Job. They take the most space in the catalog (probably 90-95% of the total). When the File records are pruned, the Job records can remain, and you can still examine what Jobs ran, but not the details of the Files backed up. In addition, without the File records, you cannot use the Console restore command to restore the files.

When a Job record is pruned, the Volume (Media record) for that Job can still remain in the database, and if you do a "list volumes", you will see the volume information, but the Job records (and its File records) will no longer be available.

In each case, pruning removes information about where older files are, but it also prevents the catalog from growing to be too large. You choose the retention periods in function of how many files you are backing up and the time periods you want to keep those records online, and the size of the database. You can always re-insert the records (with 98% of the original data) by using "bscan" to scan in a whole Volume or any part of the volume that you want.

By setting AutoPrune to yes you will permit Bacula to automatically prune all Volumes in the Pool when a Job needs another Volume. Volume pruning means removing records from the catalog. It does not shrink the size of the Volume or affect the Volume data until the Volume gets overwritten. When a Job requests another volume and there are no Volumes with Volume Status Append available, Bacula will begin volume pruning. This means that all Jobs that are older than the VolumeRetention period will be pruned from every Volume that has Volume Status Full or Used and has Recycle set to yes. Pruning consists of deleting the corresponding Job, File, and JobMedia records from the catalog database. No change to the physical data on the Volume occurs during the pruning process. When all files are pruned from a Volume (i.e. no records in the catalog), the Volume will be marked as Purged implying that no Jobs remain on the volume. The Pool records that control the pruning are described below.

AutoPrune = <yes|no>
If AutoPrune is set to yes (default), Bacula will automatically apply the Volume retention period when running a Job and it needs a new Volume but no appendable volumes are available. At that point, Bacula will prune all Volumes that can be pruned (i.e. AutoPrune set) in an attempt to find a usable volume. If during the autoprune, all files are pruned from the Volume, it will be marked with VolStatus Purged. The default is yes. Note, that although the File and Job records may be pruned from the catalog, a Volume will be marked Purged (and hence ready for recycling) if the Volume status is Append, Full, Used, or Error. If the Volume has another status, such as Archive, Read-Only, Disabled, Busy, or Cleaning, the Volume status will not be changed to Purged.

Volume Retention = <time-period-specification>
The Volume Retention record defines the length of time that Bacula will guarantee that the Volume is not reused counting from the time the last job stored on the Volume terminated.

When this time period expires, and if AutoPrune is set to yes, and a new Volume is needed, but no appendable Volume is available, Bacula will prune (remove) Job records that are older than the specified Volume Retention period.

The Volume Retention period takes precedence over any Job Retention period you have specified in the Client resource. It should also be noted, that the Volume Retention period is obtained by reading the Catalog Database Media record rather than the Pool resource record. This means that if you change the VolumeRetention in the Pool resource record, you must ensure that the corresponding change is made in the catalog by using the update pool command. Doing so will insure that any new Volumes will be created with the changed Volume Retention period. Any existing Volumes will have their own copy of the Volume Retention period that can only be changed on a Volume by Volume basis using the update volume command.

When all file catalog entries are removed from the volume, its VolStatus is set to Purged. The files remain physically on the Volume until the volume is overwritten.

Retention periods are specified in seconds, minutes, hours, days, weeks, months, quarters, or years on the record. See the Configuration chapter of this manual for additional details of time specification.

The default is 1 year.

Recycle = <yes|no>
This statement tells Bacula whether or not the particular Volume can be recycled (i.e. rewritten). If Recycle is set to no (the default), then even if Bacula prunes all the Jobs on the volume and it is marked Purged, it will not consider the tape for recycling. If Recycle is set to yes and all Jobs have been pruned, the volume status will be set to Purged and the volume may then be reused when another volume is needed. If the volume is reused, it is relabeled with the same Volume Name, however all previous data will be lost.

It is also possible to "force" pruning of all Volumes in the Pool associated with a Job by adding Prune Files = yes to the Job resource.

Recycling Algorithm

After all Volumes of a Pool have been pruned (as mentioned above, this happens when a Job needs a new Volume and no appendable Volumes are available), Bacula will look for the oldest Volume that is Purged (all Jobs and Files expired), and if the Recycle flag is on (Recycle=yes) for that Volume, Bacula will relabel it and write new data on it.

The full algorithm that Bacula uses when it needs a new Volume is:

The above occurs when Bacula has finished writing a Volume or when no Volume is present in the drive.

On the other hand, if you have inserted a different Volume after the last job, and Bacula recognizes the Volume as valid, it will request authorization from the Director to use this Volume. In this case, if you have set Recycle Current Volume = yes and the Volume is marked as Used or Full, Bacula will prune the volume and if all jobs were removed during the pruning (respecting the retention periods), the Volume will be recycled and used. The recycling algorithm in this case is:

This permits users to manually change the Volume every day and load tapes in an order different from what is in the catalog, and if the volume does not contain a current copy of your backup data, it will be used.

Recycle Status

Each Volume inherits the Recycle status (yes or no) from the Pool resource record when the Media record is created (normally when the Volume is labeled). This Recycle status is stored in the Media record of the Catalog. Using the Console program, you may subsequently change the Recycle status for each Volume. For example in the following output from list volumes:

+----------+-------+--------+---------+------------+--------+-----+
| VolumeNa | Media | VolSta | VolByte | LastWritte | VolRet | Rec |
+----------+-------+--------+---------+------------+--------+-----+
| File0001 | File  | Full   | 4190055 | 2002-05-25 | 14400  | 1   |
| File0002 | File  | Full   | 1896460 | 2002-05-26 | 14400  | 1   |
| File0003 | File  | Full   | 1896460 | 2002-05-26 | 14400  | 1   |
| File0004 | File  | Full   | 1896460 | 2002-05-26 | 14400  | 1   |
| File0005 | File  | Full   | 1896460 | 2002-05-26 | 14400  | 1   |
| File0006 | File  | Full   | 1896460 | 2002-05-26 | 14400  | 1   |
| File0007 | File  | Purged | 1896466 | 2002-05-26 | 14400  | 1   |
+----------+-------+--------+---------+------------+--------+-----+

all the volumes are marked as recyclable, and the last Volume, File0007 has been purged, so it may be immediately recycled. The other volumes are all marked recyclable and when their Volume Retention period (14400 seconds or 4 hours) expires, they will be eligible for pruning, and possibly recycling. Even though Volume File0007 has been purged, all the data on the Volume is still recoverable. A purged Volume simply means that there are no entries in the Catalog. Even if the Volume Status is changed to Recycle, the data on the Volume will be recoverable. The data is lost only when the Volume is re-labeled and re-written.

To modify Volume File0001 so that it cannot be recycled, you use the update volume pool=File command in the console program, or simply update and Bacula will prompt you for the information.

+----------+------+-------+---------+-------------+-------+-----+
| VolumeNa | Media| VolSta| VolByte | LastWritten | VolRet| Rec |
+----------+------+-------+---------+-------------+-------+-----+
| File0001 | File | Full  | 4190055 | 2002-05-25  | 14400 | 0   |
| File0002 | File | Full  | 1897236 | 2002-05-26  | 14400 | 1   |
| File0003 | File | Full  | 1896460 | 2002-05-26  | 14400 | 1   |
| File0004 | File | Full  | 1896460 | 2002-05-26  | 14400 | 1   |
| File0005 | File | Full  | 1896460 | 2002-05-26  | 14400 | 1   |
| File0006 | File | Full  | 1896460 | 2002-05-26  | 14400 | 1   |
| File0007 | File | Purged| 1896466 | 2002-05-26  | 14400 | 1   |
+----------+------+-------+---------+-------------+-------+-----+

In this case, File0001 will never be automatically recycled. The same effect can be achieved by setting the Volume Status to Read-Only.


Making Bacula Use a Single Tape

Most people will want Bacula to fill a tape and when it is full, a new tape will be mounted, and so on. However, as an extreme example, it is possible for Bacula to write on a single tape, and every night to rewrite it. To get this to work, you must do two things: first, set the VolumeRetention to less than your save period (one day), and the second item is to make Bacula mark the tape as full after using it once. This is done using UseVolumeOnce = yes. If this latter record is not used and the tape is not full after the first time it is written, Bacula will simply append to the tape and eventually request another volume. Using the tape only once, forces the tape to be marked Full after each use, and the next time Bacula runs, it will recycle the tape.

An example Pool resource that does this is:

Pool {
  Name = DDS-4
  Use Volume Once = yes
  Pool Type = Backup
  AutoPrune = yes
  VolumeRetention = 12h # expire after 12 hours
  Recycle = yes
}


A Daily, Weekly, Monthly Tape Usage Example

This example is meant to show you how one could define a fixed set of volumes that Bacula will rotate through on a regular schedule. There are an infinite number of such schemes, all of which have various advantages and disadvantages.

We start with the following assumptions:

We start the system by doing a Full save to one of the weekly volumes or one of the monthly volumes. The next morning, we remove the tape and insert a Daily tape. Friday evening, we remove the Daily tape and insert the next tape in the Weekly series. Monday, we remove the Weekly tape and re-insert the Daily tape. On the first Friday of the next month, we insert the next Monthly tape in the series rather than a Weekly tape, then continue. When a Daily tape finally fills up, Bacula will request the next one in the series, and the next day when you notice the email message, you will mount it and Bacula will finish the unfinished incremental backup.

What does this give? Well, at any point, you will have the last complete Full save plus several Incremental saves. For any given file you want to recover (or your whole system), you will have a copy of that file every day for at least the last 14 days. For older versions, you will have at least 3 and probably 4 Friday full saves of that file, and going back further, you will have a copy of that file made on the beginning of the month for at least a year.

So you have copies of any file (or your whole system) for at least a year, but as you go back in time, the time between copies increases from daily to weekly to monthly.

What would the Bacula configuration look like to implement such a scheme?

Schedule {
  Name = "NightlySave"
  Run = Level=Full Pool=Monthly 1st sat at 03:05
  Run = Level=Full Pool=Weekly 2nd-5th sat at 03:05
  Run = Level=Incremental Pool=Daily tue-fri at 03:05
}
Job {
  Name = "NightlySave"
  Type = Backup
  Level = Full
  Client = LocalMachine
  FileSet = "File Set"
  Messages = Standard
  Storage = DDS-4
  Pool = Daily
  Schedule = "NightlySave"
}
# Definition of file storage device
Storage {
  Name = DDS-4
  Address = localhost
  SDPort = 9103
  Password = XXXXXXXXXXXXX
  Device = FileStorage
  Media Type = 8mm
}
FileSet {
  Name = "File Set"
  Include = signature=MD5 {
    fffffffffffffffff
  }
  Exclude = { *.o }
}
Pool {
  Name = Daily
  Pool Type = Backup
  AutoPrune = yes
  VolumeRetention = 10d   # recycle in 10 days
  Maximum Volumes = 10
  Recycle = yes
}
Pool {
  Name = Weekly
  Use Volume Once = yes
  Pool Type = Backup
  AutoPrune = yes
  VolumeRetention = 30d  # recycle in 30 days (default)
  Recycle = yes
}
Pool {
  Name = Monthly
  Use Volume Once = yes
  Pool Type = Backup
  AutoPrune = yes
  VolumeRetention = 365d  # recycle in 1 year
  Recycle = yes
}


Automatic Pruning and Recycling Example

Perhaps the best way to understand the various resource records that come into play during automatic pruning and recycling is to run a Job that goes through the whole cycle. If you add the following resources to your Director's configuration file:

Schedule {
  Name = "30 minute cycle"
  Run = Level=Full Pool=File Messages=Standard Storage=File
         hourly at 0:05
  Run = Level=Full Pool=File Messages=Standard Storage=File
         hourly at 0:35
}
Job {
  Name = "Filetest"
  Type = Backup
  Level = Full
  Client=XXXXXXXXXX
  FileSet="Test Files"
  Messages = Standard
  Storage = File
  Pool = File
  Schedule = "30 minute cycle"
}
# Definition of file storage device
Storage {
  Name = File
  Address = XXXXXXXXXXX
  SDPort = 9103
  Password = XXXXXXXXXXXXX
  Device = FileStorage
  Media Type = File
}
FileSet {
  Name = "Test Files"
  Include = signature=MD5 {
    fffffffffffffffff
  }
  Exclude = { *.o }
}
Pool {
  Name = File
  Use Volume Once = yes
  Pool Type = Backup
  LabelFormat = "File"
  AutoPrune = yes
  VolumeRetention = 4h
  Maximum Volumes = 12
  Recycle = yes
}

Where you will need to replace the ffffffffff's by the appropriate files to be saved for your configuration. For the FileSet Include, choose a directory that has one or two megabytes maximum since there will probably be approximately 8 copies of the directory that Bacula will cycle through.

In addition, you will need to add the following to your Storage daemon's configuration file:

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

With the above resources, Bacula will start a Job every half hour that saves a copy of the directory you chose to /tmp/File0001 ... /tmp/File0012. After 4 hours, Bacula will start recycling the backup Volumes (/tmp/File0001 ...). You should see this happening in the output produced. Bacula will automatically create the Volumes (Files) the first time it uses them.

To turn it off, either delete all the resources you've added, or simply comment out the Schedule record in the Job resource.


Manually Recycling Volumes

Although automatic recycling of Volumes is implemented in version 1.20 and later (see the Automatic Recycling of Volumes chapter of this manual), you may want to manually force reuse (recycling) of a Volume.

Assuming that you want to keep the Volume name, but you simply want to write new data on the tape, the steps to take are:

Once the Volume is marked Purged, it will be recycled the next time a Volume is needed.

If you wish to reuse the tape by giving it a new name, follow the following steps:

Please note that the relabel command applies only to tape Volumes.

For Bacula versions prior to 1.30 or to manually relabel the Volume, use the instructions below:

Please be aware that the delete command can be dangerous. Once it is done, to recover the File records, you must either restore your database as it was before the delete command, or use the bscan utility program to scan the tape and recreate the database entries.


Basic Volume Management

This chapter presents most all the features needed to do Volume management. Most of the concepts apply equally well to both tape and disk Volumes. However, the chapter was originally written to explain backing up to disk, so you will see it is slanted in that direction, but all the directives presented here apply equally well whether your volume is disk or tape.

If you have a lot of hard disk storage or you absolutely must have your backups run within a small time window, you may want to direct Bacula to backup to disk Volumes rather than tape Volumes. This chapter is intended to give you some of the options that are available to you so that you can manage either disk or tape volumes.

Key Concepts and Resource Records

Getting Bacula to write to disk rather than tape in the simplest case is rather easy. In the Storage daemon's configuration file, you simply define an Archive Device to be a directory. For example, if you want your disk backups to go into the directory /home/bacula/backups, you could use the following:

Device {
  Name = FileBackup
  Media Type = File
  Archive Device = /home/bacula/backups
  Random Access = Yes;
  AutomaticMount = yes;
  RemovableMedia = no;
  AlwaysOpen = no;
}

Assuming you have the appropriate Storage resource in your Director's configuration file that references the above Device resource,

Storage {
  Name = FileStorage
  Address = ...
  Password = ...
  Device = FileBackup
  Media Type = File
}

Bacula will then write the archive to the file /home/bacula/backups/<volume-name> where <volume-name> is the volume name of a Volume defined in the Pool. For example, if you have labeled a Volume named Vol001, Bacula will write to the file /home/bacula/backups/Vol001. Although you can later move the archive file to another directory, you should not rename it or it will become unreadable by Bacula. This is because each archive has the filename as part of the internal label, and the internal label must agree with the system filename before Bacula will use it.

Although this is quite simple, there are a number of problems. The first is that unless you specify otherwise, Bacula will always write to the same volume until you run out of disk space. This problem is addressed below.

In addition, if you want to use concurrent jobs that write to several different volumes at the same time, you will need to understand a number of other details. An example of such a configuration is given at the end of this chapter under Concurrent Disk Jobs.

Pool Options to Limit the Volume Usage

Some of the options you have, all of which are specified in the Pool record, are:

Note that although you probably would not want to limit the number of bytes on a tape as you would on a disk Volume, the other options can be very useful in limiting the time Bacula will use a particular Volume (be it tape or disk). For example, the above directives can allow you to ensure that you rotate through a set of daily Volumes if you wish.

As mentioned above, each of those directives is specified in the Pool or Pools that you use for your Volumes. In the case of Maximum Volume Job, Maximum Volume Bytes, and Volume Use Duration, you can actually specify the desired value on a Volume by Volume basis. The value specified in the Pool record becomes the default when labeling new Volumes. Once a Volume has been created, it gets its own copy of the Pool defaults, and subsequently changing the Pool will have no effect on existing Volumes. You can either manually change the Volume values, or refresh them from the Pool defaults using the update volume command in the Console. As an example of the use of one of the above, suppose your Pool resource contains:

Pool {
  Name = File
  Pool Type = Backup
  Volume Use Duration = 23h
}

then if you run a backup once a day (every 24 hours), Bacula will use a new Volume for each backup, because each Volume it writes can only be used for 23 hours after the first write. Note, setting the use duration to 23 hours is not a very good solution for tapes unless you have someone on-site during the weekends, because Bacula will want a new Volume and no one will be present to mount it, so no weekend backups will be done until Monday morning.

Automatic Volume Labeling

Use of the above records brings up another problem -- that of labeling your Volumes. For automated disk backup, you can either manually label each of your Volumes, or you can have Bacula automatically label new Volumes when they are needed. While, the automatic Volume labeling in version 1.30 and prior is a bit simplistic, but it does allow for automation, the features added in version 1.31 permit automatic creation of a wide variety of labels including information from environment variables and special Bacula Counter variables. In version 1.37 and later, it is probably much better to use Python scripting and the NewVolume event since generating Volume labels in a Python script is much easier than trying to figure out Counter variables. See the Python Scripting chapter of this manual for more details.

Please note that automatic Volume labeling can also be used with tapes, but it is not nearly so practical since the tapes must be pre-mounted. This requires some user interaction. Automatic labeling from templates does NOT work with autochangers since Bacula will not access unknown slots. There are several methods of labeling all volumes in an autochanger magazine. For more information on this, please see the Autochanger chapter of this manual.

Automatic Volume labeling is enabled by making a change to both the Pool resource (Director) and to the Device resource (Storage daemon) shown above. In the case of the Pool resource, you must provide Bacula with a label format that it will use to create new names. In the simplest form, the label format is simply the Volume name, to which Bacula will append a four digit number. This number starts at 0001 and is incremented for each Volume the pool contains. Thus if you modify your Pool resource to be:

Pool {
  Name = File
  Pool Type = Backup
  Volume Use Duration = 23h
  LabelFormat = "Vol"
}

Bacula will create Volume names Vol0001, Vol0002, and so on when new Volumes are needed. Much more complex and elaborate labels can be created using variable expansion defined in the Variable Expansion chapter of this manual.

The second change that is necessary to make automatic labeling work is to give the Storage daemon permission to automatically label Volumes. Do so by adding LabelMedia = yes to the Device resource as follows:

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

You can find more details of the Label Format Pool record in Label Format description of the Pool resource records.

Restricting the Number of Volumes and Recycling

Automatic labeling discussed above brings up the problem of Volume management. With the above scheme, a new Volume will be created every day. If you have not specified Retention periods, your Catalog will continue to fill keeping track of all the files Bacula has backed up, and this procedure will create one new archive file (Volume) every day.

The tools Bacula gives you to help automatically manage these problems are the following:

  1. Catalog file record retention periods, the File Retention = ttt record in the Client resource.
  2. Catalog job record retention periods, the Job Retention = ttt record in the Client resource.
  3. The AutoPrune = yes record in the Client resource to permit application of the above two retention periods.
  4. The Volume Retention = ttt record in the Pool resource.
  5. The AutoPrune = yes record in the Pool resource to permit application of the Volume retention period.
  6. The Recycle = yes record in the Pool resource to permit automatic recycling of Volumes whose Volume retention period has expired.
  7. The Recycle Oldest Volume = yes record in the Pool resource tells Bacula to Prune the oldest volume in the Pool, and if all files were pruned to recycle this volume and use it.
  8. The Recycle Current Volume = yes record in the Pool resource tells Bacula to Prune the currently mounted volume in the Pool, and if all files were pruned to recycle this volume and use it.
  9. The Purge Oldest Volume = yes record in the Pool resource permits a forced recycling of the oldest Volume when a new one is needed. N.B. This record ignores retention periods! We highly recommend not to use this record, but instead use Recycle Oldest Volume
  10. The Maximum Volumes = nnn record in the Pool resource to limit the number of Volumes that can be created.

The first three records (File Retention, Job Retention, and AutoPrune) determine the amount of time that Job and File records will remain in your Catalog, and they are discussed in detail in the Automatic Volume Recycling chapter of this manual.

Volume Retention, AutoPrune, and Recycle determine how long Bacula will keep your Volumes before reusing them, and they are also discussed in detail in the Automatic Volume Recycling chapter of this manual.

The Maximum Volumes record can also be used in conjunction with the Volume Retention period to limit the total number of archive Volumes (files) that Bacula will create. By setting an appropriate Volume Retention period, a Volume will be purged just before it is needed and thus Bacula can cycle through a fixed set of Volumes. Cycling through a fixed set of Volumes can also be done by setting Recycle Oldest Volume = yes or Recycle Current Volume = yes. In this case, when Bacula needs a new Volume, it will prune the specified volume.

Concurrent Disk Jobs

Above, we discussed how you could have a single device named FileBackup that writes to volumes in /home/bacula/backups. You can, in fact, run multiple concurrent jobs using the Storage definition given with this example, and all the jobs will simultaneously write into the Volume that is being written.

Now suppose you want to use multiple Pools, which means multiple Volumes, or suppose you want each client to have its own Volume and perhaps its own directory such as /home/bacula/client1 and /home/bacula/client2 ... With the single Storage and Device definition above, neither of these two is possible. Why? Because Bacula disk storage follows the same rules as tape devices. Only one Volume can be mounted on any Device at any time. If you want to simultaneously write multiple Volumes, you will need multiple Device resources in your bacula-sd.conf file, and thus multiple Storage resources in your bacula-dir.conf.

OK, so now you should understand that you need multiple Device definitions in the case of different directorys or different Pools, but you also need to know that the catalog data that Bacula keeps contains only the Media Type and not the specific storage device. This permits a tape for example to be re-read on any compatible tape drive. The compatibility being determined by the Media Type. The same applies to disk storage. Since a volume that is written by a Device in say directory /home/bacula/backups cannot be read by a Device with an Archive Device definition of /home/bacula/client1, you will not be able to restore all your files if you give both those devices Media Type = File. During the restore, Bacula will simply choose the first available device, which may not be the correct one. If this is confusing, just remember that the Directory has only the Media Type and the Volume name. It does not know the Archive Device (or the full path) that is specified in the Storage daemon. Thus you must explicitly tie your Volumes to the correct Device by using the Media Type.

The example shown below shows a case where there are two clients, each using its own Pool and storing their Volumes in different directories.

An Example

The following example is not very practical, but can be used to demonstrate the proof of concept in a relatively short period of time. The example consists of a two clients that are backed up to a set of 12 archive files (Volumes) for each client into different directories on the Storage maching. Each Volume is used (written) only once, and there are four Full saves done every hour (so the whole thing cycles around after three hours).

What is key here is that each physical device on the Storage daemon has a different Media Type. This allows the Director to choose the correct device for restores ...

The Director's configuration file is as follows:

Director {
  Name = my-dir
  QueryFile = "~/bacula/bin/query.sql"
  PidDirectory = "~/bacula/working"
  WorkingDirectory = "~/bacula/working"
  Password = dir_password
}
Schedule {
  Name = "FourPerHour"
  Run = Level=Full hourly at 0:05
  Run = Level=Full hourly at 0:20
  Run = Level=Full hourly at 0:35
  Run = Level=Full hourly at 0:50
}
Job {
  Name = "RecycleExample"
  Type = Backup
  Level = Full
  Client = Rufus
  FileSet= "Example FileSet"
  Messages = Standard
  Storage = FileStorage
  Pool = Recycle
  Schedule = FourPerHour
}

Job {
  Name = "RecycleExample2"
  Type = Backup
  Level = Full
  Client = Roxie
  FileSet= "Example FileSet"
  Messages = Standard
  Storage = FileStorage1
  Pool = Recycle1
  Schedule = FourPerHour
}

FileSet {
  Name = "Example FileSet"
  Include = compression=GZIP signature=SHA1 {
    /home/kern/bacula/bin
  }
}
Client {
  Name = Rufus
  Address = rufus
  Catalog = BackupDB
  Password = client_password
}

Client {
  Name = Roxie
  Address = roxie
  Catalog = BackupDB
  Password = client1_password
}

Storage {
  Name = FileStorage
  Address = rufus
  Password = local_storage_password
  Device = RecycleDir
  Media Type = File
}

Storage {
  Name = FileStorage1
  Address = rufus
  Password = local_storage_password
  Device = RecycleDir1
  Media Type = File1
}

Catalog {
  Name = BackupDB
  dbname = bacula; user = bacula; password = ""
}
Messages {
  Name = Standard
  ...
}
Pool {
  Name = Recycle
  Use Volume Once = yes
  Pool Type = Backup
  LabelFormat = "Recycle-"
  AutoPrune = yes
  VolumeRetention = 2h
  Maximum Volumes = 12
  Recycle = yes
}

Pool {
  Name = Recycle1
  Use Volume Once = yes
  Pool Type = Backup
  LabelFormat = "Recycle1-"
  AutoPrune = yes
  VolumeRetention = 2h
  Maximum Volumes = 12
  Recycle = yes
}

and the Storage daemon's configuration file is:

Storage {
  Name = my-sd
  WorkingDirectory = "~/bacula/working"
  Pid Directory = "~/bacula/working"
  MaximumConcurrentJobs = 10
}
Director {
  Name = my-dir
  Password = local_storage_password
}
Device {
  Name = RecycleDir
  Media Type = File
  Archive Device = /home/bacula/backups
  LabelMedia = yes;
  Random Access = Yes;
  AutomaticMount = yes;
  RemovableMedia = no;
  AlwaysOpen = no;
}

Device {
  Name = RecycleDir1
  Media Type = File1
  Archive Device = /home/bacula/backups1
  LabelMedia = yes;
  Random Access = Yes;
  AutomaticMount = yes;
  RemovableMedia = no;
  AlwaysOpen = no;
}

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

With a little bit of work, you can change the above example into a weekly or monthly cycle (take care about the amount of archive disk space used).

Backing up to Multiple Disks

Bacula can, of course, use multiple disks, but in general, each disk must be a separate Device specification in the Storage daemon's conf file, and you must then select what clients to backup to each disk. You will also want to give each Device specification a different Media Type so that during a restore, Bacula will be able to find the appropriate drive.

The situation is a bit more complicated if you want to treat two different physical disk drives (or partitions) logically as a single drive, which Bacula does not directly support. However, it is possible to back up your data to multiple disks as if they were a single drive by linking the Volumes from the first disk to the second disk.

For example, assume that you have two disks named /disk1 and /disk2. If you then create a standard Storage daemon Device resource for backing up to the first disk, it will look like the following:

Device {
  Name = client1
  Media Type = File
  Archive Device = /disk1
  LabelMedia = yes;
  Random Access = Yes;
  AutomaticMount = yes;
  RemovableMedia = no;
  AlwaysOpen = no;
}

Since there is no way to get the above Device resource to reference both /disk1 and /disk2 we do it by pre-creating Volumes on /disk2 with the following:

ln -s /disk2/Disk2-vol001 /disk1/Disk2-vol001
ln -s /disk2/Disk2-vol002 /disk1/Disk2-vol002
ln -s /disk2/Disk2-vol003 /disk1/Disk2-vol003
...

At this point, you can label the Volumes as Volume Disk2-vol001, Disk2-vol002, ... and Bacula will use them as if they were on /disk1 but actually write the data to /disk2. The only minor inconvenience with this method is that you must explicitly name the disks and cannot use automatic labeling unless you arrange to have the labels exactly match the links you have created.

An important thing to know is that Bacula treats disks like tape drives as much as it can. This means that you can only have a single Volume mounted at one time on a disk as defined in your Device resource in the Storage daemon's conf file. You can have multiple concurrent jobs running that all write to the one Volume that is being used, but if you want to have multiple concurrent jobs that are writting to separate disks drives (or partitions), you will need to define separate Device resources for each one, exactly as you would do for two different tape drives. There is one fundamental difference, however. The Volumes that you creat on the two drives cannot be easily exchanged as they can for a tape drive, because they are physically resident (already mounted in a sense) on the particular drive. As a consequence, you will probably want to give them different Media Types so that Bacula can distinguish what Device resource to use during a restore. An example would be the following:

Device {
  Name = Disk1
  Media Type = File1
  Archive Device = /disk1
  LabelMedia = yes;
  Random Access = Yes;
  AutomaticMount = yes;
  RemovableMedia = no;
  AlwaysOpen = no;
}

Device {
  Name = Disk2
  Media Type = File2
  Archive Device = /disk2
  LabelMedia = yes;
  Random Access = Yes;
  AutomaticMount = yes;
  RemovableMedia = no;
  AlwaysOpen = no;
}

With the above device definitions, you can run two concurrent jobs each writing at the same time, one to /disk2 and the other to /disk2. The fact that you have given them different Media Types will allow Bacula to quickly choose the correct Storage resource in the Director when doing a restore.

Considerations for Multiple Clients

If we take the above example and add a second Client, here are a few considerations:

In this example, we have two clients, each with a different Pool and a different number of archive files retained. They also write to different directories with different Volume labeling.

The Director's configuration file is as follows:

Director {
  Name = my-dir
  QueryFile = "~/bacula/bin/query.sql"
  PidDirectory = "~/bacula/working"
  WorkingDirectory = "~/bacula/working"
  Password = dir_password
}
# Basic weekly schedule
Schedule {
  Name = "WeeklySchedule"
  Run = Level=Full fri at 1:30
  Run = Level=Incremental sat-thu at 1:30
}
FileSet {
  Name = "Example FileSet"
  Include = compression=GZIP signature=SHA1 {
    /home/kern/bacula/bin
  }
}
Job {
  Name = "Backup-client1"
  Type = Backup
  Level = Full
  Client = client1
  FileSet= "Example FileSet"
  Messages = Standard
  Storage = File1
  Pool = client1
  Schedule = "WeeklySchedule"
}
Job {
  Name = "Backup-client2"
  Type = Backup
  Level = Full
  Client = client2
  FileSet= "Example FileSet"
  Messages = Standard
  Storage = File2
  Pool = client2
  Schedule = "WeeklySchedule"
}
Client {
  Name = client1
  Address = client1
  Catalog = BackupDB
  Password = client1_password
  File Retention = 7d
}
Client {
  Name = client2
  Address = client2
  Catalog = BackupDB
  Password = client2_password
}
# Two Storage definitions with differen Media Types
#  permits different directories
Storage {
  Name = File1
  Address = rufus
  Password = local_storage_password
  Device = client1
  Media Type = File1
}
Storage {
  Name = File2
  Address = rufus
  Password = local_storage_password
  Device = client2
  Media Type = File2
}
Catalog {
  Name = BackupDB
  dbname = bacula; user = bacula; password = ""
}
Messages {
  Name = Standard
  ...
}
# Two pools permits different cycling periods and Volume names
# Cycle through 15 Volumes (two weeks)
Pool {
  Name = client1
  Use Volume Once = yes
  Pool Type = Backup
  LabelFormat = "Client1-"
  AutoPrune = yes
  VolumeRetention = 13d
  Maximum Volumes = 15
  Recycle = yes
}
# Cycle through 8 Volumes (1 week)
Pool {
  Name = client2
  Use Volume Once = yes
  Pool Type = Backup
  LabelFormat = "Client2-"
  AutoPrune = yes
  VolumeRetention = 6d
  Maximum Volumes = 8
  Recycle = yes
}

and the Storage daemon's configuration file is:

Storage {
  Name = my-sd
  WorkingDirectory = "~/bacula/working"
  Pid Directory = "~/bacula/working"
  MaximumConcurrentJobs = 10
}
Director {
  Name = my-dir
  Password = local_storage_password
}
# Archive directory for Client1
Device {
  Name = client1
  Media Type = File1
  Archive Device = /home/bacula/client1
  LabelMedia = yes;
  Random Access = Yes;
  AutomaticMount = yes;
  RemovableMedia = no;
  AlwaysOpen = no;
}
# Archive directory for Client2
Device {
  Name = client2
  Media Type = File2
  Archive Device = /home/bacula/client2
  LabelMedia = yes;
  Random Access = Yes;
  AutomaticMount = yes;
  RemovableMedia = no;
  AlwaysOpen = no;
}
Messages {
  Name = Standard
  director = my-dir = all
}


DVD Volumes

Bacula allows you to specify that you want to write to DVD. However, this feature is implemented only in version 1.37 or later. You may in fact write to DVD+RW, DVD+R, DVD-R, or DVD-RW media. The actual process used by Bacula is to first write the image to a spool directory, then when the Volume reaches a certain size or, at your option, at the end of a Job, Bacula will transfer the image from the spool directory to the DVD. The actual work of transferring the image is done by a script dvd-handler, and the heart of that script is a program called growisofs which allows creating or adding to a DVD ISO filesystem.

You must have dvd+rw-tools loaded on your system for DVD writing to work. Please note that the original dvd+rw-tools package does NOT work with Bacula. You must apply a patch which can be found in the patches directory of Bacula sources with the name dvd+rw-tools-5.21.4.10.8.bacula.patch.

The fact that Bacula cannot use the OS to write directly to the DVD makes the whole process a bit more error prone than writing to a disk or a tape, but nevertheless, it does work if you use some care to set it up properly. However, at the current time (28 October 2005) we still consider this code to be experimental and of BETA quality. As a consequence, please do careful testing before relying on DVD backups in production.

The remainder of this chapter explains the various directives that you can use to control the DVD writing.

DVD Specific SD Directives

The following directives are added to the Storage daemon's Device resource.

Requires Mount = Yes|No
You must set this directive to yes for DVD-writers, and to no for all other devices (tapes/files). This directive indicates if the device requires to be mounted using the Mount Command. To be able to write a DVD, the following directives must also be defined: Mount Point, Mount Command, Unmount Command and Write Part Command.

Mount Point = directory
Directory where the device can be mounted.

Mount Command = name-string
Command that must be executed to mount the device. Although the device is written directly, the mount command is necessary in order to determine the free space left on the DVD. Before the command is executed, %a is replaced with the Archive Device, and %m with the Mount Point.

Most frequently, you will define it as follows:

  Mount Command = "/bin/mount -t iso9660 -o ro %a %m"

Unmount Command = name-string
Command that must be executed to unmount the device. Before the command is executed, %a is replaced with the Archive Device, and %m with the Mount Point.

Most frequently, you will define it as follows:

  Unmount Command = "/bin/umount %m"

Write Part Command = name-string
Command that must be executed to write a part to the device. Before the command is executed, %a is replaced with the Archive Device, %m with the Mount Point, %e is replaced with 1 if we are writing the first part, and with 0 otherwise, and %v with the current part filename.

For a DVD, you will most frequently specify the Bacula supplied dvd-handler script as follows:

  Write Part Command = "/path/dvd-handler %a write %e %v"

Where /path is the path to your scripts install directory, and dvd-handler is the Bacula supplied script file. This command will already be present, but commented out, in the default bacula-sd.conf file. To use it, simply remove the comment (#) symbol.

Free Space Command = name-string
Command that must be executed to check how much free space is left on the device. Before the command is executed,%a is replaced with the Archive Device, %m with the Mount Point, %e is replaced with 1 if we are writing the first part, and with 0 otherwise, and %v with the current part filename.

For a DVD, you will most frequently specify the Bacula supplied dvd-handler script as follows:

  Free Space Command = "/path/dvd-handler %a free"

Where /path is the path to your scripts install directory, and dvd-freespace is the Bacula supplied script file. If you want to specify your own command, please look at the code in dvd-handler to see what output Bacula expects from this command. This command will already be present, but commented out, in the default bacula-sd.conf file. To use it, simply remove the comment (#) symbol.

If you do not set it, Bacula will expect there is always free space on the device.

In addition to the directives specified above, you must also specify the other standard Device resource directives. Please see the sample DVD Device resource in the default bacula-sd.conf file. Be sure to specify the raw device name for Archive Device. It should be a name such as /dev/cdrom or /media/cdrecorder or /dev/dvd depending on your system. It will not be a name such as /mnt/cdrom.

DVD Specific Director Directives

The following directives are added to the Director's Job resource.

Write Part After Job = <yes|no>
If this directive is set to yes (default no), the Volume written to a temporary spool file for the current Job will be written to the DVD as a new part file will be created after the job is finished.

It should be set to yes when writing to devices that require a mount (for example DVD), so you are sure that the current part, containing this job's data, is written to the device, and that no data is left in the temporary file on the hard disk. However, on some media, like DVD+R and DVD-R, a lot of space (about 10Mb) is lost everytime a part is written. So, if you run several jobs each after another, you could set this directive to no for all jobs, except the last one, to avoid wasting too much space, but to ensure that the data is written to the medium when all jobs are finished.

This directive is ignored for devices other than DVDs.

Other Points


Automated Disk Backup

If you manage 5 or 10 machines and have a nice tape backup, you don't need Pools, and you may wonder what they are good for. In this chapter, you will see that Pools can help you optimize disk storage space. The same techniques can be applied to a shop that has multiple tape drives, or that wants to mount various different Volumes to meet their needs.

The rest of this chapter will give an example involving backup to disk Volumes, but most of the information applies equally well to tape Volumes.

The Problem

A site that I administer (a charitable organization) had a tape DDS-3 tape drive that was failing. The exact reason for the failure is still unknown. Worse yet, their full backup size is about 15GB whereas the capacity of their broken DDS-3 was at best 8GB (rated 6/12). A new DDS-4 tape drive and the necessary cassettes was more expensive than their budget could handle.

The Solution

They want to maintain 6 months of backup data, and be able to access the old files on a daily basis for a week, a weekly basis for a month, then monthly for 6 months. In addition, offsite capability was not needed (well perhaps it really is, but it was never used). Their daily changes amount to about 300MB on the average, or about 2GB per week.

As a consequence, the total volume of data they need to keep to meet their needs is about 100GB (15GB x 6 + 2GB x 5 + 0.3 x 7) = 102.1GB.

The chosen solution was to buy a 120GB hard disk for next to nothing -- far less than 1/10th the price of a tape drive and the cassettes to handle the same amount of data, and to have Bacula write to disk files.

The rest of this chapter will explain how to setup Bacula so that it would automatically manage a set of disk files with the minimum intervention on my part. The system has been running since 22 January 2004 until today (08 April 2004) with no intervention. Since we have not yet crossed the six month boundary, we still lack some data to be sure the system performs as desired.

Overall Design

Getting Bacula to write to disk rather than tape in the simplest case is rather easy, and is documented in the previous chapter. In addition, all the directives discussed here are explained in that chapter. We'll leave it to you to look at the details there. If you haven't read it and are not familiar with Pools, you probably should at least read it once quickly for the ideas before continuing here.

One needs to consider about what happens if we have only a single large Bacula Volume defined on our hard disk. Everything works fine until the Volume fills, then Bacula will ask you to mount a new Volume. This same problem applies to the use of tape Volumes if your tape fills. Being a hard disk and the only one you have, this will be a bit of a problem. It should be obvious that it is better to use a number of smaller Volumes and arrange for Bacula to automatically recycle them so that the disk storage space can be reused. The other problem with a single Volume, is that at the current time (1.34.0) Bacula does not seek within a disk Volume, so restoring a single file can take more time than one would expect.

As mentioned, the solution is to have multiple Volumes, or files on the disk. To do so, we need to limit the use and thus the size of a single Volume, by time, by number of jobs, or by size. Any of these would work, but we chose to limit the use of a single Volume by putting a single job in each Volume with the exception of Volumes containing Incremental backup where there will be 6 jobs (a week's worth of data) per volume. The details of this will be discussed shortly.

The next problem to resolve is recycling of Volumes. As you noted from above, the requirements are to be able to restore monthly for 6 months, weekly for a month, and daily for a week. So to simplify things, why not do a Full save once a month, a Differential save once a week, and Incremental saves daily. Now since each of these different kinds of saves needs to remain valid for differing periods, the simplest way to do this (and possibly the only) is to have a separate Pool for each backup type.

The decision was to use three Pools: one for Full saves, one for Differential saves, and one for Incremental saves, and each would have a different number of volumes and a different Retention period to accomplish the requirements.

Full Pool

Putting a single Full backup on each Volume, will require six Full save Volumes, and a retention period of six months. The Pool needed to do that is:

Pool {
  Name = Full-Pool
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 6 months
  Accept Any Volume = yes
  Maximum Volume Jobs = 1
  Label Format = Full-
  Maximum Volumes = 6
}

Since these are disk Volumes, no space is lost by having separate Volumes for each backup (done once a month in this case). The items to note are the retention period of six months (i.e. they are recycled after 6 months), that there is one job per volume (Maximum Volume Jobs = 1), the volumes will be labeled Full-0001, ... Full-0006 automatically. One could have labeled these manual from the start, but why not use the features of Bacula.

Differential Pool

For the Differential backup Pool, we choose a retention period of a bit longer than a month and ensure that there is at least one Volume for each of the maximum of five weeks in a month. So the following works:

Pool {
  Name = Diff-Pool
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 40 days
  Accept Any Volume = yes
  Maximum Volume Jobs = 1
  Label Format = Diff-
  Maximum Volumes = 6
}

As you can see, the Differential Pool can grow to a maximum of six volumes, and the Volumes are retained 40 days and thereafter they can be recycled. Finally there is one job per volume. This, of course, could be tightened up a lot, but the expense here is a few GB which is not too serious.

Incremental Pool

Finally, here is the resource for the Incremental Pool:

Pool {
  Name = Inc-Pool
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 20 days
  Accept Any Volume = yes
  Maximum Volume Jobs = 6
  Label Format = Inc-
  Maximum Volumes = 5
}

We keep the data for 20 days rather than just a week as the needs require. To reduce the proliferation of volume names, we keep a week's worth of data (6 incremental backups) in each Volume. In practice, the retention period should be set to just a bit more than a week and keep only two or three volumes instead of five. Again, the lost is very little and as the system reaches the full steady state, we can adjust these values so that the total disk usage doesn't exceed the disk capacity.

The Actual Conf Files

The following example shows you the actual files used, with only a few minor modifications to simplify things.

The Director's configuration file is as follows:

Director {          # define myself
  Name = bacula-dir
  DIRport = 9101
  QueryFile = "/home/bacula/bin/query.sql"
  WorkingDirectory = "/home/bacula/working"
  PidDirectory = "/home/bacula/working"
  Maximum Concurrent Jobs = 1
  Password = " "
  Messages = Standard
}
#   By default, this job will back up to disk in /tmp
Job {
  Name = client
  Type = Backup
  Client = client-fd
  FileSet = "Full Set"
  Schedule = "WeeklyCycle"
  Storage = File
  Messages = Standard
  Pool = Default
  Full Backup Pool = Full-Pool
  Incremental Backup Pool = Inc-Pool
  Differential Backup Pool = Diff-Pool
  Write Bootstrap = "/home/bacula/working/client.bsr"
  Priority = 10
}
# List of files to be backed up
FileSet {
  Name = "Full Set"
  Include = signature=SHA1 compression=GZIP9 {
    /
    /usr
    /home
  }
  Exclude = {
     /proc /tmp /.journal /.fsck
  }
}
Schedule {
  Name = "WeeklyCycle"
  Run = Full 1st sun at 1:05
  Run = Differential 2nd-5th sun at 1:05
  Run = Incremental mon-sat at 1:05
}
Client {
  Name = client-fd
  Address = client
  FDPort = 9102
  Catalog = MyCatalog
  Password = " "
  AutoPrune = yes      # Prune expired Jobs/Files
  Job Retention = 6 months
  File Retention = 60 days
}
Storage {
  Name = File
  Address = localhost
  SDPort = 9103
  Password = " "
  Device = FileStorage
  Media Type = File
}
Catalog {
  Name = MyCatalog
  dbname = bacula; user = bacula; password = ""
}
Pool {
  Name = Full-Pool
  Pool Type = Backup
  Recycle = yes           # automatically recycle Volumes
  AutoPrune = yes         # Prune expired volumes
  Volume Retention = 6 months
  Accept Any Volume = yes # write on any volume in the pool
  Maximum Volume Jobs = 1
  Label Format = Full-
  Maximum Volumes = 6
}
Pool {
  Name = Inc-Pool
  Pool Type = Backup
  Recycle = yes           # automatically recycle Volumes
  AutoPrune = yes         # Prune expired volumes
  Volume Retention = 20 days
  Accept Any Volume = yes
  Maximum Volume Jobs = 6
  Label Format = Inc-
  Maximum Volumes = 5
}
Pool {
  Name = Diff-Pool
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 40 days
  Accept Any Volume = yes
  Maximum Volume Jobs = 1
  Label Format = Diff-
  Maximum Volumes = 6
}
Messages {
  Name = Standard
  mailcommand = "bsmtp -h mail.domain.com -f \"\(Bacula\) %r\"
      -s \"Bacula: %t %e of %c %l\" %r"
  operatorcommand = "bsmtp -h mail.domain.com -f \"\(Bacula\) %r\"
      -s \"Bacula: Intervention needed for %j\" %r"
  mail = root@domain.com = all, !skipped
  operator = root@domain.com = mount
  console = all, !skipped, !saved
  append = "/home/bacula/bin/log" = all, !skipped
}

and the Storage daemon's configuration file is:

Storage {               # definition of myself
  Name = bacula-sd
  SDPort = 9103       # Director's port
  WorkingDirectory = "/home/bacula/working"
  Pid Directory = "/home/bacula/working"
}
Director {
  Name = bacula-dir
  Password = " "
}
Device {
  Name = FileStorage
  Media Type = File
  Archive Device = /files/bacula
  LabelMedia = yes;    # lets Bacula label unlabeled media
  Random Access = Yes;
  AutomaticMount = yes;   # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;
}
Messages {
  Name = Standard
  director = bacula-dir = all
}


Migration

The term Migration, as used in the context of Bacula, means moving data from one Volume to another. In particular it refers to a Job (similar to a backup job) that reads data that was previously backed up to a Volume and writes it to another Volume. As part of this process, the File catalog records associated with the first backup job are purged. In other words, Migration moves Bacula Job data from one Volume to another by reading the Job data from the Volume it is stored on, writing it to a different Volume in a different Pool, and then purging the database records for the first Job.

The section process for which Job or Jobs are migrated can be based on quite a number of different criteria such as:

The details of these selection criteria will be defined below.

To run a Migration job, you must first define a Job resource very similar to a Backup Job but with Type = Migrate instead of Type = Backup. One of the key points to remember is that the Pool that is specified for the migration job is the only pool from which jobs will be migrated, with one exception noted below. In addition, the Pool to which the selected Job or Jobs will be migrated is defined by the Next Pool = ... in the Pool resource specified for the Migration Job.

Bacula permits pools to contain Volumes with different Media Types. However, when doing migration, this is a very undesirable condition. For migration to work properly, you should use pools containing only Volumes of the same Media Type for all migration jobs.

The migration job normally is either manually started or starts from a Schedule much like a backup job. It searches for a previous backup Job or Jobs that match the parameters you have specified in the migration Job resource, primarily a Selection Type (detailed a bit later). Then for each previous backup JobId found, the Migration Job will run a new Job which copies the old Job data from the previous Volume to a new Volume in the Migration Pool. It is possible that no prior Jobs are found for migration, in which case, the Migration job will simply terminate having done nothing, but normally at a minimum, three jobs are involved during a migration:

If the Migration control job finds a number of JobIds to migrate (e.g. it is asked to migrate one or more Volumes), it will start one new migration backup job for each JobId found on the specified Volumes. Please note that Migration doesn't scale too well since Migrations are done on a Job by Job basis. This if you select a very large volume or a number of volumes for migration, you may have a large number of Jobs that start. Because each job must read the same Volume, they will run consecutively (not simultaneously).

Migration Job Resource Directives

The following directives can appear in a Director's Job resource, and they are used to define a Migration job.

Pool = <Pool-name>
The Pool specified in the Migration control Job is not a new directive for the Job resource, but it is particularly important because it determines what Pool will be examined for finding JobIds to migrate. The exception to this is when Selection Type = SQLQuery, in which case no Pool is used, unless you specifically include it in the SQL query. Note, the Pool resource referenced must contain a Next Pool = ... directive to define the Pool to which the data will be migrated.

Type = Migrate
Migrate is a new type that defines the job that is run as being a Migration Job. A Migration Job is a sort of control job and does not have any Files associated with it, and in that sense they are more or less like an Admin job. Migration jobs simply check to see if there is anything to Migrate then possibly start and control new Backup jobs to migrate the data from the specified Pool to another Pool.

Selection Type = <Selection-type-keyword>
The <Selection-type-keyword> determines how the migration job will go about selecting what JobIds to migrate. In most cases, it is used in conjunction with a Selection Pattern to give you fine control over exactly what JobIds are selected. The possible values for <Selection-type-keyword> are:
SmallestVolume
This selection keyword selects the volume with the fewest bytes from the Pool to be migrated. The Pool to be migrated is the Pool defined in the Migration Job resource. The migration control job will then start and run one migration backup job for each of the Jobs found on this Volume. The Selection Pattern, if specified, is not used.

OldestVolume
This selection keyword selects the volume with the oldest last write time in the Pool to be migrated. The Pool to be migrated is the Pool defined in the Migration Job resource. The migration control job will then start and run one migration backup job for each of the Jobs found on this Volume. The Selection Pattern, if specified, is not used.

Client
The Client selection type, first selects all the Clients that have been backed up in the Pool specified by the Migration Job resource, then it applies the Selection Pattern (defined below) as a regular expression to the list of Client names, giving a filtered Client name list. All jobs that were backed up for those filtered (regexed) Clients will be migrated. The migration control job will then start and run one migration backup job for each of the JobIds found for those filtered Clients.

Volume
The Volume selection type, first selects all the Volumes that have been backed up in the Pool specified by the Migration Job resource, then it applies the Selection Pattern (defined below) as a regular expression to the list of Volume names, giving a filtered Volume list. All JobIds that were backed up for those filtered (regexed) Volumes will be migrated. The migration control job will then start and run one migration backup job for each of the JobIds found on those filtered Volumes.

Job
The Job selection type, first selects all the Jobs (as defined on the Name directive in a Job resource) that have been backed up in the Pool specified by the Migration Job resource, then it applies the Selection Pattern (defined below) as a regular expression to the list of Job names, giving a filtered Job name list. All JobIds that were run for those filtered (regexed) Job names will be migrated. Note, for a given Job named, they can be many jobs (JobIds) that ran. The migration control job will then start and run one migration backup job for each of the Jobs found.

SQLQuery
The SQLQuery selection type, used the Selection Pattern as an SQL query to obtain the JobIds to be migrated. The Selection Pattern must be a valid SELECT SQL statement for your SQL engine, and it must return the JobId as the first field of the SELECT.

PoolOccupancy
This selection type will cause the Migration job to compute the total size of the specified pool for all Media Types combined. If it exceeds the Migration High Bytes defined in the Pool, the Migration job will migrate all JobIds beginning with the oldest Volume in the pool (determined by Last Write time) until the Pool bytes drop below the Migration Low Bytes defined in the Pool. This calculation should be consider rather approximative because it is made once by the Migration job before migration is begun, and thus does not take into account additional data written into the Pool during the migration. In addition, the calculation of the total Pool byte size is based on the Volume bytes saved in the Volume (Media) database entries. The bytes calculate for Migration is based on the value stored in the Job records of the Jobs to be migrated. These do not include the Storage daemon overhead as is in the total Pool size. As a consequence, normally, the migration will migrate more bytes than strictly necessary.

PoolTime
The PoolTime selection type will cause the Migration job to look at the time each JobId has been in the Pool since the job ended. All Jobs in the Pool longer than the time specified on Migration Time directive in the Pool resource will be migrated.

Selection Pattern = <Quoted-string>
The Selection Patterns permitted for each Selection-type-keyword are described above.

For the OldestVolume and SmallestVolume, this Selection pattern is not used (ignored).

For the Client, Volume, and Job keywords, this pattern must be a valid regular expression that will filter the appropriate item names found in the Pool.

For the SQLQuery keyword, this pattern must be a valid SELECT SQL statement that returns JobIds.

Migration Pool Resource Directives

The following directives can appear in a Director's Pool resource, and they are used to define a Migration job.

Migration Time = <time-specification>
If a PoolTime migration is done, the time specified here in seconds (time modifiers are permitted -- e.g. hours, ...) will be used. If the previous Backup Job or Jobs selected have been in the Pool longer than the specified PoolTime, then they will be migrated.

Migration High Bytes = <byte-specification>
This directive specifies the number of bytes in the Pool which will trigger a migration if a PoolOccupancy migration selection type has been specified. The fact that the Pool usage goes above this level does not automatically trigger a migration job. However, if a migration job runs and has the PoolOccupancy selection type set, the Migration High Bytes will be applied. Bacula does not currently restrict a pool to have only a single Media Type, so you must keep in mind that if you mix Media Types in a Pool, the results may not be what you want, as the Pool count of all bytes will be for all Media Types combined.

Migration Low Bytes = <byte-specification>
This directive specifies the number of bytes in the Pool which will stop a migration if a PoolOccupancy migration selection type has been specified and triggered by more than Migration High Bytes being in the pool. In other words, once a migration job is started with PoolOccupancy migration selection and it determines that there are more than Migration High Bytes, the migration job will continue to run jobs until the number of bytes in the Pool drop to or below Migration Low Bytes.

Next Pool = <pool-specification>
The Next Pool directive specifies the pool to which Jobs will be migrated. This directive is required to define the Pool into which the data will be migrated. Without this directive, the migration job will terminate in error.

Storage = <storage-specification>
The Storage directive specifies what Storage resource will be used for all Jobs that use this Pool. It takes precedence over any other Storage specifications that may have been given such as in the Schedule Run directive, or in the Job resource. We highly recommend that you define the Storage resource to be used in the Pool rather than elsewhere (job, schedule run, ...).

Important Migration Considerations

Example Migration Jobs

When you specify a Migration Job, you must specify all the standard directives as for a Job. However, certain such as the Level, Client, and FileSet, though they must be defined, are ignored by the Migration job because the values from the original job used instead.

As an example, suppose you have the following Job that you run every night. To note: there is no Storage directive in the Job resource; there is a Storage directive in each of the Pool resources; the Pool to be migrated (File) contains a Next Pool directive that defines the output Pool (where the data is written by the migration job).

# Define the backup Job
Job {
  Name = "NightlySave"
  Type = Backup
  Level = Incremental                 # default
  Client=rufus-fd
  FileSet="Full Set"
  Schedule = "WeeklyCycle"
  Messages = Standard
  Pool = Default
}

# Default pool definition
Pool {
  Name = Default
  Pool Type = Backup
  AutoPrune = yes
  Recycle = yes
  Next Pool = Tape
  Storage = File
  LabelFormat = "File"
}

# Tape pool definition
Pool {
  Name = Tape
  Pool Type = Backup
  AutoPrune = yes
  Recycle = yes
  Storage = DLTDrive
}

# Definition of File storage device
Storage {
  Name = File
  Address = rufus
  Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9"
  Device = "File"          # same as Device in Storage daemon
  Media Type = File        # same as MediaType in Storage daemon
}

# Definition of DLT tape storage device
Storage {
  Name = DLTDrive
  Address = rufus
  Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9"
  Device = "HP DLT 80"      # same as Device in Storage daemon
  Media Type = DLT8000      # same as MediaType in Storage daemon
}

Where we have included only the essential information -- i.e. the Director, FileSet, Catalog, Client, Schedule, and Messages resources are omitted.

As you can see, by running the NightlySave Job, the data will be backed up to File storage using the Default pool to specify the Storage as File.

Now, if we add the following Job resource to this conf file.

Job {
  Name = "migrate-volume"
  Type = Migrate
  Level = Full
  Client = rufus-fd 
  FileSet = "Full Set"
  Messages = Standard
  Pool = Default
  Maximum Concurrent Jobs = 4
  Selection Type = Volume
  Selection Pattern = "File"
}

and then run the job named migrate-volume, all volumes in the Pool named Default (as specified in the migrate-volume Job that match the regular expression pattern File will be migrated to tape storage DLTDrive because the Next Pool in the Default Pool specifies that Migrations should go to the pool named Tape, which uses Storage DLTDrive.

If instead, we use a Job resource as follows:

Job {
  Name = "migrate"
  Type = Migrate
  Level = Full
  Client = rufus-fd
  FileSet="Full Set"
  Messages = Standard
  Pool = Default
  Maximum Concurrent Jobs = 4
  Selection Type = Job 
  Selection Pattern = ".*Save"
}

All jobs ending with the name Save will be migrated from the File Default to the Tape Pool, or from File storage to Tape storage.


Backup Strategies

Although Recycling and Backing Up to Disk Volume have been discussed in previous chapters, this chapter is meant to give you an overall view of possible backup strategies and to explain their advantages and disadvantages.

Simple One Tape Backup

Probably the simplest strategy is to back everything up to a single tape and insert a new (or recycled) tape when it fills and Bacula requests a new one.

Advantages

Disadvantages

Practical Details

This system is very simple. When the tape fills and Bacula requests a new tape, you unmount the tape from the Console program, insert a new tape and label it. In most cases after the label, Bacula will automatically mount the tape and resume the backup. Otherwise, you simply mount the tape.

Using this strategy, one typically does a Full backup once a week followed by daily Incremental backups. To minimize the amount of data written to the tape, one can do (as I do) a Full backup once a month on the first Sunday of the month, a Differential backup on the 2nd-5th Sunday of the month, and incremental backups the rest of the week.

Manually Changing Tapes

If you use the strategy presented above, Bacula will ask you to change the tape, and you will unmount it and then remount it when you have inserted the new tape.

If you do not wish to interact with Bacula to change each tape, there are several ways to get Bacula to release the tape:

Daily Tape Rotation

This scheme is quite different from the one mentioned above in that a Full backup is done to a different tape every day of the week. Generally, the backup will cycle continuously through 5 or 6 tapes each week. Variations are to use a different tape each Friday, and possibly at the beginning of the month. Thus if backups are done Monday through Friday only, you need only 5 tapes, and by having two Friday tapes, you need a total of 6 tapes. Many sites run this way, or using modifications of it based on two week cycles or longer.

Advantages

Disadvantages

Practical Details

The simplest way to "force" Bacula to use a different tape each day is to define a different Pool for each day of the the week a backup is done. In addition, you will need to specify appropriate Job and File retention periods so that Bacula will relabel and overwrite the tape each week rather than appending to it. Nic Bellamy has supplied an actual working model of this which we include here.

What is important is to create a different Pool for each day of the week, and on the run statement in the Schedule, to specify which Pool is to be used. He has one Schedule that accomplishes this, and a second Schedule that does the same thing for the Catalog backup run each day after the main backup (Priorities were not available when this script was written). In addition, he uses a Max Start Delay of 22 hours so that if the wrong tape is premounted by the operator, the job will be automatically canceled, and the backup cycle will re-synchronize the next day. He has named his Friday Pool WeeklyPool because in that Pool, he wishes to have several tapes to be able to restore to a time older than one week.

And finally, in his Storage daemon's Device resource, he has Automatic Mount = yes and Always Open = No. This is necessary for the tape ejection to work in his end_of_backup.sh script below.

For example, his bacula-dir.conf file looks like the following:

 
# /etc/bacula/bacula-dir.conf
#
# Bacula Director Configuration file
#
Director {
  Name = ServerName
  DIRport = 9101
  QueryFile = "/etc/bacula/query.sql"
  WorkingDirectory = "/var/lib/bacula"
  PidDirectory = "/var/run"
  SubSysDirectory = "/var/lock/subsys"
  Maximum Concurrent Jobs = 1
  Password = "console-pass"
  Messages = Standard
}
#
# Define the main nightly save backup job
#
Job {
  Name = "NightlySave"
  Type = Backup
  Client = ServerName
  FileSet = "Full Set"
  Schedule = "WeeklyCycle"
  Storage = Tape
  Messages = Standard
  Pool = Default
  Write Bootstrap = "/var/lib/bacula/NightlySave.bsr"
  Max Start Delay = 22h
}
# Backup the catalog database (after the nightly save)
Job {
  Name = "BackupCatalog"
  Type = Backup
  Client = ServerName
  FileSet = "Catalog"
  Schedule = "WeeklyCycleAfterBackup"
  Storage = Tape
  Messages = Standard
  Pool = Default
 # This creates an ASCII copy of the catalog
  RunBeforeJob = "/usr/lib/bacula/make_catalog_backup -u bacula"
 # This deletes the copy of the catalog, and ejects the tape
  RunAfterJob  = "/etc/bacula/end_of_backup.sh"
  Write Bootstrap = "/var/lib/bacula/BackupCatalog.bsr"
  Max Start Delay = 22h
}
# Standard Restore template, changed by Console program
Job {
  Name = "RestoreFiles"
  Type = Restore
  Client = ServerName
  FileSet = "Full Set"
  Storage = Tape
  Messages = Standard
  Pool = Default
  Where = /tmp/bacula-restores
}
# List of files to be backed up
FileSet {
  Name = "Full Set"
  Include = signature=MD5 {
    /
    /data
  }
  Exclude = { /proc /tmp /.journal }
}
#
# When to do the backups
#
Schedule {
  Name = "WeeklyCycle"
  Run = Level=Full Pool=MondayPool Monday at 8:00pm
  Run = Level=Full Pool=TuesdayPool Tuesday at 8:00pm
  Run = Level=Full Pool=WednesdayPool Wednesday at 8:00pm
  Run = Level=Full Pool=ThursdayPool Thursday at 8:00pm
  Run = Level=Full Pool=WeeklyPool Friday at 8:00pm
}
# This does the catalog. It starts after the WeeklyCycle
Schedule {
  Name = "WeeklyCycleAfterBackup"
  Run = Level=Full Pool=MondayPool Monday at 8:15pm
  Run = Level=Full Pool=TuesdayPool Tuesday at 8:15pm
  Run = Level=Full Pool=WednesdayPool Wednesday at 8:15pm
  Run = Level=Full Pool=ThursdayPool Thursday at 8:15pm
  Run = Level=Full Pool=WeeklyPool Friday at 8:15pm
}
# This is the backup of the catalog
FileSet {
  Name = "Catalog"
  Include = signature=MD5 {
     /var/lib/bacula/bacula.sql
  }
}
# Client (File Services) to backup
Client {
  Name = ServerName
  Address = dionysus
  FDPort = 9102
  Catalog = MyCatalog
  Password = "client-pass"
  File Retention = 30d
  Job Retention = 30d
  AutoPrune = yes
}
# Definition of file storage device
Storage {
  Name = Tape
  Address = dionysus
  SDPort = 9103
  Password = "storage-pass"
  Device = Tandberg
  Media Type = MLR1
}
# Generic catalog service
Catalog {
  Name = MyCatalog
  dbname = bacula; user = bacula; password = ""
}
# Reasonable message delivery -- send almost all to email address
#  and to the console
Messages {
  Name = Standard
  mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) %r\"
     -s \"Bacula: %t %e of %c %l\" %r"
  operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) %r\"
     -s \"Bacula: Intervention needed for %j\" %r"
  mail = root@localhost = all, !skipped
  operator = root@localhost = mount
  console = all, !skipped, !saved
  append = "/var/lib/bacula/log" = all, !skipped
}
    
# Pool definitions
#
# Default Pool for jobs, but will hold no actual volumes
Pool {
  Name = Default
  Pool Type = Backup
}
Pool {
  Name = MondayPool
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 6d
  Accept Any Volume = yes
  Maximum Volume Jobs = 2
}
Pool {
  Name = TuesdayPool
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 6d
  Accept Any Volume = yes
  Maximum Volume Jobs = 2
}
Pool {
  Name = WednesdayPool
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 6d
  Accept Any Volume = yes
  Maximum Volume Jobs = 2
}
Pool {
  Name = ThursdayPool
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 6d
  Accept Any Volume = yes
  Maximum Volume Jobs = 2
}
Pool {
  Name = WeeklyPool
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 12d
  Accept Any Volume = yes
  Maximum Volume Jobs = 2
}
# EOF

Note, the mailcommand and operatorcommand should be on a single line each. They were split to preserve the proper page width. In order to get Bacula to release the tape after the nightly backup, he uses a RunAfterJob script that deletes the ASCII copy of the database back and then rewinds and ejects the tape. The following is a copy of end_of_backup.sh

#! /bin/sh
/usr/lib/bacula/delete_catalog_backup
mt rewind
mt eject
exit 0

Finally, if you list his Volumes, you get something like the following:

*list media
Using default Catalog name=MyCatalog DB=bacula
Pool: WeeklyPool
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
| MeId| VolumeName| MedTyp| VolStat| VolBytes  | LastWritten     | VolRet| Recyc|
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
| 5   | Friday_1  | MLR1  | Used   | 2157171998| 2003-07-11 20:20| 103680| 1    |
| 6   | Friday_2  | MLR1  | Append | 0         | 0               | 103680| 1    |
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
Pool: MondayPool
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
| MeId| VolumeName| MedTyp| VolStat| VolBytes  | LastWritten     | VolRet| Recyc|
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
| 2   | Monday    | MLR1  | Used   | 2260942092| 2003-07-14 20:20| 518400| 1    |
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
Pool: TuesdayPool
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
| MeId| VolumeName| MedTyp| VolStat| VolBytes  | LastWritten     | VolRet| Recyc|
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
| 3   | Tuesday   | MLR1  | Used   | 2268180300| 2003-07-15 20:20| 518400| 1    |
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
Pool: WednesdayPool
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
| MeId| VolumeName| MedTyp| VolStat| VolBytes  | LastWritten     | VolRet| Recyc|
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
| 4   | Wednesday | MLR1  | Used   | 2138871127| 2003-07-09 20:2 | 518400| 1    |
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
Pool: ThursdayPool
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
| MeId| VolumeName| MedTyp| VolStat| VolBytes  | LastWritten     | VolRet| Recyc|
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
| 1   | Thursday  | MLR1  | Used   | 2146276461| 2003-07-10 20:50| 518400| 1    |
+-----+-----------+-------+--------+-----------+-----------------+-------+------+
Pool: Default
No results to list.

Note, I have truncated a number of the columns so that the information fits on the width of a page.


Autochanger Unterstützung

Bacula unterstützt Autochanger zum Lesen und Schreiben von Tapes. Damit Bacula mit einem Autochanger arbeiten kann, müssen einige Voraussetzungen erfüllt sein, die Details werden im folgenden geklärt.

In Version 1.37 und später, gibt es eine neue Autochanger-Konfiguration die erlaubt, bestimmte Device-Einträge zu gruppieren um einen Autochanger mit mehreren Laufwerken zu konfigurieren. Diese Konfiguration müssen Sie benutzen, wenn Sie einen Autochanger verwenden wollen.

Bacula benutzt sein eigenes mtx-changer Script als Interface zu dem Programm, dass die Steuerung des Autochangers übernimmt. mtx-changer kann im Prinzip so angepasst werden, dass es mit jedem Steuerungsprogramm für beliebige Autochanger funktioniert. Die derzeitige Version von mtx-changer arbeitet mit mtx. FreeBSD-Benutzer haben ein Script zur Verfügung gestellt (im Verzeichnis examples/autochangers), dass Bacula chio benutzen lässt.

Bacula unterstützt Autochanger mir Barcode-Lesern, dieses beinhaltet zwei Consolen-Kommandos: label barcodes und update slots. Im Abschnitt "Barcode Unterstützung" (siehe unten) erfolgt eine detaillierte Beschreibung dieser Kommandos.

Momentan beinhaltet die Autochanger-Unterstützung keine Stacker und Silos, und auch keine Laufwerks-Reinigung (Cleaning). Stacker und Silos werden nicht unterstützt, da sie keinen wahlfreien Zugriff auf ihre Slots erlauben. Unter Umständen schaffen Sie es vielleicht, einen Stacker (GravityFeed o. ä.) mit Bacula zum laufen zu bringen, indem Sie Ihre Konfiguration soweit anpassen, dass auf den Autochanger nur sequentiell zugegriffen wird. Die Unterstützung für Autochanger mit mehreren Laufwerken erfordert eine Konfiguration wie in Autochanger resource beschrieben. Diese Konfiguration ist aber auch für Autochanger mit nur einem Laufwerk zu benutzen.

Wenn mtx korrekt mit Ihrem Autochanger zusammenarbeitet, dann ist es nur eine Frage der Anpassung des mtx-changer Scripts (falls nötig) um den Autochanger mit Bacula zu benutzen. Eine Liste mit von mtx unterstüzten Autochangern, finden Sie unter folgendem Link: http://mtx.opensource-sw.net/compatibility.php. Die Homepage des mtx Projekts ist: http://mtx.opensource-sw.net/.

Anmerkung: wir haben Rückmeldungen von einigen Benutzern erhalten, die über gewisse Inkompatibilitäten zwischen dem Linux-Kernel und mtx berichten. Zum Beispiel zwischen Kernel 2.6.18-8.1.8.el5 von CentOS und RedHat und Version 1.3.10 und 1.3.11 von mtx. Ein Umstieg auf Kernel-Version 2.6.22 hat diese Probleme behoben.

Zusätzlich scheinen einige Versionen von mtx, z.B. 1.3.11, die maximale Anzahl der Slots auf 64 zu begrenzen, Abhilfe schafft die Benutzung von mtx-Version 1.3.10.

Wenn Sie Probleme haben, benutzen Sie bitte das auto Kommando im btape Programm, um die Funktionalität des Autochangers mit Bacula zu testen. Bitte bedenken Sie, dass bei vielen Distributionen (z.B. FreeBSD, Debian, ...) der Storage-Dienst nicht als Benutzer und Gruppe root läft, sonder als Benutzer bacula und Gruppe tape. In diesem Fall müssen Sie sicherstellen, das der Benutzer oder die Gruppe entsprechende Rechte hat, um auf den Autochanger und die Laufwerke zuzugreifen.

Manche Benutzer berichten, dass der Storage-Dienst unter Umständen beim laden eines Tapes in das Laufwerk blockiert, falls schon ein Tape im Laufwerk ist. Soweit wir das ermitteln konnten, ist es einfache eine Frage der Wartezeit: Das Laufwerk hat vorher ein Tape beschrieben und wird für eine ganze Zeit (bis zu 7 Minuten bei langsamen Laufwerken) im Status BLOCKED verbleiben, während das Tape zurückgespult und entladen wird, erst danach kann ein anderes Tape in das Laufwerk geladen werden.

Zuordnung der SCSI Geräte

Unter Linux können Sie:

cat /proc/scsi/scsi

ausführen, um zu sehen welche SCSI-Geräte Sie haben. Zudem können Sie:

cat /proc/scsi/sg/device_hdr /proc/scsi/sg/devices

benutzen, um herauszufinden, welches das Autochanger-Kontroll-Device ist, (/dev/sg0 für die erste Zeile, /dev/sg1 für die zweite, ...) das Sie in der Konfiguration unter Changer Device = angeben müssen.

Für weiterführende Information über SCSI-Geräte, schauen Sie bitte in den Abschnitt Linux SCSI Tricks aus dem Tape-Testing-Kapitel des Handbuchs.

Unter FreeBSD können Sie:

camcontrol devlist

benutzen, um SCSI-Geräte und die Kontroll-Devices /dev/passn des Autochangers anzuzeigen, die Sie in der Konfiguration unter Changer Device = angeben müssen.

Bitte stellen Sie sicher, dass der Storage-Dienst auf diese Geräte zugreifen darf.

Der folgende Tipp für FreeBSD-Benutzer kommt von Danny Butroyd: beim Neustart des Computers hat Bacula keine Berechtigung auf das Autochanger-Kontroll-Device (z.B. /dev/pass0) zuzugreifen, Um dies zu umgehen, editieren Sie die Datei /etc/devfs.conf und fügen unten diese Zeilen hinzu:

own     pass0   root:bacula
perm    pass0   0666
own     nsa0.0  root:bacula
perm    nsa0.0    0666

Das gibt der Gruppe bacula, nur um sicher zu gehen, auch die Schreib-Berechtigung für das Gerät nsa0.0. Damit die neue Konfiguration wirksam wird, müssen Sie:

/etc/rc.d/devfs restart

ausführen. Danach brauchen Sie nie wieder die Berechtigungen von Hand zu setzen, wenn der Computer neu gestartet wurde.

Beispiel Scripte

Lesen Sie bitte den nachfolgenden Abschnitt, damit Sie verstehen wie Bacula mit Autochangern arbeitet. Auch wenn Bacula ein standard mtx-changer Script installiert, benötigen Sie für Ihren Autochanger eventuell einige Anpassungen. Falls Sie Beispiele sehen wollen, schauen Sie bitte in das Verzeichnis <bacula-src>/examples/devices, wo Sie eine HP-autoloader.conf Bacula-Geräte-Konfiguration, sowie mehrere mtx-changer Scripte finden werden, die schon für unterschiedliche Autochanger angepasst sind.

Slots

Um den Autochanger richtig ansteuern zu können, muss Bacula wissen welches Volume in welchem Slot des Autochangers ist. In den Slots werden die Tapes aufbewahrt, die nicht in einem Laufwerk geladen sind. Bacula nummeriert diese Slots von eins bis zur Anzahl der vorhandenen Tapes im Autochanger.

Bacula benutzt niemals ein Volume im Autochanger, dass nicht gelabelt ist, dem keine Slotnummer im Katalog zugewiesen ist oder wenn das Volume nicht als InChanger im Katalog markiert ist. Bacula muss wissen wo das Volume/Tape ist, sonst kann es nicht geladen werden. Jedem Volume im Autochanger muss über das Console-Programm eine Slot-Nummer zugewiesen werden. Diese Information wird im Katalog, zusammen mit anderen Informationen über das Volume, gespeichert. Wenn kein Slot angegeben, oder der Slot auf Null gesetzt ist, wird Bacula das Volume nicht benutzen, auch wenn alle anderen benötigten Konfigurationsparameter richtig gesetzt sind. Wenn Sie das mount Console-Kommando ausführen, müssen Sie angeben welches Tape aus welchem Slot in das Laufwerk geladen werden soll. Falls schon ein Tape im Laufwerk ist, wird es entladen und danach das beim bf mount angegeben Tape geladen. Normalerweise wird kein anderes Tape im Laufwerk sein, da Bacula beim unmount Console-Kommando das Laufwerk leert.

Sie können die Slot-Nummer und die InChanger-Markierung überprüfen, indem Sie:

list Volumes
im Consolen-Programm ausführen.

mehrere Laufwerke

Einige Autochanger haben mehr als ein Laufwerk. Die in Version 1.37 vorgestellte Autochanger-Konfiguration, erlaubt Ihnen mehrere Geräte-Konfigurationen, die jeweils einem Laufwerk entsprechen, zu einem Autochanger zu gruppieren. Der Director-Dienst könnte trotzdem die Laufwerke direkt ansprechen, aber dies zu erlauben, würde die einwandfreie Zusammenarbeit der Laufwerke einschränken. Anstelle dessen sollte dem Director-Dienst, in der Director-Storage-Konfiguration, eine Autochanger-Konfiguration zugewiesen werden. Dieses erlaubt dem Storage-Dienst sicherzustellen, dass nur auf ein Laufwerk zur Zeit vom mtx-changer Script zugegriffen wird und nicht beide Laufwerke auf dasselbe Volume verweisen.

Mehrere Laufwerke erfordern das Setzen des Drive Index in den Geräte-Einträgen der Storage-Dienst-Konfiguration. Laufwerks-Nummern bzw. der Drive Index beginnen standardmäßig bei Null. Um mit dem zweiten Laufwerk im Autochanger arbeiten zu können, muss ein weiterer Geräte-Eintrag erstellt werden, wobei der Drive Index dann Eins ist. Normalerweise wird das zweite Laufwerk dasselbe Changer Device verwenden, aber ein anderes Archive Device.

Bacula Jobs werden bevorzugt auf das Volume geschrieben, dass schon in einem Laufwerk geladen ist. Wenn Sie mehrere Laufwerke haben und Bacula auf mehreren Laufwerke gleichzeitig Jobs, die denselben Pool verwenden, schreiben soll, muss der Parameter Prefer Mounted Volumes in der Director-Dienst-Konfiguration in den entsprechenden Job-Einträgen auf "no" gesetzt werden. Der Storage-Dienst wird daraufhin so viele Volumes wie möglich in die Laufwerke laden.

Geräte-Konfigurations-Parameter

Bacula's Autochanger-Konfiguration wird in den Geräte-Einträgen des Storage-Dienstes festgelegt. Vier Parameter: Autochanger, Changer Device,Changer Command, und Maximum Changer Wait steuern wie Bacula den Autochanger benutzt.

Diese vier Parameter der Device-Konfiguration, sind unten detailliert beschrieben. Changer Device und Changer Command werden in der Gräte-Konfiguration nicht benötigt, wenn sie in der Autochanger-Konfiguration stehen.

Autochanger = Yes|No
Der Autochanger-Parameter gibt an, ob der Geräte-Eintrag einen Autochanger beschreibt oder nicht. Der Standardwert ist Autochanger = No.

Changer Device = <device-name>
Zusätzlich zu dem Archive Device Eintrag, muss das Changer Device angegeben werden. Das ist notwendig, weil die meisten Autochanger über ein anderes Gerät gesteuert werden, als für das Schreiben und Lesen der Volumes verwendet wird. Ein Beispiel: unter Linux wird normalerweise das generische SCSI-Interface zum Steuern des Autochangers verwendet, wärend das standard SCSI-Interface für Lese- und Schreibvorgäge genutzt wird. Für das Archive Device = /dev/nst0 hat man dann typischerweise das Changer Device = /dev/sg0. Größere Autochanger, mit mehreren Laufwerken und vielen Slots, können das Kontroll-Device auch auf z.B. Changer Device = /dev/sg2 haben.

Unter FreeBSD liegt das Kontroll-Device zwischen /dev/pass0 und /dev/passn.

Unter Solaris finden Sie das Kontroll-Device im Verzeichnis /dev/rdsk.

Stellen Sie bitte sicher, dass der Storage-Dienst die notwendigen Rechte besitzt, um auf die entsprechenden Geräte zugreifen zu dürfen.

Changer Command = <command>
Dieser Parameter gibt an, welches externe Kommando und mit welchen Argumenten, aufgerufen wird, um den Autochanger zu steuern. Es wird vorausgesetzt, dass dieses Kommando ein normales Programm oder Shell-Script ist, das vom Betriebssystem ausgeführt werden kann. Dieses Kommando wird jedes mal aufgerufen, wenn Bacula das Autochanger-Kontroll-Device ansprechen möchte. Die folgenden Ersetzungen werden durchgeführt, bevor das command dem Betriebssystem zur Ausführung übergeben wird:

      %% = %
      %a = archive device name
      %c = changer device name
      %d = changer drive index base 0
      %f = Client's name
      %j = Job name
      %o = command  (loaded, load, or unload)
      %s = Slot base 0
      %S = Slot base 1
      %v = Volume name

Hier ist ein Beispiel f[ur die Benutzung von mtx mit dem mtx-changer Script, dass in der Bacula-Distribution enthalten ist:

Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"

Falls das mtx-changer Script nicht in /etc/bacula liegt, müssen Sie den Pfad entsprechend anpassen, Einzelheiten zu den drei von Bacula benutzten Kommandos (loaded, load, unload), sowie zu den von Bacula erwarteten Ausgaben des mtx-changer Scripts, werden weiter unten im Abschnitt Bacula Autochanger Schnittstelle beschrieben..

Maximum Changer Wait = <time>
Dieser Parameter gibt an, wie lange Bacula maximal warten soll, bis der Autochanger auf ein Kommando (z.B. load) reagiert. Der Standardwert beträgt 120 Sekunden. Wenn Sie einen langsamen Autochanger haben, müssen Sie hier eventuell eine längere Zeit konfigurieren.

Wenn der Autochanger nicht innerhalb der Maximum Changer Wait Zeit antwortet, wird das Kommando abgebrochen und Bacula wird das Eingreifen des Bedieners verlangen.

Drive Index = <number>
Dieser Parameter gibt die Nummer des Laufwerks innerhalb des Autochangers an. Da die Nummerierung bei Null beginnt, wird das zweite Laufwerk mit folgendem Eintrag angegeben:

Device Index = 1

Um das zweite Laufwerk nutzen zu können, muss ein zweiter Device-Eintrag in der Konfigurationsdatei des Storage-Dienstes erstellt werden. Einzelheiten dazu stehen, weiter oben in diesem Kapitel, in dem Abschnitt mehrere Laufwerke

Damit der Autochanger zuverläßig funktioniert, muss zusätzlich ein Autochanger-Eintrag erstellt werden.


Autochanger-Konfiguration

In der Autochanger-Konfiguration können Autochanger mit einzelnen oder mehreren Laufwerken angelegt werden, indem eine oder mehrere Gerätekonfigurationen zu einer Einheit, die Bacula Autochanger nennt, gruppiert werden. (Autochangerherrsteller nennen so etwas auch "Tape Library")

Damit Ihr Autochanger korrekt funktioniert, müssen Sie eine Autochanger-Konfiguration in der Konfigurationsdatei des Storage-Dienstes erstellen und in der Konfiguration des Director-Dienstes muss ein entsprechender Storage-Eintrag auf den Autochanger-Namen in der Storage-Dienst-Konfiguration verweisen. In früheren Bacula-Versionen verwies die Autochanger-Konfiguration des Director-Dienstes direkt auf Geräte-Konfigurationen des Storage-Dienstes. Seit Version 1.38.0 ist es nicht mehr möglich, aus einer Autochanger-Konfiguration des Director-Dienstes, direkt auf die Autochanger-Geräte zu verweisen.

Name = <Autochanger-Name>
die Angabe des Autochanger-Namens. Dieser Name wird in der Director-Storage-Definition benutzt um auf den Autochanger zu verweisen. Die Konfiguration des Namens ist zwingend erforderlich.

Device = <Device-name1, device-name2, ...>
die Angabe eines oder mehrerer Geräte-Namen, die den Device-Einträgen der Laufwerke des Autochangers entsprechen. Wenn Ihr Autochanger mehrere Laufwerke hat, müssen Sie auch mehrere Geräte-Namen angeben, jeweils einen für jede Geräte-Konfiguration, die einem Laufwerk des Autochangers entspricht. Sie können mehrere Geräte-Namen durch Kommas getrennt in einer Zeile, oder mehrere Device-Einträge angeben. Die Konfiguration der Geräte-Namen ist zwingend erforderlich.

Changer Device = Bezeichner
der angegebene Bezeichner entspricht dem Geräte-Namen des Autochangers (nicht der Laufwerke) der durch das Betriebssystem vergeben wird. Wenn der Geräte-Name hier konfiguriert wird, braucht er nicht mehr in den Device-Einträgen der Laufwerke angegeben werden. Wenn der Geräte-Name auch in den Device-Einträgen angegeben wird, hat der dortige Eintrag Vorrang vor der Angabe in der Autochanger-Konfiguration.

Changer Command = Bezeichner
der angegebene Bezeichner gibt das zu verwendende externe Programm an, dass Bacula aufruft, um automatisch Volumes zu wechseln. Meistens wird hier das mit Bacula zur Verfügung gestellte mtx-changer angegeben. Wenn der Kommando-Name hier konfiguriert wird, braucht er nicht mehr in den Device-Einträgen der Laufwerke angegeben werden. Wenn der Kommando-Name auch in den Device-Einträgen angegeben wird, hat der dortige Eintrag Vorrang vor der Angabe in der Autochanger-Konfiguration.

Das Folgende ist ein Beispiel einer gültigen Autochanger-Konfiguration:

Autochanger {
  Name = "DDS-4-changer"
  Device = DDS-4-1, DDS-4-2, DDS-4-3
  Changer Device = /dev/sg0
  Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"
}
Device {
  Name = "DDS-4-1"
  Drive Index = 0
  Autochanger = yes
  ...
}
Device {
  Name = "DDS-4-2"
  Drive Index = 1
  Autochanger = yes
  ...
Device {
  Name = "DDS-4-3"
  Drive Index = 2
  Autochanger = yes
  Autoselect = no
  ...
}

Bitte beachten Sie dass es wichtig ist, dass Autochanger = yes in allen Device-Einträgen angegeben wird die zum Autochanger gehören. Ein Device-Eintrag darf nie zu mehr als einem Autochanger gehören. Außerdem darf die Storage-Konfiguration des Director-Dienstes nur auf die Autochanger-Konfiguration zeigen und nicht auf die Device-Einträge.

Wenn Sie ein Laufwerk des Autochangers nicht automatisch durch Bacula benutzen lassen wollen, z.B. um immer ein freies Laufwerk für Rücksicherungen zu haben, können Sie folgendes dem entsprechenden Device-Eintrag hinzufügen:

Autoselect = no

In diesem Fall wird Bacula das Laufwerk nicht mehr automatisch auswählen, wenn es auf den Autochanger zugreift. Sie können das Laufwerk weiterhin benutzen, indem Sie direkt den Device-Namen ansprechen, anstatt des Autochangers. Ein Beispiel einer solchen Konfiguration sehen Sie oben bei dem Device-Eintrag DDS-4-3. Diese Laufwerk wird nicht benutzt werden, wenn der Autochanger-Name DDS-4-changer als Storage-Definition genutzt wird, es lässt sich aber direkt, mit entsprechenden Storage-Konfigurations-Eintrag im Director-Dienst, als Storage DDS-4-3 ansprechen.

eine Beispiel-Konfigurationsdatei

Die folgenden beiden Konfigurations-Einträge realisieren einen Autochanger:

Autochanger {
  Name = "Autochanger"
  Device = DDS-4
  Changer Device = /dev/sg0
  Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"
}

Device {
  Name = DDS-4
  Media Type = DDS-4
  Archive Device = /dev/nst0    # Normal archive device
  Autochanger = yes
  LabelMedia = no;
  AutomaticMount = yes;
  AlwaysOpen = yes;
}

Wobei Sie Archive Device, Changer Device und den Pfad zum Changer Command Ihrem System entsprechend anpassen müssen.

eine Beispiel-Konfigurationsdatei für mehrere Laufwerke

Die folgenden Konfigurations-Einträge realisieren einen Autochanger mit mehreren Laufwerken:

Autochanger {
  Name = "Autochanger"
  Device = Drive-1, Drive-2
  Changer Device = /dev/sg0
  Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"
}

Device {
  Name = Drive-1
  Drive Index = 0
  Media Type = DDS-4
  Archive Device = /dev/nst0    # Normal archive device
  Autochanger = yes
  LabelMedia = no;
  AutomaticMount = yes;
  AlwaysOpen = yes;
}

Device {
  Name = Drive-2
  Drive Index = 1
  Media Type = DDS-4
  Archive Device = /dev/nst1    # Normal archive device
  Autochanger = yes
  LabelMedia = no;
  AutomaticMount = yes;
  AlwaysOpen = yes;
}

Wobei Sie Archive Device, Changer Device und den Pfad zum Changer Command Ihrem System entsprechend anpassen müssen.

Festlegen der Slots beim Labeln

Wenn Sie einen Autochanger = yes Eintrag in Ihrer Storage-Konfiguration des Director-Dienstes hinzugefügt haben, wird die Bacula Console Sie bei diesen beiden Kommandos add und label automatisch nach einem Slot für die jeweilige Aktion fragen. Beim label Kommando wird Bacula automatisch das richtige Volume in ein Laufwerk laden.

Außerdem muss, wie oben beschrieben, der Parameter Autochanger = yes in der Geräte-Konfiguration des Storage-Dienstes vorhanden sein, damit der Autochanger benutzt werden kann. Nähere Informationen zu diesen Parametern finden Sie in der Storage Konfiguration des Director-Kapitels und in Device Konfiguration des Storage-Kapitels.

Somit können alle Aktionen mit dem Autochanger komplett automatisiert werden. Zudem ist es möglich mit dem Menüpunkt Volume Parameters des Consolen-Kommandos update den Slot zu setzen und zu ändern.

Selbst wenn alle oben genannten Konfigurationen und Parameter richtig angegeben sind, wird Bacula nur dann korrekt mit den Volumes im Autochanger arbeiten, wenn den Volume-Einträge im Katalog, die den Tapes im Autochanger entsprechenden, auch eine slot-Nummer zugewiesen ist.

Wenn Ihr Autochanger Barcodes unterstützt, können Sie alle Volumes im Autochanger, eins nach dem anderen, labeln indem Sie das Console-Kommando label barcodes verwenden. Jedes Tape mit Barcode, wird von Bacula in ein Laufwerk geladen und dann mit dem selben Namen gelabelt, der auch auf dem Barcode steht. Gleichzeitig wird ein Katalog-Eintrag für das Volume angelegt. Wenn der Barcode mit der Zeichenkette beginnt, die als CleaningPrefix= konfiguriert ist, wird Bacula das Tape für ein Reinigungsband halten und es wird nicht versucht das Tape zu labeln. Ein Beispiel:

Pool {
  Name ...
  Cleaning Prefix = "CLN"
}

Jedes Volume mit einem Barcode wie CLNxxxxx wird als Reinigungsband behandelt und nicht gelabelt.

Bitte bedenken Sie, dass jedes Volume, dass der Autochanger automatisch benutzen soll, bereits vor-gelabelt sein muss. Wenn Sie keinen Barcode-Leser haben, muss das von Hand geschehen (oder durch ein Script).

Tape-Wechsel

Wenn Sie Tapes dem Autochanger entnehmen oder hinzufügen wollen, oder das mtx Kommando von Hand aufrufen wollen, müssen Sie Bacula den Autochanger freigeben lassen, indem Sie folgendes Console-Kommando ausführen:

unmount
(wechseln der Tapes und/oder mtx ausf\"{u}hren
mount

Wenn Sie den Autochanger nicht freigeben, weiß Bacula nach dem Tapewechsel nicht mehr, welches Volume in welchen Slot des Autochanger ist und wird nicht mehr korrekt mit dem Autochanger arbeiten können. Bacula geht immer davon aus, dass es exklusiven Zugriff auf den Autochanger hat, solange ein Laufwerk gemountet ist.

Arbeiten mit mehreren Magazinen

Wenn Sie mehrere Magazine haben, oder wenn Sie Tapes in den Magazinen tauschen, müssen Sie Bacula darüber informieren. Bacula wird immer die Tapes im Autochanger bevorzugt vor anderen Tapes benutzen, somit werden Bedienereingriffe minimiert.

Wenn Ihr Autochanger mit Barcodes (maschinenlesbare Tape Labels) arbeitet, ist der Schritt, Bacula über die im Autochanger verfügbaren Tapes zu informieren, sehr einfach. Jedes mal wenn Sie ein Magazin wechseln, oder Tapes aus dem Magazine entfernen bzw. hinzufügen, führen Sie einfach:

unmount
(Magazin/Tapes wechseln)
update slots
mount

im Console-Programm aus. Daraufhin wird Bacula den Autochanger nach einer aktuellen Liste der in den Magazinen verfügbaren Tapes fragen. Bei diesem Vorgang werden keine Tapes gelesen, diese Informationen werden vom Autochanger während des Inventory ermittelt. Bacula aktualisiert die Volume-Einträge im Katalog, so dass bei allen in den Magazinen vorhandenen Tapes das InChanger Flag und auch die Slot-Nummern richtig gesetzt werden.

Falls Sie keinen Barcode-Leser im Autochanger haben, gibt es mehrere andere Möglichkeiten.

  1. Sie können den Slot und das InChanger Flag manuell setzen, indem Sie das update volume Consolen-Kommando verwenden (sehr umständlich).

  2. Sie können das

    update slots scan
    

    Consolen-Kommando ausführen. Daraufhin wird Bacula jedes Tape nacheinander in ein Laufwerk laden, das Tape Label lesen und den Katalog (Slot, InChanger-Flag) aktualisieren. Dieses Vorgehen ist zwar wirkungsvoll, aber auch sehr langsam.

  3. Sie können das mtx-changer Script anpassen, damit es die Barcodes im Autochanger simuliert (siehe unten).

Simulieren von Barcodes im Autochanger

Sie können die Barcodes im Autochanger simulieren, indem Sie das mtx-changer Script so anpassen, dass es die selben Informationen zurückgibt, die ein Autochanger mit Barcodes liefert. Dazu wird die folgende Zeile im mtx-changer Script:

  ${MTX} -f $ctl status |
             grep " *Storage Element [0-9]*:.*Full" |
                   awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
(Der Zeilenumbruch dient hier nur der Darstellung, im mtx-changer Script ist es eine Zeile)

durch ein # auskommentiert oder einfach gelöscht (Zeilennummer ist ungefähr 99). An ihrer Stelle wird eine neue Zeile erstellt, die den Inhalt einer Datei ausgibt. Zum Beispiel:

cat /etc/bacula/changer.volumes

Stellen Sie sicher, dass Sie den kompletten Pfad zur Datei angeben, Ort und Name der Datei sind egal. Die Inhalt der Datei muss folgenden Beispiel entsprechen:

1:Volume1
2:Volume2
3:Volume3
...

Wobei die 1, 2 und 3 die Slot-Nummern und Volume1, Volume2 und Volume3 die Namen (bzw. Barcodes) sind. Sie kö]nnen mehrere Datei erstellen, die den Tapes in verschiedenen Magazinen entsprechen und beim Wechsel der Magazine einfach die für das Magazine gültige Datei in die /etc/bacula/changer.volumes kopieren. Sie brauchen Bacula nicht neu zu starten, wenn Sie Magazine wechseln, nur die Datei muss den richtigen Inhalt haben. Wenn Sie dann das Console-Kommando update slots ausführen, wird Ihr Autochanger für Bacula so erscheinen, als ob er Barcodes unterstützen würde.

Alle Parameter des Update Slots Kommandos

Wenn Sie ncht alle Slots überprüfen lassen wollen, nur weil Sie ein Tape im Magazin getauscht haben, können Sie das Consolen-Kommando update slots, genauso wie das Kommando update slots scan, mit zusätzlichen Parametern aufrufen:

update slots=n1,n2,n3-n4, ...

wobei der Parameter scan optional ist. Die Parameter n1, n2, n3-n7... geben die Slots an, wobei n1, n2 für einzelne Slots und n3-n7 für einen Bereich von Slots steht (n3 bis n7).

Diese Parameter sind nützlich, wenn Sie update slots scan (sehr langsam) ausführen und dabei die Slots auf die mit gewechselten Tapes begrenzen können.

Als Beispiel, das Console-Kommando :

update slots=1,6 scan

veranlasst Bacula, das Tape im ersten Slot des Autochangers in ein Laufwerk zu laden, das Label zu lesen und den Katalog entsprechend zu aktualisieren. Danach passiert dasselbe mit dem Tape im sechsten Slot. Das Console-Kommando:

update slots=1-3,6

liest die Barcodes der Tapes in den Slots 1, 2, 3 und 6 und aktualisiert den Katalog. Wenn Ihr Autochanger keinen Barcode-Leser hat und Sie das mtx changer Script nicht, wie oben beschrieben, angepasst haben, wird dieses Console-Kommando keine Tapes finden und folglich nichts tun.

FreeBSD Belange

Falls unter FreeBSD Probleme auftreten, wenn Bacula versucht auf ein Laufwerk zuzugreifen und folgende Fehlermeldung erscheint: Device not configured, passiert dass weil FreeBSD den Geräte-Eintrag /dev/nsa1 entfernt, wenn kein Tape im Laufwerk ist. Das hat zur Folge, dass Bacula das Gerät nicht öffnen kann. Die Lösung für dieses Problem ist es, sicherzustellen, dass immer ein Tape im Laufwerk ist, wenn Bacula gestartet wird. Diese Problem ist in den Bacula-Versionen 1.32f-5 und später behoben.

Beachten Sie bitte das Kapitel Laufwerk-Tests bevor Sie den Autochanger testen, dort finden Sie weitere wichtige Informationen die Laufwerke betreffend.

Autochanger-Test und Anpassung des mtx-changer Scripts

Bevor Sie den Autochanger gleich mit Bacula ausprobieren, ist es vorzuziehen, zuerst von Hand zu testen ob er richtig funktioniert. Um das zu tun, empfehlen wir, dass Sie die folgenden Kommandos ausführen (wobei angenommen wird, dass das mtx-changer Script unter /etc/bacula/mtx-changer liegt):

Stellen Sie sicher, dass Bacula nicht läuft.

/etc/bacula/mtx-changer /dev/sg0 list 0 /dev/nst0 0

Das Kommando sollte diese Ausgabe erzeugen:

   1:
   2:
   3:
   ...

eine oder mehrere Zeilen für jeden belegten Slot im Autochanger, wobei hinter jeder Zahl ein Doppelpunkt (:) stehen muss. Wenn Ihr Autochanger Barcodes unterstützt, steht hinter dem Doppelpunkt der Barcode. Falls ein Fehler auftritt, muss die Ursache gefunden werden (versuchen Sie z.B. ein anderes Kontroll-Device zu verwenden, falls /dev/sg0 falsch ist). Unter FreeBSD z.B. liegt das Kontroll-Device gewöhnlich auf /dev/pass2.

/etc/bacula/mtx-changer /dev/sg0 slots

Das Kommando sollte die Anzahl der Slots im Autochanger anzeigen.

/etc/bacula/mtx-changer /dev/sg0 unload 1 /dev/nst0 0

Falls das Tape aus Slot 1 in einem Laufwerk geladen ist, sollte es jetzt entladen werden.

/etc/bacula/mtx-changer /dev/sg0 load 3 /dev/nst0 0

Angenommen in Slot 3 ist ein Tape, dann wird es jetzt in das erste Laufwerk geladen (Drive Index = 0)

/etc/bacula/mtx-changer /dev/sg0 loaded 0 /dev/nst0 0

Dieses Kommando sollte jetzt 3 ausgeben (Die Slot-Nummer des in Laufwerk 0 geladenen Tapes.). Beachten Sie, dass wir im Kommando eine ungültige Slotnummer 0 verwendet haben. In diesem Fall, wird sie einfach ignoriert, weil sie nicht benötigt wird. Allerdings musste eine Slot-Nummer angegeben werden, weil der Laufwerksparameter am Ende des Kommandos erforderlich war, um das richtige Laufwerk zu wählen.

/etc/bacula/mtx-changer /dev/sg0 unload 3 /dev/nst0 0

wird das Laufwerk mit Drive Index = 0 in Slot 3 entladen.

Nachdem alle oben genannten Kommandos funktionieren und in der Storage-Dienst-Konfiguration auch das richtige Changer Command angegeben ist, sollte Bacula jetzt mit Ihrem Autochanger arbeiten können. Das letzte verbleibende Problem ist, dass der Autochanger einige Zeit benötigt, das Tape zu laden, nachdem das entsprechende Kommando abgesetzt wurde. Wenn sich das mtx-changer Script nach dem load-Kommando beendet, wird Bacula sofort versuchen das Tape zurückzuspulen und zu lesen. Wenn Bacula Ein-/Ausgabe-Fehler nach dem Laden des Tapes meldet, werden Sie eventuell eine Verzögerungszeit (z.B. sleep 20) im mtx changer Script nach dem mtx Kommando einfügen müssen. Bitte bedenken Sie, dass egal was Sie dem mtx changer Script an Kommandos hinzufügen, sich das Script immer mit exit 0 beendet. Bacula überprüft den Rückgabewert des Script nach jedem Aufruf und er muss immer 0 sein, wenn alles geklappt hat.

Ob Sie eine sleep-Zeit im Script angeben müssen, können Sie mit folgenden Kommandos überprüfen, indem Sie sie in ein Script schreiben und ausführen.

#!/bin/sh
/etc/bacula/mtx-changer /dev/sg0 unload 1 /dev/nst0 0
/etc/bacula/mtx-changer /dev/sg0 load 3 /dev/nst0 0
mt -f /dev/st0 rewind
mt -f /dev/st0 weof

Wenn das Script funktioniert, haben Sie wahrscheinlich keine zeitlichen Probleme. Wenn es nicht funktioniert, tragen Sie, direkt hinter dem mtx-changer load Kommando, sleep 30 oder auch sleep 60 ein. Wenn es damit funktioniert, übernehmen Sie den passenden sleep-Eintrag in das mtx-changer Script, so wird diese Verzögerungszeit jedes mal angewendet, wenn Bacula das Script aufruft.

Ein zweites Problem, dass einige Autochanger betrifft, ist dass die Laufwerke diese Autochanger das Tape auswerfen müssen, bevor es aus dem Laufwerk entfernt werden kann. Falls das zutrifft, wird das Kommando load 3 niemals erfolgreich beendet werden, egal wie lange Sie warten. In diesem Fall, können Sie ein Auswurf-Kommando direkt hinter das unload setzen, so dass das Script dann so aussieht:

#!/bin/sh
/etc/bacula/mtx-changer /dev/sg0 unload 1 /dev/nst0 0
mt -f /dev/st0 offline
/etc/bacula/mtx-changer /dev/sg0 load 3 /dev/nst0 0
mt -f /dev/st0 rewind
mt -f /dev/st0 weof

Natürlich müssen Sie das offline Kommando in das mtx changer Script übernehmen, falls es das Problem behebt. Da Bacula den Rückgabewert des mtx changer Scripts überprüft, stellen sie wiederum sicher, dass er immer 0 ist, bzw. das der Rückgabewert des mtx Kommandos an Bacula übergeben wird.

Wie vorher schon angemerkt, sind im Verzeichnis <bacula-source>/examples/devices mehrere Scripte, die die oben genannten Kommandos bereits enthalten. Sie können eine Hilfe sein, um Ihr Script zum laufen zu bringen.

Wenn Bacula den Fehler Rewind error on /dev/nst0. ERR=Input/output error. ausgibt, werden Sie in den meisten Fällen eine längere sleep-Zeit in Ihrem mtx-changer Script hinzufügen müssen, bevor es nach dem load Kommando beendet wird.

Arbeiten mit dem Autochanger

Angenommen, Sie haben alle notwendigen Storage-Dienst-Device-Einträge richtig konfiguriert und Sie haben einen Autochanger = yes Eintrag zu der Storage-Konfiguration im Director-Dienst hinzugeügt.

Jetzt füllen Sie Ihren Autochanger mit, zum Beispiel, 6 leeren Tapes.

Was muss passieren, damit Bacula auf diese Tapes zugreifen kann?

Eine Möglichkeit ist, dass jedes Tape vorgelabelt wird. Starten Sie Bacula und führen Sie das Console-Programm aus, innerhalb des Console-Programms verwenden Sie das Kommando label:

./bconsole
Connecting to Director rufus:8101
1000 OK: rufus-dir Version: 1.26 (4 October 2002)
*label

wird etwas ähnliches wie hier ausgeben:

Using default Catalog name=BackupDB DB=bacula
The defined Storage resources are:
     1: Autochanger
     2: File
Select Storage resource (1-2): 1

Wählen Sie den Autochanger und es erscheint:

Enter new Volume name: TestVolume1
Enter slot (0 for none): 1

geben Sie Testvolume1 für den Tape-Namen ein und 1 für den Slot. Bacula fragt:

Defined Pools:
     1: Default
     2: File
Select the Pool (1-2): 1

Wählen Sie den Default Pool. Das wird automatisch gemacht, wenn Sie nur einen Pool haben. Nun wird Bacula damit beginnen, das benötigte Laufwerk zu entladen und das Tape aus Slot 1 in das Laufwerk zu laden und als Testvolume1 zu labeln. In diesem Beispiel war kein Tape im Laufwerk, die Ausgabe sieht dann so aus:

Connecting to Storage daemon Autochanger at localhost:9103 ...
Sending label command ...
3903 Issuing autochanger "load slot 1" command.
3000 OK label. Volume=TestVolume1 Device=/dev/nst0
Media record for Volume=TestVolume1 successfully created.
Requesting mount Autochanger ...
3001 Device /dev/nst0 is mounted with Volume TestVolume1
You have messages.
*

Sie können dann damit fortfahren, die andern Tapes zu labeln. Die Ausgaben werden etwas anders aussehen, weil Bacula dann erst das vorherige, gerade gelabelte Tape, aus dem Laufwerk entladen muss, bevor das neue Tape geladen werden kann.

Wenn Sie alle Tapes gelabelt haben, wird Bacula sie automatisch verwenden, wenn sie benötigt werden.

Um nachzusehen, wie die Tapes gelabelt sind, geben Sie einfach das Console-Kommando list volumes ein, das wird eine Liste, wie die folgende ausgeben:

*{\bf list volumes}
Using default Catalog name=BackupDB DB=bacula
Defined Pools:
     1: Default
     2: File
Select the Pool (1-2): 1
+-------+----------+--------+---------+-------+--------+----------+-------+------+
| MedId | VolName  | MedTyp | VolStat | Bites | LstWrt | VolReten | Recyc | Slot |
+-------+----------+--------+---------+-------+--------+----------+-------+------+
| 1     | TestVol1 | DDS-4  | Append  | 0     | 0      | 30672000 | 0     | 1    |
| 2     | TestVol2 | DDS-4  | Append  | 0     | 0      | 30672000 | 0     | 2    |
| 3     | TestVol3 | DDS-4  | Append  | 0     | 0      | 30672000 | 0     | 3    |
| ...                                                                            |
+-------+----------+--------+---------+-------+--------+----------+-------+------+

Barcode Unterstützung

Bacula unterstützt Barcodes mit zwei Console-Kommandos: label barcodes und update slots.

Das Kommando label barcodes bewirkt, dass Bacula mittels des mtx-changer list Kommandos die Barcodes der Tapes in allen Slots einliest. Danach wird jedes Tape, eins nach dem anderen, mit dem Namen gelabelt, den der Barcode enthält.

Das update slots Kommando holt, über das mtx-changer Script, zuerst eine Liste aller Tapes und deren Barcodes. Dann versucht es im Katalog die entsprechenden Tapes zu finden und aktualisiert den Slot und das InChanger Flag. Falls das Tape nicht im Katalog gelistet ist, passiert nichts. Diese Kommando wird benötigt, um die Volume-Einträge im Katalog mit den tatsächlich im Autochanger zur Verfügung stehenden Tapes abzugleichen, nachdem Tapes gewechselt oder in andere Slots verschoben wurden.

Die Angabe des Cleaning Prefix kann in der Pool-Konfiguration benutzt werden, um anzugeben welche Tapes (Barcodes) im Katalog mit dem VolStatus Cleaning gekennzeichnet werden sollen. Das verhindert, dass Bacula versucht auf dem Tape zu schreiben.

Bacula Autochanger Schnittstelle

Bacula ruft das Autochanger-Script auf, dass Sie als Changer Command angegeben haben. Normalerweise ist es das von Bacula mitgelieferte mtx-changer Script, aber tatsächlich kann es auch jedes andere Programm sein. Die einzige Anforderung ist, dass es die Kommandos die Bacula benutzt, loaded, load, unload, list und slots, unterstützt. Ausserdem muss jedes dieser Kommandos genau diese Rückgabewerte liefern:

- Die momentan benutzten Autochanger-Kommandos sind:
    loaded -- gibt, ab 1 beginnend, die Nummer des im Laufwerk geladenen Slot zur\"{u}ck,
              bzw. 0 wenn das Laufwerk leer ist.
    load   -- l\"{a}dt das Tape aus dem angegebenen Slot in das Laufwerk (einige Autochanger
              ben\"{o}tigen eine 30-sek\"{u}ndige Pause nach diesem Kommando)
    unload -- entl\"{a}dt das Tape aus dem Laufwerk zur\"{u}ck in den Slot
    list   -- gibt eine Zeile pro Tape im Autochanger aus.
              Das Format ist: <Slot>:<Barcode>. Wobei
              der {\bf Slot} eine Zahl (nicht null) ist, die der Slot-Nummer entspricht,
              und {\bf Barcode} ist, falls vorhanden, der Barcode des Tapes,
              ansonsten ist {\bf Barcode} leer.
     slots -- gibt die absolute Anzahl der Slots im Autochanger zur\"{u}ck.

Bacula überprüft den Rückgabewert des aufgerufenen Programms, wenn er Null ist, werden die gelieferten Daten akzeptiert. Wenn der Rückgabewert nicht Null ist, wird eine entsprechende Fehlermeldung ausgegeben und Bacula wird ein manuelles laden des Tapes in das Laufwerk erwarten.


Supported Autochangers


Supported Autochanger Models

I hesitate to call these "supported" autochangers because the only autochangers that I have in my possession and am able to test are the HP SureStore DAT40X6 and the Overland PowerLoader LTO-2. All the other autochangers have been reported to work by Bacula users. Note, in the Capacity/Slot column below, I quote the Compressed capacity per tape (or Slot).

OS Man. Media Model Slots Cap/Slot
Linux Adic DDS-3 Adic 1200G 12 -
Linux Adic DLT FastStore 4000 7 20GB
Linux Adic LTO-1/2, SDLT 320 Adic Scalar 24 24 100GB
Linux Adic LTO-2 Adic FastStor 2, Sun Storedge L8 8 200GB
- CA-VM ?? Tape ?? ??
Linux Gentoo Dell DLT VI,LTO-2 PowerVault 122T/132T/136T - 100GB
- DFSMS ?? VM RMM - ??
z/VM IBM ?? IBM Tape Manager - ??
z/VM IBM ?? native tape - ??
Linux Exabyte VXA2 VXA PacketLoader 1x10 2U 10 80/160GB
- Exabyte LTO Magnum 1x7 LTO Tape Auotloader 7 200/400GB
Linux Gentoo 1.4 Exabyte AIT-2 215A 15 (2 drives) 50GB
Linux HP DDS-4 SureStore DAT-40X6 6 40GB
Linux HP Ultrium-2/LTO MSL 6000/ 60030/ 5052 28 200/400GB
- HP DLT A4853 DLT 30 40/70GB
Linux HP (Compaq) DLT VI Compaq TL-895 96+4 import export 35/70GB
SuSE 9.0 IBM LTO IBM 3581 Ultrium Tape Loader 7 200/400GB
FreeBSD 5.4 IBM DLT IBM 3502-R14 -- rebranded ATL L-500 14 35/70GB
Debian Overland LTO Overland LoaderXpress LTO/DLT8000 10-19 40-100GB
Fedora Overland LTO Overland PowerLoader LTO-2 10-19 200/400GB
FreeBSD 5.4-Stable Overland LTO-2 Overland Powerloader tape 17 100GB
- Overland LTO Overland Neo2000 LTO 26-30 100GB
- Quantum ?? Super Loader ?? ??
FreeBSD 4.9 QUALSTAR TLS-4210 (Qualstar) AIT1: 36GB, AIT2: 50GB all uncomp QUALSTAR TLS-4210 12 AIT1: 36GB, AIT2: 50GB all uncomp
Linux Skydata DLT ATL-L200 8 40/80
- Sony DDS-4 TSL-11000 8 40GB
Linux Sony AIT-2 LIB-304(SDX-500C) ? 200GB
Linux Sony AIT-3 LIB-D81) ? 200GB
FreeBSD 4.9-STABLE Sony AIT-1 TSL-SA300C 4 45/70GB
- Storagetek DLT Timberwolf DLT 6 40/70
- Storagetek ?? ACSLS ?? ??
Solaris Sun 4mm DLT Sun Desktop Archive Python 29279 4 20GB
Linux Tandberg DLT VI VS 640 8? 35/70GB
Linux 2.6.x Tandberg Data SLR100 SLR100 Autoloader 8 50/100GB


Data Spooling

Bacula allows you to specify that you want the Storage daemon to initially write your data to disk and then subsequently to tape. This serves several important purposes.

Data spooling is exactly that "spooling". It is not a way to first write a "backup" to a disk file and then to a tape. When the backup has only been spooled to disk, it is not complete yet and cannot be restored until it is written to tape. In a future version, Bacula will support writing a backup to disk then later Migrating or Copying it to a tape.

The remainder of this chapter explains the various directives that you can use in the spooling process.

Data Spooling Directives

The following directives can be used to control data spooling.

!!! MAJOR WARNING !!!

Please be very careful to exclude the spool directory from any backup, otherwise, your job will write enormous amounts of data to the Volume, and most probably terminate in error. This is because in attempting to backup the spool file, the backup data will be written a second time to the spool file, and so on ad infinitum.

Another advice is to always specify the maximum spool size so that your disk doesn't completely fill up. In principle, data spooling will properly detect a full disk, and despool data allowing the job to continue. However, attribute spooling is not so kind to the user. If the disk on which attributes are being spooled fills, the job will be canceled. In addition, if your working directory is on the same partition as the spool directory, then Bacula jobs will fail possibly in bizarre ways when the spool fills.

Other Points


Python Scripting

You may be asking what Python is and why a scripting language is needed in Bacula. The answer to the first question is that Python is an Object Oriented scripting language with features similar to those found in Perl, but the syntax of the language is much cleaner and simpler. The answer to why have scripting in Bacula is to give the user more control over the whole backup process. Probably the simplest example is when Bacula needs a new Volume name, with a scripting language such as Python, you can generate any name you want, based on the current state of Bacula.

Python Configuration

Python must be enabled during the configuration process by adding a --with-python, and possibly specifying an alternate directory if your Python is not installed in a standard system location. If you are using RPMs you will need the python-devel package installed.

When Python is configured, it becomes an integral part of Bacula and runs in Bacula's address space, so even though it is an interpreted language, it is very efficient.

When the Director starts, it looks to see if you have a Scripts Directory Directive defined, if so, it looks in that directory for a file named DirStartUp.py. If it is found, Bacula will pass this file to Python for execution. The Scripts Directory is a new directive that you add to the Director resource of your bacula-dir.conf file.

Bacula Events

A Bacula event is a point in the Bacula code where Bacula will call a subroutine (actually a method) that you have defined in the Python StartUp script. Events correspond to some significant event such as a Job Start, a Job End, Bacula needs a new Volume Name, ... When your script is called, it will have access to all the Bacula variables specific to the Job (attributes of the Job Object), and it can even call some of the Job methods (subroutines) or set new values in the Job attributes, such as the Priority. You will see below how the events are used.

Python Objects

There are four Python objects that you will need to work with:

The Bacula Object
The Bacula object is created by the Bacula daemon (the Director in the present case) when the daemon starts. It is available to the Python startup script, DirStartup.py, by importing the Bacula definitions with import bacula. The methods available with this object are described below.

The Bacula Events Class
You create this class in the startup script, and you pass it to the Bacula Object's set_events method. The purpose of the Bacula Events Class is to define what global or daemon events you want to monitor. When one of those events occurs, your Bacula Events Class will be called at the method corresponding to the event. There are currently three events, JobStart, JobEnd, and Exit, which are described in detail below.

The Job Object
When a Job starts, and assuming you have defined a JobStart method in your Bacula Events Class, Bacula will create a Job Object. This object will be passed to the JobStart event. The Job Object has a has good number of read-only members or attributes providing many details of the Job, and it also has a number of writable attributes that allow you to pass information into the Job. These attributes are described below.

The Job Events Class
You create this class in the JobStart method of your Bacula Events class, and it allows you to define which of the possible Job Object events you want to see. You must pass an instance of your Job Events class to the Job Object set_events() method. Normally, you will probably only have one Job Events Class, which will be instantiated for each Job. However, if you wish to see different events in different Jobs, you may have as many Job Events classes as you wish.

The first thing the startup script must do is to define what global Bacula events (daemon events), it wants to see. This is done by creating a Bacula Events class, instantiating it, then passing it to the set_events method. There are three possible events.

JobStart
This Python method, if defined, will be called each time a Job is started. The method is passed the class instantiation object as the first argument, and the Bacula Job object as the second argument. The Bacula Job object has several built-in methods, and you can define which ones you want called. If you do not define this method, you will not be able to interact with Bacula jobs.

JobEnd
This Python method, if defined, will be called each time a Job terminates. The method is passed the class instantiation object as the first argument, and the Bacula Job object as the second argument.

Exit
This Python method, if defined, will be called when the Director terminates. The method is passed the class instantiation object as the first argument.

Access to the Bacula variables and methods is done with:

import bacula

The following are the read-only attributes provided by the bacula object.

Name
ConfigFile
WorkingDir
Version
string consisting of "Version Build-date"

A simple definition of the Bacula Events Class might be the following:

import sys, bacula
class BaculaEvents:
  def JobStart(self, job):
     ...

Then to instantiate the class and pass it to Bacula, you would do:

bacula.set_events(BaculaEvents()) # register Bacula Events wanted

And at that point, each time a Job is started, your BaculaEvents JobStart method will be called.

Now to actually do anything with a Job, you must define which Job events you want to see, and this is done by defining a JobEvents class containing the methods you want called. Each method name corresponds to one of the Job Events that Bacula will generate.

A simple Job Events class might look like the following:

class JobEvents:
  def NewVolume(self, job):
     ...

Here, your JobEvents class method NewVolume will be called each time the Job needs a new Volume name. To actually register the events defined in your class with the Job, you must instantiate the JobEvents class and set it in the Job set_events variable. Note, this is a bit different from how you registered the Bacula events. The registration process must be done in the Bacula JobStart event (your method). So, you would modify Bacula Events (not the Job events) as follows:

import sys, bacula
class BaculaEvents:
  def JobStart(self, job):
     events = JobEvents()         # create instance of Job class
     job.set_events(events)       # register Job events desired
     ...

When a job event is triggered, the appropriate event definition is called in the JobEvents class. This is the means by which your Python script or code gets control. Once it has control, it may read job attributes, or set them. See below for a list of read-only attributes, and those that are writable.

In addition, the Bacula job obbject in the Director has a number of methods (subroutines) that can be called. They are:

set_events
The set_events takes a single argument, which is the instantation of the Job Events class that contains the methods that you want called. The method names that will be called must correspond to the Bacula defined events. You may define additional methods but Bacula will not use them.
run
The run method takes a single string argument, which is the run command (same as in the Console) that you want to submit to start a new Job. The value returned by the run method is the JobId of the job that started, or -1 if there was an error.
write
The write method is used to be able to send print output to the Job Report. This will be described later.
DoesVolumeExist
The DoesVolumeExist takes a single string argument, which is the Volume name, and returns 1 if the volume exists in the Catalog and 0 if the volume does not exist.

The following attributes are read/write within the Director for the job object.

Priority
Read or set the Job priority. Note, that setting a Job Priority is effective only before the Job actually starts. (not functional yet)

The following read-only attributes are available within the Director for the job object.

Level
This attribute contains a string representing the Job level, e.g. Full, Differential, Incremental, ...
Type
This attribute contains a string representing the Job type, e.g. Backup, Restore, Verify, ...
JobId
This attribute contains an integer representing the JobId.
Client
This attribute contains a string with the name of the Client for this job.
NumVols
This attribute contains an integer with the number of Volumes in the Pool being used by the Job.
Pool
This attribute contains a string with the name of the Pool being used by the Job.
Storage
This attribute contains a string with the name of the Storage resource being used by the Job.
Catalog
This attribute contains a string with the name of the Catalog resource being used by the Job.
MediaType
This attribute contains a string with the name of the Media Type associated with the Storage resource being used by the Job.
Job
This attribute contains a string containing the name of the Job resource used by this job (not unique).
JobName
This attribute contains a string representing the full unique Job name.
JobStatus
This attribute contains a single character string representing the current Job status. The status may change during execution of the job.
Priority
This attribute contains an integer with the priority assigned to the job.
CatalogRes
tuple consisting of (DBName, Address, User, Password, Socket, Port, Database Vendor) taken from the Catalog resource for the Job with the exception of Database Vendor, which is one of the following: MySQL, PostgreSQL, SQLite, Internal, depending on what database you configured.
VolumeName
After a Volume has been purged, this attribute will contain the name of that Volume. At other times, this value may have no meaning.

The following write-only attributes are available within the Director:

JobReport
Send line to the Job Report.
VolumeName
Set a new Volume name. Valid only during the NewVolume event.

Python Console Command

There is a new Console command named python. It takes a single argument restart. Example:

  python restart

This command restarts the Python interpreter in the Director. This can be useful when you are modifying the DirStartUp script, because normally Python will cache it, and thus the script will be read one time.

Python Example

An example script for the Director startup file is provided in examples/python/DirStartup.py as follows:

#
# Bacula Python interface script for the Director
#

# You must import both sys and bacula
import sys, bacula

# This is the list of Bacula daemon events that you
#  can receive.
class BaculaEvents:
  def __init__(self):
     # Called here when a new Bacula Events class is
     #  is created. Normally not used 
     noop = 1

  def JobStart(self, job):
     """
       Called here when a new job is started. If you want
       to do anything with the Job, you must register
       events you want to receive.
     """
     events = JobEvents()         # create instance of Job class
     events.job = job             # save Bacula's job pointer
     job.set_events(events)       # register events desired
     sys.stderr = events          # send error output to Bacula
     sys.stdout = events          # send stdout to Bacula
     jobid = job.JobId; client = job.Client
     numvols = job.NumVols 
     job.JobReport="Python Dir JobStart: JobId=%d Client=%s NumVols=%d\n" % (jobid,client,numvols) 

  # Bacula Job is going to terminate
  def JobEnd(self, job):    
     jobid = job.JobId
     client = job.Client 
     job.JobReport="Python Dir JobEnd output: JobId=%d Client=%s.\n" % (jobid, client) 

  # Called here when the Bacula daemon is going to exit
  def Exit(self, job):
      print "Daemon exiting."
     
bacula.set_events(BaculaEvents()) # register daemon events desired

"""
  These are the Job events that you can receive.
"""
class JobEvents:
  def __init__(self):
     # Called here when you instantiate the Job. Not
     # normally used
     noop = 1
     
  def JobInit:
     # Called when the job is first scheduled
     noop = 1
     
  def JobRun:
     # Called just before running the job after initializing
     #  This is the point to change most Job parameters.
     #  It is equivalent to the JobRunBefore point.
     noop = 1

  def NewVolume(self, job):
     # Called when Bacula wants a new Volume name. The Volume
     #  name returned, if any, must be stored in job.VolumeName
     jobid = job.JobId
     client = job.Client 
     numvol = job.NumVols
     volname = "TestA-001"
     job.JobReport = "JobId=%d Client=%s NumVols=%d VolumeName=%s" % (jobid, client, numvol,volname)
     job.JobReport="Python before New Volume set for Job.\n"
     job.VolumeName=volname

  def VolumePurged(self, job):
     # Called when a Volume is purged. The Volume name can be referenced
     #  with job.VolumeName
     noop = 1


ANSI und IBM Tape Labels

Wenn Bacula entsprechend konfiguriert wird, unterstützt es ANSI und IBM Tape Labels. Mit der richtigen Konfiguration, kann man Bacula sogar zwingen, nur noch ANSI oder IBM Labels zu verwenden.

Bacula kann ein ANSI oder IBM Tape Label erstellen, aber wenn Check Labels konfiguriert ist (siehe unten), wird Bacula versuchen ein existierendes Tape Label zu finden, und dieses dann verwenden. Sie können die Tape Labels also mit anderen Programmen erstellen und Bacula wird diese Labels erkennen und damit arbeiten.

Obwohl Bacula ANSI und IBM Tape Labels erkennen und auch schreiben kann, wird es immer auch ein eigenes Tape Label erzeugen.

Wenn ANSI oder IBM Tape Labels verwenden werden, dürfen die Volume Namen nicht mehr als 6 Zeichen beinhalten.

Wenn Sie Ihre Volumes nicht mit Bacula gelabelt haben, dann wird das ANSI oder IBM Tape Label nur von Bacula erkannt, wenn Sie das HDR1 Label mit BACULA.DATA im Dateinamen (beginnend mit dem 5. Zeichen) erzeugt haben. Wenn Bacula das Tape Label schreibt, werden diese Informationen genutzt um das Tape als Bacula Tape zu erkennen. Dieses ermöglicht Tapes mit ANSI oder IBM Labels mit unterschiedlichen Backupprogrammen zu benutzen.

Director Pool Konfiguration

Label Type = ANSI | IBM | Bacula
Diese Direktive ist in der Director Pool und in der SD Device Konfiguration gültig. Wenn sie in der SD Device Konfiguration angegeben wird, hat sie Vorrang vor dem, was der Director dem SD übergibt. Der Standardwert ist Label Type = Bacula.

Storage Daemon Device Konfiguration

Label Type = ANSI | IBM | Bacula
Diese Direktive ist in der Director Pool und in der SD Device Konfiguration gültig. Wenn sie in der SD Device Konfiguration angegeben wird, hat sie Vorrang vor dem, was der Director dem SD übergibt. Der Standardwert ist Label Type = Bacula.

Check Labels = yes | no
Diese Direktive ist in der SD Device Konfiguration gültig. Wenn Sie beabsichtigen, ANSI oder IBM Tape Labels zu lesen, *muss* sie auf yes gesetzt sein. Auch wenn das Volume kein ANSI oder IBM Label hat, kann diese Direktive auf yes gesetzt werden, Bacula wird dann den Typ des Tape Labels automatisch überprüfen. Wird sie nicht auf yes gesetzt, wird Bacula annehmen, dass das Volume mit einem Bacula Tape Label versehen ist, eine Überprüfung auf ANSI oder IBM Tape Labels finden dann nicht statt. Der Standardwert ist Check Labels = no.


Bacula Frequently Asked Questions

These are questions that have been submitted over time by the Bacula users.

Please also see the bugs section of this document for a list of known bugs and solutions.

What is Bacula?

[What is Bacula? ] Bacula is a network backup and restore program.

Does Bacula support Windows?

[Does Bacula support Windows?] Yes, Bacula compiles and runs on Windows machines (Win98, WinMe, WinXP, WinNT, and Win2000). We provide a binary version of the Client (bacula-fd), but have not tested the Director nor the Storage daemon. Note, Win95 is no longer supported because it doesn't have the GetFileAttributesExA API call.

What language is Bacula written in?

[What language is Bacula written in?] It is written in C++, but it is mostly C code using only a limited set of the C++ extensions over C. Thus Bacula is completely compiled using the C++ compiler. There are several modules, including the Win32 interface, that are written using the object oriented C++ features. Over time, we are slowly adding a larger subset of C++.

On what machines does Bacula run?

[On what machines does Bacula run? ] Bacula builds and executes on RedHat Linux (versions RH7.1-RHEL 3.0, SuSE, Gentoo, Debian, Mandriva, ...), FreeBSD, Solaris, Alpha, SGI (client), NetBSD, OpenBSD, Mac OS X (client), and Win32 (client).

Bacula has been my only backup tool for over four years backing up 5 machines nightly (3 Linux boxes running RedHat, a WinXP machine, and a WinNT machine).

Is Bacula Stable?

[Is Bacula Stable? ] Yes, it is remarkably stable, but remember, there are still a lot of unimplemented or partially implemented features. With a program of this size (100,000+ lines of C++ code not including the SQL programs) there are bound to be bugs. The current test environment (a twisted pair local network and a HP DLT backup tape) is not exactly ideal, so additional testing on other sites is necessary. The File daemon has never crashed -- running months at a time with no intervention. The Storage daemon is remarkably stable with most of the problems arising during labeling or switching tapes. Storage daemon crashes are rare. The Director, given the multitude of functions it fulfills is also relatively stable. In a production environment, it rarely if ever crashes. Of the three daemons, the Director is the most prone to having problems. Still, it frequently runs several months with no problems.

There are a number of reasons for this stability.

  1. The program was largely written by one person to date (Kern).
  2. The program is constantly checking the chain of allocated memory buffers to ensure that no overruns have occurred.
  3. All memory leaks (orphaned buffers) are reported each time the program terminates.
  4. Any signal (segmentation fault, ...) generates a traceback that is emailed to the developer. This permits quick resolution of bugs even if they only show up rarely in a production system.
  5. There is a reasonably comprehensive set of regression tests that avoids re-creating the most common errors in new versions of Bacula.

I'm Getting Authorization Errors. What is Going On?

[I'm Getting Authorization Errors. What is Going On? ] For security reasons, Bacula requires that both the File daemon and the Storage daemon know the name of the Director as well as its password. As a consequence, if you change the Director's name or password, you must make the corresponding change in the Storage daemon's and in the File daemon's configuration files.

During the authorization process, the Storage daemon and File daemon also require that the Director authenticates itself, so both ends require the other to have the correct name and password.

If you have edited the conf files and modified any name or any password, and you are getting authentication errors, then your best bet is to go back to the original conf files generated by the Bacula installation process. Make only the absolutely necessary modifications to these files -- e.g. add the correct email address. Then follow the instructions in the Running Bacula chapter of this manual. You will run a backup to disk and a restore. Only when that works, should you begin customization of the conf files.

Another reason that you can get authentication errors is if you are running Multiple Concurrent Jobs in the Director, but you have not set them in the File daemon or the Storage daemon. Once you reach their limit, they will reject the connection producing authentication (or connection) errors.

If you are having problems connecting to a Windows machine that previously worked, you might try restarting the Bacula service since Windows frequently encounters networking connection problems.

Some users report that authentication fails if there is not a proper reverse DNS lookup entry for the machine. This seems to be a requirement of gethostbyname(), which is what Bacula uses to translate names into IP addresses. If you cannot add a reverse DNS entry, or you don't know how to do so, you can avoid the problem by specifying an IP address rather than a machine name in the appropriate Bacula conf file.

Here is a picture that indicates what names/passwords in which files/Resources must match up:

\includegraphics{./Conf-Diagram.eps}

In the left column, you will find the Director, Storage, and Client resources, with their names and passwords -- these are all in bacula-dir.conf. The right column is where the corresponding values should be found in the Console, Storage daemon (SD), and File daemon (FD) configuration files.

Another thing to check is to ensure that the Bacula component you are trying to access has Maximum Concurrent Jobs set large enough to handle each of the Jobs and the Console that want to connect simultaneously. Once the maximum connections has been reached, each Bacula component will reject all new connections.

Finally, make sure you have no hosts.allow or hosts.deny file that is not permitting access to the site trying to connect.

Bacula Runs Fine but Cannot Access a Client on a Different Machine. Why?

[Bacula Runs Fine but Cannot Access a Client on a Different Machine. Why? ] There are several reasons why Bacula could not contact a client on a different machine. They are:

My Catalog is Full of Test Runs, How Can I Start Over?

[My Catalog is Full of Test Runs, How Can I Start Over? ] If you are using MySQL do the following:

   cd <bacula-source>/src/cats
   ./drop_mysql_tables
   ./make_mysql_tables

If you are using SQLite, do the following:

   Delete bacula.db from your working directory.
   cd <bacula-source>/src/cats
   ./drop_sqlite_tables
   ./make_sqlite_tables

Then write an EOF on each tape you used with Bacula using:

mt -f /dev/st0 rewind
mt -f /dev/st0 weof

where you need to adjust the device name for your system.

I Run a Restore Job and Bacula Hangs. What do I do?

[I Run a Restore Job and Bacula Hangs. What do I do?] On Bacula version 1.25 and prior, it expects you to have the correct tape mounted prior to a restore. On Bacula version 1.26 and higher, it will ask you for the tape, and if the wrong one is mounted, it will inform you.

If you have previously done an unmount command, all Storage daemon sessions (jobs) will be completely blocked from using the drive unmounted, so be sure to do a mount after your unmount. If in doubt, do a second mount, it won't cause any harm.

I Cannot Get My Windows Client to Start Automatically?

[I Cannot Get My Windows Client to Start Automatically? ] You are probably having one of two problems: either the Client is dying due to an incorrect configuration file, or you didn't do the Installation commands necessary to install it as a Windows Service.

For the first problem, see the next FAQ question. For the second problem, please review the Windows Installation instructions in this manual.

My Windows Client Immediately Dies When I Start It

[My Windows Client Immediately Dies When I Start It ] The most common problem is either that the configuration file is not where it expects it to be, or that there is an error in the configuration file. You must have the configuration file in c:\bacula\bin\bacula-fd.conf.

To see what is going on when the File daemon starts on Windows, do the following:

    Start a DOS shell Window.
    cd c:\bacula\bin
    bacula-fd -d100 -c c:\bacula\bin\bacula-fd.conf

This will cause the FD to write a file bacula.trace in the current directory, which you can examine and thereby determine the problem.

[When I Start the Console, the Error Messages Fly By. How can I see them? ] Either use a shell window with a scroll bar, or use the gnome-console. In any case, you probably should be logging all output to a file, and then you can simply view the file using an editor or the less program. To log all output, I have the following in my Director's Message resource definition:

    append = "/home/kern/bacula/bin/log" = all, !skipped

Obviously you will want to change the filename to be appropriate for your system.

My backups are not working on my Windows Client. What should I do?

[I didn't realize that the backups were not working on my Windows Client. What should I do? ] You should be sending yourself an email message for each job. This will avoid the possibility of not knowing about a failed backup. To do so put something like:

  Mail = yourname@yourdomain = all, !skipped

in your Director's message resource. You should then receive one email for each Job that ran. When you are comfortable with what is going on (it took me 9 months), you might change that to:

   MailOnError = yourname@yourdomain = all, !skipped

then you only get email messages when a Job errors as is the case for your Windows machine.

You should also be logging the Director's messages, please see the previous FAQ for how to do so.

All my Jobs are scheduled for the same time. Will this cause problems?

[All my Jobs are scheduled for the same time. Will this cause problems? ] No, not at all. Bacula will schedule all the Jobs at the same time, but will run them one after another unless you have increased the number of simultaneous jobs in the configuration files for the Director, the File daemon, and the Storage daemon. The appropriate configuration record is Maximum Concurrent Jobs = nn. At the current time, we recommend that you leave this set to 1 for the Director.

Can Bacula Backup My System To Files instead of Tape?

[Can Bacula Backup My System To Files instead of Tape? ] Yes, in principle, Bacula can backup to any storage medium as long as you have correctly defined that medium in the Storage daemon's Device resource. For an example of how to backup to files, please see the Pruning Example in the Recycling chapter of this manual. Also, there is a whole chapter devoted to Basic Volume Management. This chapter was originally written to explain how to write to disk, but was expanded to include volume management. It is, however, still quite a good chapter to read.

Can Bacula Backup and Restore Files Greater than 2 Gigabytes?

[Can Bacula Backup and Restore Files Greater than 2 Gigabytes in Size? ] If your operating system permits it, and you are running Bacula version 1.26 or later, the answer is yes. To the best of our knowledge all client system supported by Bacula can handle files larger than 2 Gigabytes.

I want to stop a job. Is there a better way than ./bacula stop to stop it?

[I Started A Job then Decided I Really Did Not Want to Run It. Is there a better way than ./bacula stop to stop it?] Yes, you normally should use the Console command cancel to cancel a Job that is either scheduled or running. If the Job is scheduled, it will be marked for cancellation and will be canceled when it is scheduled to start. If it is running, it will normally terminate after a few minutes. If the Job is waiting on a tape mount, you may need to do a mount command before it will be canceled.

Why have You Trademarked the Name Bacula®?

[Why have You Trademarked the Name Bacula®?] We have trademarked the name Bacula to ensure that all media written by any program named Bacula will always be compatible. Anyone may use the name Bacula, even in a derivative product as long as it remains totally compatible in all respects with the program defined here.

Why is Your Online Document for Version 1.37 but the Released Version is 1.36?

[Why is Your Online Document for Version 1.37 of Bacula when the Currently Release Version is 1.36?] As Bacula is being developed, the document is also being enhanced, more often than not it has clarifications of existing features that can be very useful to our users, so we publish the very latest document. Fortunately it is rare that there are confusions with new features.

If you want to read a document that pertains only to a specific version, please use the one distributed in the source code.

Does Bacula really save and restore all files?

[How Can I Be Sure that Bacula Really Saves and Restores All Files? ] It is really quite simple, but took me a while to figure out how to "prove" it. First make a Bacula Rescue disk, see the Disaster Recovery Using Bacula of this manual. Second, you run a full backup of all your files on all partitions. Third, you run an Verify InitCatalog Job on the same FileSet, which effectively makes a record of all the files on your system. Fourth, you run a Verify Catalog job and assure yourself that nothing has changed (well, between an InitCatalog and Catalog one doesn't expect anything). Then do the unthinkable, write zeros on your MBR (master boot record) wiping out your hard disk. Now, restore your whole system using your Bacula Rescue disk and the Full backup you made, and finally re-run the Verify Catalog job. You will see that with the exception of the directory modification and access dates and the files changed during the boot, your system is identical to what it was before you wiped your hard disk. Alternatively you could do the wiping and restoring to another computer of the same type.

I want an Incremental but Bacula runs it as a Full backup. Why?

[I did a Full backup last week, but now in running an Incremental, Bacula says it did not find a FULL backup, so it did a FULL backup. Why?] Before doing an Incremental or a Differential backup, Bacula checks to see if there was a prior Full backup of the same Job that terminated successfully. If so, it uses the date that full backup started as the time for comparing if files have changed. If Bacula does not find a successful full backup, it proceeds to do one. Perhaps you canceled the full backup, or it terminated in error. In such cases, the full backup will not be successful. You can check by entering list jobs and look to see if there is a prior Job with the same Name that has Level F and JobStatus T (normal termination).

Another reason why Bacula may not find a suitable Full backup is that every time you change the FileSet, Bacula will require a new Full backup. This is necessary to ensure that all files are properly backed up in the case where you have added more files to the FileSet. Beginning with version 1.31, the FileSets are also dated when they are created, and this date is displayed with the name when you are listing or selecting a FileSet. For more on backup levels see below.

Do you really handle unlimited path lengths?

[How Can You Claim to Handle Unlimited Path and Filename Lengths when All Other Programs Have Fixed Limits?] Most of those other programs have been around for a long time, in fact since the beginning of Unix, which means that they were designed for rather small fixed length path and filename lengths. Over the years, these restrictions have been relaxed allowing longer names. Bacula on the other hand was designed in 2000, and so from the start, Path and Filenames have been kept in buffers that start at 256 bytes in length, but can grow as needed to handle any length. Most of the work is carried out by lower level routines making the coding rather easy.

Note that due to limitations Win32 path and filenames cannot exceed 260 characters. By using Win32 Unicode functions, we will remove this restriction in later versions of Bacula.

What Is the Really Unique Feature of Bacula?

[What Is the Really Unique Feature of Bacula?] Well, it is hard to come up with unique features when backup programs for Unix machines have been around since the 1960s. That said, I believe that Bacula is the first and only program to use a standard SQL interface to catalog its database. Although this adds a bit of complexity and possibly overhead, it provides an amazingly rich set of features that are easy to program and enhance. The current code has barely scratched the surface in this regard (version 1.31).

The second feature, which gives a lot of power and flexibility to Bacula is the Bootstrap record definition.

The third unique feature, which is currently (1.30) unimplemented, and thus can be called vaporware :-), is Base level saves. When implemented, this will enormously reduce tape usage.

How can I force one job to run after another?

[If I Run Multiple Simultaneous Jobs, How Can I Force One Particular Job to Run After Another Job? ] Yes, you can set Priorities on your jobs so that they run in the order you specify. Please see: the Priority record in the Job resource.

I Am Not Getting Email Notification, What Can I Do?

[I Am Not Getting Email Notification, What Can I Do? ]

The most common problem is that you have not specified a fully qualified email address and your bsmtp server is rejecting the mail. The next most common problem is that your bsmtp server doesn't like the syntax on the From part of the message. For more details on this and other problems, please see the Getting Email Notification to Work section of the Tips chapter of this manual. The section Getting Notified of Job Completion of the Tips chapter may also be useful. For more information on the bsmtp mail program, please see bsmtp in the Volume Utility Tools chapter of this manual.

My retention periods don't work

[I Change Recycling, Retention Periods, or File Sizes in my Pool Resource and they Still Don't Work.] The different variables associated with a Pool are defined in the Pool Resource, but are actually read by Bacula from the Catalog database. On Bacula versions prior to 1.30, after changing your Pool Resource, you must manually update the corresponding values in the Catalog by using the update pool command in the Console program. In Bacula version 1.30, Bacula does this for you automatically every time it starts.

When Bacula creates a Media record (Volume), it uses many default values from the Pool record. If you subsequently change the Pool record, the new values will be used as a default for the next Volume that is created, but if you want the new values to apply to existing Volumes, you must manually update the Volume Catalog entry using the update volume command in the Console program.

Why aren't my files compressed?

[I Have Configured Compression On, But None of My Files Are Compressed. Why?] There are two kinds of compression. One is tape compression. This is done by the tape drive hardware, and you either enable or disable it with system tools such as mt. This compression works independently of Bacula.

Bacula also has compression code, which is normally used only when backing up to file Volumes. There are two conditions for this "software" to become enabled.

  1. You must have the zip development libraries loaded on your system when building Bacula and Bacula must find this library, normally /usr/lib/libz.a. On RedHat systems, this library is provided by the zlib-devel rpm.

    If the library is found by Bacula during the ./configure it will be mentioned in the config.out line by:

                 ZLIB support:  yes
    

  2. You must add the compression=gzip option on your Include statement in the Director's configuration file.

[Bacula is Asking for a New Tape After 2 GB of Data but My Tape holds 33 GB. Why?] There are several reasons why Bacula will request a new tape.

Incremental backups are not working

[Bacula is Not Doing the Right Thing When I Request an Incremental Backup. Why?] As explained in one of the previous questions, Bacula will automatically upgrade an Incremental or Differential job to a Full backup if it cannot find a prior Full backup or a suitable Full backup. For the gory details on how/when Bacula decides to upgrade levels please see the Level record in the Director's configuration chapter of this manual.

If after reading the above mentioned section, you believe that Bacula is not correctly handling the level (Differential/Incremental), please send us the following information for analysis:

The above information can allow us to analyze what happened, without it, there is not much we can do.

I am waiting forever for a backup of an offsite machine

[I am Backing Up an Offsite Machine with an Unreliable Connection. The Director Waits Forever for the Client to Contact the SD. What Can I Do?] Bacula was written on the assumption that it will have a good TCP/IP connection between all the daemons. As a consequence, the current Bacula doesn't deal with faulty connections very well. This situation is slowly being corrected over time.

There are several things you can do to improve the situation.

SSH hangs forever after starting Bacula

[When I ssh into a machine and start Bacula then attempt to exit, ssh hangs forever.] This happens because Bacula leaves stdin, stdout, and stderr open for debug purposes. To avoid it, the simplest thing to do is to redirect the output of those files to /dev/null or another file in your startup script (the RedHat autostart scripts do this automatically). For example, you start the Director with:

    bacula-dir -c bacula-dir.conf ... 0>\&1 2>\&1 >/dev/null

and likewise for the other daemons.

I'm confused by retention periods

[I'm confused by the different Retention periods: File Retention, Job Retention, Volume Retention. Why are there so many?] Yes, this certainly can be confusing. The basic reason for so many is to allow flexibility. The File records take quite a lot of space in the catalog, so they are typically records you want to remove rather quickly. The Job records, take very little space, and they can be useful even without the File records to see what Jobs actually ran and when. One must understand that if the File records are removed from the catalog, you cannot use the restore command to restore an individual file since Bacula no longer knows where it is. However, as long as the Volume Retention period has not expired, the data will still be on the tape, and can be recovered from the tape.

For example, I keep a 30 day retention period for my Files to keep my catalog from getting too big, but I keep my tapes for a minimum of one year, just in case.

MaxVolumeSize is ignored

[Why Does Bacula Ignore the MaxVolumeSize Set in my Pool?] The MaxVolumeSize that Bacula uses comes from the Media record, so most likely you changed your Pool, which is used as the default for creating Media records, after you created your Volume. Check what is in the Media record by doing:

llist Volume=xxx

If it doesn't have the right value, you can use:

update Volume=xxx

to change it.

I get a Connection refused when connecting to my Client

[In connecting to my Client, I get "ERR:Connection Refused. Packet Size too big from File daemon:192.168.1.4:9102" Why?] This is typically a communications error resulting from one of the following:

If it is neither of the above, please submit a bug report at bugs.bacula.org.

Another solution might be to run the daemon with the debug option by:

    Start a DOS shell Window.
    cd c:\bacula\bin
    bacula-fd -d100 -c c:\bacula\bin\bacula-fd.conf

This will cause the FD to write a file bacula.trace in the current directory, which you can examine to determine the problem.

Long running jobs die with Pipe Error

[During long running jobs my File daemon dies with Pipe Error, or some other communications error. Why?] There are a number of reasons why a connection might break. Most often, it is a router between your two computers that times out inactive lines (not respecting the keepalive feature that Bacula uses). In that case, you can use the Heartbeat Interval directive in both the Storage daemon and the File daemon.

In at least one case, the problem has been a bad driver for a Win32 NVidia NForce 3 ethernet card with driver (4.4.2 17/05/2004). In this case, a good driver is (4.8.2.0 06/04/2005). Moral of the story, make sure you have the latest ethernet drivers loaded, or use the following workaround as suggested by Thomas Simmons for Win32 machines:

Browse to: Start > Control Panel > Network Connections

Right click the connection for the nvidia adapter and select properties. Under the General tab, click "Configure...". Under the Advanced tab set "Checksum Offload" to disabled and click OK to save the change.

Lack of communications, or communications that get interrupted can also be caused by Linux firewalls where you have a rule that throttles connections or traffic. For example, if you have:

iptables -t filter -A INPUT -m limit --limit 3/second --limit-burst 3 -j DROP

you will want to add the following rules before the above rule:

iptables -t filter -A INPUT --dport 9101 -j ACCEPT
iptables -t filter -A INPUT --dport 9102 -j ACCEPT
iptables -t filter -A INPUT --dport 9103 -j ACCEPT
This will ensure that any Bacula traffic will not get terminated because of high usage rates.

How to I tell the Job which Volume to use?

[I can't figure out how to tell the job which volume to use] This is an interesting statement. I now see that a number of people new to Bacula have the same problem as you, probably from using programs like tar.

In fact, you do not tell Bacula what tapes to use. It is the inverse. Bacula tells you want tapes it wants. You put tapes at its disposition and it chooses.

Now, if you *really* want to be tricky and try to tell Bacula what to do, it will be reasonable if for example you mount a valid tape that it can use on a drive, it will most likely go ahead and use it. It also has a documented algorithm for choosing tapes -- but you are asking for problems ...

So, the trick is to invert your concept of things and put Bacula in charge of handling the tapes. Once you do that, you will be fine. If you want to anticipate what it is going to do, you can generally figure it out correctly and get what you want.

If you start with the idea that you are going to force or tell Bacula to use particular tapes or you insist on trying to run in that kind of mode, you will probably not be too happy.

I don't want to worry about what tape has what data. That is what Bacula is designed for.

If you have an application where you *really* need to remove a tape each day and insert a new one, it can be done the directives exist to accomplish that. In such a case, one little "trick" to knowing what tape Bacula will want at 2am while you are asleep is to run a tiny job at 4pm while you are still at work that backs up say one directory, or even one file. You will quickly find out what tape it wants, and you can mount it before you go home ...


Tips and Suggestions

There are a number of example scripts for various things that can be found in the example subdirectory and its subdirectories of the Bacula source distribution.

For additional tips, please see the Bacula wiki.


Upgrading Bacula Versions

The first thing to do before upgrading from one version to another is to ensure that you don't overwrite or delete your production (current) version of Bacula until you have tested that the new version works.

If you have installed Bacula into a single directory, this is simple: simply make a copy of your Bacula directory.

If you have done a more typical Unix installation where the binaries are placed in one directory and the configuration files are placed in another, then the simplest way is to configure your new Bacula to go into a single file. Alternatively, make copies of all your binaries and especially your conf files.

Whatever your situation may be (one of the two just described), you should probably start with the defaultconf script that can be found in the examples subdirectory. Copy this script to the main Bacula directory, modify it as necessary (there should not need to be many modifications), configure Bacula, build it, install it, then stop your production Bacula, copy all the *.conf files from your production Bacula directory to the test Bacula directory, start the test version, and run a few test backups. If all seems good, then you can proceed to install the new Bacula in place of or possibly over the old Bacula.

When installing a new Bacula you need not worry about losing the changes you made to your configuration files as the installation process will not overwrite them providing that you do not do a make uninstall.

If the new version of Bacula requires an upgrade to the database, you can upgrade it with the script update_bacula_tables, which will be installed in your scripts directory (default /etc/bacula), or alternatively, you can find it in the <bacula-source>/src/cats directory.


Getting Notified of Job Completion

One of the first things you should do is to ensure that you are being properly notified of the status of each Job run by Bacula, or at a minimum of each Job that terminates with an error.

Until you are completely comfortable with Bacula, we recommend that you send an email to yourself for each Job that is run. This is most easily accomplished by adding an email notification address in the Messages resource of your Director's configuration file. An email is automatically configured in the default configuration files, but you must ensure that the default root address is replaced by your email address.

For additional examples of how to configure a Bacula, please take a look at the .conf files found in the examples sub-directory. We recommend the following configuration (where you change the paths and email address to correspond to your setup). Note, the mailcommand and operatorcommand should be on a single line. They were split here for presentation:

Messages {
  Name = Standard
  mailcommand = "/home/bacula/bin/bsmtp -h localhost
                -f \"\(Bacula\) %r\"
                -s \"Bacula: %t %e of %c %l\" %r"
  operatorcommand = "/home/bacula/bin/bsmtp -h localhost
                -f \"\(Bacula\) %r\"
                -s \"Bacula: Intervention needed for %j\" %r"
  Mail = your-email-address = all, !skipped, !terminate
  append = "/home/bacula/bin/log" = all, !skipped, !terminate
  operator = your-email-address = mount
  console = all, !skipped, !saved
}

You will need to ensure that the /home/bacula/bin path on the mailcommand and the operatorcommand lines point to your Bacula binary directory where the bsmtp program will be installed. You will also want to ensure that the your-email-address is replaced by your email address, and finally, you will also need to ensure that the /home/bacula/bin/log points to the file where you want to log all messages.

With the above Messages resource, you will be notified by email of every Job that ran, all the output will be appended to the log file you specify, all output will be directed to the console program, and all mount messages will be emailed to you. Note, some messages will be sent to multiple destinations.

The form of the mailcommand is a bit complicated, but it allows you to distinguish whether the Job terminated in error or terminated normally. Please see the Mail Command section of the Messages Resource chapter of this manual for the details of the substitution characters used above.

Once you are totally comfortable with Bacula as I am, or if you have a large number of nightly Jobs as I do (eight), you will probably want to change the Mail command to Mail On Error which will generate an email message only if the Job terminates in error. If the Job terminates normally, no email message will be sent, but the output will still be appended to the log file as well as sent to the Console program.


Getting Email Notification to Work

The section above describes how to get email notification of job status. Occasionally, however, users have problems receiving any email at all. In that case, the things to check are the following:


Getting Notified that Bacula is Running

If like me, you have setup Bacula so that email is sent only when a Job has errors, as described in the previous section of this chapter, inevitably, one day, something will go wrong and Bacula can stall. This could be because Bacula crashes, which is vary rare, or more likely the network has caused Bacula to hang for some unknown reason.

To avoid this, you can use the RunAfterJob command in the Job resource to schedule a Job nightly, or weekly that simply emails you a message saying that Bacula is still running. For example, I have setup the following Job in my Director's configuration file:

Schedule {
  Name = "Watchdog"
  Run = Level=Full sun-sat at 6:05
}
Job {
  Name = "Watchdog"
  Type = Admin
  Client=Watchdog
  FileSet="Verify Set"
  Messages = Standard
  Storage = DLTDrive
  Pool = Default
  Schedule = "Watchdog"
  RunAfterJob = "/home/kern/bacula/bin/watchdog %c %d"
}
Client {
  Name = Watchdog
  Address = rufus
  FDPort = 9102
  Catalog = Verify
  Password = ""
  File Retention = 1day
  Job Retention = 1 month
  AutoPrune = yes
}

Where I established a schedule to run the Job nightly. The Job itself is type Admin which means that it doesn't actually do anything, and I've defined a FileSet, Pool, Storage, and Client, all of which are not really used (and probably don't need to be specified). The key aspect of this Job is the command:

  RunAfterJob = "/home/kern/bacula/bin/watchdog %c %d"

which runs my "watchdog" script. As an example, I have added the Job codes %c and %d which will cause the Client name and the Director's name to be passed to the script. For example, if the Client's name is Watchdog and the Director's name is main-dir then referencing $1 in the script would get Watchdog and referencing $2 would get main-dir. In this case, having the script know the Client and Director's name is not really useful, but in other situations it may be.

You can put anything in the watchdog script. In my case, I like to monitor the size of my catalog to be sure that Bacula is really pruning it. The following is my watchdog script:

#!/bin/sh
cd /home/kern/mysql/var/bacula
du . * |
/home/kern/bacula/bin/bsmtp  \
   -f "\(Bacula\) abuse@whitehouse.com" -h mail.yyyy.com \
   -s "Bacula running" abuse@whitehouse.com

If you just wish to send yourself a message, you can do it with:

#!/bin/sh
cd /home/kern/mysql/var/bacula
/home/kern/bacula/bin/bsmtp  \
   -f "\(Bacula\) abuse@whitehouse.com" -h mail.yyyy.com \
   -s "Bacula running" abuse@whitehouse.com <<END-OF-DATA
Bacula is still running!!!
END-OF-DATA


Maintaining a Valid Bootstrap File

By using a WriteBootstrap record in each of your Director's Job resources, you can constantly maintain a bootstrap file that will enable you to recover the state of your system as of the last backup without having the Bacula catalog. This permits you to more easily recover from a disaster that destroys your Bacula catalog.

When a Job resource has a WriteBootstrap record, Bacula will maintain the designated file (normally on another system but mounted by NSF) with up to date information necessary to restore your system. For example, in my Director's configuration file, I have the following record:

 Write Bootstrap = "/mnt/deuter/files/backup/client-name.bsr"

where I replace client-name by the actual name of the client that is being backed up. Thus, Bacula automatically maintains one file for each of my clients. The necessary bootstrap information is appended to this file during each Incremental backup, and the file is totally rewritten during each Full backup.

Note, one disadvantage of writing to an NFS mounted volume as I do is that if the other machine goes down, the OS will wait forever on the fopen() call that Bacula makes. As a consequence, Bacula will completely stall until the machine exporting the NFS mounts comes back up. A possible solution to this problem was provided by Andrew Hilborne, and consists of using the soft option instead of the hard option when mounting the NFS volume, which is typically done in /etc/fstab/. The NFS documentation explains these options in detail. However, I found that with the soft option NFS disconnected frequently causing even more problems.

If you are starting off in the middle of a cycle (i.e. with Incremental backups) rather than at the beginning (with a Full backup), the bootstrap file will not be immediately valid as it must always have the information from a Full backup as the first record. If you wish to synchronize your bootstrap file immediately, you can do so by running a restore command for the client and selecting a full restore, but when the restore command asks for confirmation to run the restore Job, you simply reply no, then copy the bootstrap file that was written to the location specified on the Write Bootstrap record. The restore bootstrap file can be found in restore.bsr in the working directory that you defined. In the example given below for the client rufus, my input is shown in bold. Note, the JobId output has been partially truncated to fit on the page here:

(in the Console program)
*restore
First you select one or more JobIds that contain files
to be restored. You will then be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
To select the JobIds, you have the following choices:
     1: List last 20 Jobs run
     2: List Jobs where a given File is saved
     3: Enter list of JobIds to select
     4: Enter SQL list command
     5: Select the most recent backup for a client
     6: Cancel
Select item:  (1-6): 5
The defined Client resources are:
     1: Minimatou
     2: Rufus
     3: Timmy
Select Client (File daemon) resource (1-3): 2
The defined FileSet resources are:
     1: Other Files
Item 1 selected automatically.
+-------+------+-------+---------+---------+------+-------+------------+
| JobId | Levl | Files | StrtTim | VolName | File | SesId | VolSesTime |
+-------+------+-------+---------+---------+------+-------+------------+
| 2     | F    | 84    |  ...    | test1   | 0    | 1     | 1035645259 |
+-------+------+-------+---------+---------+------+-------+------------+
You have selected the following JobId: 2
Building directory tree for JobId 2 ...
The defined Storage resources are:
     1: File
Item 1 selected automatically.
You are now entering file selection mode where you add and
remove files to be restored. All files are initially added.
Enter "done" to leave this mode.
cwd is: /
$ done
84 files selected to restore.
Run Restore job
JobName:    kernsrestore
Bootstrap:  /home/kern/bacula/working/restore.bsr
Where:      /tmp/bacula-restores
FileSet:    Other Files
Client:     Rufus
Storage:    File
JobId:      *None*
OK to run? (yes/mod/no): no
quit
(in a shell window)
cp ../working/restore.bsr /mnt/deuter/files/backup/rufus.bsr


Rejected Volumes After a Crash

Bacula keeps a count of the number of files on each Volume in its Catalog database so that before appending to a tape, it can verify that the number of files are correct, and thus prevent overwriting valid data. If the Director or the Storage daemon crashes before the job has completed, the tape will contain one more file than is noted in the Catalog, and the next time you attempt to use the same Volume, Bacula will reject it due to a mismatch between the physical tape (Volume) and the catalog.

The easiest solution to this problem is to label a new tape and start fresh. If you wish to continue appending to the current tape, you can do so by using the update command in the console program to change the Volume Files entry in the catalog. A typical sequence of events would go like the following:

- Bacula crashes
- You restart Bacula

Bacula then prints:

17-Jan-2003 16:45 rufus-dir: Start Backup JobId 13,
                  Job=kernsave.2003-01-17_16.45.46
17-Jan-2003 16:45 rufus-sd: Volume test01 previously written,
                  moving to end of data.
17-Jan-2003 16:46 rufus-sd: kernsave.2003-01-17_16.45.46 Error:
                  I cannot write on this volume because:
                  The number of files mismatch! Volume=11 Catalog=10
17-Jan-2003 16:46 rufus-sd: Job kernsave.2003-01-17_16.45.46 waiting.
                   Cannot find any appendable volumes.
Please use the "label"  command to create a new Volume for:
    Storage:      SDT-10000
    Media type:   DDS-4
    Pool:         Default

(note, lines wrapped for presentation) The key here is the line that reads:

  The number of files mismatch! Volume=11 Catalog=10

It says that Bacula found eleven files on the volume, but that the catalog says there should be ten. When you see this, you can be reasonably sure that the SD was interrupted while writing before it had a chance to update the catalog. As a consequence, you can just modify the catalog count to eleven, and even if the catalog contains references to files saved in file 11, everything will be OK and nothing will be lost. Note that if the SD had written several file marks to the volume, the difference between the Volume count and the Catalog count could be larger than one, but this is unusual.

If on the other hand the catalog is marked as having more files than Bacula found on the tape, you need to consider the possible negative consequences of modifying the catalog. Please see below for a more complete discussion of this.

Continuing with the example of Volume = 11 Catalog = 10, to enable to Bacula to append to the tape, you do the following:

update
Update choice:
     1: Volume parameters
     2: Pool from resource
     3: Slots from autochanger
Choose catalog item to update (1-3): 1
Defined Pools:
     1: Default
     2: File
Select the Pool (1-2):
+-------+---------+--------+---------+-----------+------+----------+------+-----+
| MedId | VolName | MedTyp | VolStat | VolBytes  | Last | VolReten | Recy | Slt |
+-------+---------+--------+---------+-----------+------+----------+------+-----+
| 1     | test01  | DDS-4  | Error   | 352427156 | ...  | 31536000 | 1    | 0   |
+-------+---------+--------+---------+-----------+------+----------+------+-----+
Enter MediaId or Volume name: 1

(note table output truncated for presentation) First, you chose to update the Volume parameters by entering a 1. In the volume listing that follows, notice how the VolStatus is Error. We will correct that after changing the Volume Files. Continuing, you respond 1,

Updating Volume "test01"
Parameters to modify:
     1: Volume Status
     2: Volume Retention Period
     3: Volume Use Duration
     4: Maximum Volume Jobs
     5: Maximum Volume Files
     6: Maximum Volume Bytes
     7: Recycle Flag
     8: Slot
     9: Volume Files
    10: Pool
    11: Done
Select parameter to modify (1-11): 9
Warning changing Volume Files can result
in loss of data on your Volume
Current Volume Files is: 10
Enter new number of Files for Volume: 11
New Volume Files is: 11
Updating Volume "test01"
Parameters to modify:
     1: Volume Status
     2: Volume Retention Period
     3: Volume Use Duration
     4: Maximum Volume Jobs
     5: Maximum Volume Files
     6: Maximum Volume Bytes
     7: Recycle Flag
     8: Slot
     9: Volume Files
    10: Pool
    11: Done
Select parameter to modify (1-10): 1

Here, you have selected 9 in order to update the Volume Files, then you changed it from 10 to 11, and you now answer 1 to change the Volume Status.

Current Volume status is: Error
Possible Values are:
     1: Append
     2: Archive
     3: Disabled
     4: Full
     5: Used
     6: Read-Only
Choose new Volume Status (1-6): 1
New Volume status is: Append
Updating Volume "test01"
Parameters to modify:
     1: Volume Status
     2: Volume Retention Period
     3: Volume Use Duration
     4: Maximum Volume Jobs
     5: Maximum Volume Files
     6: Maximum Volume Bytes
     7: Recycle Flag
     8: Slot
     9: Volume Files
    10: Pool
    11: Done
Select parameter to modify (1-11): 11
Selection done.

At this point, you have changed the Volume Files from 10 to 11 to account for the last file that was written but not updated in the database, and you changed the Volume Status back to Append.

This was a lot of words to describe something quite simple.

The Volume Files option exists only in version 1.29 and later, and you should be careful using it. Generally, if you set the value to that which Bacula said is on the tape, you will be OK, especially if the value is one more than what is in the catalog.

Now lets consider the case:

  The number of files mismatch! Volume=10 Catalog=12

Here the Bacula found fewer files on the volume than what is marked in the catalog. Now, in this case, you should hesitate a lot before modifying the count in the catalog, because if you force the catalog from 12 to 10, Bacula will start writing after the file 10 on the tape, possibly overwriting valid data, and if you ever try to restore any of the files that the catalog has marked as saved on Files 11 and 12, all chaos will break out. In this case, you will probably be better off using a new tape. In fact, you might want to see what files the catalog claims are actually stored on that Volume, and back them up to another tape and recycle this tape.


Security Considerations

Only the File daemon needs to run with root permission (so that it can access all files). As a consequence, you may run your Director, Storage daemon, and MySQL or PostgreSQL database server as non-root processes. Version 1.30 has the -u and the -g options that allow you to specify a userid and groupid on the command line to be used after Bacula starts.

As of version 1.33, thanks to Dan Langille, it is easier to configure the Bacula Director and Storage daemon to run as non-root.

You should protect the Bacula port addresses (normally 9101, 9102, and 9103) from outside access by a firewall or other means of protection to prevent unauthorized use of your daemons.

You should ensure that the configuration files are not world readable since they contain passwords that allow access to the daemons. Anyone who can access the Director using a console program can restore any file from a backup Volume.

You should protect your Catalog database. If you are using SQLite, make sure that the working directory is readable only by root (or your Bacula userid), and ensure that bacula.db has permissions -rw-r--r-- (i.e. 640) or more strict. If you are using MySQL or PostgreSQL, please note that the Bacula setup procedure leaves the database open to anyone. At a minimum, you should assign the user bacula a userid and add it to your Director's configuration file in the appropriate Catalog resource.


Creating Holiday Schedules

If you normally change tapes every day or at least every Friday, but Thursday is a holiday, you can use a trick proposed by Lutz Kittler to ensure that no job runs on Thursday so that you can insert Friday's tape and be sure it will be used on Friday. To do so, define a RunJobBefore script that normally returns zero, so that the Bacula job will normally continue. You can then modify the script to return non-zero on any day when you do not want Bacula to run the job.


Automatic Labeling Using Your Autochanger

If you have an autochanger but it does not support barcodes, using a "trick" you can make Bacula automatically label all the volumes in your autochanger's magazine.

First create a file containing one line for each slot in your autochanger that has a tape to be labeled. The line will contain the slot number a colon (:) then the Volume name you want to use. For example, create a file named volume-list, which contains:

1:Volume001
2:TestVolume02
5:LastVolume

The records do not need to be in any order and you don't need to mention all the slots. Normally, you will have a consistent set of Volume names and a sequential set of numbers for each slot you want labeled. In the example above, I've left out slots 3 and 4 just as an example. Now, modify your mtx-changer script and comment out all the lines in the list) case by putting a # in column 1. Then add the following two lines:

  cat <absolute-path>/volume-list
  exit 0

so that the whole case looks like:

  list)
#
# commented out lines
   cat <absolute-path>/volume-list
   exit 0
   ;;

where you replace <absolute-path> with the full path to the volume-list file. Then using the console, you enter the following command:

   label barcodes

and Bacula will proceed to mount the autochanger Volumes in the list and label them with the Volume names you have supplied. Bacula will think that the list was provided by the autochanger barcodes, but in reality, it was you who supplied the <barcodes>.

If it seems to work, when it finishes, enter:

   list volumes

and you should see all the volumes nicely created.


Backing Up Portables Using DHCP

You may want to backup laptops or portables that are not always connected to the network. If you are using DHCP to assign an IP address to those machines when they connect, you will need to use the Dynamic Update capability of DNS to assign a name to those machines that can be used in the Address field of the Client resource in the Director's conf file.


Going on Vacation

At some point, you may want to be absent for a week or two and you want to make sure Bacula has enough tape left so that the backups will complete. You start by doing a list volumes in the Console program:

list volumes
 
Using default Catalog name=BackupDB DB=bacula
Pool: Default
+---------+---------------+-----------+-----------+----------------+-
| MediaId | VolumeName    | MediaType | VolStatus |       VolBytes |
+---------+---------------+-----------+-----------+----------------+-
|      23 | DLT-30Nov02   | DLT8000   | Full      | 54,739,278,128 |
|      24 | DLT-21Dec02   | DLT8000   | Full      | 56,331,524,629 |
|      25 | DLT-11Jan03   | DLT8000   | Full      | 67,863,514,895 |
|      26 | DLT-02Feb03   | DLT8000   | Full      | 63,439,314,216 |
|      27 | DLT-03Mar03   | DLT8000   | Full      | 66,022,754,598 |
|      28 | DLT-04Apr03   | DLT8000   | Full      | 60,792,559,924 |
|      29 | DLT-28Apr03   | DLT8000   | Full      | 62,072,494,063 |
|      30 | DLT-17May03   | DLT8000   | Full      | 65,901,767,839 |
|      31 | DLT-07Jun03   | DLT8000   | Used      | 56,558,490,015 |
|      32 | DLT-28Jun03   | DLT8000   | Full      | 64,274,871,265 |
|      33 | DLT-19Jul03   | DLT8000   | Full      | 64,648,749,480 |
|      34 | DLT-08Aug03   | DLT8000   | Full      | 64,293,941,255 |
|      35 | DLT-24Aug03   | DLT8000   | Append    |  9,999,216,782 |
+---------+---------------+-----------+-----------+----------------+

Note, I have truncated the output for presentation purposes. What is significant, is that I can see that my current tape has almost 10 Gbytes of data, and that the average amount of data I get on my tapes is about 60 Gbytes. So if I go on vacation now, I don't need to worry about tape capacity (at least not for short absences).

Equally significant is the fact that I did go on vacation the 28th of June 2003, and when I did the list volumes command, my current tape at that time, DLT-07Jun03 MediaId 31, had 56.5 Gbytes written. I could see that the tape would fill shortly. Consequently, I manually marked it as Used and replaced it with a fresh tape that I labeled as DLT-28Jun03, thus assuring myself that the backups would all complete without my intervention.


Exclude Files on Windows Regardless of Case

This tip was submitted by Marc Brueckner who wasn't sure of the case of some of his files on Win32, which is case insensitive. The problem is that Bacula thinks that /UNIMPORTANT FILES is different from /Unimportant Files. Marc was aware that the file exclusion permits wild-cards. So, he specified:

"/[Uu][Nn][Ii][Mm][Pp][Oo][Rr][Tt][Aa][Nn][Tt] [Ff][Ii][Ll][Ee][Ss]"

As a consequence, the above exclude works for files of any case.

Please note that this works only in Bacula Exclude statement and not in Include.


Executing Scripts on a Remote Machine

This tip also comes from Marc Brueckner. (Note, this tip is probably outdated by the addition of ClientRunBeforJob and ClientRunAfterJob Job records, but the technique still could be useful.) First I thought the "Run Before Job" statement in the Job-resource is for executing a script on the remote machine (the machine to be backed up). (Note, this is possible as mentioned above by using ClientRunBeforJob and ClientRunAfterJob). It could be useful to execute scripts on the remote machine e.g. for stopping databases or other services while doing the backup. (Of course I have to start the services again when the backup has finished) I found the following solution: Bacula could execute scripts on the remote machine by using ssh. The authentication is done automatically using a private key. First you have to generate a keypair. I've done this by:

ssh-keygen -b 4096 -t dsa -f Bacula_key

This statement may take a little time to run. It creates a public/private key pair with no passphrase. You could save the keys in /etc/bacula. Now you have two new files : Bacula_key which contains the private key and Bacula_key.pub which contains the public key.

Now you have to append the Bacula_key.pub file to the file authorized_keys in the \root\.ssh directory of the remote machine. Then you have to add (or uncomment) the line

AuthorizedKeysFile           %h/.ssh/authorized_keys

to the sshd_config file on the remote machine. Where the %h stands for the home-directory of the user (root in this case).

Assuming that your sshd is already running on the remote machine, you can now enter the following on the machine where Bacula runs:

ssh -i Bacula_key  -l root <machine-name-or-ip-address> "ls -la"

This should execute the "ls -la" command on the remote machine.

Now you could add lines like the following to your Director's conf file:

...
Run Before Job = ssh -i /etc/bacula/Bacula_key 192.168.1.1 \
                 "/etc/init.d/database stop"
Run After Job = ssh -i /etc/bacula/Bacula_key 192.168.1.1 \
                 "/etc/init.d/database start"
...

Even though Bacula version 1.32 and later has a ClientRunBeforeJob, the ssh method still could be useful for updating all the Bacula clients on several remote machines in a single script.


Recycling All Your Volumes

This tip comes from Phil Stracchino.

If you decide to blow away your catalog and start over, the simplest way to re-add all your prelabeled tapes with a minimum of fuss (provided you don't care about the data on the tapes) is to add the tape labels using the console add command, then go into the catalog and manually set the VolStatus of every tape to Recycle.

The SQL command to do this is very simple, either use your vendor's command line interface (mysql, postgres, sqlite, ...) or use the sql command in the Bacula console:

update Media set VolStatus='Recycle';

Bacula will then ignore the data already stored on the tapes and just re-use each tape without further objection.


Backing up ACLs on ext3 or XFS filesystems

This tip comes from Volker Sauer.

Note, this tip was given prior to implementation of ACLs in Bacula (version 1.34.5). It is left here because dumping/displaying ACLs can still be useful in testing/verifying that Bacula is backing up and restoring your ACLs properly. Please see the aclsupport FileSet option in the configuration chapter of this manual.

For example, you could dump the ACLs to a file with a script similar to the following:

#!/bin/sh
BACKUP_DIRS="/foo /bar"
STORE_ACL=/root/acl-backup
umask 077
for i in $BACKUP_DIRS; do
 cd $i /usr/bin/getfacl -R --skip-base .>$STORE_ACL/${i//\//_}
done

Then use Bacula to backup /root/acl-backup.

The ACLs could be restored using Bacula to the /root/acl-backup file, then restored to your system using:

setfacl --restore/root/acl-backup


Total Automation of Bacula Tape Handling

This tip was provided by Alexander Kuehn.

Bacula is a really nice backup program except that the manual tape changing requires user interaction with the bacula console.

Fortunately I can fix this. NOTE!!! This suggestion applies for people who do *NOT* have tape autochangers and must change tapes manually.!!!!!

Bacula supports a variety of tape changers through the use of mtx-changer scripts/programs. This highly flexible approach allowed me to create this shell script which does the following: Whenever a new tape is required it sends a mail to the operator to insert the new tape. Then it waits until a tape has been inserted, sends a mail again to say thank you and let's bacula continue its backup. So you can schedule and run backups without ever having to log on or see the console. To make the whole thing work you need to create a Device resource which looks something like this ("Archive Device", "Maximum Changer Wait", "Media Type" and "Label media" may have different values):

Device {
   Name=DDS3
   Archive Device = # use yours not mine! ;)/dev/nsa0
   Changer Device = # not really required/dev/nsa0
   Changer Command = "# use this (maybe change the path)!
         /usr/local/bin/mtx-changer %o %a %S"
   Maximum Changer Wait = 3d          # 3 days in seconds
   AutomaticMount = yes;              # mount on start
   AlwaysOpen = yes;                  # keep device locked
   Media Type = DDS3                  # it's just a name
   RemovableMedia = yes;              #
   Offline On Unmount = Yes;          # keep this too
   Label media = Yes;                 #
}

As the script has to emulate the complete wisdom of a mtx-changer it has an internal "database" containing where which tape is stored, you can see this on the following line:

labels="VOL-0001 VOL-0002 VOL-0003 VOL-0004 VOL-0005 VOL-0006
VOL-0007 VOL-0008 VOL-0009 VOL-0010 VOL-0011 VOL-0012"

The above should be all on one line, and it effectively tells Bacula that volume "VOL-0001" is located in slot 1 (which is our lowest slot), that volume "VOL-0002" is located in slot 2 and so on.. The script also maintains a logfile (/var/log/mtx.log) where you can monitor its operation.


Running Concurrent Jobs

Bacula can run multiple concurrent jobs, but the default configuration files do not enable it. Using the Maximum Concurrent Jobs directive, you can configure how many and which jobs can be run simultaneously. The Director's default value for Maximum Concurrent Jobs is "1".

To initially setup concurrent jobs you need to define Maximum Concurrent Jobs in the Director's configuration file (bacula-dir.conf) in the Director, Job, Client, and Storage resources.

Additionally the File daemon, and the Storage daemon each have their own Maximum Concurrent Jobs directive that sets the overall maximum number of concurrent jobs the daemon will run. The default for both the File daemon and the Storage daemon is "20".

For example, if you want two different jobs to run simultaneously backing up the same Client to the same Storage device, they will run concurrently only if you have set Maximum Concurrent Jobs greater than one in the Director resource, the Client resource, and the Storage resource in bacula-dir.conf.

We recommend that you read the Data Spooling of this manual first, then test your multiple concurrent backup including restore testing before you put it into production.

Below is a super stripped down bacula-dir.conf file showing you the four places where the the file must be modified to allow the same job NightlySave to run up to four times concurrently. The change to the Job resource is not necessary if you want different Jobs to run at the same time, which is the normal case.

#
# Bacula Director Configuration file -- bacula-dir.conf
#
Director {
  Name = rufus-dir
  Maximum Concurrent Jobs = 4
  ...
}
Job {
  Name = "NightlySave"
  Maximum Concurrent Jobs = 4
  Client = rufus-fd
  Storage = File
  ...
}
Client {
  Name = rufus-fd
  Maximum Concurrent Jobs = 4
  ...
}
Storage {
  Name = File
  Maximum Concurrent Jobs = 4
  ...
}


Volume Utility Tools

This document describes the utility programs written to aid Bacula users and developers in dealing with Volumes external to Bacula.

Specifying the Configuration File

Starting with version 1.27, each of the following programs requires a valid Storage daemon configuration file (actually, the only part of the configuration file that these programs need is the Device resource definitions). This permits the programs to find the configuration parameters for your archive device (generally a tape drive). By default, they read bacula-sd.conf in the current directory, but you may specify a different configuration file using the -c option.

Specifying a Device Name For a Tape

Each of these programs require a device-name where the Volume can be found. In the case of a tape, this is the physical device name such as /dev/nst0 or /dev/rmt/0ubn depending on your system. For the program to work, it must find the identical name in the Device resource of the configuration file. See below for specifying Volume names.

Please note that if you have Bacula running and you ant to use one of these programs, you will either need to stop the Storage daemon, or unmount any tape drive you want to use, otherwise the drive will busy because Bacula is using it.

Specifying a Device Name For a File

If you are attempting to read or write an archive file rather than a tape, the device-name should be the full path to the archive location including the filename. The filename (last part of the specification) will be stripped and used as the Volume name, and the path (first part before the filename) must have the same entry in the configuration file. So, the path is equivalent to the archive device name, and the filename is equivalent to the volume name.

Specifying Volumes

In general, you must specify the Volume name to each of the programs below (with the exception of btape). The best method to do so is to specify a bootstrap file on the command line with the -b option. As part of the bootstrap file, you will then specify the Volume name or Volume names if more than one volume is needed. For example, suppose you want to read tapes tape1 and tape2. First construct a bootstrap file named say, list.bsr which contains:

Volume=test1|test2

where each Volume is separated by a vertical bar. Then simply use:

./bls -b list.bsr /dev/nst0

In the case of Bacula Volumes that are on files, you may simply append volumes as follows:

./bls /tmp/test1\|test2

where the backslash (\) was necessary as a shell escape to permit entering the vertical bar (|).

And finally, if you feel that specifying a Volume name is a bit complicated with a bootstrap file, you can use the -V option (on all programs except bcopy) to specify one or more Volume names separated by the vertical bar (|). For example,

./bls -V Vol001 /dev/nst0

You may also specify an asterisk (*) to indicate that the program should accept any volume. For example:

./bls -V* /dev/nst0


bls

bls can be used to do an ls type listing of a Bacula tape or file. It is called:

Usage: bls [options] <device-name>
       -b <file>       specify a bootstrap file
       -c <file>       specify a config file
       -d <level>      specify debug level
       -e <file>       exclude list
       -i <file>       include list
       -j              list jobs
       -k              list blocks
    (no j or k option) list saved files
       -L              dump label
       -p              proceed inspite of errors
       -v              be verbose
       -V              specify Volume names (separated by |)
       -?              print this message

For example, to list the contents of a tape:

./bls -V Volume-name /dev/nst0

Or to list the contents of a file:

./bls /tmp/Volume-name
or
./bls -V Volume-name /tmp

Note that, in the case of a file, the Volume name becomes the filename, so in the above example, you will replace the xxx with the name of the volume (file) you wrote.

Normally if no options are specified, bls will produce the equivalent output to the ls -l command for each file on the tape. Using other options listed above, it is possible to display only the Job records, only the tape blocks, etc. For example:

 
./bls /tmp/File002
bls: butil.c:148 Using device: /tmp
drwxrwxr-x   3 k  k  4096 02-10-19 21:08  /home/kern/bacula/k/src/dird/
drwxrwxr-x   2 k  k  4096 02-10-10 18:59  /home/kern/bacula/k/src/dird/CVS/
-rw-rw-r--   1 k  k    54 02-07-06 18:02  /home/kern/bacula/k/src/dird/CVS/Root
-rw-rw-r--   1 k  k    16 02-07-06 18:02  /home/kern/bacula/k/src/dird/CVS/Repository
-rw-rw-r--   1 k  k  1783 02-10-10 18:59  /home/kern/bacula/k/src/dird/CVS/Entries
-rw-rw-r--   1 k  k 97506 02-10-18 21:07  /home/kern/bacula/k/src/dird/Makefile
-rw-r--r--   1 k  k  3513 02-10-18 21:02  /home/kern/bacula/k/src/dird/Makefile.in
-rw-rw-r--   1 k  k  4669 02-07-06 18:02  /home/kern/bacula/k/src/dird/README-config
-rw-r--r--   1 k  k  4391 02-09-14 16:51  /home/kern/bacula/k/src/dird/authenticate.c
-rw-r--r--   1 k  k  3609 02-07-07 16:41  /home/kern/bacula/k/src/dird/autoprune.c
-rw-rw-r--   1 k  k  4418 02-10-18 21:03  /home/kern/bacula/k/src/dird/bacula-dir.conf
...
-rw-rw-r--   1 k  k    83 02-08-31 19:19  /home/kern/bacula/k/src/dird/.cvsignore
bls: Got EOF on device /tmp
84 files found.

Listing Jobs

If you are listing a Volume to determine what Jobs to restore, normally the -j option provides you with most of what you will need as long as you don't have multiple clients. For example,

./bls -j -V Test1 -c stored.conf DDS-4
bls: butil.c:258 Using device: "DDS-4" for reading.
11-Jul 11:54 bls: Ready to read from volume "Test1" on device "DDS-4" (/dev/nst0).
Volume Record: File:blk=0:1 SessId=4 SessTime=1121074625 JobId=0 DataLen=165
Begin Job Session Record: File:blk=0:2 SessId=4 SessTime=1121074625 JobId=1 Level=F Type=B
Begin Job Session Record: File:blk=0:3 SessId=5 SessTime=1121074625 JobId=5 Level=F Type=B
Begin Job Session Record: File:blk=0:6 SessId=3 SessTime=1121074625 JobId=2 Level=F Type=B
Begin Job Session Record: File:blk=0:13 SessId=2 SessTime=1121074625 JobId=4 Level=F Type=B
End Job Session Record: File:blk=0:99 SessId=3 SessTime=1121074625 JobId=2 Level=F Type=B
   Files=168 Bytes=1,732,978 Errors=0 Status=T
End Job Session Record: File:blk=0:101 SessId=2 SessTime=1121074625 JobId=4 Level=F Type=B
   Files=168 Bytes=1,732,978 Errors=0 Status=T
End Job Session Record: File:blk=0:108 SessId=5 SessTime=1121074625 JobId=5 Level=F Type=B
   Files=168 Bytes=1,732,978 Errors=0 Status=T
End Job Session Record: File:blk=0:109 SessId=4 SessTime=1121074625 JobId=1 Level=F Type=B
   Files=168 Bytes=1,732,978 Errors=0 Status=T
11-Jul 11:54 bls: End of Volume at file 1 on device "DDS-4" (/dev/nst0), Volume "Test1"
11-Jul 11:54 bls: End of all volumes.

shows a full save followed by two incremental saves.

Adding the -v option will display virtually all information that is available for each record:

Listing Blocks

Normally, except for debugging purposes, you will not need to list Bacula blocks (the "primitive" unit of Bacula data on the Volume). However, you can do so with:

./bls -k /tmp/File002
bls: butil.c:148 Using device: /tmp
Block: 1 size=64512
Block: 2 size=64512
...
Block: 65 size=64512
Block: 66 size=19195
bls: Got EOF on device /tmp
End of File on device

By adding the -v option, you can get more information, which can be useful in knowing what sessions were written to the volume:

./bls -k -v /tmp/File002
Volume Label:
Id                : Bacula 0.9 mortal
VerNo             : 10
VolName           : File002
PrevVolName       :
VolFile           : 0
LabelType         : VOL_LABEL
LabelSize         : 147
PoolName          : Default
MediaType         : File
PoolType          : Backup
HostName          :
Date label written: 2002-10-19 at 21:16
Block: 1 blen=64512 First rec FI=VOL_LABEL SessId=1 SessTim=1035062102 Strm=0 rlen=147
Block: 2 blen=64512 First rec FI=6 SessId=1 SessTim=1035062102 Strm=DATA rlen=4087
Block: 3 blen=64512 First rec FI=12 SessId=1 SessTim=1035062102 Strm=DATA rlen=5902
Block: 4 blen=64512 First rec FI=19 SessId=1 SessTim=1035062102 Strm=DATA rlen=28382
...
Block: 65 blen=64512 First rec FI=83 SessId=1 SessTim=1035062102 Strm=DATA rlen=1873
Block: 66 blen=19195 First rec FI=83 SessId=1 SessTim=1035062102 Strm=DATA rlen=2973
bls: Got EOF on device /tmp
End of File on device

Armed with the SessionId and the SessionTime, you can extract just about anything.

If you want to know even more, add a second -v to the command line to get a dump of every record in every block.

./bls -k -v -v /tmp/File002
bls: block.c:79 Dump block  80f8ad0: size=64512 BlkNum=1
               Hdrcksum=b1bdfd6d cksum=b1bdfd6d
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=VOL_LABEL Strm=0 len=147 p=80f8b40
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=SOS_LABEL Strm=-7 len=122 p=80f8be7
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=1 Strm=UATTR len=86 p=80f8c75
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=2 Strm=UATTR len=90 p=80f8cdf
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=3 Strm=UATTR len=92 p=80f8d4d
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=3 Strm=DATA len=54 p=80f8dbd
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=3 Strm=MD5 len=16 p=80f8e07
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=4 Strm=UATTR len=98 p=80f8e2b
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=4 Strm=DATA len=16 p=80f8ea1
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=4 Strm=MD5 len=16 p=80f8ec5
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=5 Strm=UATTR len=96 p=80f8ee9
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=5 Strm=DATA len=1783 p=80f8f5d
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=5 Strm=MD5 len=16 p=80f9668
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=UATTR len=95 p=80f968c
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=DATA len=32768 p=80f96ff
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=DATA len=32768 p=8101713
bls: block.c:79 Dump block  80f8ad0: size=64512 BlkNum=2
               Hdrcksum=9acc1e7f cksum=9acc1e7f
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=contDATA len=4087 p=80f8b40
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=DATA len=31970 p=80f9b4b
bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=MD5 len=16 p=8101841
...


bextract

Normally, you will restore files by running a Restore Job from the Console program. However, bextract can be used to extract a single file or a list of files from a Bacula tape or file. In fact, bextract can be a useful tool to restore files to an empty system assuming you are able to boot, you have statically linked bextract and you have an appropriate bootstrap file.

It is called:

 
Usage: bextract [-d debug_level] <device-name> <directory-to-store-files>
       -b <file>       specify a bootstrap file
       -dnn            set debug level to nn
       -e <file>       exclude list
       -i <file>       include list
       -p              proceed inspite of I/O errors
       -V              specify Volume names (separated by |)
       -?              print this message

where device-name is the Archive Device (raw device name or full filename) of the device to be read, and directory-to-store-files is a path prefix to prepend to all the files restored.

NOTE: On Windows systems, if you specify a prefix of say d:/tmp, any file that would have been restored to c:/My Documents will be restored to d:/tmp/My Documents. That is, the original drive specification will be stripped. If no prefix is specified, the file will be restored to the original drive.

Extracting with Include or Exclude Lists

Using the -e option, you can specify a file containing a list of files to be excluded. Wildcards can be used in the exclusion list. This option will normally be used in conjunction with the -i option (see below). Both the -e and the -i options may be specified at the same time as the -b option. The bootstrap filters will be applied first, then the include list, then the exclude list.

Likewise, and probably more importantly, with the -i option, you can specify a file that contains a list (one file per line) of files and directories to include to be restored. The list must contain the full filename with the path. If you specify a path name only, all files and subdirectories of that path will be restored. If you specify a line containing only the filename (e.g. my-file.txt) it probably will not be extracted because you have not specified the full path.

For example, if the file include-list contains:

/home/kern/bacula
/usr/local/bin

Then the command:

./bextract -i include-list -V Volume /dev/nst0 /tmp

will restore from the Bacula archive /dev/nst0 all files and directories in the backup from /home/kern/bacula and from /usr/local/bin. The restored files will be placed in a file of the original name under the directory /tmp (i.e. /tmp/home/kern/bacula/... and /tmp/usr/local/bin/...).

Extracting With a Bootstrap File

The -b option is used to specify a bootstrap file containing the information needed to restore precisely the files you want. Specifying a bootstrap file is optional but recommended because it gives you the most control over which files will be restored. For more details on the bootstrap file, please see Restoring Files with the Bootstrap File chapter of this document. Note, you may also use a bootstrap file produced by the restore command. For example:

./bextract -b bootstrap-file /dev/nst0 /tmp

The bootstrap file allows detailed specification of what files you want restored (extracted). You may specify a bootstrap file and include and/or exclude files at the same time. The bootstrap conditions will first be applied, and then each file record seen will be compared to the include and exclude lists.

Extracting From Multiple Volumes

If you wish to extract files that span several Volumes, you can specify the Volume names in the bootstrap file or you may specify the Volume names on the command line by separating them with a vertical bar. See the section above under the bls program entitled Listing Multiple Volumes for more information. The same techniques apply equally well to the bextract program.


bscan

The bscan program can be used to re-create a database (catalog) from the backup information written to one or more Volumes. This is normally needed only if one or more Volumes have been pruned or purged from your catalog so that the records on the Volume are no longer in the catalog.

With some care, it can also be used to synchronize your existing catalog with a Volume. Although we have never seen a case of bscan damaging a catalog, since bscan modifies your catalog, we recommend that you do a simple ASCII backup of your database before running bscan just to be sure. See Compacting Your Database.

bscan can also be useful in a disaster recovery situation, after the loss of a hard disk, if you do not have a valid bootstrap file for reloading your system, or if a Volume has been recycled but not overwritten, you can use bscan to re-create your database, which can then be used to restore your system or a file to its previous state.

It is called:

 
Usage: bscan [options] <bacula-archive>
       -b bootstrap   specify a bootstrap file
       -c <file>      specify configuration file
       -d <nn>        set debug level to nn
       -m             update media info in database
       -n <name>      specify the database name (default bacula)
       -u <user>      specify database user name (default bacula)
       -P <password>  specify database password (default none)
       -h <host>      specify database host (default NULL)
       -p             proceed inspite of I/O errors
       -r             list records
       -s             synchronize or store in database
       -v             verbose
       -V <Volumes>   specify Volume names (separated by |)
       -w <dir>       specify working directory (default from conf file)
       -?             print this message

If you are using MySQL or PostgreSQL, there is no need to supply a working directory since in that case, bscan knows where the databases are. However, if you have provided security on your database, you may need to supply either the database name (-b option), the user name (-u option), and/or the password (-p) options.

As an example, let's suppose that you did a backup to Volumes "Vol001" and "Vol002", then sometime later all records of one or both those Volumes were pruned or purged from the database. By using bscan you can recreate the catalog entries for those Volumes and then use the restore command in the Console to restore whatever you want. A command something like:

bscan -c bacula-sd.conf -v -V Vol001\|Vol002 /dev/nst0

will give you an idea of what is going to happen without changing your catalog. Of course, you may need to change the path to the Storage daemon's conf file, the Volume name, and your tape (or disk) device name. This command must read the entire tape, so if it has a lot of data, it may take a long time, and thus you might want to immediately use the command listed below. Note, if you are writing to a disk file, replace the device name with the path to the directory that contains the Volumes. This must correspond to the Archive Device in the conf file.

Then to actually write or store the records in the catalog, add the -s option as follows:

 bscan -s -m -c bacula-sd.conf -v -V Vol001\|Vol002 /dev/nst0

When writing to the database, if bscan finds existing records, it will generally either update them if something is wrong or leave them alone. Thus if the Volumes you are scanning are all or partially in the catalog already, no harm will be done to that existing data. Any missing data will simply be added.

If you have multiple tapes, you should scan them with:

 bscan -s -m -c bacula-sd.conf -v -V Vol001\|Vol002\|Vol003 /dev/nst0

You should, always try to specify the tapes in the order they are written. However, bscan can handle scanning tapes that are not sequential. Any incomplete records at the end of the tape will simply be ignored in that case. If you are simply reparing an existing catalog, this may be OK, but if you are creating a new catalog from scratch, it will leave your database in an incorrect state. If you do not specify all necessary Volumes on a single bscan command, bscan will not be able to correctly restore the records that span two volumes. In other words, it is much better to specify two or three volumes on a single bscan command rather than run bscan two or three times, each with a single volume.

Note, the restoration process using bscan is not identical to the original creation of the catalog data. This is because certain non-essential data such as volume reads, volume mounts, etc is not stored on the Volume, and thus is not restored by bscan. The results of bscanning are, however, perfectly valid, and will permit restoration of any or all the files in the catalog using the normal Bacula console commands.

Using bscan to Compare a Volume to an existing Catalog

If you wish to compare the contents of a Volume to an existing catalog without changing the catalog, you can safely do so if and only if you do not specify either the -m or the -s options. However, at this time (Bacula version 1.26), the comparison routines are not as good or as thorough as they should be, so we don't particularly recommend this mode other than for testing.

Using bscan to Recreate a Catalog from a Volume

This is the mode for which bscan is most useful. You can either bscan into a freshly created catalog, or directly into your existing catalog (after having made an ASCII copy as described above). Normally, you should start with a freshly created catalog that contains no data.

Starting with a single Volume named TestVolume1, you run a command such as:

./bscan -V TestVolume1 -v -s -m -c bacula-sd.conf /dev/nst0

If there is more than one volume, simply append it to the first one separating it with a vertical bar. You may need to precede the vertical bar with a forward slash escape the shell -- e.g. TestVolume1\|TestVolume2 . The -v option was added for verbose output (this can be omitted if desired). The -s option that tells bscan to store information in the database. The physical device name /dev/nst0 is specified after all the options.

For example, after having done a full backup of a directory, then two incrementals, I reinitialized the SQLite database as described above, and using the bootstrap.bsr file noted above, I entered the following command:

./bscan -b bootstrap.bsr -v -s -c bacula-sd.conf /dev/nst0

which produced the following output:

bscan: bscan.c:182 Using Database: bacula, User: bacula
bscan: bscan.c:673 Created Pool record for Pool: Default
bscan: bscan.c:271 Pool type "Backup" is OK.
bscan: bscan.c:632 Created Media record for Volume: TestVolume1
bscan: bscan.c:298 Media type "DDS-4" is OK.
bscan: bscan.c:307 VOL_LABEL: OK for Volume: TestVolume1
bscan: bscan.c:693 Created Client record for Client: Rufus
bscan: bscan.c:769 Created new JobId=1 record for original JobId=2
bscan: bscan.c:717 Created FileSet record "Kerns Files"
bscan: bscan.c:819 Updated Job termination record for new JobId=1
bscan: bscan.c:905 Created JobMedia record JobId 1, MediaId 1
bscan: Got EOF on device /dev/nst0
bscan: bscan.c:693 Created Client record for Client: Rufus
bscan: bscan.c:769 Created new JobId=2 record for original JobId=3
bscan: bscan.c:708 Fileset "Kerns Files" already exists.
bscan: bscan.c:819 Updated Job termination record for new JobId=2
bscan: bscan.c:905 Created JobMedia record JobId 2, MediaId 1
bscan: Got EOF on device /dev/nst0
bscan: bscan.c:693 Created Client record for Client: Rufus
bscan: bscan.c:769 Created new JobId=3 record for original JobId=4
bscan: bscan.c:708 Fileset "Kerns Files" already exists.
bscan: bscan.c:819 Updated Job termination record for new JobId=3
bscan: bscan.c:905 Created JobMedia record JobId 3, MediaId 1
bscan: Got EOF on device /dev/nst0
bscan: bscan.c:652 Updated Media record at end of Volume: TestVolume1
bscan: bscan.c:428 End of Volume. VolFiles=3 VolBlocks=57 VolBytes=10,027,437

The key points to note are that bscan prints a line when each major record is created. Due to the volume of output, it does not print a line for each file record unless you supply the -v option twice or more on the command line.

In the case of a Job record, the new JobId will not normally be the same as the original Jobid. For example, for the first JobId above, the new JobId is 1, but the original JobId is 2. This is nothing to be concerned about as it is the normal nature of databases. bscan will keep everything straight.

Although bscan claims that it created a Client record for Client: Rufus three times, it was actually only created the first time. This is normal.

You will also notice that it read an end of file after each Job (Got EOF on device ...). Finally the last line gives the total statistics for the bscan.

If you had added a second -v option to the command line, Bacula would have been even more verbose, dumping virtually all the details of each Job record it encountered.

Now if you start Bacula and enter a list jobs command to the console program, you will get:

+-------+----------+------------------+------+-----+----------+----------+---------+
| JobId | Name     | StartTime        | Type | Lvl | JobFiles | JobBytes | JobStat |
+-------+----------+------------------+------+-----+----------+----------+---------+
| 1     | kernsave | 2002-10-07 14:59 | B    | F   | 84       | 4180207  | T       |
| 2     | kernsave | 2002-10-07 15:00 | B    | I   | 15       | 2170314  | T       |
| 3     | kernsave | 2002-10-07 15:01 | B    | I   | 33       | 3662184  | T       |
+-------+----------+------------------+------+-----+----------+----------+---------+

which corresponds virtually identically with what the database contained before it was re-initialized and restored with bscan. All the Jobs and Files found on the tape are restored including most of the Media record. The Volume (Media) records restored will be marked as Full so that they cannot be rewritten without operator intervention.

It should be noted that bscan cannot restore a database to the exact condition it was in previously because a lot of the less important information contained in the database is not saved to the tape. Nevertheless, the reconstruction is sufficiently complete, that you can run restore against it and get valid results.

Using bscan to Correct the Volume File Count

If the Storage daemon crashes during a backup Job, the catalog will not be properly updated for the Volume being used at the time of the crash. This means that the Storage daemon will have written say 20 files on the tape, but the catalog record for the Volume indicates only 19 files.

Bacula refuses to write on a tape that contains a different number of files from what is in the catalog. To correct this situation, you may run a bscan with the -m option (but without the -s option) to update only the final Media record for the Volumes read.

After bscan

If you use bscan to enter the contents of the Volume into an existing catalog, you should be aware that the records you entered may be immediately pruned during the next job, particularly if the Volume is very old or had been previously purged. To avoid this, after running bscan, you can manually set the volume status (VolStatus) to Read-Only by using the update command in the catalog. This will allow you to restore from the volume without having it immediately purged. When you have restored and backed up the data, you can reset the VolStatus to Used and the Volume will be purged from the catalog.


bcopy

The bcopy program can be used to copy one Bacula archive file to another. For example, you may copy a tape to a file, a file to a tape, a file to a file, or a tape to a tape. For tape to tape, you will need two tape drives. (a later version is planned that will buffer it to disk). In the process of making the copy, no record of the information written to the new Volume is stored in the catalog. This means that the new Volume, though it contains valid backup data, cannot be accessed directly from existing catalog entries. If you wish to be able to use the Volume with the Console restore command, for example, you must first bscan the new Volume into the catalog.

bcopy Command Options

Usage: bcopy [-d debug_level] <input-archive> <output-archive>
       -b bootstrap      specify a bootstrap file
       -c <file>         specify configuration file
       -dnn              set debug level to nn
       -i                specify input Volume names (separated by |)
       -o                specify output Volume names (separated by |)
       -p                proceed inspite of I/O errors
       -v                verbose
       -w dir            specify working directory (default /tmp)
       -?                print this message

By using a bootstrap file, you can copy parts of a Bacula archive file to another archive.

One of the objectives of this program is to be able to recover as much data as possible from a damaged tape. However, the current version does not yet have this feature.

As this is a new program, any feedback on its use would be appreciated. In addition, I only have a single tape drive, so I have never been able to test this program with two tape drives.


btape

This program permits a number of elementary tape operations via a tty command interface. The test command, described below, can be very useful for testing older tape drive compatibility problems. Aside from initial testing of tape drive compatibility with Bacula, btape will be mostly used by developers writing new tape drivers.

btape can be dangerous to use with existing Bacula tapes because it will relabel a tape or write on the tape if so requested regardless that the tape may contain valuable data, so please be careful and use it only on blank tapes.

To work properly, btape needs to read the Storage daemon's configuration file. As a default, it will look for bacula-sd.conf in the current directory. If your configuration file is elsewhere, please use the -c option to specify where.

The physical device name must be specified on the command line, and this same device name must be present in the Storage daemon's configuration file read by btape

Usage: btape [-c config_file] [-d debug_level] [device_name]
       -c <file>   set configuration file to file
       -dnn        set debug level to nn
       -s          turn off signals
       -t          open the default tape device
       -?          print this message.

Using btape to Verify your Tape Drive

An important reason for this program is to ensure that a Storage daemon configuration file is defined so that Bacula will correctly read and write tapes.

It is highly recommended that you run the test command before running your first Bacula job to ensure that the parameters you have defined for your storage device (tape drive) will permit Bacula to function properly. You only need to mount a blank tape, enter the command, and the output should be reasonably self explanatory. Please see the Tape Testing Chapter of this manual for the details.

btape Commands

The full list of commands are:

  Command    Description
  =======    ===========
  bsf        backspace file
  bsr        backspace record
  cap        list device capabilities
  clear      clear tape errors
  eod        go to end of Bacula data for append
  test       General test Bacula tape functions
  eom        go to the physical end of medium
  fill       fill tape, write onto second volume
  unfill     read filled tape
  fsf        forward space a file
  fsr        forward space a record
  help       print this command
  label      write a Bacula label to the tape
  load       load a tape
  quit       quit btape
  rd         read tape
  readlabel  read and print the Bacula tape label
  rectest    test record handling functions
  rewind     rewind the tape
  scan       read tape block by block to EOT and report
  status     print tape status
  test       test a tape for compatibility with Bacula
  weof       write an EOF on the tape
  wr         write a single record of 2048 bytes

The most useful commands are:

The readlabel command can be used to display the details of a Bacula tape label. This can be useful if the physical tape label was lost or damaged.

In the event that you want to relabel a Bacula, you can simply use the label command which will write over any existing label. However, please note for labeling tapes, we recommend that you use the label command in the Console program since it will never overwrite a valid Bacula tape.

Other Programs

The following programs are general utility programs and in general do not need a configuration file nor a device name.


bsmtp

bsmtp is a simple mail transport program that permits more flexibility than the standard mail programs typically found on Unix systems. It can even be used on Windows machines.

It is called:

Usage: bsmtp [-f from] [-h mailhost] [-s subject] [-c copy] [recipient ...]
       -c          set the Cc: field
       -dnn        set debug level to nn
       -f          set the From: field
       -h          use mailhost:port as the bsmtp server
       -s          set the Subject: field
       -?          print this message.

If the -f option is not specified, bsmtp will use your userid. If the option is not specified bsmtp will use the value in the environment variable bsmtpSERVER or if there is none localhost. By default port 25 is used.

recipients is a space separated list of email recipients.

The body of the email message is read from standard input.

An example of the use of bsmtp would be to put the following statement in the Messages resource of your bacula-dir.conf file. Note, these commands should appear on a single line each.

  mailcommand = "/home/bacula/bin/bsmtp -h mail.domain.com -f \"\(Bacula\) %r\"
                 -s \"Bacula: %t %e of %c %l\" %r"
  operatorcommand = "/home/bacula/bin/bsmtp -h mail.domain.com -f \"\(Bacula\) %r\"
                    -s \"Bacula: Intervention needed for %j\" %r"

Where you replace /home/bacula/bin with the path to your Bacula binary directory, and you replace mail.domain.com with the fully qualified name of your bsmtp (email) server, which normally listens on port 25. For more details on the substitution characters (e.g. %r) used in the above line, please see the documentation of the MailCommand in the Messages Resource chapter of this manual.

It is HIGHLY recommended that you test one or two cases by hand to make sure that the mailhost that you specified is correct and that it will accept your email requests. Since bsmtp always uses a TCP connection rather than writing in the spool file, you may find that your from address is being rejected because it does not contain a valid domain, or because your message is caught in your spam filtering rules. Generally, you should specify a fully qualified domain name in the from field, and depending on whether your bsmtp gateway is Exim or Sendmail, you may need to modify the syntax of the from part of the message. Please test.

When running bsmtp by hand, you will need to terminate the message by entering a ctl-d in column 1 of the last line.


dbcheck

dbcheck is a simple program that will search for inconsistencies in your database, and optionally fix them. The dbcheck program can be found in the <bacula-source>/src/tools directory of the source distribution. Though it is built with the make process, it is not normally "installed".

It is called:

Usage: dbcheck [-c config] [-C catalog name] [-d debug_level]     []
       -b              batch mode
       -C              catalog name in the director conf file
       -c              director conf filename
       -dnn            set debug level to nn
       -f              fix inconsistencies
       -v              verbose
       -?              print this message

If the -c option is given with the Director's conf file, there is no need to enter any of the command line arguments, in particular the working directory as dbcheck will read them from the file.

If the -f option is specified, dbcheck will repair (fix) the inconsistencies it finds. Otherwise, it will report only.

If the -b option is specified, dbcheck will run in batch mode, and it will proceed to examine and fix (if -f is set) all programmed inconsistency checks. If the -b option is not specified, dbcheck will enter interactive mode and prompt with the following:

Hello, this is the database check/correct program.
Please select the function you want to perform.
     1) Toggle modify database flag
     2) Toggle verbose flag
     3) Repair bad Filename records
     4) Repair bad Path records
     5) Eliminate duplicate Filename records
     6) Eliminate duplicate Path records
     7) Eliminate orphaned Jobmedia records
     8) Eliminate orphaned File records
     9) Eliminate orphaned Path records
    10) Eliminate orphaned Filename records
    11) Eliminate orphaned FileSet records
    12) Eliminate orphaned Client records
    13) Eliminate orphaned Job records
    14) Eliminate all Admin records
    15) Eliminate all Restore records
    16) All (3-15)
    17) Quit
Select function number:

By entering 1 or 2, you can toggle the modify database flag (-f option) and the verbose flag (-v). It can be helpful and reassuring to turn off the modify database flag, then select one or more of the consistency checks (items 3 through 9) to see what will be done, then toggle the modify flag on and re-run the check.

The inconsistencies examined are the following:


testfind

testfind permits listing of files using the same search engine that is used for the Include resource in Job resources. Note, much of the functionality of this program (listing of files to be included) is present in the estimate command in the Console program.

The original use of testfind was to ensure that Bacula's file search engine was correct and to print some statistics on file name and path length. However, you may find it useful to see what bacula would do with a given Include resource. The testfind program can be found in the <bacula-source>/src/tools directory of the source distribution. Though it is built with the make process, it is not normally "installed".

It is called:

Usage: testfind [-d debug_level] [-] [pattern1 ...]
       -a          print extended attributes (Win32 debug)
       -dnn        set debug level to nn
       -           read pattern(s) from stdin
       -?          print this message.
Patterns are used for file inclusion -- normally directories.
Debug level>= 1 prints each file found.
Debug level>= 10 prints path/file for catalog.
Errors are always printed.
Files/paths truncated is a number with len> 255.
Truncation is only in the catalog.

Where a pattern is any filename specification that is valid within an Include resource definition. If none is specified, / (the root directory) is assumed. For example:

./testfind /bin

Would print the following:

Dir: /bin
Reg: /bin/bash
Lnk: /bin/bash2 -> bash
Lnk: /bin/sh -> bash
Reg: /bin/cpio
Reg: /bin/ed
Lnk: /bin/red -> ed
Reg: /bin/chgrp
...
Reg: /bin/ipcalc
Reg: /bin/usleep
Reg: /bin/aumix-minimal
Reg: /bin/mt
Lnka: /bin/gawk-3.1.0 -> /bin/gawk
Reg: /bin/pgawk
Total files    : 85
Max file length: 13
Max path length: 5
Files truncated: 0
Paths truncated: 0

Even though testfind uses the same search engine as Bacula, each directory to be listed, must be entered as a separate command line entry or entered one line at a time to standard input if the - option was specified.

Specifying a debug level of one (i.e. -d1) on the command line will cause testfind to print the raw filenames without showing the Bacula internal file type, or the link (if any). Debug levels of 10 or greater cause the filename and the path to be separated using the same algorithm that is used when putting filenames into the Catalog database.


Testing Your Tape Drive With Bacula

This chapter is concerned with testing and configuring your tape drive to make sure that it will work properly with Bacula using the btape program.

Get Your Tape Drive Working

In general, you should follow the following steps to get your tape drive to work with Bacula. Start with a tape mounted in your drive. If you have an autochanger, load a tape into the drive. We use /dev/nst0 as the tape drive name, you will need to adapt it according to your system.

Do not proceed to the next item until you have succeeded with the previous one.

  1. Make sure that Bacula (the Storage daemon) is not running or that you have unmounted the drive you will use for testing.

  2. Use tar to write to, then read from your drive:

       mt -f /dev/nst0 rewind
       tar cvf /dev/nst0 .
       mt -f /dev/nst0 rewind
       tar tvf /dev/nst0
    

  3. Make sure you have a valid and correct Device resource corresponding to your drive. For Linux users, generally, the default one works. For FreeBSD users, there are two possible Device configurations (see below). For other drives and/or OSes, you will need to first ensure that your system tape modes are properly setup (see below), then possibly modify you Device resource depending on the output from the btape program (next item). When doing this, you should consult the Storage Daemon Configuration of this manual.

  4. If you are using a Fibre Channel to connect your tape drive to Bacula, please be sure to disable any caching in the NSR (network storage router, which is a Fibre Channel to SCSI converter).

  5. Run the btape test command:

       ./btape -c bacula-sd.conf /dev/nst0
       test
    

    It isn't necessary to run the autochanger part of the test at this time, but do not go past this point until the basic test succeeds. If you do have an autochanger, please be sure to read the Autochanger chapter of this manual.

  6. Run the btape fill command, preferably with two volumes. This can take a long time. If you have an autochanger and it is configured, Bacula will automatically use it. If you do not have it configured, you can manually issue the appropriate mtx command, or press the autochanger buttons to change the tape when requested to do so.

  7. FreeBSD users, if you have a pre-5.0 system run the tapetest program, and make sure your system is patched if necessary. The tapetest program can be found in the platform/freebsd directory. The instructions for its use are at the top of the file.

  8. Run Bacula, and backup a reasonably small directory, say 60 Megabytes. Do three successive backups of this directory.

  9. Stop Bacula, then restart it. Do another full backup of the same directory. Then stop and restart Bacula.

  10. Do a restore of the directory backed up, by entering the following restore command, being careful to restore it to an alternate location:

       restore select all done
       yes
    

    Do a diff on the restored directory to ensure it is identical to the original directory. If you are going to backup multiple different systems (Linux, Windows, Mac, Solaris, FreeBSD, ...), be sure you test the restore on each system type.

  11. If you have an autochanger, you should now go back to the btape program and run the autochanger test:

         ./btape -c bacula-sd.conf /dev/nst0
         auto
    

    Adjust your autochanger as necessary to ensure that it works correctly. See the Autochanger chapter of this manual for a complete discussion of testing your autochanger.

  12. We strongly recommend that you use a dedicated SCSI controller for your tape drives. Scanners are known to induce serious problems with the SCSI bus, causing it to reset. If the SCSI bus is reset while Bacula has the tape drive open, it will most likely be fatal to your tape since the drive will rewind. These kinds of problems show up in the system log. For example, the following was most likely caused by a scanner:

    Feb 14 17:29:55 epohost kernel: (scsi0:A:2:0): No or incomplete CDB sent to device.
    Feb 14 17:29:55 epohost kernel: scsi0: Issued Channel A Bus Reset. 1 SCBs aborted
    

If you have reached this point, you stand a good chance of having everything work. If you get into trouble at any point, carefully read the documentation given below. If you cannot get past some point, ask the bacula-users email list, but specify which of the steps you have successfully completed. In particular, you may want to look at the Tips for Resolving Problems section below.

Problems When no Tape in Drive

When Bacula was first written the Linux 2.4 kernel permitted opening the drive whether or not there was a tape in the drive. Thus the Bacula code is based on the concept that if the drive cannot be opened, there is a serious problem, and the job is failed.

With version 2.6 of the Linux kernel, if there is no tape in the drive, the OS will wait two minutes (default) and then return a failure, and consequently, Bacula version 1.36 and below will fail the job. This is important to keep in mind, because if you use an option such as Offline on Unmount = yes, there will be a point when there is no tape in the drive, and if another job starts or if Bacula asks the operator to mount a tape, when Bacula attempts to open the drive (about a 20 minute delay), it will fail and Bacula will fail the job.

In version 1.38.x, the Bacula code partially gets around this problem -- at least in the initial open of the drive. However, functions like Polling the drive do not work correctly if there is no tape in the drive. Providing you do not use Offline on Unmount = yes, you should not experience job failures as mentioned above. If you do experience such failures, you can also increase the Maximum Open Wait time interval, which will give you more time to mount the next tape before the job is failed.

Specifying the Configuration File

Starting with version 1.27, each of the tape utility programs including the btape program requires a valid Storage daemon configuration file (actually, the only part of the configuration file that btape needs is the Device resource definitions). This permits btape to find the configuration parameters for your archive device (generally a tape drive). Without those parameters, the testing and utility programs do not know how to properly read and write your drive. By default, they use bacula-sd.conf in the current directory, but you may specify a different configuration file using the -c option.

Specifying a Device Name For a Tape

btape device-name where the Volume can be found. In the case of a tape, this is the physical device name such as /dev/nst0 or /dev/rmt/0ubn depending on your system that you specify on the Archive Device directive. For the program to work, it must find the identical name in the Device resource of the configuration file. If the name is not found in the list of physical names, the utility program will compare the name you entered to the Device names (rather than the Archive device names).

When specifying a tape device, it is preferable that the "non-rewind" variant of the device file name be given. In addition, on systems such as Sun, which have multiple tape access methods, you must be sure to specify to use Berkeley I/O conventions with the device. The b in the Solaris (Sun) archive specification /dev/rmt/0mbn is what is needed in this case. Bacula does not support SysV tape drive behavior.

See below for specifying Volume names.

Specifying a Device Name For a File

If you are attempting to read or write an archive file rather than a tape, the device-name should be the full path to the archive location including the filename. The filename (last part of the specification) will be stripped and used as the Volume name, and the path (first part before the filename) must have the same entry in the configuration file. So, the path is equivalent to the archive device name, and the filename is equivalent to the volume name.


btape

This program permits a number of elementary tape operations via a tty command interface. The test command, described below, can be very useful for testing tape drive compatibility problems. Aside from initial testing of tape drive compatibility with Bacula, btape will be mostly used by developers writing new tape drivers.

btape can be dangerous to use with existing Bacula tapes because it will relabel a tape or write on the tape if so requested regardless of whether or not the tape contains valuable data, so please be careful and use it only on blank tapes.

To work properly, btape needs to read the Storage daemon's configuration file. As a default, it will look for bacula-sd.conf in the current directory. If your configuration file is elsewhere, please use the -c option to specify where.

The physical device name or the Device resource name must be specified on the command line, and this same device name must be present in the Storage daemon's configuration file read by btape

Usage: btape [options] device_name
       -b <file>   specify bootstrap file
       -c <file>   set configuration file to file
       -d <nn>     set debug level to nn
       -p          proceed inspite of I/O errors
       -s          turn off signals
       -v          be verbose
       -?          print this message.

Using btape to Verify your Tape Drive

An important reason for this program is to ensure that a Storage daemon configuration file is defined so that Bacula will correctly read and write tapes.

It is highly recommended that you run the test command before running your first Bacula job to ensure that the parameters you have defined for your storage device (tape drive) will permit Bacula to function properly. You only need to mount a blank tape, enter the command, and the output should be reasonably self explanatory. For example:

(ensure that Bacula is not running)
./btape -c /usr/bin/bacula/bacula-sd.conf /dev/nst0

The output will be:

Tape block granularity is 1024 bytes.
btape: btape.c:376 Using device: /dev/nst0
*

Enter the test command:

test

The output produced should be something similar to the following: I've cut the listing short because it is frequently updated to have new tests.

=== Append files test ===
This test is essential to Bacula.
I'm going to write one record  in file 0,
                   two records in file 1,
             and three records in file 2
btape: btape.c:387 Rewound /dev/nst0
btape: btape.c:855 Wrote one record of 64412 bytes.
btape: btape.c:857 Wrote block to device.
btape: btape.c:410 Wrote EOF to /dev/nst0
btape: btape.c:855 Wrote one record of 64412 bytes.
btape: btape.c:857 Wrote block to device.
btape: btape.c:855 Wrote one record of 64412 bytes.
btape: btape.c:857 Wrote block to device.
btape: btape.c:410 Wrote EOF to /dev/nst0
btape: btape.c:855 Wrote one record of 64412 bytes.
btape: btape.c:857 Wrote block to device.
btape: btape.c:855 Wrote one record of 64412 bytes.
btape: btape.c:857 Wrote block to device.
btape: btape.c:855 Wrote one record of 64412 bytes.
btape: btape.c:857 Wrote block to device.
btape: btape.c:410 Wrote EOF to /dev/nst0
btape: btape.c:387 Rewound /dev/nst0
btape: btape.c:693 Now moving to end of media.
btape: btape.c:427 Moved to end of media
We should be in file 3. I am at file 3. This is correct!
Now the important part, I am going to attempt to append to the tape.
...
=== End Append files test ===

If you do not successfully complete the above test, please resolve the problem(s) before attempting to use Bacula. Depending on your tape drive, the test may recommend that you add certain records to your configuration. We strongly recommend that you do so and then re-run the above test to insure it works the first time.

Some of the suggestions it provides for resolving the problems may or may not be useful. If at all possible avoid using fixed blocking. If the test suddenly starts to print a long series of:

Got EOF on tape.
Got EOF on tape.
...

then almost certainly, you are running your drive in fixed block mode rather than variable block mode. See below for more help of resolving fix versus variable block problems.

It is also possible that you have your drive set in SysV tape drive mode. The drive must use BSD tape conventions. See the section above on setting your Archive device correctly.

For FreeBSD users, please see the notes below for doing further testing of your tape drive.

Linux SCSI Tricks

You can find out what SCSI devices you have by doing:

lsscsi

Typical output is:

[0:0:0:0]    disk    ATA      ST3160812AS      3.AD  /dev/sda
[2:0:4:0]    tape    HP       Ultrium 2-SCSI   F6CH  /dev/st0
[2:0:5:0]    tape    HP       Ultrium 2-SCSI   F6CH  /dev/st1
[2:0:6:0]    mediumx OVERLAND LXB              0107  -
[2:0:9:0]    tape    HP       Ultrium 1-SCSI   E50H  /dev/st2
[2:0:10:0]   mediumx OVERLAND LXB              0107  -

There are two drives in one autochanger: /dev/st0 and /dev/st1 and a third tape drive at /dev/st2. For using them with Bacula, one would normally reference them as /dev/nst0 ... /dev/nst2. Not also, there are two different autochangers identified as "mediumx OVERLAND LXB". They can be addressed via their /dev/sgN designation, which can be obtained by counting from the beginning as 0 to each changer. In the above case, the two changers are located on /dev/sg3 and /dev/sg5. The one at /dev/sg3, controls drives /dev/nst0 and /dev/nst1; and the one at /dev/sg5 controles drive /dev/nst2.

If you do not have the lsscsi command, you can obtain the same information as follows:

cat /proc/scsi/scsi

For the above example with the three drives and two autochangers, I get:

Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: ST3160812AS      Rev: 3.AD
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 04 Lun: 00
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F6CH
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 05 Lun: 00
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F6CH
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 06 Lun: 00
  Vendor: OVERLAND Model: LXB              Rev: 0107
  Type:   Medium Changer                   ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 09 Lun: 00
  Vendor: HP       Model: Ultrium 1-SCSI   Rev: E50H
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 10 Lun: 00
  Vendor: OVERLAND Model: LXB              Rev: 0107
  Type:   Medium Changer                   ANSI SCSI revision: 02

As an additional example, I get the following (on a different machine from the above example):

Attached devices:
Host: scsi2 Channel: 00 Id: 01 Lun: 00
  Vendor: HP       Model: C5713A           Rev: H107
  Type:   Sequential-Access                ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 04 Lun: 00
  Vendor: SONY     Model: SDT-10000        Rev: 0110
  Type:   Sequential-Access                ANSI SCSI revision: 02

The above represents first an autochanger and second a simple tape drive. The HP changer (the first entry) uses the same SCSI channel for data and for control, so in Bacula, you would use:

Archive Device = /dev/nst0
Changer Device = /dev/sg0

If you want to remove the SDT-10000 device, you can do so as root with:

echo "scsi remove-single-device 2 0 4 0">/proc/scsi/scsi

and you can put add it back with:

echo "scsi add-single-device 2 0 4 0">/proc/scsi/scsi

where the 2 0 4 0 are the Host, Channel, Id, and Lun as seen on the output from cat /proc/scsi/scsi. Note, the Channel must be specified as numeric.

Below is a slightly more complicated output, which is a single autochanger with two drives, and which operates the changer on a different channel from from the drives:

Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD1600JD-75H Rev: 08.0
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 04 Lun: 00
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F6CH
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 05 Lun: 00
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F6CH
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 06 Lun: 00
  Vendor: OVERLAND Model: LXB              Rev: 0106
  Type:   Medium Changer                   ANSI SCSI revision: 02

The above tape drives are accessed on /dev/nst0 and /dev/nst1, while the control channel for those two drives is /dev/sg3.

Tips for Resolving Problems

Bacula Saves But Cannot Restore Files

If you are getting error messages such as:

Volume data error at 0:1! Wanted block-id: "BB02", got "". Buffer discarded

It is very likely that Bacula has tried to do block positioning and ended up at an invalid block. This can happen if your tape drive is in fixed block mode while Bacula's default is variable blocks. Note that in such cases, Bacula is perfectly able to write to your Volumes (tapes), but cannot position to read them.

There are two possible solutions.

  1. The first and best is to always ensure that your drive is in variable block mode. Note, it can switch back to fixed block mode on a reboot or if another program uses the drive. So on such systems you need to modify the Bacula startup files to explicitly set:

    mt -f /dev/nst0 defblksize 0
    

    or whatever is appropriate on your system. Note, if you are running a Linux system, and the above command does not work, it is most likely because you have not loaded the appropriate mt package, which is often called mt_st, but may differ according to your distribution.

  2. The second possibility, especially, if Bacula wrote while the drive was in fixed block mode, is to turn off block positioning in Bacula. This is done by adding:

    Block Positioning = no
    

    to the Device resource. This is not the recommended procedure because it can enormously slow down recovery of files, but it may help where all else fails. This directive is available in version 1.35.5 or later (and not yet tested).

If you are getting error messages such as:

Volume data error at 0:0!
Block checksum mismatch in block=0 len=32625 calc=345678 blk=123456

You are getting tape read errors, and this is most likely due to one of the following things:

  1. An old or bad tape.
  2. A dirty drive that needs cleaning (particularly for DDS drives).
  3. A loose SCSI cable.
  4. Old firmware in your drive. Make sure you have the latest firmware loaded.
  5. Computer memory errors.
  6. Over-clocking your CPU.
  7. A bad SCSI card.

Bacula Cannot Open the Device

If you get an error message such as:

dev open failed: dev.c:265 stored: unable to open
device /dev/nst0:> ERR=No such device or address

the first time you run a job, it is most likely due to the fact that you specified the incorrect device name on your Archive Device.

If Bacula works fine with your drive, then all off a sudden you get error messages similar to the one shown above, it is quite possible that your driver module is being removed because the kernel deems it idle. This is done via crontab with the use of rmmod -a. To fix the problem, you can remove this entry from crontab, or you can manually modprob your driver module (or add it to the local startup script). Thanks to Alan Brown for this tip.

Incorrect File Number

When Bacula moves to the end of the medium, it normally uses the ioctl(MTEOM) function. Then Bacula uses the ioctl(MTIOCGET) function to retrieve the current file position from the mt_fileno field. Some SCSI tape drivers will use a fast means of seeking to the end of the medium and in doing so, they will not know the current file position and hence return a -1. As a consequence, if you get "This is NOT correct!" in the positioning tests, this may be the cause. You must correct this condition in order for Bacula to work.

There are two possible solutions to the above problem of incorrect file number:

Incorrect Number of Blocks or Positioning Errors

Bacula's preferred method of working with tape drives (sequential devices) is to run in variable block mode, and this is what is set by default. You should first ensure that your tape drive is set for variable block mode (see below).

If your tape drive is in fixed block mode and you have told Bacula to use different fixed block sizes or variable block sizes (default), you will get errors when Bacula attempts to forward space to the correct block (the kernel driver's idea of tape blocks will not correspond to Bacula's).

All modern tape drives support variable tape blocks, but some older drives (in particular the QIC drives) as well as the ATAPI ide-scsi driver run only in fixed block mode. The Travan tape drives also apparently must run in fixed block mode (to be confirmed).

Even in variable block mode, with the exception of the first record on the second or subsequent volume of a multi-volume backup, Bacula will write blocks of a fixed size. However, in reading a tape, Bacula will assume that for each read request, exactly one block from the tape will be transferred. This the most common way that tape drives work and is well supported by Bacula.

Drives that run in fixed block mode can cause serious problems for Bacula if the drive's block size does not correspond exactly to Bacula's block size. In fixed block size mode, drivers may transmit a partial block or multiple blocks for a single read request. From Bacula's point of view, this destroys the concept of tape blocks. It is much better to run in variable block mode, and almost all modern drives (the OnStream is an exception) run in variable block mode. In order for Bacula to run in fixed block mode, you must include the following records in the Storage daemon's Device resource definition:

Minimum Block Size = nnn
Maximum Block Size = nnn

where nnn must be the same for both records and must be identical to the driver's fixed block size.

We recommend that you avoid this configuration if at all possible by using variable block sizes.

If you must run with fixed size blocks, make sure they are not 512 bytes. This is too small and the overhead that Bacula has with each record will become excessive. If at all possible set any fixed block size to something like 64,512 bytes or possibly 32,768 if 64,512 is too large for your drive. See below for the details on checking and setting the default drive block size.

To recover files from tapes written in fixed block mode, see below.

Ensuring that the Tape Modes Are Properly Set -- Linux Only

If you have a modern SCSI tape drive and you are having problems with the test command as noted above, it may be that some program has set one or more of your SCSI driver's options to non-default values. For example, if your driver is set to work in SysV manner, Bacula will not work correctly because it expects BSD behavior. To reset your tape drive to the default values, you can try the following, but ONLY if you have a SCSI tape drive on a Linux system:

become super user
mt -f /dev/nst0 rewind
mt -f /dev/nst0 stoptions buffer-writes async-writes read-ahead

The above commands will clear all options and then set those specified. None of the specified options are required by Bacula, but a number of other options such as SysV behavior must not be set. Bacula does not support SysV tape behavior. On systems other than Linux, you will need to consult your mt man pages or documentation to figure out how to do the same thing. This should not really be necessary though -- for example, on both Linux and Solaris systems, the default tape driver options are compatible with Bacula. On Solaris systems, you must take care to specify the correct device name on the Archive device directive. See above for more details.

You may also want to ensure that no prior program has set the default block size, as happened to one user, by explicitly turning it off with:

mt -f /dev/nst0 defblksize 0

If you are running a Linux system, and the above command does not work, it is most likely because you have not loaded the appropriate mt package, which is often called mt_st, but may differ according to your distribution.

If you would like to know what options you have set before making any of the changes noted above, you can now view them on Linux systems, thanks to a tip provided by Willem Riede. Do the following:

become super user
mt -f /dev/nst0 stsetoptions 0
grep st0 /var/log/messages

and you will get output that looks something like the following:

kernel: st0: Mode 0 options: buffer writes: 1, async writes: 1, read ahead: 1
kernel: st0:    can bsr: 0, two FMs: 0, fast mteom: 0, auto lock: 0,
kernel: st0:    defs for wr: 0, no block limits: 0, partitions: 0, s2 log: 0
kernel: st0:    sysv: 0 nowait: 0

Note, I have chopped off the beginning of the line with the date and machine name for presentation purposes.

Some people find that the above settings only last until the next reboot, so please check this otherwise you may have unexpected problems.

Beginning with Bacula version 1.35.8, if Bacula detects that you are running in variable block mode, it will attempt to set your drive appropriately. All OSes permit setting variable block mode, but some OSes do not permit setting the other modes that Bacula needs to function properly.

Tape Hardware Compression and Blocking Size

As far as I can tell, there is no way with the mt program to check if your tape hardware compression is turned on or off. You can, however, turn it on by using (on Linux):

become super user
mt -f /dev/nst0 defcompression 1

and of course, if you use a zero instead of the one at the end, you will turn it off.

If you have built the mtx program in the depkgs package, you can use tapeinfo to get quite a bit of information about your tape drive even if it is not an autochanger. This program is called using the SCSI control device. On Linux for tape drive /dev/nst0, this is usually /dev/sg0, while on FreeBSD for /dev/nsa0, the control device is often /dev/pass2. For example on my DDS-4 drive (/dev/nst0), I get the following:

tapeinfo -f /dev/sg0
Product Type: Tape Drive
Vendor ID: 'HP      '
Product ID: 'C5713A          '
Revision: 'H107'
Attached Changer: No
MinBlock:1
MaxBlock:16777215
SCSI ID: 5
SCSI LUN: 0
Ready: yes
BufferedMode: yes
Medium Type: Not Loaded
Density Code: 0x26
BlockSize: 0

where the DataCompEnabled: yes means that tape hardware compression is turned on. You can turn it on and off (yes|no) by using the mt commands given above. Also, this output will tell you if the BlockSize is non-zero and hence set for a particular block size. Bacula is not likely to work in such a situation because it will normally attempt to write blocks of 64,512 bytes, except the last block of the job which will generally be shorter. The first thing to try is setting the default block size to zero using the mt -f /dev/nst0 defblksize 0 command as shown above. On FreeBSD, this would be something like: mt -f /dev/nsa0 blocksize 0.

On some operating systems with some tape drives, the amount of data that can be written to the tape and whether or not compression is enabled is determined by the density usually the mt -f /dev/nst0 setdensity xxx command. Often mt -f /dev/nst0 status will print out the current density code that is used with the drive. Most systems, but unfortunately not all, set the density to the maximum by default. On some systems, you can also get a list of all available density codes with: mt -f /dev/nst0 densities or a similar mt command. Note, for DLT and SDLT devices, no-compression versus compression is very often controlled by the density code. On FreeBSD systems, the compression mode is set using mt -f /dev/nsa0 comp xxx where xxx is the mode you want. In general, see man mt for the options available on your system.

Note, some of the above mt commands may not be persistent depending on your system configuration. That is they may be reset if a program other than Bacula uses the drive or, as is frequently the case, on reboot of your system.

If your tape drive requires fixed block sizes (very unusual), you can use the following records:

Minimum Block Size = nnn
Maximum Block Size = nnn

in your Storage daemon's Device resource to force Bacula to write fixed size blocks (where you sent nnn to be the same for both of the above records). This should be done only if your drive does not support variable block sizes, or you have some other strong reasons for using fixed block sizes. As mentioned above, a small fixed block size of 512 or 1024 bytes will be very inefficient. Try to set any fixed block size to something like 64,512 bytes or larger if your drive will support it.

Also, note that the Medium Type field of the output of tapeinfo reports Not Loaded, which is not correct. As a consequence, you should ignore that field as well as the Attached Changer field.

To recover files from tapes written in fixed block mode, see below.

Tape Modes on FreeBSD

On most FreeBSD systems such as 4.9 and most tape drives, Bacula should run with:

mt  -f  /dev/nsa0  seteotmodel  2
mt  -f  /dev/nsa0  blocksize   0
mt  -f  /dev/nsa0  comp  enable

You might want to put those commands in a startup script to make sure your tape driver is properly initialized before running Bacula, because depending on your system configuration, these modes may be reset if a program other than Bacula uses the drive or when your system is rebooted.

Then according to what the btape test command returns, you will probably need to set the following (see below for an alternative):

  Hardware End of Medium = no
  BSF at EOM = yes
  Backward Space Record = no
  Backward Space File = no
  Fast Forward Space File = no
  TWO EOF = yes

Then be sure to run some append tests with Bacula where you start and stop Bacula between appending to the tape, or use btape version 1.35.1 or greater, which includes simulation of stopping/restarting Bacula.

Please see the file platforms/freebsd/pthreads-fix.txt in the main Bacula directory concerning important information concerning compatibility of Bacula and your system. A much more optimal Device configuration is shown below, but does not work with all tape drives. Please test carefully before putting either into production.

Note, for FreeBSD 4.10-RELEASE, using a Sony TSL11000 L100 DDS4 with an autochanger set to variable block size and DCLZ compression, Brian McDonald reports that to get Bacula to append correctly between Bacula executions, the correct values to use are:

mt  -f  /dev/nsa0  seteotmodel  1
mt  -f  /dev/nsa0  blocksize  0
mt  -f /dev/nsa0  comp  enable

and

  Hardware End of Medium = no
  BSF at EOM = no
  Backward Space Record = no
  Backward Space File = no
  Fast Forward Space File = yes
  TWO EOF = no

This has been confirmed by several other people using different hardware. This configuration is the preferred one because it uses one EOF and no backspacing at the end of the tape, which works much more efficiently and reliably with modern tape drives.

Finally, here is a Device configuration that Danny Butroyd reports to work correctly with the Overland Powerloader tape library using LT0-2 and FreeBSD 5.4-Stable:

# Overland Powerloader LT02 - 17 slots single drive
Device {
  Name = Powerloader
  Media Type = LT0-2
  Archive Device = /dev/nsa0
  AutomaticMount = yes;              
  AlwaysOpen = yes;
  RemovableMedia = yes;
  RandomAccess = no;
  Changer Command = "/usr/local/sbin/mtx-changer %c %o %S %a %d"
  Changer Device = /dev/pass2
  AutoChanger = yes
  Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"

  # FreeBSD Specific Settings
  Offline On Unmount = no
  Hardware End of Medium = no
  BSF at EOM = yes
  Backward Space Record = no
  Fast Forward Space File = no
  TWO EOF = yes
}

The following Device resource works fine with Dell PowerVault 110T and
120T devices on both FreeBSD 5.3 and on NetBSD 3.0.  It also works
with Sony AIT-2 drives on FreeBSD.
\footnotesize
\begin{verbatim}
Device {
  ...
  # FreeBSD/NetBSD Specific Settings
  Hardware End of Medium = no
  BSF at EOM = yes
  Backward Space Record = no
  Fast Forward Space File = yes
  TWO EOF = yes
}

On FreeBSD version 6.0, it is reported that you can even set Backward Space Record = yes.

Finding your Tape Drives and Autochangers on FreeBSD

On FreeBSD, you can do a camcontrol devlist as root to determine what drives and autochangers you have. For example,

undef# camcontrol devlist
    at scbus0 target 2 lun 0 (pass0,sa0)
    at scbus0 target 4 lun 0 (pass1,sa1)
    at scbus0 target 4 lun 1 (pass2)

from the above, you can determine that there is a tape drive on /dev/sa0 and another on /dev/sa1 in addition since there is a second line for the drive on /dev/sa1, you know can assume that it is the control device for the autochanger (i.e. /dev/pass2). It is also the control device name to use when invoking the tapeinfo program. E.g.

tapeinfo -f /dev/pass2

Using the OnStream driver on Linux Systems

Bacula version 1.33 (not 1.32x) is now working and ready for testing with the OnStream kernel osst driver version 0.9.14 or above. Osst is available from: http://sourceforge.net/projects/osst/.

To make Bacula work you must first load the new driver then, as root, do:

  mt -f /dev/nosst0 defblksize 32768

Also you must add the following to your Device resource in your Storage daemon's conf file:

 Minimum Block Size = 32768
 Maximum Block Size = 32768

Here is a Device specification provided by Michel Meyers that is known to work:

Device {
  Name = "Onstream DI-30"
  Media Type = "ADR-30"
  Archive Device = /dev/nosst0
  Minimum Block Size = 32768
  Maximum Block Size = 32768
  Hardware End of Medium = yes
  BSF at EOM = no
  Backward Space File = yes
  Fast Forward Space File = yes
  Two EOF = no
  AutomaticMount = yes
  AlwaysOpen = yes
  Removable Media = yes
}

Hardware Compression on EXB-8900

To active, check, or disable the hardware compression feature on an EXB-8900, use the exabyte MammothTool. You can get it here: http://www.exabyte.com/support/online/downloads/index.cfm. There is a Solaris version of this tool. With option -C 0 or 1 you can disable or activate compression. Start this tool without any options for a small reference.

Using btape to Simulate Filling a Tape

Because there are often problems with certain tape drives or systems when end of tape conditions occur, btape has a special command fill that causes it to write random data to a tape until the tape fills. It then writes at least one more Bacula block to a second tape. Finally, it reads back both tapes to ensure that the data has been written in a way that Bacula can recover it. Note, there is also a single tape option as noted below, which you should use rather than the two tape test. See below for more details.

This can be an extremely time consuming process (here it is about 6 hours) to fill a full tape. Note, that btape writes random data to the tape when it is filling it. This has two consequences: 1. it takes a bit longer to generate the data, especially on slow CPUs. 2. the total amount of data is approximately the real physical capacity of your tape, regardless of whether or not the tape drive compression is on or off. This is because random data does not compress very much.

To begin this test, you enter the fill command and follow the instructions. There are two options: the simple single tape option and the multiple tape option. Please use only the simple single tape option because the multiple tape option still doesn't work totally correctly. If the single tape option does not succeed, you should correct the problem before using Bacula.

Recovering Files Written With Fixed Block Sizes

If you have been previously running your tape drive in fixed block mode (default 512) and Bacula with variable blocks (default), then in version 1.32f-x and 1.34 and above, Bacula will fail to recover files because it does block spacing, and because the block sizes don't agree between your tape drive and Bacula it will not work.

The long term solution is to run your drive in variable block mode as described above. However, if you have written tapes using fixed block sizes, this can be a bit of a pain. The solution to the problem is: while you are doing a restore command using a tape written in fixed block size, ensure that your drive is set to the fixed block size used while the tape was written. Then when doing the restore command in the Console program, do not answer the prompt yes/mod/no. Instead, edit the bootstrap file (the location is listed in the prompt) using any ASCII editor. Remove all VolBlock lines in the file. When the file is re-written, answer the question, and Bacula will run without using block positioning, and it should recover your files.

Tape Blocking Modes

SCSI tapes may either be written in variable or fixed block sizes. Newer drives support both modes, but some drives such as the QIC devices always use fixed block sizes. Bacula attempts to fill and write complete blocks (default 65K), so that in normal mode (variable block size), Bacula will always write blocks of the same size except the last block of a Job. If Bacula is configured to write fixed block sizes, it will pad the last block of the Job to the correct size. Bacula expects variable tape block size drives to behave as follows: Each write to the drive results in a single record being written to the tape. Each read returns a single record. If you request less bytes than are in the record, only those number of bytes will be returned, but the entire logical record will have been read (the next read will retrieve the next record). Thus data from a single write is always returned in a single read, and sequentially written records are returned by sequential reads.

Bacula expects fixed block size tape drives to behave as follows: If a write length is greater than the physical block size of the drive, the write will be written as two blocks each of the fixed physical size. This single write may become multiple physical records on the tape. (This is not a good situation). According to the documentation, one may never write an amount of data that is not the exact multiple of the blocksize (it is not specified if an error occurs or if the the last record is padded). When reading, it is my understanding that each read request reads one physical record from the tape. Due to the complications of fixed block size tape drives, you should avoid them if possible with Bacula, or you must be ABSOLUTELY certain that you use fixed block sizes within Bacula that correspond to the physical block size of the tape drive. This will ensure that Bacula has a one to one correspondence between what it writes and the physical record on the tape.

Please note that Bacula will not function correctly if it writes a block and that block is split into two or more physical records on the tape. Bacula assumes that each write causes a single record to be written, and that it can sequentially recover each of the blocks it has written by using the same number of sequential reads as it had written.

Details of Tape Modes

Rudolf Cejka has provided the following information concerning certain tape modes and MTEOM.

Tape level
It is always possible to position filemarks or blocks, whereas positioning to the end-of-data is only optional feature, however it is implemented very often. SCSI specification also talks about optional sequential filemarks, setmarks and sequential setmarks, but these are not implemented so often. Modern tape drives keep track of file positions in built-in chip (AIT, LTO) or at the beginning of the tape (SDLT), so there is not any speed difference, if end-of-data or filemarks is used (I have heard, that LTO-1 from all 3 manufacturers do not use its chip for file locations, but a tape as in SDLT case, and I'm not sure about LTO-2 and LTO-3 case). However there is a big difference, that end-of-data ignores file position, whereas filemarks returns the real number of skipped files, so OS can track current file number just in filemarks case.

OS level
Solaris does use just SCSI SPACE Filemarks, it does not support SCSI SPACE End-of-data. When MTEOM is called, Solaris does use SCSI SPACE Filemarks with count = 1048576 for fast mode, and combination of SCSI SPACE Filemarks with count = 1 with SCSI SPACE Blocks with count = 1 for slow mode, so EOD mark on the tape on some older tape drives is not skipped. File number is always tracked for MTEOM.

Linux does support both SCSI SPACE Filemarks and End-of-data: When MTEOM is called in MT_ST_FAST_MTEOM mode, SCSI SPACE End-of-data is used. In the other case, SCSI SPACE Filemarks with count = 8388607 is used. There is no real slow mode like in Solaris - I just expect, that for older tape drives Filemarks may be slower than End-of-data, but not so much as in Solaris slow mode. File number is tracked for MTEOM just without MT_ST_FAST_MTEOM - when MT_ST_FAST_MTEOM is used, it is not.

FreeBSD does support both SCSI SPACE Filemarks and End-of-data, but when MTEOD (MTEOM) is called, SCSI SPACE End-of-data is always used. FreeBSD never use SCSI SPACE Filemarks for MTEOD. File number is never tracked for MTEOD.

Bacula level
When Hardware End of Medium = Yes is used, MTEOM is called, but it does not mean, that hardware End-of-data must be used. When Hardware End of Medium = No, if Fast Forward Space File = Yes, MTFSF with count = 32767 is used, else Block Read with count = 1 with Forward Space File with count = 1 is used, which is really very slow.

Hardware End of Medium = Yes|No
The name of this option is misleading and is the source of confusion, because it is not the hardware EOM, what is really switched here.

If I use Yes, OS must not use SCSI SPACE End-of-data, because Bacula expects, that there is tracked file number, which is not supported by SCSI specification. Instead, the OS have to use SCSI SPACE Filemarks.

If I use No, an action depends on Fast Forward Space File.

When I set Hardware End of Medium = no and Fast Forward Space File = no file positioning was very slow on my LTO-3 (about ten to 100 minutes), but

with Hardware End of Medium = no and Fast Forward Space File = yes, the time is ten to 100 times faster (about one to two minutes).

Autochanger Errors

If you are getting errors such as:

3992 Bad autochanger "load slot 1, drive 1": ERR=Child exited with code 1.

and you are running your Storage daemon as non-root, then most likely you are having permissions problems with the control channel. Running as root, set permissions on /dev/sgX so that the userid and group of your Storage daemon can access the device. You need to ensure that you all access to the proper control device, and if you don't have any SCSI disk drives (including SATA drives), you might want to change the permissions on /dev/sg*.

Syslog Errors

If you are getting errors such as:

: kernel: st0: MTSETDRVBUFFER only allowed for root

you are most likely running your Storage daemon as non-root, and Bacula is attempting to set the correct OS buffering to correspond to your Device resource. Most OSes allow only root to issue this ioctl command. In general, the message can be ignored providing you are sure that your OS parameters are properly configured as described earlier in this manual. If you are running your Storage daemon as root, you should not be getting these system log messages, and if you are, something is probably wrong.


What To Do When Bacula Crashes (Kaboom)

If you are running on a Linux system, and you have a set of working configuration files, it is very unlikely that Bacula will crash. As with all software, however, it is inevitable that someday, it may crash, particularly if you are running on another operating system or using a new or unusual feature.

This chapter explains what you should do if one of the three Bacula daemons (Director, File, Storage) crashes.

Traceback

Each of the three Bacula daemons has a built-in exception handler which, in case of an error, will attempt to produce a traceback. If successful the traceback will be emailed to you.

For this to work, you need to ensure that a few things are setup correctly on your system:

  1. You must have an installed copy of gdb (the GNU debugger), and it must be on Bacula's path.
  2. The Bacula installed script file btraceback must be in the same directory as the daemon which dies, and it must be marked as executable.
  3. The script file btraceback.gdb must have the correct path to it specified in the btraceback file.
  4. You must have a mail program which is on Bacula's path.

If all the above conditions are met, the daemon that crashes will produce a traceback report and email it to you. If the above conditions are not true, you can either run the debugger by hand as described below, or you may be able to correct the problems by editing the btraceback file. I recommend not spending too much time on trying to get the traceback to work as it can be very difficult.

The changes that might be needed are to add a correct path to the gdb program, correct the path to the btraceback.gdb file, change the mail program or its path, or change your email address. The key line in the btraceback file is:

gdb -quiet -batch -x /home/kern/bacula/bin/btraceback.gdb \
     $1 $2 2>\&1 | mail -s "Bacula traceback" your-address@xxx.com

Since each daemon has the same traceback code, a single btraceback file is sufficient if you are running more than one daemon on a machine.

Testing The Traceback

To "manually" test the traceback feature, you simply start Bacula then obtain the PID of the main daemon thread (there are multiple threads). Unfortunately, the output had to be split to fit on this page:

[kern@rufus kern]$ ps fax --columns 132 | grep bacula-dir
 2103 ?        S      0:00 /home/kern/bacula/k/src/dird/bacula-dir -c
                                       /home/kern/bacula/k/src/dird/dird.conf
 2104 ?        S      0:00  \_ /home/kern/bacula/k/src/dird/bacula-dir -c
                                       /home/kern/bacula/k/src/dird/dird.conf
 2106 ?        S      0:00      \_ /home/kern/bacula/k/src/dird/bacula-dir -c
                                       /home/kern/bacula/k/src/dird/dird.conf
 2105 ?        S      0:00      \_ /home/kern/bacula/k/src/dird/bacula-dir -c
                                       /home/kern/bacula/k/src/dird/dird.conf

which in this case is 2103. Then while Bacula is running, you call the program giving it the path to the Bacula executable and the PID. In this case, it is:

./btraceback /home/kern/bacula/k/src/dird 2103

It should produce an email showing you the current state of the daemon (in this case the Director), and then exit leaving Bacula running as if nothing happened. If this is not the case, you will need to correct the problem by modifying the btraceback script.

Typical problems might be that gdb is not on the default path. Fix this by specifying the full path to it in the btraceback file. Another common problem is that the mail program doesn't work or is not on the default path. On some systems, it is preferable to use Mail rather than mail.

Getting A Traceback On Other Systems

It should be possible to produce a similar traceback on systems other than Linux, either using gdb or some other debugger. Solaris with gdb loaded works quite fine. On other systems, you will need to modify the btraceback program to invoke the correct debugger, and possibly correct the btraceback.gdb script to have appropriate commands for your debugger. If anyone succeeds in making this work with another debugger, please send us a copy of what you modified.

Manually Running Bacula Under The Debugger

If for some reason you cannot get the automatic traceback, or if you want to interactively examine the variable contents after a crash, you can run Bacula under the debugger. Assuming you want to run the Storage daemon under the debugger (the technique is the same for the other daemons, only the name changes), you would do the following:

  1. Start the Director and the File daemon. If the Storage daemon also starts, you will need to find its PID as shown above (ps fax | grep bacula-sd) and kill it with a command like the following:

          kill -15 PID
    

    where you replace PID by the actual value.

  2. At this point, the Director and the File daemon should be running but the Storage daemon should not.
  3. cd to the directory containing the Storage daemon
  4. Start the Storage daemon under the debugger:

        gdb ./bacula-sd
    

  5. Run the Storage daemon:

         run -s -f -c ./bacula-sd.conf
    

    You may replace the ./bacula-sd.conf with the full path to the Storage daemon's configuration file.

  6. At this point, Bacula will be fully operational.
  7. In another shell command window, start the Console program and do what is necessary to cause Bacula to die.
  8. When Bacula crashes, the gdb shell window will become active and gdb will show you the error that occurred.
  9. To get a general traceback of all threads, issue the following command:

           thread apply all bt
    

    After that you can issue any debugging command.

Getting Debug Output from Bacula

Each of the daemons normally has debug compiled into the program, but disabled. There are two ways to enable the debug output. One is to add the -d nnn option on the command line when starting the debugger. The nnn is the debug level, and generally anything between 50 and 200 is reasonable. The higher the number, the more output is produced. The output is written to standard output.

The second way of getting debug output is to dynamically turn it on using the Console using the setdebug command. The full syntax of the command is:

 setdebug level=nnn client=client-name storage=storage-name dir

If none of the options are given, the command will prompt you. You can selectively turn on/off debugging in any or all the daemons (i.e. it is not necessary to specify all the components of the above command).


The Windows Version of Bacula

At the current time only the File daemon or Client program has been thouroughly tested on Windows and is suitable for a production environment. As a consequence, when we speak of the Windows version of Bacula below, we are referring to the File daemon (client) only.

As of Bacula version 1.39.20 or greater, the installer is capable of installing not just the Client program, but also the Director and the Storage daemon and all the other programs that were previously available only on Unix systems. These additional programs, notably the Director and Storage daemon, have been partially tested, are reported to have some bugs, and still need to be documented. They are not yet supported, and we cannot currently accept or fix bug reports on them. Consequently, please test them carefully before putting them into a critical production environment.

The Windows version of the Bacula File daemon has been tested on Win98, WinMe, WinNT, WinXP, Win2000, and Windows 2003 systems. We have coded to support Win95, but no longer have a system for testing. The Windows version of Bacula is a native Win32 port, but there are very few source code changes to the Unix code, which means that the Windows version is for the most part running code that has long proved stable on Unix systems. When running, it is perfectly integrated with Windows and displays its icon in the system icon tray, and provides a system tray menu to obtain additional information on how Bacula is running (status and events dialog boxes). If so desired, it can also be stopped by using the system tray menu, though this should normally never be necessary.

Once installed Bacula normally runs as a system service. This means that it is immediately started by the operating system when the system is booted, and runs in the background even if there is no user logged into the system.


Win32 Installation

Normally, you will install the Windows version of Bacula from the binaries. This install is standard Windows .exe that runs an install wizard using the NSIS Free Software installer, so if you have already installed Windows software, it should be very familiar to you.

If you have a previous version Bacula (1.39.20 or lower) installed, you should stop the service, uninstall it, and remove the Bacula installation directory possibly saving your bacula-fd.conf, bconsole.conf, and bwx-console.conf files for use with the new version you will install. The Uninstall program is normally found in c:\bacula\Uninstall.exe. We also recommend that you completely remove the directory c:\bacula, because the current installer uses a different directory structure (see below).

Providing you do not already have Bacula installed, the new installer (1.39.22 and later) installs the binaries and dlls in c:\Program Files\Bacula\bin and the configuration files in c:\Documents and Settings\All Users\Application Data\Bacula In addition, the Start>All Programs>Bacula menu item will be created during the installation, and on that menu, you will find items for editing the configuration files, displaying the document, and starting bwx-console or bconsole.

Finally, proceed with the installation.

That should complete the installation process. When the Bacula File Server is ready to serve files, an icon \includegraphics{./idle.eps} representing a cassette (or tape) will appear in the system tray \includegraphics{./tray-icon.eps}; right click on it and a menu will appear.
\includegraphics{./menu.eps}
The Events item is currently unimplemented, by selecting the Status item, you can verify whether any jobs are running or not.

When the Bacula File Server begins saving files, the color of the holes in the cassette icon will change from white to green \includegraphics{./running.eps}, and if there is an error, the holes in the cassette icon will change to red \includegraphics{./error.eps}.

If you are using remote desktop connections between your Windows boxes, be warned that that tray icon does not always appear. It will always be visible when you log into the console, but the remote desktop may not display it.

Post Win32 Installation

After installing Bacula and before running it, you should check the contents of the configuration files to ensure that they correspond to your installation. You can get to them by using: the Start>All Programs>Bacula menu item.

Finally, but pulling up the Task Manager (ctl-alt-del), verify that Bacula is running as a process (not an Application) with User Name SYSTEM. If this is not the case, you probably have not installed Bacula while running as Administrator, and hence it will be unlikely that Bacula can access all the system files.

Uninstalling Bacula on Win32

Once Bacula has been installed, it can be uninstalled using the standard Windows Add/Remove Programs dialog found on the Control panel.


Dealing with Win32 Problems

Sometimes Win32 machines the File daemon may have very slow backup transfer rates compared to other machines. To you might try setting the Maximum Network Buffer Size to 32,768 in both the File daemon and in the Storage daemon. The default size is larger, and apparently some Windows ethernet controllers do not deal with a larger network buffer size.

Many Windows ethernet drivers have a tendency to either run slowly due to old broken firmware, or because they are running in half-duplex mode. Please check with the ethernet card manufacturer for the latest firmware and use whatever techniques are necessary to ensure that the card is running in duplex.

If you are not using the portable option, and you have VSS (Volume Shadow Copy) enabled in the Director, and you experience problems with Bacula not being able to open files, it is most likely that you are running an antivirus program that blocks Bacula from doing certain operations. In this case, disable the antivirus program and try another backup. If it succeeds, either get a different (better) antivirus program or use something like RunClientJobBefore/After to turn off the antivirus program while the backup is running.

If turning off anti-virus software does not resolve your VSS problems, you might have to turn on VSS debugging. The following link describes how to do this: http://support.microsoft.com/kb/887013/en-us.

In Microsoft Windows Small Business Server 2003 the VSS Writer for Exchange is turned off by default. To turn it on, please see the following link: http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q838183

The most likely source of problems is authentication when the Director attempts to connect to the File daemon that you installed. This can occur if the names and the passwords defined in the File daemon's configuration file bacula-fd.conf file on the Windows machine do not match with the names and the passwords in the Director's configuration file bacula-dir.conf located on your Unix/Linux server.

More specifically, the password found in the Client resource in the Director's configuration file must be the same as the password in the Director resource of the File daemon's configuration file. In addition, the name of the Director resource in the File daemon's configuration file must be the same as the name in the Director resource of the Director's configuration file.

It is a bit hard to explain in words, but if you understand that a Director normally has multiple Clients and a Client (or File daemon) may permit access by multiple Directors, you can see that the names and the passwords on both sides must match for proper authentication.

One user had serious problems with the configuration file until he realized that the Unix end of line conventions were used and Bacula wanted them in Windows format. This has not been confirmed though, and Bacula version 2.0.0 and above should now accept all end of line conventions (Win32, Unix, Mac).

Running Unix like programs on Windows machines is a bit frustrating because the Windows command line shell (DOS Window) is rather primitive. As a consequence, it is not generally possible to see the debug information and certain error messages that Bacula prints. With a bit of work, however, it is possible. When everything else fails and you want to see what is going on, try the following:

   Start a DOS shell Window.
   c:\Program Files\bacula\bin\bacula-fd -t >out
   type out

The precise path to bacula-fd depends on where it is installed. The example above is the default used in 1.39.22 and later. The -t option will cause Bacula to read the configuration file, print any error messages and then exit. the > redirects the output to the file named out, which you can list with the type command.

If something is going wrong later, or you want to run Bacula with a debug option, you might try starting it as:

   c:\Program Files\bacula\bin\bacula-fd -d 100 >out

In this case, Bacula will run until you explicitly stop it, which will give you a chance to connect to it from your Unix/Linux server. In later versions of Bacula (1.34 on, I think), when you start the File daemon in debug mode it can write the output to a trace file bacula.trace in the current directory. To enable this, before running a job, use the console, and enter:

   trace on

then run the job, and once you have terminated the File daemon, you will find the debug output in the bacula.trace file, which will probably be located in the same directory as bacula-fd.exe.

In addition, you should look in the System Applications log on the Control Panel to find any Windows errors that Bacula got during the startup process.

Finally, due to the above problems, when you turn on debugging, and specify trace=1 on a setdebug command in the Console, Bacula will write the debug information to the file bacula.trace in the directory from which Bacula is executing.

If you are having problems with ClientRunBeforeJob scripts randomly dying, it is possible that you have run into an Oracle bug. See bug number 622 in the bugs.bacula.org database. The following information has been provided by a user on this issue:

The information in this document applies to:
 Oracle HTTP Server - Version: 9.0.4
 Microsoft Windows Server 2003
 Symptoms
 When starting an OC4J instance, the System Clock runs faster, about 7
seconds per minute.
 
 Cause
 
 + This is caused by the Sun JVM bug 4500388, which states that "Calling
Thread.sleep() with a small argument affects the system clock". Although
this is reported as fixed in JDK 1.4.0_02, several reports contradict this
(see the bug in
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4500388).
 
 + Also reported by Microsoft as "The system clock may run fast when you
use the ACPI power management timer as a high-resolution counter on Windows
2000-based computers" (See http://support.microsoft.com/?id=821893)

Windows Compatibility Considerations

If you are not using the VSS (Volume Shadow Copy) option described in the next section of this chapter, and if any applications are running during the backup and they have files opened exclusively, Bacula will not be able to backup those files, so be sure you close your applications (or tell your users to close their applications) before the backup. Fortunately, most Microsoft applications do not open files exclusively so that they can be backed up. However, you will need to experiment. In any case, if Bacula cannot open the file, it will print an error message, so you will always know which files were not backed up. For version 1.37.25 and greater, see the section below on Volume Shadow Copy Service that permits backing up any file.

During backup, Bacula doesn't know about the system registry, so you will either need to write it out to an ASCII file using regedit  /e or use a program specifically designed to make a copy or backup the registry.

In Bacula version 1.31 and later, we use Windows backup API calls by default. Typical of Windows, programming these special BackupRead and BackupWrite calls is a real nightmare of complications. The end result gives some distinct advantages and some disadvantages.

First, the advantages are that on WinNT/2K/XP systems, the security and ownership information is now backed up. In addition, with the exception of files in exclusive use by another program, Bacula can now access all system files. This means that when you restore files, the security and ownership information will be restored on WinNT/2K/XP along with the data.

The disadvantage of the Windows backup API calls is that it produces non-portable backups. That is files and their data that are backed up on WinNT using the native API calls (BackupRead/BackupWrite) cannot be restored on Win95/98/Me or Unix systems. In principle, a file backed up on WinNT can be restored on WinXP, but this remains to be seen in practice (not yet tested). In addition, the stand-alone tools such as bls and bextract cannot be used to retrieve the data for those files because those tools are not available on Windows. All restores must use the Bacula restore command. As of Bacula 1.39.x, thanks to Thorsten Engel, this restriction is removed, and Bacula should be able to read non-portable backups on any system and restore the data appropriately. However, on a system that does not have the BackupRead/BackupWrite calls (older Windows versions and all Unix/Linux machines), though the file data can be restored, the Windows security and access control data will not be restored. This means that a standard set of access permissions will be set for such restored files.

As a default, Bacula backs up Windows systems using the Windows API calls. If you want to backup data on a WinNT/2K/XP system and restore it on a Unix/Win95/98/Me system, we have provided a special portable option that backs up the data in a portable fashion by using portable API calls. See the portable option on the Include statement in a FileSet resource in the Director's configuration chapter for the details on setting this option. However, using the portable option means you may have permissions problems accessing files, and none of the security and ownership information will be backed up or restored. The file data can, however, be restored on any system.

You should always be able to restore any file backed up on Unix or Win95/98/Me to any other system. On some systems, such as WinNT/2K/XP, you may have to reset the ownership of such restored files. Any file backed up on WinNT/2K/XP should in principle be able to be restored to a similar system (i.e. WinNT/2K/XP), however, I am unsure of the consequences if the owner information and accounts are not identical on both systems. Bacula will not let you restore files backed up on WinNT/2K/XP to any other system (i.e. Unix Win95/98/Me) if you have used the defaults.

Finally, if you specify the portable=yes option on the files you back up. Bacula will be able to restore them on any other system. However, any WinNT/2K/XP specific security and ownership information will be lost.

The following matrix will give you an idea of what you can expect. Thanks to Marc Brueckner for doing the tests:

Backup OS Restore OS Results
WinMe WinMe Works
WinMe WinNT Works (SYSTEM permissions)
WinMe WinXP Works (SYSTEM permissions)
WinMe Linux Works (SYSTEM permissions)
     
WinXP WinXP Works
WinXP WinNT Works (all files OK, but got "The data is invalid" message)
WinXP WinMe Error: Win32 data stream not supported.
WinXP WinMe Works if Portable=yes specified during backup.
WinXP Linux Error: Win32 data stream not supported.
WinXP Linux Works if Portable=yes specified during backup.
     
WinNT WinNT Works
WinNT WinXP Works
WinNT WinMe Error: Win32 data stream not supported.
WinNT WinMe Works if Portable=yes specified during backup.
WinNT Linux Error: Win32 data stream not supported.
WinNT Linux Works if Portable=yes specified during backup.
     
Linux Linux Works
Linux WinNT Works (SYSTEM permissions)
Linux WinMe Works
Linux WinXP Works (SYSTEM permissions)

Note: with Bacula versions 1.39.x and later, non-portable Windows data can be restore to any machine.

Volume Shadow Copy Service

In version 1.37.30 and greater, you can turn on Microsoft's Volume Shadow Copy Service (VSS).

Microsoft added VSS to Windows XP and Windows 2003. From the perspective of a backup-solution for Windows, this is an extremely important step. VSS allows Bacula to backup open files and even to interact with applications like RDBMS to produce consistent file copies. VSS aware applications are called VSS Writers, they register with the OS so that when Bacula wants to do a Snapshot, the OS will notify the register Writer programs, which may then create a consistent state in their application, which will be backed up. Examples for these writers are "MSDE" (Microsoft database engine), "Event Log Writer", "Registry Writer" plus 3rd party-writers. If you have a non-vss aware application (e.g. SQL Anywhere or probably MySQL), a shadow copy is still generated and the open files can be backed up, but there is no guarantee that the file is consistent.

Bacula produces a message from each of the registered writer programs when it is doing a VSS backup so you know which ones are correctly backed up.

Bacula supports VSS on both Windows 2003 and Windows XP. Technically Bacula creates a shadow copy as soon as the backup process starts. It does then backup all files from the shadow copy and destroys the shadow copy after the backup process. Please have in mind, that VSS creates a snapshot and thus backs up the system at the state it had when starting the backup. It will disregard file changes which occur during the backup process.

VSS can be turned on by placing an

Enable VSS = yes

in your FileSet resource.

The VSS aware File daemon has the letters VSS on the signon line that it produces when contacted by the console. For example:

Tibs-fd Version: 1.37.32 (22 July 2005) VSS Windows XP MVS NT 5.1.2600
the VSS is shown in the line above. This only means that the File daemon is capable of doing VSS not that VSS is turned on for a particular backup. There are two ways of telling if VSS is actually turned on during a backup. The first is to look at the status output for a job, e.g.:
Running Jobs:
JobId 1 Job NightlySave.2005-07-23_13.25.45 is running.
    VSS Backup Job started: 23-Jul-05 13:25
    Files=70,113 Bytes=3,987,180,650 Bytes/sec=3,244,247
    Files Examined=75,021
    Processing file: c:/Documents and Settings/kern/My Documents/My Pictures/Misc1/Sans titre - 39.pdd
    SDReadSeqNo=5 fd=352
Here, you see under Running Jobs that JobId 1 is "VSS Backup Job started ..." This means that VSS is enabled for that job. If VSS is not enabled, it will simply show "Backup Job started ..." without the letters VSS.

The second way to know that the job was backed up with VSS is to look at the Job Report, which will look something like the following:

23-Jul 13:25 rufus-dir: Start Backup JobId 1, Job=NightlySave.2005-07-23_13.25.45
23-Jul 13:26 rufus-sd: Wrote label to prelabeled Volume "TestVolume001" on device "DDS-4" (/dev/nst0)
23-Jul 13:26 rufus-sd: Spooling data ...
23-Jul 13:26 Tibs: Generate VSS snapshots. Driver="VSS WinXP", Drive(s)="C"
23-Jul 13:26 Tibs: VSS Writer: "MSDEWriter", State: 1 (VSS_WS_STABLE)
23-Jul 13:26 Tibs: VSS Writer: "Microsoft Writer (Bootable State)", State: 1 (VSS_WS_STABLE)
23-Jul 13:26 Tibs: VSS Writer: "WMI Writer", State: 1 (VSS_WS_STABLE)
23-Jul 13:26 Tibs: VSS Writer: "Microsoft Writer (Service State)", State: 1 (VSS_WS_STABLE)
In the above Job Report listing, you see that the VSS snapshot was generated for drive C (if other drives are backed up, they will be listed on the Drive(s)="C" You also see the reports from each of the writer program. Here they all report VSS_WS_STABLE, which means that you will get a consistent snapshot of the data handled by that writer.

VSS Problems

If you are experiencing problems such as VSS hanging on MSDE, first try running vssadmin to check for problems, then try running ntbackup which also uses VSS to see if it has similar problems. If so, you know that the problem is in your Windows machine and not with Bacula.

The FD hang problems were reported with MSDEwriter when:

Windows Firewalls

If you turn on the firewalling feature on Windows (default in WinXP SP2), you are likely to find that the Bacula ports are blocked and you cannot communicate to the other daemons. This can be deactivated through the Security Notification dialog, which is apparently somewhere in the Security Center. I don't have this on my computer, so I cannot give the exact details.

The command:

netsh firewall set opmode disable

is purported to disable the firewall, but this command is not accepted on my WinXP Home machine.

Windows Port Usage

If you want to see if the File daemon has properly opened the port and is listening, you can enter the following command in a shell window:

   netstat -an | findstr 910[123]

TopView is another program that has been recommend, but it is not a standard Win32 program, so you must find and download it from the Internet.

Windows Disaster Recovery

We don't currently have a good solution for disaster recovery on Windows as we do on Linux. The main piece lacking is a Windows boot floppy or a Windows boot CD. Microsoft releases a Windows Pre-installation Environment (WinPE) that could possibly work, but we have not investigated it. This means that until someone figures out the correct procedure, you must restore the OS from the installation disks, then you can load a Bacula client and restore files. Please don't count on using bextract to extract files from your backup tapes during a disaster recovery unless you have backed up those files using the portable option. bextract does not run on Windows, and the normal way Bacula saves files using the Windows API prevents the files from being restored on a Unix machine. Once you have an operational Windows OS loaded, you can run the File daemon and restore your user files.

Please see Disaster Recovery of Win32 Systems for the latest suggestion, which looks very promising.

It looks like Bart PE Builder, which creates a Windows PE (Pre-installation Environment) Boot-CD, may be just what is needed to build a complete disaster recovery system for Win32. This distribution can be found at http://www.nu2.nu/pebuilder/.

Windows Restore Problems

Please see the Restore Chapter of this manual for problems that you might encounter doing a restore.

sectionWindows Backup Problems If during a Backup, you get the message: ERR=Access is denied and you are using the portable option, you should try both adding both the non-portable (backup API) and the Volume Shadow Copy options to your Director's conf file.

In the Options resource:

portable = no

In the FileSet resource:

enablevss = yes

In general, specifying these two options should allow you to backup any file on a Windows system. However, in some cases, if users have allowed to have full control of their folders, even system programs such a Bacula can be locked out. In this case, you must identify which folders or files are creating the problem and do the following:

  1. Grant ownership of the file/folder to the Administrators group, with the option to replace the owner on all child objects.
  2. Grant full control permissions to the Administrators group, and change the user's group to only have Modify permission to the file/folder and all child objects.

Thanks to Georger Araujo for the above information.

Windows Ownership and Permissions Problems

If you restore files backed up from WinNT/XP/2K to an alternate directory, Bacula may need to create some higher level directories that were not saved (or restored). In this case, the File daemon will create them under the SYSTEM account because that is the account that Bacula runs under as a service. As of version 1.32f-3, Bacula creates these files with full access permission. However, there may be cases where you have problems accessing those files even if you run as administrator. In principle, Microsoft supplies you with the way to cease the ownership of those files and thus change the permissions. However, a much better solution to working with and changing Win32 permissions is the program SetACL, which can be found at http://setacl.sourceforge.net/.

If you have not installed Bacula while running as Administrator and if Bacula is not running as a Process with the userid (User Name) SYSTEM, then it is very unlikely that it will have sufficient permission to access all your files.

Some users have experienced problems restoring files that participate in the Active Directory. They also report that changing the userid under which Bacula (bacula-fd.exe) runs, from SYSTEM to a Domain Admin userid, resolves the problem.

Manually resetting the Permissions

The following solution was provided by Dan Langille <dan at langille in the dot org domain>. The steps are performed using Windows 2000 Server but they should apply to most Win32 platforms. The procedure outlines how to deal with a problem which arises when a restore creates a top-level new directory. In this example, "top-level" means something like c:\src, not c:\tmp\src where c:\tmp already exists. If a restore job specifies / as the Where: value, this problem will arise.

The problem appears as a directory which cannot be browsed with Windows Explorer. The symptoms include the following message when you try to click on that directory:

\includegraphics{./access-is-denied.eps}

If you encounter this message, the following steps will change the permissions to allow full access.

  1. right click on the top level directory (in this example, c:/src) and select Properties.
  2. click on the Security tab.
  3. If the following message appears, you can ignore it, and click on OK.

    \includegraphics{./view-only.eps}

    You should see something like this:

    \includegraphics{./properties-security.eps}

  4. click on Advanced
  5. click on the Owner tab
  6. Change the owner to something other than the current owner (which is SYSTEM in this example as shown below).

    \includegraphics{./properties-security-advanced-owner.eps}

  7. ensure the "Replace owner on subcontainers and objects" box is checked
  8. click on OK
  9. When the message "You do not have permission to read the contents of directory c:\src\basis. Do you wish to replace the directory permissions with permissions granting you Full Control?", click on Yes.

    \includegraphics{./confirm.eps}

  10. Click on OK to close the Properties tab

With the above procedure, you should now have full control over your restored directory.

In addition to the above methods of changing permissions, there is a Microsoft program named cacls that can perform similar functions.

Backing Up the WinNT/XP/2K System State

A suggestion by Damian Coutts using Microsoft's NTBackup utility in conjunction with Bacula should permit a full restore of any damaged system files on Win2K/XP. His suggestion is to do an NTBackup of the critical system state prior to running a Bacula backup with the following command:

ntbackup backup systemstate /F c:\systemstate.bkf

The backup is the command, the systemstate says to backup only the system state and not all the user files, and the /F c:\systemstate.bkf specifies where to write the state file. this file must then be saved and restored by Bacula.

To restore the system state, you first reload a base operating system if the OS is damaged, otherwise, this is not necessary, then you would use Bacula to restore all the damaged or lost user's files and to recover the c:\systemstate.bkf file. Finally if there are any damaged or missing system files or registry problems, you run NTBackup and catalogue the system statefile, and then select it for restore. The documentation says you can't run a command line restore of the systemstate.

To the best of my knowledge, this has not yet been tested. If you test it, please report your results to the Bacula email list.

Considerations for Filename Specifications

Please see the Director's Configuration chapter of this manual for important considerations on how to specify Windows paths in Bacula FileSet Include and Exclude directives.

Bacula versions prior to 1.37.28 do not support Windows Unicode filenames. As of that version, both bconsole and bwx-console support Windows Unicode filenames. There may still be some problems with multiple byte characters (e.g. Chinese, ...) where it is a two byte character but the displayed character is not two characters wide.

Path/filenames longer than 260 characters (up to 32,000) are supported beginning with Bacula version 1.39.20. Older Bacula versions support only 260 character path/filenames.

Win32 Specific File daemon Command Line

These options are not normally seen or used by the user, and are documented here only for information purposes. At the current time, to change the default options, you must either manually run Bacula or you must manually edit the system registry and modify the appropriate entries.

In order to avoid option clashes between the options necessary for Bacula to run on Windows and the standard Bacula options, all Windows specific options are signaled with a forward slash character (/), while as usual, the standard Bacula options are signaled with a minus (-), or a minus minus (--). All the standard Bacula options can be used on the Windows version. In addition, the following Windows only options are implemented:

/service
Start Bacula as a service

/run
Run the Bacula application

/install
Install Bacula as a service in the system registry

/remove
Uninstall Bacula from the system registry

/about
Show the Bacula about dialogue box

/status
Show the Bacula status dialogue box

/events
Show the Bacula events dialogue box (not yet implemented)

/kill
Stop any running Bacula

/help
Show the Bacula help dialogue box

It is important to note that under normal circumstances the user should never need to use these options as they are normally handled by the system automatically once Bacula is installed. However, you may note these options in some of the .bat files that have been created for your use.

Shutting down Windows Systems

Some users like to shutdown their Windows machines after a backup using a Client Run After Job directive. If you want to do something similar, you might take the shutdown program from the apcupsd project or one from the Sysinternals project.


Disaster Recovery Using Bacula

General

When disaster strikes, you must have a plan, and you must have prepared in advance otherwise the work of recovering your system and your files will be considerably greater. For example, if you have not previously saved the partitioning information for your hard disk, how can you properly rebuild it if the disk must be replaced?

Unfortunately, many of the steps one must take before and immediately after a disaster are very operating system dependent. As a consequence, this chapter will discuss in detail disaster recovery (also called Bare Metal Recovery) for Linux and Solaris. For Solaris, the procedures are still quite manual. For FreeBSD the same procedures may be used but they are not yet developed. For Win32, a number of Bacula users have reported success using BartPE.

Important Considerations

Here are a few important considerations concerning disaster recovery that you should take into account before a disaster strikes.

Steps to Take Before Disaster Strikes

Bare Metal Recovery on Linux with a Bacula Rescue CD

As an alternative to creating a Bacula Rescue CD, please see the section below entitled Bare Metal Recovery using a LiveCD.

The remainder of this section concerns recovering a Linux client computer (i.e. one running just the Bacula File daemon). The Solaris procedures can be found below under the Solaris Bare Metal Recovery section of this chapter.

Previously Bacula supported a floppy rescue disk. This code has been removed in 1.37.40 and later.

A so called "Bare Metal" recovery is one where you start with an empty hard disk and you restore your machine. There are also cases where you may lose a file or a directory and want it restored. Please see the previous chapter for more details for those cases.

The primary goals of the Bacula rescue CD are:

One of the main of the advantages of a Bacula Rescue CDROM is that it contains a bootable copy of your system, so you should be familiar with it.

Bare Metal Recovery assumes that you have the following items for your system:

Requirements

In addition, to the above assumptions, the following conditions or restrictions apply:

Directories

To build the Bacula Rescue CDROM, you must get a copy of the rescue files. In version 1.37 and later, they are separate from the Bacula source. The rescue files are distributed as a compressed tar file on the Source Forge Bacula release area with the name bacula-rescue-xx.yy.zz.tar.gz. They are also automatically installed in /etc/bacula/rescue when installing by rpms. Another place you can find the rescue files is in the Source Forge Bacula SVN module named rescue.

Please read the README file in the main directory of the Rescue source code. Before using it, you must run configure and specify the location of the Bacula source code (not necessary if installed from rpms). This permits the rescue build scripts to automatically create a statically linked Bacula File daemon.

You will find the necessary scripts in linux/cdrom subdirectory of the rescue source code. If you installed the bacula rpm package the scripts will be found in the /etc/bacula/rescue/linux/cdrom directory.

Preparation for a Bare Metal Recovery

Before you can do a Bare Metal recovery, you must create a Bacula Rescue CDROM, which will contain everything you need to begin recovery. This assumes that you will have your Director and Storage daemon running on a different machine. If you want to recover a machine where the Director and/or the database were previously running, things will be much more complicated.

Creating a Bacula Rescue CDROM

You should probably make a new rescue CDROM each time you upgrade a major version of Bacula and whenever you modify your disk partitioning.

To build the rescue CDROM from source, you must first configure the rescue package, which is distributed separately from the source. The simplest procedure is for you to pre-build a static-bacula-fd taking care to use a minimum configuration such as:

cd <bacula-source>
./configure \
   --prefix=/usr \
   --sbindir=/usr/sbin \
   --sysconfdir=/etc/bacula \
   --with-scriptdir=/etc/bacula \
   --enable-smartalloc \
   --enable-client-only \
   --enable-static-fd
make

Then to copy the src/filed/static-bacula-fd, and a valid working copy of your bacula-fd.conf file to some specific directory. You can then proceed to configure the rescue package with:

cd <bacula-rescue>
./configure \
   --with-static-fd=<directory-containing-static-bacula-fd> \
   --with-bacula-scripts=<directory-containing-bacula-fd.conf>
cd linux/cdrom
su 
(enter root password)
make

The above instructions were for building the rescue CDROM from a bacula-rescue release. The advantage of the above procedure is that you have explicitly built your static-bacula-fd and you will supply the configuration with a working copy of bacula-fd.conf containing the correct Director name and password.

Alternatively when you configure the rescue package, you could supply it with the path to your Bacula source code, and when building the rescue disk, it will attepmpt to build a static-bacula-fd for you. We suggest you manually build your static Bacula File daemon and use the --with-static-fd option rather than letting the script attempt to build it (as shown below) because by manually building it, you can ensure that there are no errors, and you can execute it prior to putting it on the CD (e.g. ./bacula-fd -t).

To have the rescue scripts automatically build a static File daemon for you, use:

cd <bacula-rescue>
./configure \
   --with-bacula=<bacula-source-directory>
cd linux/cdrom
su 
(enter root password)
make

If you have multiple kernels installed on your system, you can specify which one using the following configuration option:

cd <bacula-rescue>
./configure \
   --with-kernel=<kernel-version> \
   ...

For example a kernel-version might be 2.6.14-1.1653.

One additional option that can be useful is to specify the device name of your CDROM on the ./configure. To do so use:

cd <bacula-rescue>
./configure \
   --with-dev=<device> \
   ...

Where <device> is typically replaced with something like /dev/hdc. This option is needed only if you have a recent OS that used device specifications rather than rather than ATA addresses, and you want to use the Bacula script make burn to automatically burn your ISO onto a CDROM.

For users of the bacula-rescue rpm the static bacula-fd has already been built and placed in /etc/bacula/rescue/linux/cdrom/bin/ along with a symbolic link to your /etc/bacula/bacula-fd.conf file. Rpm users only need to do the second step:

cd /etc/bacula/rescue/linux/cdrom
su (become root)
make

At this point, if the scripts are successful, they should have done the following things:

Once this is accomplished, you need only burn it into a CDROM. This can be done directly from the makefile with:

make burn

However, you may need to modify the Makefile to properly specify your CD burner as the detection process is complicated especially if you have two CDROMs or do not have cdrecord loaded on your system. Users of the rescue rpm package should definitely examine the Makefile since it was configured on the host used to produce the rpm package. If you find that the make burn does not work for you, try doing a:

make scan

and use the output of that to modify the Makefile accordingly.

The "make" that you did above actually does the equivalent to the following:

make kernel
make binaries
make bacula
make iso

If you wish, you can modify what you put on the CDROM and redo any part of the make that you wish. For example, if you want to add a new directory, you might do the first three makes, then add a new directory to the CDROM, and finally do a "make iso". Please see the README file in the rescue/linux/cdrom or /etc/bacula/rescue/linux/cdromdirectory for instructions on changing the contents of the CDROM.

At the current time, the size of the CDROM is about 100MB (compressed to about 20MB), so there is quite a bit more room for additional programs. Keep in mind that when this CDROM is booted, *everything* is in memory, so the total size cannot exceed your memory size, and even then you will need some reserve memory for running programs, ...

Finally, if you want to be completely responsible for getting your own FD binary on the disk, you can do the following:

cd linux/cdrom
touch rpm_release
make kernel
make binaries
make bacula
(add your own Bacula FD to the bacula/bin directory)
make iso
rm -f rpm_release

The rpm_release file prevents the make bacula from attempting to build or copy a File daemon, so that you can do it before the "make iso" step. Once "make iso" is run, you can no longer add anything to the in-memory part of the image. You can still add files to the cdtree directory, and when you do a "make burn" they will be written to the CDROM. However, to access them, you must be able to mount the CDROM after booting it, then copy them into memory.

Putting Multiple Systems on Your Rescue Disk

You can put multiple systems on the same rescue CD if you wish. This is because the information that is specific to your OS will be stored in the /bacula-hostname directory, where hostname is the name of the host on which you are building the CD. Suppose for example, you have two systems. One named client1 and one named client2. Assume also that your CD burner is on client1, and that is the machine we start on, and that we can ssh into client2 and also client2's disks are mounted on client1.

ssh client2
cd <bacula-source>
./configure --with-static-fd (our options)
make
cd <bacula-rescue-source>
./configure --with-bacula=<path-to-bacula-source>
cd linux/cdrom
su (become root)
make bacula
exit

Again, for rpm package users the above command set would be:

ssh client2
cd /etc/bacula/rescue/linux/cdrom
su
(enter root password)
make bacula
exit

Thus we have just built a Bacula rescue directory on client2. Now, on client1, we copy the appropriate directory to two places (explained below), then build an ISO and burn it:

cd <bacula-source>
./configure (your options)
make
cd <bacula-rescue-source>
./configure --with-bacula=<path-to-bacula-source>
cd linux/cdrom
su (become root)
c=/mnt/client2/home/user/bacula/rescue/linux/cdrom
cp -a $c/roottree/bacula-client2 cdtree
make
make burn
exit

And with the rpm package:

cd /etc/bacula/rescue/linux/cdrom
su
(enter root password)
c=/mnt/client2/etc/bacula/rescue/linux/cdrom
cp -a $c/roottree/bacula-client2 cdtree
make
make burn
exit

In summary, with the above commands, we first build a Bacula directory on client2 in roottree/bacula-client2, then we copied the bacula-client2 directory into the client1's cdtree so it will also be on the CD as a separate directory and thus can be read without booting the CDROM. Then we made and burned the CDROM for client1, which of course, contains the client2 data.

Restoring a Client System

Now, let's assume that your hard disk has just died and that you have replaced it with an new identical drive. In addition, we assume that you have:

  1. A recent Bacula backup (Full plus Incrementals)
  2. A Bacula Rescue CDROM.
  3. Your Bacula Director, Catalog, and Storage daemon running on another machine on your local network.

This is a relatively simple case, and later in this chapter, as time permits, we will discuss how you might recover from a situation where the machine that crashes is your main Bacula server (i.e. has the Director, the Catalog, and the Storage daemon).

You will take the following steps to get your system back up and running:

  1. Boot with your Bacula Rescue CDROM.
  2. Start the Network (local network)
  3. Re-partition your hard disk(s) as it was before
  4. Re-format your partitions
  5. Restore the Bacula File daemon (static version)
  6. Perform a Bacula restore of all your files
  7. Re-install your boot loader
  8. Reboot

Now for the details ...

Boot with your Bacula Rescue CDROM

When the CDROM boots, you will be presented with a script that looks like:

 
      Welcome to the Bacula Rescue Disk 2.0.0
To proceed, press the <ENTER> key or type "linux <runlevel>"
 
   linux 1     -> shell
   linux 2     -> login  (default if ENTER pressed)
   linux 3     -> network started and login (network not working yet)
   linux debug -> print debug during boot then login

Normally, at this point, you simply press ENTER. However, you may supply options for the boot if you wish.

Once it has booted, you will be requested to login something like:

bash-3.1#

You will be in the root directory, and you can proceed to examine your system.

The complete Bacula rescue part of the CD will be in the directory: /bacula-hostname, where hostname is replaced by the name of the host machine on which you did the build for the CDROM. This naming procedure allows you to put multiple restore environments for each of your machines on a single CDROM if you so wish to do. Please see the README document in the rescue/linux/cdrom directory for more information on adding to the CDROM.

Start the Network:

At this point, you should bring up your network. Normally, this is quite simple and requires just a few commands. Please cd into the /bacula-hostname directory before continuing. To simplify your task, we have created a script that should work in most cases by typing:

cd /bacula-hostname
./start_network

You can test it by pinging another machine, or pinging your broken machine machine from another machine. Do not proceed until your network is up.

Partition Your Hard Disk(s):

Assuming that your hard disk crashed and needs repartitioning, proceed with:

./partition.hda

If you have multiple disks, do the same for each of them. For SCSI disks, the repartition script will be named: partition.sda. If the script complains about the disk being in use, simply go back and redo the df command and umount commands until you no longer have your hard disk mounted. Note, in many cases, if your hard disk was seriously damaged or a new one installed, it will not automatically be mounted. If it is mounted, it is because the emergency kernel found one or more possibly valid partitions.

If for some reason this procedure does not work, you can use the information in partition.hda to re-partition your disks by hand using fdisk.

Format Your Hard Disk(s):

If you have repartitioned your hard disk, you must format it appropriately. The formatting script will put back swap partitions, normal Unix partitions (ext2) and journaled partitions (ext3) as well as Reiser partitions (rei). Do so by entering for each disk:

./format.hda

The format script will ask you if you want a block check done. We recommend to answer yes, but realize that for very large disks this can take hours.

Mount the Newly Formatted Disks:

Once the disks are partitioned and formatted, you can remount them with the mount_drives script. All your drives must be mounted for Bacula to be able to access them. Run the script as follows:

./mount_drives
df

The df command will tell you if the drives are mounted. If not, re-run the script again. It isn't always easy to figure out and create the mount points and the mounts in the proper order, so repeating the ./mount_drives command will not cause any harm and will most likely work the second time. If not, correct it by hand before continuing.

Start the Network:

Before starting the File Daemon, you must bring up the network so that it can communicate with the Director and Storage daemon. Generally you can do so by running:

./start_network

Restore and Start the File Daemon:

If you have booted with a Bacula Rescue CDROM, your statically linked Bacula File daemon and the bacula-fd.conf file will be in the /bacula-hostname/bin directory. Make sure bacula-fd and bacula-fd.conf are both there.

If you did not already install a correct conf file, please edit the Bacula configuration file, create the working/pid/subsys directory if you haven't already done so above, and start Bacula. Before starting Bacula, you will need to move it and bacula-fd.conf from /bacula-hostname/bin, to the /mnt/disk/tmp directory so that it will be on your hard disk. Then start it with the following command:

chroot /mnt/disk /tmp/bacula-fd -c /tmp/bacula-fd.conf

The above command starts the Bacula File daemon with the proper root disk location (i.e. /mnt/disk/tmp. If Bacula does not start, correct the problem and start it. You can check if it is running by entering:

ps fax

You can kill Bacula by entering:

kill -TERM <pid>

where pid is the first number printed in front of the first occurrence of bacula-fd in the ps fax command.

Now, you should be able to use another computer with Bacula installed to check the status by entering:

status client=xxxx

into the Console program, where xxxx is the name of the client you are restoring.

One common problem is that your bacula-dir.conf may contain machine addresses that are not properly resolved on the stripped down system to be restored because it is not running DNS. This is particularly true for the address in the Storage resource of the Director, which may be very well resolved on the Director's machine, but not on the machine being restored and running the File daemon. In that case, be prepared to edit bacula-dir.conf to replace the name of the Storage daemon's domain name with its IP address.

Restore Your Files:

On the computer that is running the Director, you now run a restore command and select the files to be restored (normally everything), but before starting the restore, there is one final change you must make using the mod option. You must change the Where directory to be the root by using the mod option just before running the job and selecting Where. Set it to:

/

then run the restore.

You might be tempted to avoid using chroot and running Bacula directly and then using a Where to specify a destination of /mnt/disk. This is possible, however, the current version of Bacula always restores files to the new location, and thus any soft links that have been specified with absolute paths will end up with /mnt/disk prefixed to them. In general this is not fatal to getting your system running, but be aware that you will have to fix these links if you do not use chroot.

Final Step:

At this point, the restore should have finished with no errors, and all your files will be restored. One last task remains and that is to write a new boot sector so that your machine will boot. For lilo, you enter the following command:

./run_lilo

If you are using grub instead of lilo, you must enter the following:

./run_grub

Note, I've had quite a number of problems with grub because it is rather complicated and not designed to install easily under a simplified system. In fact, the ./run_grub script is not going to work on most Linux 2.6 kernels with the latest grub, because grub-install references /usr/share/grub/... and it uses /dev/pts, which will not be in /dev if you are using udev (as do many 2.6 kernels).

So, if you experience errors or end up unexpectedly in a chroot shell, simply exit back to the normal shell and type in the appropriate commands from the run_grub script by hand until you get it to install. When you run the run_grub script, it will print the commands that you should manually enter if that is necessary.

In my more recent tests on FC4 running a 2.6.14 kernel and udev, I see that because of the above mentioned problems with grub, you will need version 1.8.2 rescue disk or later, and you may be more successful in getting grub to run by running it directly from the command line while logged into the rescue kernel using:

/sbin/grub-install --root-directory=/mnt/disk /dev/hda

Note, in this case, you omit the chroot command, and you must replace /dev/hda with your boot device. If you don't know what your boot device is, run the ./run_grub script once and it will tell you.

Finally, I've even run into a case where grub-install was unable to rewrite the boot block. In my case, it produced the following error message:

/dev/hdx does not have any corresponding BIOS drive.

The solution is to insure that all your disks are properly mounted on /mnt/disk, then do the following:

chroot /mnt/disk
mount /dev/pts

Then edit the file /boot/grub/grub.conf and uncomment the line that reads:

#boot=/dev/hda

So that it reads:

boot=/dev/hda

Note, the /dev/hda may be /dev/sda or possibly some other drive depending on your configuration, but in any case, it is the same as the one that you previously tried with grub-install.

Then, enter the following commands:

grub --batch --device-map=/boot/grub/device.map \
  --config-file=/boot/grub/grub.conf --no-floppy
root (hd0,0)
setup (hd0)
quit

If the grub call worked, you will get a prompt of grub> before the root, setup, and quit commands, and after entering the setup command, it should indicate that it successfully wrote the MBR (master boot record).

Reboot:

First unmount all your hard disks, otherwise they will not be cleanly shutdown, then reboot your machine by entering exit until you get to the main prompt then enter Ctrl-d. Once back to the main CDROM prompt, you will need to turn the power off, then back on to your machine to get it to reboot.

If everything went well, you should now be back up and running. If not, re-insert the emergency boot CDROM, boot, and figure out what is wrong.

Restoring a Server

Above, we considered how to recover a client machine where a valid Bacula server was running on another machine. However, what happens if your server goes down and you no longer have a running Director, Catalog, or Storage daemon? There are several solutions:

  1. Bring up static versions of your Director, Catalog, and Storage daemon on the damaged machine.

  2. Move your server to another machine.

  3. Use a Hot Spare Server on another Machine.

The first option, is very difficult because it requires you to have created a static version of the Director and the Storage daemon as well as the Catalog. If the Catalog uses MySQL or PostgreSQL, this may or may not be possible. In addition, to loading all these programs on a bare system (quite possible), you will need to make sure you have a valid driver for your tape drive.

The second suggestion is probably a much simpler solution, and one I have done myself. To do so, you might want to consider the following steps:

For additional details of restoring your database, please see the Restoring When Things Go Wrong section of the Console Restore Command chapter of this manual.

Linux Problems or Bugs

Since every flavor and every release of Linux is different, there are likely to be some small difficulties with the scripts, so please be prepared to edit them in a minimal environment. A rudimentary knowledge of vi is very useful. Also, these scripts do not do everything. You will need to reformat Windows partitions by hand, for example.

Getting the boot loader back can be a problem if you are using grub because it is so complicated. If all else fails, reboot your system from your floppy but using the restored disk image, then proceed to a reinstallation of grub (looking at the run-grub script can help). By contrast, lilo is a piece of cake.

Bare Metal Recovery using a LiveCD

Rather than building a full Bacula Rescue CDROM, you can use any system rescue or LiveCD to recover your system. The big problem with most rescue or LiveCDs is that they are not designed to capture the current state of your system, so when you boot them on a damaged system, you might be somewhat lost -- e.g. how many of you remember your exact hard disk partitioning.

This lack can be easily corrected by running the part of the Bacula Rescue code that creates a directory containing a static-bacula-fd, a snapshot of your current system disk configuration, and scripts that help restoring it.

The procedure is similar to creating and your Bacula Rescue CDROM described above, but with the following differences:

Before a disaster strikes:

  1. Run only the make bacula part of the Bacula Rescue procedure to create the static Bacula File daemon, and system disk snapshot.
  2. Save the directory generated (more details below) preferrably on a CDROM or alternatively to some other system.
  3. Possibly run make bacula every night as part of your backup process to ensure that you have a current snapshot of your system.

Then when disaster strikes, do the following:

  1. Boot with your system rescue disk or LiveCD (e.g. Knoppix).
  2. Start the Network (local network).
  3. Copy the Bacula recovery directory to the damaged system using ftp, scp, wget or if your boot disk permits it reading it directly from a CDROM.
  4. Continue as documented above as if you were using the Bacula Rescue CDROM -- that is.
  5. Re-partition your hard disk(s) as it was before, if necessary.
  6. Re-format your partitions, if necessary.
  7. Restore the Bacula File daemon (static version).
  8. Perform a Bacula restore of all your files.
  9. Re-install your boot loader.
  10. Reboot.

In order to create the Bacula recovery directory, you need a copy of the Bacula Rescue code as described above, and you must first configure that directory (and possibly your Bacula source) as described above in the section entitled Creating a Bacula Rescue CDROM.

Once the configuration is done, you can do the following to create the Bacula recovery directory:

cd <bacula-rescue-source>/linux/cdrom
su (become root)
make bacula

The directory you want to save will be created in the current directory with the name bacula. You need only save that directory either as a directory or possibly as a compressed tar file. If you run this procedure on multiple machines, you will probably want to rename this directory to something like bacula-hostname.

FreeBSD Bare Metal Recovery

The same basic techniques described above also apply to FreeBSD. Although we don't yet have a fully automated procedure, Alex Torres Molina has provided us with the following instructions with a few additions from Jesse Guardiani and Dan Langille:

  1. Boot with the FreeBSD installation disk
  2. Go to Custom, Partition and create your slices and go to Label and create the partitions that you want. Apply changes.
  3. Go to Fixit to start an emergency console.
  4. Create devs ad0 .. .. if they don't exist under /mnt2/dev (in my situation) with MAKEDEV. The device or devices you create depend on what hard drives you have. ad0 is your first ATA drive. da0 would by your first SCSI drive. Under OS version 5 and greater, your device files are most likely automatically created for you.
  5. mkdir /mnt/disk this is the root of the new disk
  6. mount /mnt2/dev/ad0s1a /mnt/disk mount /mnt2/dev/ad0s1c /mnt/disk/var mount /mnt2/dev/ad0s1d /mnt/disk/usr ..... The same hard drive issues as above apply here too. Note, under OS version 5 or higher, your disk devices may be in /dev not /mnt2/dev.
  7. Network configuration (ifconfig xl0 ip/mask + route add default ip-gateway)
  8. mkdir /mnt/disk/tmp
  9. cd /mnt/disk/tmp
  10. Copy bacula-fd and bacula-fd.conf to this path
  11. If you need to, use sftp to copy files, after which you must do this: ln -s /mnt2/usr/bin /usr/bin
  12. chmod u+x bacula-fd
  13. Modify bacula-fd.conf to fit this machine
  14. Copy /bin/sh to /mnt/disk, necessary for chroot
  15. Don't forget to put your bacula-dir's IP address and domain name in /mnt/disk/etc/hosts if it's not on a public net. Otherwise the FD on the machine you are restoring to won't be able to contact the SD and DIR on the remote machine.
  16. mkdir -p /mnt/disk/var/db/bacula
  17. chroot /mnt/disk /tmp/bacula-fd -c /tmp/bacula-fd.conf to start bacula-fd
  18. Now you can go to bacula-dir and restore the job with the entire contents of the broken server.
  19. You must create /proc

Solaris Bare Metal Recovery

The same basic techniques described above apply to Solaris:

However, during the recovery phase, the boot and disk preparation procedures are different:

Once the disk is partitioned, formatted and mounted, you can continue with bringing up the network and reloading Bacula.

Preparing Solaris Before a Disaster

As mentioned above, before a disaster strikes, you should prepare the information needed in the case of problems. To do so, in the rescue/solaris subdirectory enter:

su
./getdiskinfo
./make_rescue_disk

The getdiskinfo script will, as in the case of Linux described above, create a subdirectory diskinfo containing the output from several system utilities. In addition, it will contain the output from the SysAudit program as described in Curtis Preston's book. This file diskinfo/sysaudit.bsi will contain the disk partitioning information that will allow you to manually follow the procedures in the "Unix Backup & Recovery" book to repartition and format your hard disk. In addition, the getdiskinfo script will create a start_network script.

Once you have your disks repartitioned and formatted, do the following:

Bugs and Other Considerations

Directory Modification and Access Times are Modified on pre-1.30 Baculas :

When a pre-1.30 version of Bacula restores a directory, it first must create the directory, then it populates the directory with its files and subdirectories. The act of creating the files and subdirectories updates both the modification and access times associated with the directory itself. As a consequence, all modification and access times of all directories will be updated to the time of the restore.

This has been corrected in Bacula version 1.30 and later. The directory modification and access times are reset to the value saved in the backup after all the files and subdirectories have been restored. This has been tested and verified on normal restore operations, but not verified during a bare metal recovery.

Strange Bootstrap Files:

If any of you look closely at the bootstrap file that is produced and used for the restore (I sure do), you will probably notice that the FileIndex item does not include all the files saved to the tape. This is because in some instances there are duplicates (especially in the case of an Incremental save), and in such circumstances, Bacula restores only the last of multiple copies of a file or directory.

Disaster Recovery of Win32 Systems

Due to open system files, and registry problems, Bacula cannot save and restore a complete Win2K/XP/NT environment.

A suggestion by Damian Coutts using Microsoft's NTBackup utility in conjunction with Bacula should permit a Full bare metal restore of Win2K/XP (and possibly NT systems). His suggestion is to do an NTBackup of the critical system state prior to running a Bacula backup with the following command:

ntbackup backup systemstate /F c:\systemstate.bkf

The backup is the command, the systemstate says to backup only the system state and not all the user files, and the /F c:\systemstate.bkf specifies where to write the state file. this file must then be saved and restored by Bacula. This command can be put in a Client Run Before Job directive so that it is automatically run during each backup, and thus saved to a Bacula Volume.

To restore the system state, you first reload a base operating system, then you would use Bacula to restore all the users files and to recover the c:\systemstate.bkf file, and finally, run NTBackup and catalogue the system statefile, and then select it for restore. The documentation says you can't run a command line restore of the systemstate.

This procedure has been confirmed to work by Ludovic Strappazon -- many thanks!

A new tool is provided in the form of a bacula plugin for the BartPE rescue CD. BartPE is a self-contained WindowsXP boot CD which you can make using the PeBuilder tools available at http://www.nu2.nu/pebuilder/ and a valid Windows XP SP1 CDROM. The plugin is provided as a zip archive. Unzip the file and copy the bacula directory into the plugin directory of your BartPE installation. Edit the configuration files to suit your installation and build your CD according to the instructions at Bart's site. This will permit you to boot from the cd, configure and start networking, start the bacula file client and access your director with the console program. The programs menu on the booted CD contains entries to install the file client service, start the file client service, and start the WX-Console. You can also open a command line window and CD Programs\Bacula and run the command line console bconsole.

Ownership and Permissions on Win32 Systems

Bacula versions after 1.31 should properly restore ownership and permissions on all WinNT/XP/2K systems. If you do experience problems, generally in restores to alternate directories because higher level directories were not backed up by Bacula, you can correct any problems with the SetACL available under the GPL license at: http://sourceforge.net/projects/setacl/.

Alternate Disaster Recovery Suggestion for Win32 Systems

Ludovic Strappazon has suggested an interesting way to backup and restore complete Win32 partitions. Simply boot your Win32 system with a Linux Rescue disk as described above for Linux, install a statically linked Bacula, and backup any of the raw partitions you want. Then to restore the system, you simply restore the raw partition or partitions. Here is the email that Ludovic recently sent on that subject:

I've just finished testing my brand new cd LFS/Bacula
with a raw Bacula backup and restore of my portable.
I can't resist sending you the results: look at the rates !!!
hunt-dir: Start Backup JobId 100, Job=HuntBackup.2003-04-17_12.58.26
hunt-dir: Bacula 1.30 (14Apr03): 17-Apr-2003 13:14
JobId:                  100
Job:                    HuntBackup.2003-04-17_12.58.26
FileSet:                RawPartition
Backup Level:           Full
Client:                 sauvegarde-fd
Start time:             17-Apr-2003 12:58
End time:               17-Apr-2003 13:14
Files Written:          1
Bytes Written:          10,058,586,272
Rate:                   10734.9 KB/s
Software Compression:   None
Volume names(s):        000103
Volume Session Id:      2
Volume Session Time:    1050576790
Last Volume Bytes:      10,080,883,520
FD termination status:  OK
SD termination status:  OK
Termination:            Backup OK
hunt-dir: Begin pruning Jobs.
hunt-dir: No Jobs found to prune.
hunt-dir: Begin pruning Files.
hunt-dir: No Files found to prune.
hunt-dir: End auto prune.
hunt-dir: Start Restore Job RestoreFilesHunt.2003-04-17_13.21.44
hunt-sd: Forward spacing to file 1.
hunt-dir: Bacula 1.30 (14Apr03): 17-Apr-2003 13:54
JobId:                  101
Job:                    RestoreFilesHunt.2003-04-17_13.21.44
Client:                 sauvegarde-fd
Start time:             17-Apr-2003 13:21
End time:               17-Apr-2003 13:54
Files Restored:         1
Bytes Restored:         10,056,130,560
Rate:                   5073.7 KB/s
FD termination status:  OK
Termination:            Restore OK
hunt-dir: Begin pruning Jobs.
hunt-dir: No Jobs found to prune.
hunt-dir: Begin pruning Files.
hunt-dir: No Files found to prune.
hunt-dir: End auto prune.

Restoring to a Running System

If for some reason you want to do a Full restore to a system that has a working kernel (not recommended), you will need to take care not to overwrite the following files:

/etc/grub.conf
/etc/X11/Conf
/etc/fstab
/etc/mtab
/lib/modules
/usr/modules
/usr/X11R6
/etc/modules.conf

Additional Resources

Many thanks to Charles Curley who wrote Linux Complete Backup and Recovery HOWTO for the The Linux Documentation Project. This is an excellent document on how to do Bare Metal Recovery on Linux systems, and it was this document that made me realize that Bacula could do the same thing.

You can find quite a few additional resources, both commercial and free at Storage Mountain, formerly known as Backup Central.

And finally, the O'Reilly book, "Unix Backup & Recovery" by W. Curtis Preston covers virtually every backup and recovery topic including bare metal recovery for a large range of Unix systems.


Bacula TLS

Bacula TLS (Transport Layer Security) is built-in network encryption code to provide secure network transport similar to that offered by stunnel or ssh. The Bacula code was written by Landon Fuller.

Supported features of this code include:

This document will refer to both "server" and "client" contexts. These terms refer to the accepting and initiating peer, respectively.

Diffie-Hellman anonymous ciphers are not supported by this code. The use of DH anonymous ciphers increases the code complexity and places explicit trust upon the two-way CRAM-MD5 implementation. CRAM-MD5 is subject to known plaintext attacks, and it should be considered considerably less secure than PKI certificate-based authentication.

Appropriate autoconf macros have been added to detect and use OpenSSL if enabled on the ./configure line with --enable-openssl

TLS Configuration Directives

Additional configuration directives have been added to all the daemons (Director, File daemon, and Storage daemon) as well as the various different Console programs. These new directives are defined as follows:

TLS Enable = <yes|no>
Enable TLS support.

TLS Require = <yes|no>
Require TLS connections.

TLS Certificate = <Directory>
Path to a PEM encoded TLS certificate. It can be used as either a client or server certificate. PEM stands for Privacy Enhanced Mail, but in this context refers to how the certificates are encoded. It is used because PEM files are base64 encoded and hence ASCII text based rather than binary. They may also contain encrypted information.

TLS Key = <Directory>
Path to a PEM encoded TLS private key. It must correspond to the TLS certificate.

TLS Verify Peer = <yes|no>
Verify peer certificate. Instructs server to request and verify the client's x509 certificate. Any client certificate signed by a known-CA will be accepted unless the TLS Allowed CN configuration directive is used, in which case the client certificate must correspond to the Allowed Common Name specified. This directive is valid only for a server and not in a client context.

TLS Allowed CN = <string list>
Common name attribute of allowed peer certificates. If this directive is specified, all client certificates will be verified against this list. This directive may be specified more than once. It is not valid in a client context.

TLS CA Certificate File = <Filename>
The full path and filename specifying a PEM encoded TLS CA certificate(s). Multiple certificates are permitted in the file. One of TLS CA Certificate File or TLS CA Certificate Dir are required in a server context if TLS Verify Peer (see above) is also specified, and are always required in a client context.

TLS CA Certificate Dir = <Directory>
Full path to TLS CA certificate directory. In the current implementation, certificates must be stored PEM encoded with OpenSSL-compatible hashes, which is the subject name's hash and an extension of bf .0. One of TLS CA Certificate File or TLS CA Certificate Dir are required in a server context if TLS Verify Peer is also specified, and are always required in a client context.

TLS DH File = <Directory>
Path to PEM encoded Diffie-Hellman parameter file. If this directive is specified, DH key exchange will be used for the ephemeral keying, allowing for forward secrecy of communications. DH key exchange adds an additional level of security because the key used for encryption/decryption by the server and the client is computed on each end and thus is never passed over the network if Diffie-Hellman key exchange is used. Even if DH key exchange is not used, the encryption/decryption key is always passed encrypted. This directive is only valid within a server context.

To generate the parameter file, you may use openssl:

 
   openssl dhparam -out dh1024.pem -5 1024

Creating a Self-signed Certificate

You may create a self-signed certificate for use with the Bacula TLS that will permit you to make it function, but will not allow certificate validation. The .pem file containing both the certificate and the key valid for 10 years can be made with the following:

   openssl req -new -x509 -nodes -out bacula.pem -keyout bacula.pem -days 3650

The above script will ask you a number of questions. You may simply answer each of them by entering a return, or if you wish you may enter your own data.

Note, however, that self-signed certificates will only work for the outgoing end of connections. For example, in the case of the Director making a connection to a File Daemon, the File Daemon may be configured to allow self-signed certifictes, but the certificate being sed by the Director must be signed by a certificate that is explicitly trusted on the File Daemon end.

This is neccessary to prevent ``man in the middle'' attacks from tools such as ettercap. Essentially, if the Director does not verify that it is talking to a trusted remote endpoint, it can be tricked into talking to a malicious 3rd party who is relaying and capturing all traffic by presenting its own certificates to the Director and File Daemons. The only way to prevent this is by using trusted certificates, so that the man in the middle is incapable of spoofing the connection using his own.

To get a trusted certificate (CA or Certificate Authority signed certificate), you will either need to purchase certificates signed by a commercial CA or find a friend that has setup his own CA or become a CA yourself, and thus you can sign all your own certificates. The book OpenSSL by John Viega, Matt Mesier & Pravir Chandra from O'Reilly explains how to do it, or you can read the documentation provided in the Open-source PKI Book project at Source Forge: http://ospkibook.sourceforge.net/docs/OSPKI-2.4.7/OSPKI-html/ospki-book.htm. Note, this link may change.

The program TinyCA has a very nice Graphical User Interface that allows you to easily setup and maintain your own CA. TinyCA can be found at http://tinyca.sm-zone.net/.

Getting a CA Signed Certificate

The process of getting a certificate that is signed by a CA is quite a bit more complicated. You can purchase one from quite a number of PKI vendors, but that is not at all necessary for use with Bacula. To get a CA signed certificate, you will either need to find a friend that has setup his own CA or to become a CA yourself, and thus you can sign all your own certificates. The book OpenSSL by John Viega, Matt Mesier & Pravir Chandra from O'Reilly explains how to do it, or you can read the documentation provided in the Open-source PKI Book project at Source Forge: http://ospkibook.sourceforge.net/docs/OSPKI-2.4.7/OSPKI-html/ospki-book.htm. Note, this link may change.

Example TLS Configuration Files

Landon has supplied us with the TLS portions of his configuration files, which should help you setting up your own.

bacula-dir.conf

   Director {                            # define myself
     Name = backup1-dir
     ...
     TLS Require = yes
     TLS Verify Peer = yes
     TLS Allowed CN = "bacula@backup1.example.com"
     TLS Allowed CN = "administrator@example.com"
     TLS CA Certificate File = /usr/local/etc/ssl/ca.pem
     # This is a server certificate, used for incoming
     # console connections.
     TLS Certificate = /usr/local/etc/ssl/backup1/cert.pem
     TLS Key = /usr/local/etc/ssl/backup1/key.pem
   }

   Storage {
     Name = File
     Address = backup1.example.com
     ...
     TLS Require = yes
     TLS CA Certificate File = /usr/local/etc/ssl/ca.pem
     # This is a client certificate, used by the director to
     # connect to the storage daemon
     TLS Certificate = /usr/local/etc/ssl/bacula@backup1/cert.pem
     TLS Key = /usr/local/etc/ssl/bacula@backup1/key.pem
   }

bacula-fd.conf

   Director {
     Name = backup1-dir
     ...
     TLS Require = yes
     TLS Verify Peer = yes
     # Allow only the Director to connect
     TLS Allowed CN = "bacula@backup1.example.com"
     TLS CA Certificate File = /usr/local/etc/ssl/ca.pem\
     # This is a server certificate. It is used by connecting
     # directors to verify the authenticity of this file daemon
     TLS Certificate = /usr/local/etc/ssl/server1/cert.pem
     TLS Key = /usr/local/etc/ssl/server1/key.pem
   }

bacula-sd.conf

   Storage {                             # definition of myself
     Name = backup1-sd
     ...
     # These TLS configuration options are used for incoming
     # file daemon connections. Director TLS settings are handled
     # below.
     TLS Require = yes
     # Peer certificate is not required/requested -- peer validity
     # is verified by the storage connection cookie provided to the
     # File Daemon by the director.
     TLS Verify Peer = no
     TLS CA Certificate File = /usr/local/etc/ssl/ca.pem
     # This is a server certificate. It is used by connecting
     # file daemons to verify the authenticity of this storage daemon
     TLS Certificate = /usr/local/etc/ssl/backup1/cert.pem
     TLS Key = /usr/local/etc/ssl/backup1/key.pem
   }

   #
   # List Directors who are permitted to contact Storage daemon
   #
   Director {
     Name = backup1-dir
     ...
     TLS Require = yes
     # Require the connecting director to provide a certificate
     # with the matching CN.
     TLS Verify Peer = yes
     TLS Allowed CN = "bacula@backup1.example.com"
     TLS CA Certificate File = /usr/local/etc/ssl/ca.pem
     # This is a server certificate. It is used by the connecting
     # director to verify the authenticity of this storage daemon
     TLS Certificate = /usr/local/etc/ssl/backup1/cert.pem
     TLS Key = /usr/local/etc/ssl/backup1/key.pem
   }


Data Encryption

Bacula permits file data encryption and signing within the File Daemon (or Client) prior to sending data to the Storage Daemon. Upon restoration, file signatures are validated and any mismatches are reported. At no time does the Director or the Storage Daemon have access to unencrypted file contents.

It is very important to specify what this implementation does NOT do:

Encryption and signing are implemented using RSA private keys coupled with self-signed x509 public certificates. This is also sometimes known as PKI or Public Key Infrastructure.

Each File Daemon should be given its own unique private/public key pair. In addition to this key pair, any number of "Master Keys" may be specified -- these are key pairs that may be used to decrypt any backups should the File Daemon key be lost. Only the Master Key's public certificate should be made available to the File Daemon. Under no circumstances should the Master Private Key be shared or stored on the Client machine.

The Master Keys should be backed up to a secure location, such as a CD placed in a in a fire-proof safe or bank safety deposit box. The Master Keys should never be kept on the same machine as the Storage Daemon or Director if you are worried about an unauthorized party compromising either machine and accessing your encrypted backups.

While less critical than the Master Keys, File Daemon Keys are also a prime candidate for off-site backups; burn the key pair to a CD and send the CD home with the owner of the machine.

NOTE!!! If you lose your encryption keys, backups will be unrecoverable. ALWAYS store a copy of your master keys in a secure, off-site location.

The basic algorithm used for each backup session (Job) is:

  1. The File daemon generates a session key.
  2. The FD encrypts that session key via PKE for all recipients (the file daemon, any master keys).
  3. The FD uses that session key to perform symmetric encryption on the data.

Building Bacula with Encryption Support

The configuration option for enabling OpenSSL encryption support has not changed since Bacula 1.38. To build Bacula with encryption support, you will need the OpenSSL libraries and headers installed. When configuring Bacula, use:

   ./configure --with-openssl ...

Encryption Technical Details

The implementation uses 128bit AES-CBC, with RSA encrypted symmetric session keys. The RSA key is user supplied. If you are running OpenSSL 0.9.8 or later, the signed file hash uses SHA-256 -- otherwise, SHA-1 is used.

End-user configuration settings for the algorithms are not currently exposed -- only the algorithms listed above are used. However, the data written to Volume supports arbitrary symmetric, asymmetric, and digest algorithms for future extensibility, and the back-end implementation currently supports:

Symmetric Encryption:
    - 128, 192, and 256-bit AES-CBC
    - Blowfish-CBC

Asymmetric Encryption (used to encrypt symmetric session keys):
    - RSA

Digest Algorithms:
    - MD5
    - SHA1
    - SHA256
    - SHA512

The various algorithms are exposed via an entirely re-usable, OpenSSL-agnostic API (ie, it is possible to drop in a new encryption backend). The Volume format is DER-encoded ASN.1, modeled after the Cryptographic Message Syntax from RFC 3852. Unfortunately, using CMS directly was not possible, as at the time of coding a free software streaming DER decoder/encoder was not available.

Decrypting with a Master Key

It is preferable to retain a secure, non-encrypted copy of the client's own encryption keypair. However, should you lose the client's keypair, recovery with the master keypair is possible.

You must:

Generating Private/Public Encryption Keys

Generate a Master Key Pair with:

  openssl genrsa -out master.key 2048
  openssl req -new -key master.key -x509 -out master.cert

Generate a File Daemon Key Pair for each FD:

  openssl genrsa -out fd-example.key 2048
  openssl req -new -key fd-example.key -x509 -out fd-example.cert
  cat fd-example.key fd-example.cert >fd-example.pem

Note, there seems to be a lot of confusion around the file extensions given to these keys. For example, a .pem file can contain all the following: private keys (RSA and DSA), public keys (RSA and DSA) and (x509) certificates. It is the default format for OpenSSL. It stores data Base64 encoded DER format, surrounded by ASCII headers, so is suitable for text mode transfers between systems. A .pem file may contain any number of keys either public or private. We use it in cases where there is both a public and a private key.

Typically, above we have used the .cert extension to refer to X509 certificate encoding that contains only a single public key.

Example Data Encryption Configuration

bacula-fd.conf

FileDaemon {
   Name = example-fd
   FDport = 9102                  # where we listen for the director
   WorkingDirectory = /var/bacula/working
   Pid Directory = /var/run
   Maximum Concurrent Jobs = 20
 
   PKI Signatures = Yes            # Enable Data Signing
   PKI Encryption = Yes            # Enable Data Encryption
   PKI Keypair = "/etc/bacula/fd-example.pem"    # Public and Private Keys
   PKI Master Key = "/etc/bacula/master.cert"    # ONLY the Public Key
}


Bacula Security Issues

Backward Compatibility

One of the major goals of Bacula is to ensure that you can restore tapes (I'll use the word tape to include disk Volumes) that you wrote years ago. This means that each new version of Bacula should be able to read old format tapes. The first problem you will have is to ensure that the hardware is still working some years down the road, and the second problem will be to ensure that the media will still be good, then your OS must be able to interface to the device, and finally Bacula must be able to recogize old formats. All the problems except the last are ones that we cannot solve, but by careful planning you can.

Since the very beginning of Bacula (January 2000) until today (December 2005), there have been two major Bacula tape formats. The second format was introduced in version 1.27 in November of 2002, and it has not changed since then. In principle, Bacula can still read the original format, but I haven't tried it lately so who knows ...

Though the tape format is fixed, the kinds of data that we can put on the tapes are extensible, and that is how we added new features such as ACLs, Win32 data, encrypted data, ... Obviously, an older version of Bacula would not know how to read these newer data streams, but each newer version of Bacula should know how to read all the older streams.

If you want to be 100should:

1. Try reading old tapes from time to time -- e.g. at least once a year.

2. Keep statically linked copies of every version of Bacula that you use in production then if for some reason, we botch up old tape compatibility, you can always pull out an old copy of Bacula ...

The second point is probably overkill but if you want to be sure, it may save you someday.

subsection*Configuring and Testing TCP Wrappers index[general]Configuring and Testing TCP Wrappers addcontentslinetocsubsectionConfiguring and Testing TCP Wrappers

TCP Wrappers are implemented if you turn them on when configuring (./configure --with-libwrap). With this code enabled, you may control who may access your daemons. This control is done by modifying the file: /etc/hosts.allow. The program name that Bacula uses when applying these access restrictions is the name you specify in the daemon configuration file. You must not use the twist option in your /etc/hosts.allow or it will terminate the Bacula daemon when a connection is refused.

Dan Langille has provided the following information on configuring and testing TCP wrappers with Bacula.

If you read hosts_options(5), you will see an option called twist. This option replaces the current process by an instance of the specified shell command. Typically, something like this is used:

ALL : ALL \
 : severity auth.info \
 : twist /bin/echo "You are not welcome to use %d from %h."

The libwrap code tries to avoid twist if it runs in a resident process, but that test will not protect the first hosts_access() call. This will result in the process (e.g. bacula-fd, bacula-sd, bacula-dir) being terminated if the first connection to their port results in the twist option being invoked. The potential, and I strees potential, exists for an attacker to prevent the daemons from running. This situation is eliminated if your /etc/hosts.allow file contains an appropriate ruleset. The following example is sufficent:

undef-fd : localhost : allow
undef-sd : localhost : allow
undef-dir : localhost : allow
undef-fd : ALL : deny
undef-sd : ALL : deny
undef-dir : ALL : deny

You must adjust the daemon names to those found in the respective daemon configuration files. In these examples, the Director is undef- dir, the Storage Daemon is undef-sd, and the File Daemon is undef-fd. Adjust to suit your situation. The above example rules assume that the SD, FD, and DIR all reside on the same box. If you have a remote FD client, then the following ruleset on the remote client will suffice:

undef-fd : director.example.org : allow
undef-fd : ALL : deny

where director.example.org is the host which will be contacting the client (ie. the box on which the Bacula Director daemon runs). The use of "ALL : deny" ensures that the twist option (if present) is not invoked. To properly test your configuration, start the daemon(s), then attempt to connect from an IP address which should be able to connect. You should see something like this:

$ telnet undef 9103
Trying 192.168.0.56...
Connected to undef.example.org.
Escape character is '^]'.
Connection closed by foreign host.
$

This is the correct response. If you see this:

$ telnet undef 9103
Trying 192.168.0.56...
Connected to undef.example.org.
Escape character is '^]'.
You are not welcome to use undef-sd from xeon.example.org.
Connection closed by foreign host.
$

then twist has been invoked and your configuration is not correct and you need to add the deny statement. It is important to note that your testing must include restarting the daemons after each connection attempt. You can also tcpdchk(8) and tcpdmatch(8) to validate your /etc/hosts.allow rules. Here is a simple test using tcpdmatch:

$ tcpdmatch undef-dir xeon.example.org
warning: undef-dir: no such process name in /etc/inetd.conf
client: hostname xeon.example.org
client: address 192.168.0.18
server: process undef-dir
matched: /etc/hosts.allow line 40
option: allow
access: granted

If you are running Bacula as a standalone daemon, the warning above can be safely ignored. Here is an example which indicates that your rules are missing a deny statement and the twist option has been invoked.

$ tcpdmatch undef-dir 10.0.0.1
warning: undef-dir: no such process name in /etc/inetd.conf
client: address 10.0.0.1
server: process undef-dir
matched: /etc/hosts.allow line 91
option: severity auth.info
option: twist /bin/echo "You are not welcome to use
  undef-dir from 10.0.0.1."
access: delegated

Running as non-root

Security advice from Dan Langille:

It is a good idea to run daemons with the lowest possible privileges. In other words, if you can, don't run applications as root which do not have to be root. The Storage Daemon and the Director Daemon do not need to be root. The File Daemon needs to be root in order to access all files on your system. In order to run as non-root, you need to create a user and a group. Choosing bacula as both the user name and the group name sounds like a good idea to me.

The FreeBSD port creates this user and group for you (actually, as I write this, the port doesn't do that, but it soon will). Here is what those entries looked like on my FreeBSD laptop:

bacula:*:1002:1002::0:0:Bacul Daemon:/var/db/bacula:/sbin/nologin

I used vipw to create this entry. I selected a User ID and Group ID of 1002 as they were unused on my system.

I also created a group in /etc/group:

bacula:*:1002:

The bacula user (as opposed to the Bacula daemon) will have a home directory of /var/db/bacula which is the default location for the Bacula database.

Now that you have both a bacula user and a bacula group, you can secure the bacula home directory by issuing this command:

chown -R bacula:bacula /var/db/bacula/

This ensures that only the bacula user can access this directory. It also means that if we run the Director and the Storage daemon as bacula, those daemons also have restricted access. This would not be the case if they were running as root.

It is important to note that the storage daemon actually needs to be in the operator group for normal access to tape drives etc (at least on a FreeBSD system, that's how things are set up by default) Such devices are normally chown root:operator. It is easier and less error prone to make Bacula a member of that group than it is to play around with system permissions.

Starting the Bacula daemons

To start the bacula daemons on a FreeBSD system, issue the following command:

/usr/local/etc/rc.d/bacula.sh start

To confirm they are all running:

$ ps auwx | grep bacula
root\ 63416\ 0.0\ 0.3\ 2040 1172\ ??\ Ss\ 4:09PM 0:00.01
    /usr/local/sbin/bacula-sd -v -c /usr/local/etc/bacula-sd.conf
root\ 63418\ 0.0\ 0.3\ 1856 1036\ ??\ Ss\ 4:09PM 0:00.00
    /usr/local/sbin/bacula-fd -v -c /usr/local/etc/bacula-fd.conf
root\ 63422\ 0.0\ 0.4\ 2360 1440\ ??\ Ss\ 4:09PM 0:00.00
    /usr/local/sbin/bacula-dir -v -c /usr/local/etc/bacula-dir.conf


Dealing with Firewalls

If you have a firewall or a DMZ installed on your computer, you may experience difficulties contacting one or more of the Clients to back them up. This is especially true if you are trying to backup a Client across the Internet.

Technical Details

If you are attempting to do this, the sequence of network events in Bacula to do a backup are the following:

Console -> DIR:9101
DIR     -> SD:9103
DIR     -> FD:9102
FD      -> SD:9103

Where it should be obvious that DIR represents the Director, FD the File daemon or client, and SD the Storage daemon. The numbers that follow those names are the standard ports used by Bacula, and the -> represents the left side making a connection to the right side (i.e. the right side is the "server" or is listening on the specified port), and the left side is the "client" who initiates the conversation.

Note, port 9103 serves both the Director and the File daemon, each having its own independent connection.

If you are running iptables, you might add something like:

-A FW-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9101:9103 -j ACCEPT

on your server, and

-A FW-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9102 -j ACCEPT

on your client. In both cases, I assume that the machine is allowed to initiate connections on any port. If not, you will need to allow outgoing connections on ports 9102 and 9103 on your server and 9103 on your client. Thanks to Raymond Norton for this tip.

A Concrete Example

Jesse Guardiani's solution for his network for this problem, in his own words, is:

My bacula server is on the 192.168.1.0/24 network at IP address 192.168.1.52. For the sake of discussion we will refer to this network as the 'internal' network because it connects to the internet through a NAT'd firewall. We will call the network on the public (internet) side of the NAT'd firewall the 'external' network. Also, for the sake of discussion we will call my bacula server:

    server.int.mydomain.tld

when a fully qualified domain name is required, or simply:

    server

if a hostname is adequate. We will call the various bacula daemons running on the server.int.mydomain.tld machine:

    server-fd
    server-sd
    server-dir

In addition, I have two clients that I want to back up with Bacula. The first client is on the internal network. Its fully qualified domain name is:

    private1.int.mydomain.tld

And its hostname is:

    private1

This machine is a client and therefore runs just one bacula daemon:

    private1-fd

The second client is on the external network. Its fully qualified domain name is:

    public1.mydomain.tld

And its hostname is:

    public1

This machine also runs just one bacula daemon:

    public1-fd

Finally, I have a NAT firewall/gateway with two network interfaces. The first interface is on the internal network and serves as a gateway to the internet for all the machines attached to the internal network (For example, server.int.mydomain.tld and private1.int.mydomain.tld). The second interface is on the external (internet) network. The external interface has been assigned the name:

    firewall.mydomain.tld

Remember:

    *.int.mydomain.tld = internal network
        *.mydomain.tld = external network

The Bacula Configuration Files for the Above

server-sd manages a 4 tape AIT autoloader. All of my backups are written to server-sd. I have just *one* Device resource in my server-sd.conf file:

Device {
  Name = "autochanger1";
  Media Type = AIT-1;
  Archive Device = /dev/nrsa1;
  Changer Device = /dev/ch0;
  Changer Command = "/usr/local/sbin/chio-bacula %c %o %S %a";
  Label Media = yes;
  AutoChanger = yes;
  AutomaticMount = yes;               # when device opened, read it
  AlwaysOpen = yes;
    Hardware End of Medium = No
    Fast Forward Space File = No
    BSF at EOM = yes
}

(note, please see the Tape Testing chapter of this manual for important FreeBSD information.) However, I have *two* Storage resources in my server-dir.conf file:

Storage {
  Name = "autochanger1-int"    # Storage device for backing up
  Address = server.int.mydomain.tld
  SDPort = 9103
  Password = "mysecretpassword"
  Device = "autochanger1"
  Media Type = AIT-1
  Autochanger = yes
}
Storage {
  Name = "autochanger1-ext"    # Storage device for backing up
  Address = firewall.mydomain.tld
  SDPort = 9103
  Password = "mysecretpassword"
  Device = "autochanger1"
  Media Type = AIT-1
  Autochanger = yes
}

Note that BOTH of the above server-dir.conf Storage resources use the same 'autochanger1' Device resource from server-sd.conf.

My backup jobs run consecutively, one after the other, so only one of the above Storage resources is being used by Bacula file daemons at any given time. I don't know if this would cause problems at a site that runs more than one backup in parallel to a single tape device.

In addition to the above, I have two Client resources defined in server-dir.conf:

Client {
  Name = private1-fd
  Address = private1.int.mydomain.tld
  FDPort = 9102
  Catalog = MyCatalog
  Password = "mysecretpassword"       # password for FileDaemon
}
Client {
  Name = public1-fd
  Address = public1.mydomain.tld
  FDPort = 9102
  Catalog = MyCatalog
  Password = "mysecretpassword"       # password for FileDaemon
}

And finally, to tie it all together, I have two Job resources defined in server-dir.conf:

Job {
  Name = "Private1-Backup"
  Type = Backup
  Client = private1-fd
  FileSet = "Private1"
  Schedule = "WeeklyCycle"
  Storage = "autochanger1-int"
  Messages = Standard
  Pool = "Weekly"
  Write Bootstrap = "/var/db/bacula/Private1-Backup.bsr"
  Priority = 12
}
Job {
  Name = "Public1-Backup"
  Type = Backup
  Client = public1-fd
  FileSet = "Public1"
  Schedule = "WeeklyCycle"
  Storage = "autochanger1-ext"
  Messages = Standard
  Pool = "Weekly"
  Write Bootstrap = "/var/db/bacula/Public1-Backup.bsr"
  Priority = 13
}

It is important to notice that because the 'Private1-Backup' Job is intended to back up a machine on the internal network it uses the 'autochanger1-int' Storage resource. On the other hand, the 'Public1-Backup' Job is intended to back up a machine on the external network, so it uses the 'autochanger1-ext' Storage resource.

I have left the Pool, Catalog, Messages, FileSet, Schedule, and Director resources out of the above server-dir.conf examples because they are not pertinent to the discussion.

How Does It Work?

If I want to run a backup of private1.int.mydomain.tld and store that backup using server-sd then my understanding of the order of events is this:

  1. I execute my Bacula 'console' command on server.int.mydomain.tld.
  2. console connects to server-dir.
  3. I tell console to 'run' backup Job 'Private1-Backup'.
  4. console relays this command to server-dir.
  5. server-dir connects to private1-fd at private1.int.mydomain.tld:9102
  6. server-dir tells private1-fd to start sending the files defined in the 'Private1-Backup' Job's FileSet resource to the Storage resource 'autochanger1-int', which we have defined in server-dir.conf as having the address:port of server.int.mydomain.tld:9103.
  7. private1-fd connects to server.int.mydomain.tld:9103 and begins sending files.

Alternatively, if I want to run a backup of public1.mydomain.tld and store that backup using server-sd then my understanding of the order of events is this:

  1. I execute my Bacula 'console' command on server.int.mydomain.tld.
  2. console connects to server-dir.
  3. I tell console to 'run' backup Job 'Public1-Backup'.
  4. console relays this command to server-dir.
  5. server-dir connects, through the NAT'd firewall, to public1-fd at public1.mydomain.tld:9102
  6. server-dir tells public1-fd to start sending the files defined in the 'Public1-Backup' Job's FileSet resource to the Storage resource 'autochanger1-ext', which we have defined in server-dir.conf as having the address:port of firewall.mydomain.tld:9103.
  7. public1-fd connects to firewall.mydomain.tld:9103 and begins sending files.

Important Note

In order for the above 'Public1-Backup' Job to succeed, firewall.mydomain.tld:9103 MUST be forwarded using the firewall's configuration software to server.int.mydomain.tld:9103. Some firewalls call this 'Server Publication'. Others may call it 'Port Forwarding'.

Firewall Problems

Either a firewall or a router may decide to timeout and terminate open connections if they are not active for a short time. By Internet standards the period should be two hours, and should be indefinitely extended if KEEPALIVE is set as is the case by Bacula. If your firewall or router does not respect these rules, you may find Bacula connections terminated. In that case, the first thing to try is turning on the Heart Beat Interval both in the File daemon and the Storage daemon and set an interval of say five minutes.

Also, if you have denial of service rate limiting in your firewall, this too can cause Bacula disconnects since Bacula can at times use very high access rates. To avoid this, you should implement default accept rules for the Bacula ports involved before the rate limiting rules.

Finally, if you have a Windows machine, it will most likely by default disallow connections to the Bacula Windows File daemon. See the Windows chapter of this manual for additional details.


Using Bacula to Improve Computer Security

Since Bacula maintains a catalog of files, their attributes, and either SHA1 or MD5 signatures, it can be an ideal tool for improving computer security. This is done by making a snapshot of your system files with a Verify Job and then checking the current state of your system against the snapshot, on a regular basis (e.g. nightly).

The first step is to set up a Verify Job and to run it with:

Level = InitCatalog

The InitCatalog level tells Bacula simply to get the information on the specified files and to put it into the catalog. That is your database is initialized and no comparison is done. The InitCatalog is normally run one time manually.

Thereafter, you will run a Verify Job on a daily (or whatever) basis with:

Level = Catalog

The Level = Catalog level tells Bacula to compare the current state of the files on the Client to the last InitCatalog that is stored in the catalog and to report any differences. See the example below for the format of the output.

You decide what files you want to form your "snapshot" by specifying them in a FileSet resource, and normally, they will be system files that do not change, or that only certain features change.

Then you decide what attributes of each file you want compared by specifying comparison options on the Include statements that you use in the FileSet resource of your Catalog Jobs.

The Details

In the discussion that follows, we will make reference to the Verify Configuration Example that is included below in the A Verify Configuration Example section. You might want to look it over now to get an idea of what it does.

The main elements consist of adding a schedule, which will normally be run daily, or perhaps more often. This is provided by the VerifyCycle Schedule, which runs at 5:05 in the morning every day.

Then you must define a Job, much as is done below. We recommend that the Job name contain the name of your machine as well as the word Verify or Check. In our example, we named it MatouVerify. This will permit you to easily identify your job when running it from the Console.

You will notice that most records of the Job are quite standard, but that the FileSet resource contains verify=pins1 option in addition to the standard signature=SHA1 option. If you don't want SHA1 signature comparison, and we cannot imagine why not, you can drop the signature=SHA1 and none will be computed nor stored in the catalog. Or alternatively, you can use verify=pins5 and signature=MD5, which will use the MD5 hash algorithm. The MD5 hash computes faster than SHA1, but is cryptographically less secure.

The verify=pins1 is ignored during the InitCatalog Job, but is used during the subsequent Catalog Jobs to specify what attributes of the files should be compared to those found in the catalog. pins1 is a reasonable set to begin with, but you may want to look at the details of these and other options. They can be found in the FileSet Resource section of this manual. Briefly, however, the p of the pins1 tells Verify to compare the permissions bits, the i is to compare inodes, the n causes comparison of the number of links, the s compares the file size, and the 1 compares the SHA1 checksums (this requires the signature=SHA1 option to have been set also).

You must also specify the Client and the Catalog resources for your Verify job, but you probably already have them created for your client and do not need to recreate them, they are included in the example below for completeness.

As mentioned above, you will need to have a FileSet resource for the Verify job, which will have the additional verify=pins1 option. You will want to take some care in defining the list of files to be included in your FileSet. Basically, you will want to include all system (or other) files that should not change on your system. If you select files, such as log files or mail files, which are constantly changing, your automatic Verify job will be constantly finding differences. The objective in forming the FileSet is to choose all unchanging important system files. Then if any of those files has changed, you will be notified, and you can determine if it changed because you loaded a new package, or because someone has broken into your computer and modified your files. The example below shows a list of files that I use on my Red Hat 7.3 system. Since I didn't spend a lot of time working on it, it probably is missing a few important files (if you find one, please send it to me). On the other hand, as long as I don't load any new packages, none of these files change during normal operation of the system.

Running the Verify

The first thing you will want to do is to run an InitCatalog level Verify Job. This will initialize the catalog to contain the file information that will later be used as a basis for comparisons with the actual file system, thus allowing you to detect any changes (and possible intrusions into your system).

The easiest way to run the InitCatalog is manually with the console program by simply entering run. You will be presented with a list of Jobs that can be run, and you will choose the one that corresponds to your Verify Job, MatouVerify in this example.

The defined Job resources are:
     1: MatouVerify
     2: kernsrestore
     3: Filetest
     4: kernsave
Select Job resource (1-4): 1

Next, the console program will show you the basic parameters of the Job and ask you:

Run Verify job
JobName:  MatouVerify
FileSet:  Verify Set
Level:    Catalog
Client:   MatouVerify
Storage:  DLTDrive
OK to run? (yes/mod/no): mod

Here, you want to respond mod to modify the parameters because the Level is by default set to Catalog and we want to run an InitCatalog Job. After responding mod, the console will ask:

Parameters to modify:
     1: Job
     2: Level
     3: FileSet
     4: Client
     5: Storage
Select parameter to modify (1-5): 2

you should select number 2 to modify the Level, and it will display:

Levels:
     1: Initialize Catalog
     2: Verify from Catalog
     3: Verify Volume
     4: Verify Volume Data
Select level (1-4): 1

Choose item 1, and you will see the final display:

Run Verify job
JobName:  MatouVerify
FileSet:  Verify Set
Level:    Initcatalog
Client:   MatouVerify
Storage:  DLTDrive
OK to run? (yes/mod/no): yes

at which point you respond yes, and the Job will begin.

Thereafter the Job will automatically start according to the schedule you have defined. If you wish to immediately verify it, you can simply run a Verify Catalog which will be the default. No differences should be found.

What To Do When Differences Are Found

If you have setup your messages correctly, you should be notified if there are any differences and exactly what they are. For example, below is the email received after doing an update of OpenSSH:

HeadMan: Start Verify JobId 83 Job=RufusVerify.2002-06-25.21:41:05
HeadMan: Verifying against Init JobId 70 run 2002-06-21 18:58:51
HeadMan: File: /etc/pam.d/sshd
HeadMan:       st_ino   differ. Cat: 4674b File: 46765
HeadMan: File: /etc/rc.d/init.d/sshd
HeadMan:       st_ino   differ. Cat: 56230 File: 56231
HeadMan: File: /etc/ssh/ssh_config
HeadMan:       st_ino   differ. Cat: 81317 File: 8131b
HeadMan:       st_size  differ. Cat: 1202 File: 1297
HeadMan:       SHA1 differs.
HeadMan: File: /etc/ssh/sshd_config
HeadMan:       st_ino   differ. Cat: 81398 File: 81325
HeadMan:       st_size  differ. Cat: 1182 File: 1579
HeadMan:       SHA1 differs.
HeadMan: File: /etc/ssh/ssh_config.rpmnew
HeadMan:       st_ino   differ. Cat: 812dd File: 812b3
HeadMan:       st_size  differ. Cat: 1167 File: 1114
HeadMan:       SHA1 differs.
HeadMan: File: /etc/ssh/sshd_config.rpmnew
HeadMan:       st_ino   differ. Cat: 81397 File: 812dd
HeadMan:       st_size  differ. Cat: 2528 File: 2407
HeadMan:       SHA1 differs.
HeadMan: File: /etc/ssh/moduli
HeadMan:       st_ino   differ. Cat: 812b3 File: 812ab
HeadMan: File: /usr/bin/scp
HeadMan:       st_ino   differ. Cat: 5e07e File: 5e343
HeadMan:       st_size  differ. Cat: 26728 File: 26952
HeadMan:       SHA1 differs.
HeadMan: File: /usr/bin/ssh-keygen
HeadMan:       st_ino   differ. Cat: 5df1d File: 5e07e
HeadMan:       st_size  differ. Cat: 80488 File: 84648
HeadMan:       SHA1 differs.
HeadMan: File: /usr/bin/sftp
HeadMan:       st_ino   differ. Cat: 5e2e8 File: 5df1d
HeadMan:       st_size  differ. Cat: 46952 File: 46984
HeadMan:       SHA1 differs.
HeadMan: File: /usr/bin/slogin
HeadMan:       st_ino   differ. Cat: 5e359 File: 5e2e8
HeadMan: File: /usr/bin/ssh
HeadMan:       st_mode  differ. Cat: 89ed File: 81ed
HeadMan:       st_ino   differ. Cat: 5e35a File: 5e359
HeadMan:       st_size  differ. Cat: 219932 File: 234440
HeadMan:       SHA1 differs.
HeadMan: File: /usr/bin/ssh-add
HeadMan:       st_ino   differ. Cat: 5e35b File: 5e35a
HeadMan:       st_size  differ. Cat: 76328 File: 81448
HeadMan:       SHA1 differs.
HeadMan: File: /usr/bin/ssh-agent
HeadMan:       st_ino   differ. Cat: 5e35c File: 5e35b
HeadMan:       st_size  differ. Cat: 43208 File: 47368
HeadMan:       SHA1 differs.
HeadMan: File: /usr/bin/ssh-keyscan
HeadMan:       st_ino   differ. Cat: 5e35d File: 5e96a
HeadMan:       st_size  differ. Cat: 139272 File: 151560
HeadMan:       SHA1 differs.
HeadMan: 25-Jun-2002 21:41
JobId:                  83
Job:                    RufusVerify.2002-06-25.21:41:05
FileSet:                Verify Set
Verify Level:           Catalog
Client:                 RufusVerify
Start time:             25-Jun-2002 21:41
End time:               25-Jun-2002 21:41
Files Examined:         4,258
Termination:            Verify Differences

At this point, it was obvious that these files were modified during installation of the RPMs. If you want to be super safe, you should run a Verify Level=Catalog immediately before installing new software to verify that there are no differences, then run a Verify Level=InitCatalog immediately after the installation.

To keep the above email from being sent every night when the Verify Job runs, we simply re-run the Verify Job setting the level to InitCatalog (as we did above in the very beginning). This will re-establish the current state of the system as your new basis for future comparisons. Take care that you don't do an InitCatalog after someone has placed a Trojan horse on your system!

If you have included in your FileSet a file that is changed by the normal operation of your system, you will get false matches, and you will need to modify the FileSet to exclude that file (or not to Include it), and then re-run the InitCatalog.

The FileSet that is shown below is what I use on my Red Hat 7.3 system. With a bit more thought, you can probably add quite a number of additional files that should be monitored.

A Verify Configuration Example

Schedule {
  Name = "VerifyCycle"
  Run = Level=Catalog sun-sat at 5:05
}
Job {
  Name = "MatouVerify"
  Type = Verify
  Level = Catalog                     # default level
  Client = MatouVerify
  FileSet = "Verify Set"
  Messages = Standard
  Storage = DLTDrive
  Pool = Default
  Schedule = "VerifyCycle"
}
#
# The list of files in this FileSet should be carefully
# chosen. This is a good starting point.
#
FileSet {
  Name = "Verify Set"
  Include {
    Options {
      verify=pins1
      signature=SHA1
    }
    File = /boot
    File = /bin
    File = /sbin
    File = /usr/bin
    File = /lib
    File = /root/.ssh
    File = /home/kern/.ssh
    File = /var/named
    File = /etc/sysconfig
    File = /etc/ssh
    File = /etc/security
    File = /etc/exports
    File = /etc/rc.d/init.d
    File = /etc/sendmail.cf
    File = /etc/sysctl.conf
    File = /etc/services
    File = /etc/xinetd.d
    File = /etc/hosts.allow
    File = /etc/hosts.deny
    File = /etc/hosts
    File = /etc/modules.conf
    File = /etc/named.conf
    File = /etc/pam.d
    File = /etc/resolv.conf
  }
  Exclude = { }
P
Client {
  Name = MatouVerify
  Address = lmatou
  Catalog = Bacula
  Password = ""
  File Retention = 80d                # 80 days
  Job Retention = 1y                  # one year
  AutoPrune = yes                     # Prune expired Jobs/Files
}
Catalog {
  Name = Bacula
  dbname = verify; user = bacula; password = ""
}


Bacula RPM Packaging FAQ

  1. How do I build Bacula for platform xxx?
  2. How do I control which database support gets built?

  3. What other defines are used?
  4. I'm getting errors about not having permission when I try to build the packages. Do I need to be root?
  5. I'm building my own rpms but on all platforms and compiles I get an unresolved dependency for something called /usr/afsws/bin/pagsh.
  6. I'm building my own rpms because you don't publish for my platform. Can I get my packages released to sourceforge for other people to use?
  7. Is there an easier way than sorting out all these command line options?
  8. I just upgraded from 1.36.x to 1.38.x and now my director daemon won't start. It appears to start but dies silently and I get a "connection refused" error when starting the console. What is wrong?
  9. There are a lot of rpm packages. Which packages do I need for what?

Answers

  1. How do I build Bacula for platform xxx? The bacula spec file contains defines to build for several platforms: Red Hat 7.x (rh7), Red Hat 8.0 (rh8), Red Hat 9 (rh9), Fedora Core (fc1, fc3, fc4, fc5, fc6, fc7), Whitebox Enterprise Linux 3.0 (wb3), Red Hat Enterprise Linux (rhel3, rhel4), Mandrake 10.x (mdk), Mandriva 2006.x (mdv) CentOS (centos3, centos4) Scientific Linux (sl3, sl4) and SuSE (su9, su10, su102). The package build is controlled by a mandatory define set at the beginning of the file. These defines basically just control the dependency information that gets coded into the finished rpm package as well as any special configure options required. The platform define may be edited in the spec file directly (by default all defines are set to 0 or "not set"). For example, to build the Red Hat 7.x package find the line in the spec file which reads

            %define rh7 0
            

    and edit it to read

            %define rh7 1
            

    Alternately you may pass the define on the command line when calling rpmbuild:

            rpmbuild -ba --define "build_rh7 1" bacula.spec
            rpmbuild --rebuild --define build_rh7 1" bacula-x.x.x-x.src.rpm
    

  2. How do I control which database support gets built? Another mandatory build define controls which database support is compiled, one of build_sqlite, build_mysql or build_postgresql. To get the MySQL package and support either set the

            %define mysql 0
            OR
            %define mysql4 0
            OR
            %define mysql5 0
            

    to

            %define mysql 1
            OR
            %define mysql4 1
            OR
            %define mysql5 1
            

    in the spec file directly or pass it to rpmbuild on the command line:

            rpmbuild -ba --define "build_rh7 1" --define "build_mysql 1" bacula.spec
            rpmbuild -ba --define "build_rh7 1" --define "build_mysql4 1" bacula.spec
            rpmbuild -ba --define "build_rh7 1" --define "build_mysql5 1" bacula.spec
    

  3. What other defines are used? Three other building defines of note are the depkgs_version, docs_version and _rescuever identifiers. These two defines are set with each release and must match the version of those sources that are being used to build the packages. You would not ordinarily need to edit these. See also the Build Options section below for other build time options that can be passed on the command line.
  4. I'm getting errors about not having permission when I try to build the packages. Do I need to be root? No, you do not need to be root and, in fact, it is better practice to build rpm packages as a non-root user. Bacula packages are designed to be built by a regular user but you must make a few changes on your system to do this. If you are building on your own system then the simplest method is to add write permissions for all to the build directory (/usr/src/redhat/, /usr/src/RPM or /usr/src/packages). To accomplish this, execute the following command as root:

            chmod -R 777 /usr/src/redhat
            chmod -R 777 /usr/src/RPM
            chmod -R 777 /usr/src/packages
    

    If you are working on a shared system where you can not use the method above then you need to recreate the appropriate above directory tree with all of its subdirectories inside your home directory. Then create a file named

    .rpmmacros

    in your home directory (or edit the file if it already exists) and add the following line:

            %_topdir /home/myuser/redhat
            

    Another handy directive for the .rpmmacros file if you wish to suppress the creation of debug rpm packages is:

            %debug_package %{nil}
            

  5. I'm building my own rpms but on all platforms and compiles I get an unresolved dependency for something called /usr/afsws/bin/pagsh. This is a shell from the OpenAFS (Andrew File System). If you are seeing this then you chose to include the docs/examples directory in your package. One of the example scripts in this directory is a pagsh script. Rpmbuild, when scanning for dependencies, looks at the shebang line of all packaged scripts in addition to checking shared libraries. To avoid this do not package the examples directory. If you are seeing this problem you are building a very old bacula package as the examples have been removed from the doc packaging.

  6. I'm building my own rpms because you don't publish for my platform. Can I get my packages released to sourceforge for other people to use? Yes, contributions from users are accepted and appreciated. Please examine the directory platforms/contrib-rpm in the source code for further information.

  7. Is there an easier way than sorting out all these command line options? Yes, there is a gui wizard shell script which you can use to rebuild the src rpm package. Look in the source archive for platforms/contrib-rpm/rpm_wizard.sh. This script will allow you to specify build options using GNOME dialog screens. It requires zenity.

  8. I just upgraded from 1.36.x to 1.38.x and now my director daemon won't start. It appears to start but dies silently and I get a "connection refused" error when starting the console. What is wrong? Beginning with 1.38 the rpm packages are configured to run the director and storage daemons as a non-root user. The file daemon runs as user root and group bacula, the storage daemon as user bacula and group disk, and the director as user bacula and group bacula. If you are upgrading you will need to change some file permissions for things to work. Execute the following commands as root:

            chown bacula.bacula /var/bacula/*
            chown root.bacula /var/bacula/bacula-fd.9102.state
            chown bacula.disk /var/bacula/bacula-sd.9103.state
    

    Further, if you are using File storage volumes rather than tapes those files will also need to have ownership set to user bacula and group bacula.

  9. There are a lot of rpm packages. Which packages do I need for what? For a bacula server you need to select the packsge based upon your preferred catalog database: one of bacula-mysql, bacula-postgresql or bacula-sqlite. If your system does not provide an mtx package you also need bacula-mtx to satisfy that dependancy. For a client machine you need only install bacula-client. Optionally, for either server or client machines, you may install a graphical console bacula-gconsole and/or bacula-wxconsole. The Bacula Administration Tool is installed with the bacula-bat package. One last package, bacula-updatedb is required only when upgrading a server more than one database revision level.

  10. Support for RHEL3/4, CentOS 3/4 and x86_64 The examples below show explicit build support for RHEL4 and CentOS 4. Build support for x86_64 has also been added. Test builds have been done on CentOS but not RHEL4.

Build with one of these 3 commands:

rpmbuild --rebuild \
        --define "build_rhel4 1" \
        --define "build_sqlite 1" \
        bacula-1.38.3-1.src.rpm

rpmbuild --rebuild \
        --define "build_rhel4 1" \
        --define "build_postgresql 1" \
        bacula-1.38.3-1.src.rpm

rpmbuild --rebuild \
        --define "build_rhel4 1" \
        --define "build_mysql4 1" \
        bacula-1.38.3-1.src.rpm

For CentOS substitute '--define "build_centos4 1"' in place of rhel4.

For 64 bit support add '--define "build_x86_64 1"'

Build Options

The spec file currently supports building on the following platforms:
Red Hat builds
--define "build_rh7 1"
--define "build_rh8 1"
--define "build_rh9 1"

Fedora Core build
--define "build_fc1 1"
--define "build_fc3 1"
--define "build_fc4 1"
--define "build_fc5 1"
--define "build_fc6 1"
--define "build_fc7 1"

Whitebox Enterprise build
--define "build_wb3 1"

Red Hat Enterprise builds
--define "build_rhel3 1"
--define "build_rhel4 1"

CentOS build
--define "build_centos3 1"
--define "build_centos4 1"

Scientific Linux build
--define "build_sl3 1"
--define "build_sl4 1"

SuSE build
--define "build_su9 1"
--define "build_su10 1"
--define "build_su102 1"

Mandrake 10.x build
--define "build_mdk 1"

Mandriva build
--define "build_mdv 1"

MySQL support:
for mysql 3.23.x support define this
--define "build_mysql 1"
if using mysql 4.x define this,
currently: Mandrake 10.x, Mandriva 2006.0, SuSE 9.x & 10.0, FC4 & RHEL4
--define "build_mysql4 1"
if using mysql 5.x define this,
currently: SuSE 10.1 & FC5
--define "build_mysql5 1"

PostgreSQL support:
--define "build_postgresql 1"

Sqlite support:
--define "build_sqlite 1"

Build the client rpm only in place of one of the above database full builds:
--define "build_client_only 1"

X86-64 support:
--define "build_x86_64 1"

Supress build of bgnome-console:
--define "nobuild_gconsole 1"

Build the WXWindows console:
requires wxGTK >= 2.6
--define "build_wxconsole 1"

Build the Bacula Administration Tool:
requires QT >= 4
--define "build_bat 1"

Build python scripting support:
--define "build_python 1"

Modify the Packager tag for third party packages:
--define "contrib_packager Your Name <youremail@site.org>"

RPM Install Problems

In general the RPMs, once properly built should install correctly. However, when attempting to run the daemons, a number of problems can occur:
Wrong /var/bacula Permissions
By default, the Director and Storage daemon do not run with root permission. If the /var/bacula is owned by root, then it is possible that the Director and the Storage daemon will not be able to access this directory, which is used as the Working Directory. To fix this, the easiest thing to do is:
  chown bacula:bacula /var/bacula
Note: as of 1.38.8 /var/bacula is installed root:bacula with permissions 770.
The Storage daemon cannot Access the Tape drive
This can happen in some older RPM releases where the Storage daemon ran under userid bacula, group bacula. There are two ways of fixing this: the best is to modify the /etc/init.d/bacula-sd file so that it starts the Storage daemon with group "disk". The second way to fix the problem is to change the permissions of your tape drive (usually /dev/nst0) so that Bacula can access it. You will probably need to change the permissions of the SCSI control device as well, which is usually /dev/sg0. The exact names depend on your configuration, please see the Tape Testing chapter for more information on devices.


Die Bootstrap-Datei

Die Informationen in diesem Kapitel sollen Ihnen helfen, entweder eigene Bootstrap-Dateien zu erstellen, oder die von Bacula erzeugten zu editieren. Da die Bootstrap-Datei automatisch beim ausführen des restore Console-Kommandos, oder wenn Sie Write Bootstrap in den Job-Einträgen der Director-Dienst-Konfiguration angeben, erzeugt wird, brauchen Sie das genaue Format eigentlich nicht wissen.

Die Bootstrap-Datei enthält Informationen im ASCII-Format, die präzise angeben, welche Dateien wiederhergestellt werden sollen, auf welchem Volume sie liegen und wo auf dem Volume. Es ist ein relativ kompaktes Format diese Informationen anzugeben, aber es ist lesbar für Menschen und kann mit einem Texteditor geändert werden.

Bootstrap-Datei Format

Das generelle Format der Bootstrap-Datei ist:

<Schlüsselwort> = <Wert>

Wobei jedes Schlüsselwort und sein Wert angeben, welche Dateien wiederhergestellt werden. Genauer gesagt, das Schlüsselwort und sein Wert dienen dazu, zu limitieren welche Dateien wiederhergestellt werden, sie verhalten sich wie ein Filter. Das Fehlen eines Schlüsselwort bedeutet, dass alle Dateien angenommen werden.

In der Bootstrap-Datei werden Leerzeilen und Zeilen beginnent mit # ignoriert.

Es existieren Schlüsselwörter, die die Filterung nach Volume, Client, Job, Fileindex, Session ID, Session Time usw. erlauben.

Je mehr Schlüsselwörter Sie angeben, desto genauer ist die Auswahl der Dateien, die wiederhergestellt werden. Alle Schlüsselwörter werden über UND verknüpft.

Ein Beispiel:

Volume = Test-001
VolSessionId = 1
VolSessionTime = 108927638

veranlasst den Storage-Dienst (oder das bextract Programm), nur die Dateien wiederherzustellen, die auf dem Volume Test-001 vorhanden sind UND eine VolumeSessionID mit 1 haben UND deren VolumeSessionTime gleich 108927638 ist.

Hier ist eine Liste aller erlaubten Schlüsselwörter in der Reihenfolge in der sie auf die auf dem Volume befindlichen Daten angewendet werden:

Volume
Dieser Wert gibt an, auf welches Volume die folgenden Schlüsselwörter angewendet werden sollen. Falls in der Bootstrap-Datei ein zweites Volume angegeben wird, beziehen sich die darauf folgenden Schlüsselwörter auf dieses Volume. Wenn der Name des Volumes Leerzeichen enthält, muss er in Anführungszeichen gesetzt werden. Mindestens ein Volume muss angegeben werden.

Count
Dieser Wert ist die Gesamtanzahl der Dateien, die von dem Volume gelesen werden sollen. Daran erkennt der Storage-Dienst, wann er das Lesen beenden soll. Dieser Wert ist optional.

VolFile
Dieser Wert gibt eine Dateinummer oder eine Liste bzw. einen Bereich von Dateinummern an, die auf dem aktuellen Volume gefunden werden soll. Die Dateinummer stellt die physikalische Datei auf dem Volume da, wo die Daten gespeichert sind. Bei einem Tape wird dieser Wert benutzt, um das Band richtig zu positionieren und wenn das Laufwerk die letzte angegebene Datei gelesen hat, wird der Lesevorgang gestoppt.

VolBlock
Dieser Wert gibt eine Blocknummer oder eine Liste bzw. einen Bereich von Blocknummern an, die auf dem aktuellen Volume gefunden werden soll. Die Blocknummer stellt die physikalischen Blöcke auf dem Volume da, wo die Daten gespeichert sind.

VolSessionTime
Dieser Wert gibt die Volume-Session-Zeit an, die auf dem aktuellen Volume gefunden werden soll.

VolSessionId
Dieser Wert gibt eine Volume-Session-ID oder eine Liste bzw. einen Bereich von Volume-Sesion-IDs an, die auf dem aktuellen Volume gefunden werden soll. Jedes Paar aus Volume-Session-ID und Volume-Session-Zeit, stimmt mit einem einzelnen Job überein, der auf dem Volume gespeichert ist.

JobId
Dieser Wert gibt eine Job-ID oder eine Liste bzw. einen Bereich von Job-Ids an, die auf dem aktuellen Volume gefunden werden soll. Beachten Sie bitte, dass die Job-ID eventuell nicht eindeutig ist, falls Sie mehrere Director-Dienste haben, oder falls Sie Ihre Datenbank neu initialisiert haben sollten. Der Job-ID-Filter funktioniert nicht, wenn Sie mehrere Jobs gleichzeitig haben laufen lassen. Dieser Wert ist optional und wird von Bacula nicht zum zurücksichern benötigt.

Job
Dieser Wert gibt einen Job-Namen oder eine Liste von Job-Namen an, die auf dem aktuellen Volume gefunden werden sollen. Der Job-Name stimmt mit einem einzigartigen Paar aus Volume-Session-Zeit und VolumeSessionID überein, allerdings ist er für Menschen ein bischen leichter zu lesen. Gewöhnliche reguläre Ausdrücke können benutzt werden, um einen entsprechenden Job-Namen zu finden. Der Job-Name-Filter funktioniert nicht, wenn Sie mehrere Jobs gleichzeitig haben laufen lassen. Dieser Wert ist optional und wird von Bacula nicht zum zurücksichern benötigt.

Client
Dieser Wert gibt einen Client-Namen oder eine Liste von Client-Namen an, dia auf dem aktuellen Volume gefunden werden soll. Gewöhnliche reguläre Ausdrücke können benutzt werden, um einen entsprechenden Job-Namen zu finden. Der Client-Filter funktioniert nicht, wenn Sie mehrere Jobs gleichzeitig haben laufen lassen. Dieser Wert ist optional und wird von Bacula nicht zum zurücksichern benötigt.

FileIndex
Dieser Wert gibt einen File-Index oder eine Liste bzw. einen Bereich von File-Indexen an, die auf dem aktuellen Volume gefunden werden soll. Jedes File (Datei) das auf einem Volume gespeichert ist, hat für seine Session einen einzigartigen File-Index. Bei jeder Session wird für das erste gespeicherte File der File-Index auf eins gesetzt und dann mit jedem weiteren File um eins erhöht.

Für ein beliebiges Volume bedeutet das, dass die drei Werte von Volume-Session-ID, Volume-Session-Time und File-Index zusammen eine einzelne einzigartige Datei auf einem Volume angeben. Diese Datei ist eventuell mehrfach auf dem Volume vorhanden, aber für jedes Vorkommen gibt es eine einzigartige Kombination dieser drei Werte. Diese drei Werte sind für jede Datei in der Katalog-Datenbank gespeichert.

Um eine Datei wiederherzustellen, ist die Angabe eines Wertes (oder einer Liste von File-Indexen) erforderlich.

Slot
Dieser Wert gibt den Autochanger-Slot an. Für jedes Volume darf nur ein Slot angegeben werden.

Stream
Dieser Wert gibt einen Stream (Strom) oder eine Liste bzw. einen Bereich von Streams an. Solange Sie nicht wirklich wissen, was Sie tun, (wenn Sie das interne Arbeiten von Bacula kennen), sollten Sie auf diese Angabe verzichten. Dieser Wert ist optional und wird von Bacula nicht zum zurücksichern benötigt.

*JobType
Noch nicht implementiert.

*JobLevel
Noch nicht implementiert.

Bei der Angabe des Volume ist zu bedenken, dass dies der erste Parameter sein muss. Alle anderen Parameter können in beliebiger Reihenfolge und Anzahl hinter einem Volume-Eintrag angegeben werden.

Mehrere Volume-Einträge können in der selben Bootstrap-Datei vorkommen, aber mit jedem Vorkommen beginnt ein neuer Satz an Filter, gültig für das abgegebene Volume.

Beim verarbeiten der Bootstrap-Datei werden alle Schlüsselwörter unterhalb eines Volume-Eintrags mit UND verknüpft. Also wird:

Volume = Test-01
Client = "My machine"
FileIndex = 1

auf alle Dateien auf dem Volume Test-01 UND von Client My machine UND mit dem Fileindex 1 passen.

Mehrfach angegebene Schlüsselwörter werden mit ODER verknüpft. Also wird:

Volume = Test-01
Client = "My machine"
Client = "Backup machine"
FileIndex = 1

auf alle Dateien auf dem Volume Test-01 UND von Client My machine ODER vom Client Backup machine UND mit dem Fileindex 1 passen.

Für Zahlenwerte können Sie einen Bereich oder eine Liste angeben, für alle anderen Parameter, bis auf Volumes, nur eine Liste. Eine Liste ist gleichbedeutend mit mehrfachen Angaben eines Parameters. Ein Beispiel

Volume = Test-01
Client = "My machine", "Backup machine"
FileIndex = 1-20, 35

passt auf alle Dateien auf dem Volume Test-01 UND von Client My machine ODER vom Client Backup machine UND mit dem Fileindex 1 ODER 2 ODER 3 ... ODER 20 ODER 35.

Wie oben erwähnt, können mehrere Volume-Einträge in der selben Bootstrap-Datei stehen. Jedes Vorkommen eines Volume-Eintrags beginnt einen neuen Satz an Filterregeln der auf dem angegebenen Volume angewendet wird und mit weiteren Volume-Einträgen über ODER verknüpft wird.

Als ein Beispiel nehmen wir an, dass wir, mit dem Console-Kommando query , nach dem Satz Volumes fragen, die benötigt werden, um alle Dateien des Clients Rufus wiederherstellen zu können:

Using default Catalog name=MySQL DB=bacula
*query
Available queries:
     1: List Job totals:
     2: List where a file is saved:
     3: List where the most recent copies of a file are saved:
     4: List total files/bytes by Job:
     5: List total files/bytes by Volume:
     6: List last 10 Full Backups for a Client:
     7: List Volumes used by selected JobId:
     8: List Volumes to Restore All Files:
Choose a query (1-8): 8
Enter Client Name: Rufus
+-------+------------------+------------+-----------+----------+------------+
| JobId | StartTime        | VolumeName | StartFile | VolSesId | VolSesTime |
+-------+------------------+------------+-----------+----------+------------+
| 154   | 2002-05-30 12:08 | test-02    | 0         | 1        | 1022753312 |
| 202   | 2002-06-15 10:16 | test-02    | 0         | 2        | 1024128917 |
| 203   | 2002-06-15 11:12 | test-02    | 3         | 1        | 1024132350 |
| 204   | 2002-06-18 08:11 | test-02    | 4         | 1        | 1024380678 |
+-------+------------------+------------+-----------+----------+------------+

Die Ausgabe zeigt uns, dass wir vier Jobs wiederherstellen müssen. Der erste ist eine vollständige Sicherung, und die drei folgenden sind inkrementelle Sicherungen.

Die folgende Bootstrap-Datei wird benötigt um alle Dateien wiederherzustellen:

Volume=test-02
VolSessionId=1
VolSessionTime=1022753312
Volume=test-02
VolSessionId=2
VolSessionTime=1024128917
Volume=test-02
VolSessionId=1
VolSessionTime=1024132350
Volume=test-02
VolSessionId=1
VolSessionTime=1024380678

Als letztes Beispiel nehmen wir an, dass die erste vollständige Sicherung sich über zwei verschiedene Volumes erstreckt. Die Ausgabe des Console-Kommandos query sieht eventuell so aus:

+-------+------------------+------------+-----------+----------+------------+
| JobId | StartTime        | VolumeName | StartFile | VolSesId | VolSesTime |
+-------+------------------+------------+-----------+----------+------------+
| 242   | 2002-06-25 16:50 | File0003   | 0         | 1        | 1025016612 |
| 242   | 2002-06-25 16:50 | File0004   | 0         | 1        | 1025016612 |
| 243   | 2002-06-25 16:52 | File0005   | 0         | 2        | 1025016612 |
| 246   | 2002-06-25 19:19 | File0006   | 0         | 2        | 1025025494 |
+-------+------------------+------------+-----------+----------+------------+

und die folgende Bootstrap-Datei wird benötigt, um diese Dateien wiederherzustellen:

Volume=File0003
VolSessionId=1
VolSessionTime=1025016612
Volume=File0004
VolSessionId=1
VolSessionTime=1025016612
Volume=File0005
VolSessionId=2
VolSessionTime=1025016612
Volume=File0006
VolSessionId=2
VolSessionTime=1025025494

automatische Erzeugung der Bootstrap-Datei

Eine Sache ist vermutlich wissenswert: die Bootstrap-Dateien die automatisch am Ende eines jeden Jobs erzeugt werden, sind nicht so optimiert wie die, die durch das Console-Kommando restore erzeugt werden. Das ist so, weil die Bootstrap-Dateien, die am Ende des Jobs erstellt werden, alle Dateien enthalten, die für diesen Job auf das Volume geschrieben wurden. Die Konsequenz ist, dass alle Dateien die wärend eines inkrementellen oder differenziellen Jobs geschrieben wurden, beim Wiederherstellen zunächst von der vollständigen Sicherung wiederhergestellt werden und dann von der inkrementellen oder differenziellen Sicherung.

Wenn die Bootstrap-Datei für die Wiederherstellung erstellt wird, wird immer nur eine Version der Datei (die aktuellste) zur Wiederherstellung aufgelistet.

Falls Ihr Rechner noch ein bischen Zeit übrig hat, können Sie Ihre Bootstrap-Dateien optimieren, indem Sie das folgende tun:

   ./bconsole
   restore client=xxx select all
   done
   no
   quit
   Backup bootstrap file.

Das wird allerdings nicht funktionieren, wenn Ihr Client mehrere Filesets hat, denn dann wird noch eine weitere Eingabe erforderlich. Das Console-Kommando restore client=xxx select all erstellt den Restore-Dateibaum und wählt alle Dateien aus, done beendet den Auswahlmodus, dann wird die Bootstrap-Datei für diesen Wiederherstellungs-Job geschrieben. Das no beantwortet die Frage Do you want to run this (yes/mod/no). quit beendet das Console-Programm, danach kann die neu erstellte Bootstrap-Datei gesichert werden.

Bootstrap-Datei für bscan

Wenn Sie mit dem bscan-Programm sehr viele Volumes abfragen müssen, wird Ihr Kommando eventuell das Limit der Kommandozeilelänge überschreiten (511 Zeichen). In dem Fall, können Sie eine einfache Bootstrap-Datei erzeugen, die nur Volume-Namen enthält. Ein Beispiel:

Volume="Vol001"
Volume="Vol002"
Volume="Vol003"
Volume="Vol004"
Volume="Vol005"

ein weiteres Beispiel der Bootstrap-Datei

Wenn Sie nur einen einzigen Job vom Volume lesen wollen, können Sie das durch auswählen der Job-Id tun (Funktion nicht getestet), oder besser noch, Sie geben die VolumeSessionTime und VolumeSessionID an, falls Sie sie wissen. (Die beiden Werte werden auf dem Job-Report ausgegeben und sind in der Katalog-Datenbank zu finden.) Die VolumeSessionTime und VolumeSessionID anzugeben ist auch die Art, wie Bacula Wiederherstellungen durchführt. Eine Bootstrap-Datei kann dann wie folgt aussehen:

Volume="Vol001"
VolSessionId=10
VolSessionTime=1080847820

Wenn Sie wissen, wie viele Dateien gesichert wurden (siehe den Job-Report), können Sie die Auswahl enorm beschleunigen, indem Sie der Bootstrap-Datei folgendes hinzufügen (angenommen es waren 157 Dateien):

FileIndex=1-157
Count=157

Letztendlich, wenn Sie auch die File-Nummer wissen, wo auf dem Volume die ausgewählten Dateien liegen, können Sie das bcopy-Programm veranlassen, zum richtigen File auf dem Volumen zu springen, ohne jeden Eintrag lesen zu müssen:

VolFile=20

Bootstrap-Dateien sind weder magisch noch kompliziert. Sie zu lesen und Bacula sinnvoll mit ihnen arbeiten zu lassen *ist* magisch, aber darum brauchen Sie sich nicht kümmern.

Wenn Sie eine *echte* Bootstrap-Datei sehen wollen, starten sie das Console-Programm und geben Sie restore ein, wählen ein paar Dateien aus und antworten mit no, wenn Sie gefragt werden, ob Sie die Wiederherstellung starten wollen. Dann finden Sie die Bootstrap-Datei im Arbeitsverzeichnis des Director-Dienstes (z.B. unter /var/lib/bacula/backup-dir.restore.2.bsr).


Installing and Configuring MySQL

Installing and Configuring MySQL -- Phase I

If you use the ./configure --with-mysql=mysql-directory statement for configuring Bacula, you will need MySQL version 3.23.53 or later installed in the mysql-directory. Bacula has been tested on MySQL version 4.1.12 and works providing you are running it in the default installation that is compatible with MySQL 3.23.x. If you are using one of the new modes such as ANSI/ISO compatibility, you may experience problems.

If MySQL is installed in the standard system location, you need only enter --with-mysql since the configure program will search all the standard locations. If you install MySQL in your home directory or some other non-standard directory, you will need to provide the full path to it.

Installing and Configuring MySQL is not difficult but can be confusing the first time. As a consequence, below, we list the steps that we used to install it on our machines. Please note that our configuration leaves MySQL without any user passwords. This may be an undesirable situation if you have other users on your system.

Beginning with Bacula version 1.31, the thread safe version of the MySQL client library is used, and hence you must add the --enable-thread-safe-client option to the ./configure as shown below:

  1. Download MySQL source code from www.mysql.com/downloads

  2. Detar it with something like:

    tar xvfz mysql-filename

    Note, the above command requires GNU tar. If you do not have GNU tar, a command such as:

    zcat mysql-filename | tar xvf -

    will probably accomplish the same thing.

  3. cd mysql-source-directory

    where you replace mysql-source-directory with the directory name where you put the MySQL source code.

  4. ./configure --enable-thread-safe-client --prefix=mysql-directory

    where you replace mysql-directory with the directory name where you want to install mysql. Normally for system wide use this is /usr/local/mysql. In my case, I use ~kern/mysql.

  5. make

    This takes a bit of time.

  6. make install

    This will put all the necessary binaries, libraries and support files into the mysql-directory that you specified above.

  7. ./scripts/mysql_install_db

    This will create the necessary MySQL databases for controlling user access. Note, this script can also be found in the bin directory in the installation directory

The MySQL client library mysqlclient requires the gzip compression library libz.a or libz.so. If you are using rpm packages, these libraries are in the libz-devel package. On Debian systems, you will need to load the zlib1g-dev package. If you are not using rpms or debs, you will need to find the appropriate package for your system.

At this point, you should return to completing the installation of Bacula. Later after Bacula is installed, come back to this chapter to complete the installation. Please note, the installation files used in the second phase of the MySQL installation are created during the Bacula Installation.

Installing and Configuring MySQL -- Phase II

At this point, you should have built and installed MySQL, or already have a running MySQL, and you should have configured, built and installed Bacula. If not, please complete these items before proceeding.

Please note that the ./configure used to build Bacula will need to include --with-mysql=mysql-directory, where mysql-directory is the directory name that you specified on the ./configure command for configuring MySQL. This is needed so that Bacula can find the necessary include headers and library files for interfacing to MySQL.

Bacula will install scripts for manipulating the database (create, delete, make tables etc) into the main installation directory. These files will be of the form *_bacula_* (e.g. create_bacula_database). These files are also available in the <bacula-src>/src/cats directory after running ./configure. If you inspect create_bacula_database, you will see that it calls create_mysql_database. The *_bacula_* files are provided for convenience. It doesn't matter what database you have chosen; create_bacula_database will always create your database.

Now you will create the Bacula MySQL database and the tables that Bacula uses.

  1. Start mysql. You might want to use the startmysql script provided in the Bacula release.

  2. cd <install-directory> This directory contains the Bacula catalog interface routines.

  3. ./grant_mysql_privileges This script creates unrestricted access rights for the user bacula. You may want to modify it to suit your situation. Please note that none of the userids, including root, are password protected. If you need more security, please assign a password to the root user and to bacula. The program mysqladmin can be used for this.

  4. ./create_mysql_database This script creates the MySQL bacula database. The databases you create as well as the access databases will be located in <install-dir>/var/ in a subdirectory with the name of the database, where <install-dir> is the directory name that you specified on the --prefix option. This can be important to know if you want to make a special backup of the Bacula database or to check its size.

  5. ./make_mysql_tables This script creates the MySQL tables used by Bacula.

Each of the three scripts (grant_mysql_privileges, create_mysql_database and make_mysql_tables) allows the addition of a command line argument. This can be useful for specifying the user and or password. For example, you might need to add -u root to the command line to have sufficient privilege to create the Bacula tables.

To take a closer look at the access privileges that you have setup with the above, you can do:

mysql-directory/bin/mysql -u root mysql
select * from user;

Re-initializing the Catalog Database

After you have done some initial testing with Bacula, you will probably want to re-initialize the catalog database and throw away all the test Jobs that you ran. To do so, you can do the following:

  cd <install-directory>
  ./drop_mysql_tables
  ./make_mysql_tables

Please note that all information in the database will be lost and you will be starting from scratch. If you have written on any Volumes, you must write an end of file mark on the volume so that Bacula can reuse it. Do so with:

   (stop Bacula or unmount the drive)
   mt -f /dev/nst0 rewind
   mt -f /dev/nst0 weof

Where you should replace /dev/nst0 with the appropriate tape drive device name for your machine.

Linking Bacula with MySQL

After configuring Bacula with

./configure --enable-thread-safe-client --prefix=<mysql-directory> where <mysql-directory> is in my case /home/kern/mysql, you may have to configure the loader so that it can find the MySQL shared libraries. If you have previously followed this procedure and later add the --enable-thread-safe-client options, you will need to rerun the ldconfig program shown below. If you put MySQL in a standard place such as /usr/lib or /usr/local/lib this will not be necessary, but in my case it is. The description that follows is Linux specific. For other operating systems, please consult your manuals on how to do the same thing:

First edit: /etc/ld.so.conf and add a new line to the end of the file with the name of the mysql-directory. In my case, it is:

/home/kern/mysql/lib/mysql then rebuild the loader's cache with:

/sbin/ldconfig If you upgrade to a new version of MySQL, the shared library names will probably change, and you must re-run the /sbin/ldconfig command so that the runtime loader can find them.

Alternatively, your system my have a loader environment variable that can be set. For example, on a Solaris system where I do not have root permission, I use:

LD_LIBRARY_PATH=/home/kern/mysql/lib/mysql

Finally, if you have encryption enabled in MySQL, you may need to add -lssl -lcrypto to the link. In that case, you can either export the appropriate LDFLAGS definition, or alternatively, you can include them directly on the ./configure line as in:

LDFLAGS="-lssl -lcyrpto" \
   ./configure \
      <your-options>

Installing MySQL from RPMs

If you are installing MySQL from RPMs, you will need to install both the MySQL binaries and the client libraries. The client libraries are ususally found in a devel package, so you must install:

  mysql
  mysql-devel

This will be the same with most other package managers too.

Upgrading MySQL

If you upgrade MySQL, you must reconfigure, rebuild, and re-install Bacula otherwise you are likely to get bizarre failures. If you install from rpms and you upgrade MySQL, you must also rebuild Bacula. You can do so by rebuilding from the source rpm. To do so, you may need to modify the bacula.spec file to account for the new MySQL version.


Installing and Configuring PostgreSQL

If you are considering using PostreSQL, you should be aware of their philosophy of upgrades, which could be destabilizing for a production shop. Basically at every major version upgrade, you are required to dump your database in an ASCII format, do the upgrade, and then reload your database (or databases). This is because they frequently update the "data format" from version to version, and they supply no tools to automatically do the conversion. If you forget to do the ASCII dump, your database may become totally useless because none of the new tools can access it due to the format change, and the PostgreSQL server will not be able to start.

If you are building PostgreSQL from source, please be sure to add the --enable-thread-safety option when doing the ./configure for PostgreSQL.

Installing PostgreSQL

If you use the ./configure --with-postgresql=PostgreSQL-Directory statement for configuring Bacula, you will need PostgreSQL version 7.4 or later installed. NOTE! PostgreSQL versions earlier than 7.4 do not work with Bacula. If PostgreSQL is installed in the standard system location, you need only enter --with-postgresql since the configure program will search all the standard locations. If you install PostgreSQL in your home directory or some other non-standard directory, you will need to provide the full path with the --with-postgresql option.

Installing and configuring PostgreSQL is not difficult but can be confusing the first time. If you prefer, you may want to use a package provided by your chosen operating system. Binary packages are available on most PostgreSQL mirrors.

If you prefer to install from source, we recommend following the instructions found in the PostgreSQL documentation.

If you are using FreeBSD, this FreeBSD Diary article will be useful. Even if you are not using FreeBSD, the article will contain useful configuration and setup information.

If you configure the Batch Insert code in Bacula (attribute inserts are 10 times faster), you must be using a PostgreSQL that was built with the --enable-thread-safety option, otherwise you will get data corruption. Most major Linux distros have thread safety turned on, but it is better to check. One way is to see if the PostgreSQL library that Bacula will be linked against references pthreads. This can be done with a command such as:

  nm /usr/lib/libpq.a | grep pthread_mutex_lock

The above command should print a line that looks like:

         U pthread_mutex_lock

if does, then everything is OK. If it prints nothing, do not enable batch inserts when building Bacula.

After installing PostgreSQL, you should return to completing the installation of Bacula. Later, after Bacula is installed, come back to this chapter to complete the installation. Please note, the installation files used in the second phase of the PostgreSQL installation are created during the Bacula Installation. You must still come back to complete the second phase of the PostgreSQL installation even if you installed binaries (e.g. rpm, deb, ...).

Configuring PostgreSQL

At this point, you should have built and installed PostgreSQL, or already have a running PostgreSQL, and you should have configured, built and installed Bacula. If not, please complete these items before proceeding.

Please note that the ./configure used to build Bacula will need to include --with-postgresql=PostgreSQL-directory, where PostgreSQL-directory is the directory name that you specified on the ./configure command for configuring PostgreSQL (if you didn't specify a directory or PostgreSQL is installed in a default location, you do not need to specify the directory). This is needed so that Bacula can find the necessary include headers and library files for interfacing to PostgreSQL.

Bacula will install scripts for manipulating the database (create, delete, make tables etc) into the main installation directory. These files will be of the form *_bacula_* (e.g. create_bacula_database). These files are also available in the <bacula-src>/src/cats directory after running ./configure. If you inspect create_bacula_database, you will see that it calls create_postgresql_database. The *_bacula_* files are provided for convenience. It doesn't matter what database you have chosen; create_bacula_database will always create your database.

Now you will create the Bacula PostgreSQL database and the tables that Bacula uses. These instructions assume that you already have PostgreSQL running. You will need to perform these steps as a user that is able to create new databases. This can be the PostgreSQL user (on most systems, this is the pgsql user).

  1. cd <install-directory>

    This directory contains the Bacula catalog interface routines.

  2. ./create_bacula_database

    This script creates the PostgreSQL bacula database. Before running this command, you should carefully think about what encoding sequence you want for the text fields (paths, files, ...). Ideally, the encoding should be set to UTF8. However, many Unix systems have filenames that are not encoded in UTF8, either because you have not set UTF8 as your default character set or because you have imported files from elsewhere (e.g. MacOS X). For this reason, Bacula uses SQL_ASCII as the default encoding. If you want to change this, please modify the script before running it.

    If running the script fails, it is probably because the database is owned by a user other than yourself. On many systems, the database owner is pgsql and on others such as Red Hat and Fedora it is postgres. You can find out which it is by examining your /etc/passwd file. To create a new user under either your name or with say the name bacula, you can do the following:

       su
       (enter root password)
       su pgsql (or postgres)
       createuser kern (or perhaps bacula)
       Shall the new user be allowed to create databases? (y/n) y
       Shall the new user be allowed to create more new users? (y/n) (choose
             what you want)
       exit
    

    At this point, you should be able to execute the ./create_bacula_database command.

  3. ./make_bacula_tables

    This script creates the PostgreSQL tables used by Bacula.

  4. ./grant_bacula_privileges

    This script creates the database user bacula with restricted access rights. You may want to modify it to suit your situation. Please note that this database is not password protected.

Each of the three scripts (create_bacula_database, make_bacula_tables, and grant_bacula_privileges) allows the addition of a command line argument. This can be useful for specifying the user name. For example, you might need to add -h hostname to the command line to specify a remote database server.

To take a closer look at the access privileges that you have setup with the above, you can do:

PostgreSQL-directory/bin/psql --command \\dp bacula

Also, I had an authorization problem with the password. In the end, I had to modify my pg_hba.conf file (in /var/lib/pgsql/data on my machine) from:

  local   all    all        ident  sameuser
to
  local   all    all        trust  sameuser

This solved the problem for me, but it is not always a good thing to do from a security standpoint. However, it allowed me to run my regression scripts without having a password.

A more secure way to perform database authentication is with md5 password hashes. Begin by editing the pg_hba.conf file, and just prior the the existing ``local'' and ``host'' lines, add the line:

  local bacula bacula md5

and restart the Postgres database server (frequently, this can be done using "/etc/init.d/postgresql restart" or "service postgresql restart") to put this new authentication rule into effect.

Next, become the Postgres administrator, postgres, either by logging on as the postgres user, or by using su to become root and then using su - postgres to become postgres. Add a password to the bacula database for the bacula user using:

  \$ psql bacula
  bacula=# alter user bacula with password 'secret';
  ALTER USER
  bacula=# \\q

You'll have to add this password to two locations in the bacula-dir.conf file: once to the Catalog resource and once to the RunBeforeJob entry in the BackupCatalog Job resource. With the password in place, these two lines should look something like:

  dbname = bacula; user = bacula; password = "secret"
    ... and ...
  RunBeforeJob = "/etc/make_catalog_backup bacula bacula secret"

Naturally, you should choose your own significantly more random password, and ensure that the bacula-dir.conf file containing this password is readable only by the root.

Even with the files containing the database password properly restricted, there is still a security problem with this approach: on some platforms, the environment variable that is used to supply the password to Postgres is available to all users of the local system. To eliminate this problem, the Postgres team have deprecated the use of the environment variable password-passing mechanism and recommend the use of a .pgpass file instead. To use this mechanism, create a file named .pgpass containing the single line:

  localhost:5432:bacula:bacula:secret

This file should be copied into the home directory of all accounts that will need to gain access to the database: typically, root, bacula, and any users who will make use of any of the console programs. The files must then have the owner and group set to match the user (so root:root for the copy in root, and so on), and the mode set to 600, limiting access to the owner of the file.

Re-initializing the Catalog Database

After you have done some initial testing with Bacula, you will probably want to re-initialize the catalog database and throw away all the test Jobs that you ran. To do so, you can do the following:

  cd <install-directory>
  ./drop_bacula_tables
  ./make_bacula_tables
  ./grant_bacula_privileges

Please note that all information in the database will be lost and you will be starting from scratch. If you have written on any Volumes, you must write an end of file mark on the volume so that Bacula can reuse it. Do so with:

   (stop Bacula or unmount the drive)
   mt -f /dev/nst0 rewind
   mt -f /dev/nst0 weof

Where you should replace /dev/nst0 with the appropriate tape drive device name for your machine.

Installing PostgreSQL from RPMs

If you are installing PostgreSQL from RPMs, you will need to install both the PostgreSQL binaries and the client libraries. The client libraries are usually found in a devel package, so you must install:

  postgresql
  postgresql-devel
  postgresql-server
  postgresql-libs

These will be similar with most other package managers too. After installing from rpms, you will still need to run the scripts that set up the database and create the tables as described above.

Converting from MySQL to PostgreSQL

The conversion procedure presented here was worked out by Norm Dressler <ndressler at dinmar dot com>

This process was tested using the following software versions:

WARNING: Always as a precaution, take a complete backup of your databases before proceeding with this process!

  1. Shutdown bacula (cd /etc/bacula;./bacula stop)
  2. Run the following command to dump your Mysql database:

           mysqldump -f -t -n >bacula-backup.dmp
    

  3. Make a backup of your /etc/bacula directory (but leave the original in place).
  4. Go to your Bacula source directory and rebuild it to include PostgreSQL support rather then Mysql support. Check the config.log file for your original configure command and replace enable-mysql with enable-postgresql.
  5. Recompile Bacula with a make and if everything compiles completely, perform a make install.
  6. Shutdown Mysql.
  7. Start PostgreSQL on your system.
  8. Create a bacula user in Postgres with the createuser command. Depending on your Postgres install, you may have to SU to the user who has privileges to create a user.
  9. Verify your pg_hba.conf file contains sufficient permissions to allow bacula to access the server. Mine has the following since it's on a secure network:

    local all all trust
                    
    host all all 127.0.0.1 255.255.255.255 trust
                    
    NOTE: you should restart your postgres server if you
          made changes
    

  10. Change into the /etc/bacula directory and prepare the database and tables with the following commands:

    ./create_postgresql_database
                                    
    ./make_postgresql_tables
                                    
    ./grant_postgresql_privileges
    

  11. Verify you have access to the database:

      
    psql -Ubacula bacula
    

    You should not get any errors.

  12. Load your database from the Mysql database dump with:

    psql -Ubacula bacula <bacula-backup.dmp>
    

  13. Resequence your tables with the following commands:

    psql -Ubacula bacula
                    
    SELECT SETVAL('basefiles_baseid_seq', (SELECT
    MAX(baseid) FROM basefiles));
    SELECT SETVAL('client_clientid_seq', (SELECT
    MAX(clientid) FROM client));
    SELECT SETVAL('file_fileid_seq', (SELECT MAX(fileid)
    FROM file));
    SELECT SETVAL('filename_filenameid_seq', (SELECT
    MAX(filenameid) FROM filename));
                    
    SELECT SETVAL('fileset_filesetid_seq', (SELECT
    MAX(filesetid) FROM fileset));
                    
    SELECT SETVAL('job_jobid_seq', (SELECT MAX(jobid) FROM job));
    SELECT SETVAL('jobmedia_jobmediaid_seq', (SELECT
    MAX(jobmediaid) FROM jobmedia));
    SELECT SETVAL('media_mediaid_seq', (SELECT MAX(mediaid) FROM media));
    SELECT SETVAL('path_pathid_seq', (SELECT MAX(pathid) FROM path));
                    
    SELECT SETVAL('pool_poolid_seq', (SELECT MAX(poolid) FROM pool));
    

  14. At this point, start up Bacula, verify your volume library and perform a test backup to make sure everything is working properly.

Upgrading PostgreSQL

If you upgrade PostgreSQL, you must reconfigure, rebuild, and re-install Bacula otherwise you are likely to get bizarre failures. If you to modify the bacula.spec file to account for the new PostgreSQL version. You can do so by rebuilding from the source rpm. To do so, you may need install from rpms and you upgrade PostgreSQL, you must also rebuild Bacula.

Credits

Many thanks to Dan Langille for writing the PostgreSQL driver. This will surely become the most popular database that Bacula supports.


Installing and Configuring SQLite

Installing and Configuring SQLite -- Phase I

If you use the ./configure --with-sqlite statement for configuring Bacula, you will need SQLite version 2.8.16 or later installed. Our standard location (for the moment) for SQLite is in the dependency package depkgs/sqlite-2.8.16. Please note that the version will be updated as new versions are available and tested.

You may install and use SQLite version 3.x with Bacula by using: ./configure --with-sqlite3. You should ensure that when the database is created that you have used

PRAGMA synchronous = NORMAL;
otherwiset SQLite version 3.x is 4 to 10 times slower than version 2.8.16.

Installing and Configuring is quite easy.

  1. Download the Bacula dependency packages
  2. Detar it with something like:

    tar xvfz depkgs.tar.gz

    Note, the above command requires GNU tar. If you do not have GNU tar, a command such as:

    zcat depkgs.tar.gz | tar xvf -

    will probably accomplish the same thing.

  3. cd depkgs

  4. make sqlite

At this point, you should return to completing the installation of Bacula.

Please note that the ./configure used to build Bacula will need to include --with-sqlite.


Installing and Configuring SQLite -- Phase II

This phase is done after you have run the ./configure command to configure Bacula.

Bacula will install scripts for manipulating the database (create, delete, make tables etc) into the main installation directory. These files will be of the form *_bacula_* (e.g. create_bacula_database). These files are also available in the <bacula-src>/src/cats directory after running ./configure. If you inspect create_bacula_database, you will see that it calls create_sqlite_database. The *_bacula_* files are provided for convenience. It doesn't matter what database you have chosen; create_bacula_database will always create your database.

At this point, you can create the SQLite database and tables:

  1. cd <install-directory>

    This directory contains the Bacula catalog interface routines.

  2. ./make_sqlite_tables

    This script creates the SQLite database as well as the tables used by Bacula. This script will be automatically setup by the ./configure program to create a database named bacula.db in Bacula's working directory.

Linking Bacula with SQLite

If you have followed the above steps, this will all happen automatically and the SQLite libraries will be linked into Bacula.

Testing SQLite

We have much less "production" experience using SQLite than using MySQL. SQLite has performed flawlessly for us in all our testing. However, several users have reported corrupted databases while using SQLite. For that reason, we do not recommend it for production use.

If Bacula crashes with the following type of error when it is started:

Using default Catalog name=MyCatalog DB=bacula
Could not open database "bacula".
sqlite.c:151 Unable to open Database=/var/lib/bacula/bacula.db.
ERR=malformed database schema - unable to open a temporary database file
for storing temporary tables

this is most likely caused by the fact that some versions of SQLite attempt to create a temporary file in the current directory. If that fails, because Bacula does not have write permission on the current directory, then you may get this errr. The solution is to start Bacula in a current directory where it has write permission.

Re-initializing the Catalog Database

After you have done some initial testing with Bacula, you will probably want to re-initialize the catalog database and throw away all the test Jobs that you ran. To do so, you can do the following:

  cd <install-directory>
  ./drop_sqlite_tables
  ./make_sqlite_tables

Please note that all information in the database will be lost and you will be starting from scratch. If you have written on any Volumes, you must write an end of file mark on the volume so that Bacula can reuse it. Do so with:

   (stop Bacula or unmount the drive)
   mt -f /dev/nst0 rewind
   mt -f /dev/nst0 weof

Where you should replace /dev/nst0 with the appropriate tape drive device name for your machine.


The Bacula internal database is no longer supported, please do not use it.

Internal Bacula Database

Previously it was intended to be used primarily by Bacula developers for testing; although SQLite is also a good choice for this. We do not recommend its use in general.

This database is simplistic in that it consists entirely of Bacula's internal structures appended sequentially to a file. Consequently, it is in most cases inappropriate for sites with many clients or systems with large numbers of files, or long-term production environments.

Below, you will find a table comparing the features available with SQLite and MySQL and with the internal Bacula database. At the current time, you cannot dynamically switch from one to the other, but must rebuild the Bacula source code. If you wish to experiment with both, it is possible to build both versions of Bacula and install them into separate directories.

Feature SQLite or MySQL Bacula
Job Record Yes Yes
Media Record Yes Yes
FileName Record Yes No
File Record Yes No
FileSet Record Yes Yes
Pool Record Yes Yes
Client Record Yes Yes
JobMedia Record Yes Yes
List Job Records Yes Yes
List Media Records Yes Yes
List Pool Records Yes Yes
List JobMedia Records Yes Yes
Delete Pool Record Yes Yes
Delete Media Record Yes Yes
Update Pool Record Yes Yes
Implement Verify Yes No
MD5 Signatures Yes No

In addition, since there is no SQL available, the Console commands: sqlquery, query, retention, and any other command that directly uses SQL are not available with the Internal database.


Bacula Copyright, Trademark, and Licenses

There are a number of different licenses that are used in Bacula. If you have a printed copy of this manual, the details of each of the licenses referred to in this chapter can be found in the online version of the manual at http://www.bacula.org.

FDL

The GNU Free Documentation License (FDL) is used for this manual, which is a free and open license. This means that you may freely reproduce it and even make changes to it. However, rather than distribute your own version of this manual, we would much prefer if you would send any corrections or changes to the Bacula project.

The most recent version of the manual can always be found online at http://www.bacula.org.

GPL

The vast bulk of the source code is released under the GNU General Public License version 2..

Most of this code is copyrighted: Copyright ©2000-2007 Free Software Foundation Europe e.V.

Portions may be copyrighted by other people (ATT, the Free Software Foundation, ...). These files are released under the GPL license.

LGPL

Some of the Bacula library source code is released under the GNU Lesser General Public License. This permits third parties to use these parts of our code in their proprietary programs to interface to Bacula.

Public Domain

Some of the Bacula code, or code that Bacula references, has been released to the public domain. E.g. md5.c, SQLite.

Trademark

Bacula® is a registered trademark of Kern Sibbald.

We have trademarked the Bacula name to ensure that any program using the name Bacula will be exactly compatible with the program that we have released. The use of the name Bacula is restricted to software systems that agree exactly with the program presented here.

Fiduciary License Agreement

Developers who have contributed significant changes to the Bacula code should have signed a Fiduciary License Agreement (FLA), which guarantees them the right to use the code they have developed, and also ensures that the Free Software Foundation Europe (and thus the Bacula project) has the rights to the code. This Fiduciary License Agreement is found on the Bacula web site at:

http://www.bacula.org/en/FLA-bacula.en.pdf

and should be filled out then sent to:

Free Software Foundation Europe
Freedom Task Force
Sumatrastrasse 25
8006 Zürich
Switzerland

Please note that the above address is different from the officially registered office mentioned in the document. When you send in such a complete document, please notify me: kern at sibbald dot com.

Disclaimer

NO WARRANTY

BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

GNU Free Documentation License

Version 1.2, November 2002

Copyright ©2000,2001,2002 Free Software Foundation, Inc.


51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

Preamble

The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

1. APPLICABILITY AND DEFINITIONS

This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.

A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.

The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.

A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque".

Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.

The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.

A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition.

The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.

2. VERBATIM COPYING

You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

You may also lend copies, under the same conditions stated above, and you may publicly display copies.

3. COPYING IN QUANTITY

If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

4. MODIFICATIONS

You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

A.
Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.

B.
List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.

C.
State on the Title page the name of the publisher of the Modified Version, as the publisher.

D.
Preserve all the copyright notices of the Document.

E.
Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.

F.
Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.

G.
Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.

H.
Include an unaltered copy of this License.

I.
Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.

J.
Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.

K.
For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.

L.
Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.

M.
Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version.

N.
Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section.

O.
Preserve any Warranty Disclaimers.

If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.

You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

5. COMBINING DOCUMENTS

You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.

The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements".

6. COLLECTIONS OF DOCUMENTS

You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

7. AGGREGATION WITH INDEPENDENT WORKS

A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.

If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.

8. TRANSLATION

Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.

If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.

9. TERMINATION

You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

10. FUTURE REVISIONS OF THIS LICENSE

The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.

Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.

ADDENDUM: How to use this License for your documents

To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:


Copyright ©YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".


If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this:


with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.


If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.

If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.


GNU General Public License

image of a Philosophical GNU

Table of Contents


GNU GENERAL PUBLIC LICENSE

Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.


Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.


TERMS AND CONDITIONS

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS


How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

{\it one line to give the program's name and an idea of what it does.}
Copyright (C) {\it yyyy}  {\it name of author}
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) {\it year} {\it name of author}
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
type `show w'.  This is free software, and you are welcome
to redistribute it under certain conditions; type `show c'
for details.

The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright
interest in the program `Gnomovision'
(which makes passes at compilers) written
by James Hacker.
{\it signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. Return to GNU's home page.

FSF & GNU inquiries & questions to gnu@gnu.org. Other ways to contact the FSF.

Comments on these web pages to webmasters@www.gnu.org, send other questions to gnu@gnu.org.

Copyright notice above. Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA

Updated: 3 Jan 2000 rms


GNU Lesser General Public License

image of a Philosophical GNU [ English | Japanese ]

This GNU Lesser General Public License counts as the successor of the GNU Library General Public License. For an explanation of why this change was necessary, read the Why you shouldn't use the Lesser GPL for your next library article.

Table of Contents


GNU LESSER GENERAL PUBLIC LICENSE

Version 2.1, February 1999

Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL.  It also counts
 as the successor of the GNU Library Public License, version 2, hence
 the version number 2.1.]


Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.

This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.

When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.

To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.

For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.

We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.

To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.

Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.

Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.

When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.

We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.

For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.

In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.

Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.

The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.


TERMS AND CONDITIONS

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".

A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.

The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)

"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.

1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.

Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.

This option is useful when you wish to copy part of the code of the Library into a program that is not a library.

4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.

If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.

5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.

However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.

When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.

If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)

Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.

6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.

You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:

For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.

7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:

8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.

10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.

11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.

14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS


How to Apply These Terms to Your New Libraries

If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).

To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

{\it one line to give the library's name and an idea of what it does.}
Copyright (C) {\it year}  {\it name of author}
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright interest in
the library "Frob" (a library for tweaking knobs) written
by James Random Hacker.
{\it signature of Ty Coon}, 1 April 1990
Ty Coon, President of Vice

That's all there is to it! Return to GNU's home page.

FSF & GNU inquiries & questions to gnu@gnu.org. Other ways to contact the FSF.

Comments on these web pages to webmasters@www.gnu.org, send other questions to gnu@gnu.org.

Copyright notice above. Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA

Updated: 27 Nov 2000 paulv


Bacula Projects

Once a new major version of Bacula is released, the Bacula users will vote on a list of new features. This vote is used as the main element determining what new features will be implemented for the next version. Generally, the development time for a new release is between 4 to 9 months.

For the current list of project, please see the projects page in the CVS at: http://cvs.sourceforge.net/viewcvs.py/*checkout*/bacula/bacula/projects see the projects file in the main source directory. The projects file is updated approximately once every six months.

Separately from the project list, Kern maintains a current list of tasks as well as ideas, feature requests, and occassionally design notes. This list is updated roughly weekly (sometimes more often). For a current list of tasks you can see kernstodo in the Source Forge CVS at http://cvs.sourceforge.net/viewcvs.py/*checkout*/bacula/bacula/kernstodo.


Thanks

Thanks to Richard Stallman for starting the Free Software movement and for bringing us gcc and all the other GNU tools as well as the GPL license.

Thanks to Linus Torvalds for bringing us Linux.

Thanks to all the Free Software programmers. Without being able to peek at your code, and in some cases, take parts of it, this project would have been much more difficult.

Thanks to John Walker for suggesting this project, giving it a name, contributing software he has written, and for his programming efforts on Bacula as well as having acted as a constant sounding board and source of ideas.

Thanks to the apcupsd project where I started my Free Software efforts, and from which I was able to borrow some ideas and code that I had written.

Special thanks to D. Scott Barninger for writing the bacula RPM spec file, building all the RPM files and loading them onto Source Forge. This has been a tremendous help.

Many thanks to Karl Cunningham for converting the manual from html format to LaTeX. It was a major effort flawlessly done that will benefit the Bacula users for many years to come. Thanks Karl.

Thanks to Dan Langille for the incredible amount of testing he did on FreeBSD. His perseverance is truly remarkable. Thanks also for the many contributions he has made to improve Bacula (pthreads patch for FreeBSD, improved start/stop script and addition of Bacula userid and group, stunnel, ...), his continuing support of Bacula users. He also wrote the PostgreSQL driver for Bacula and has been a big help in correcting the SQL.

Thanks to multiple other Bacula Packagers who make and release packages for different platforms for Bacula.

Thanks to Christopher Hull for developing the native Win32 Bacula emulation code and for contributing it to the Bacula project.

Thanks to Thorsten Engel for his excellent knowledge of Win32 systems, and for making the Win32 File daemon Unicode compatible, as well as making the Win32 File daemon interface to Microsoft's Volume Shadow Copy (VSS). These two are big pluses for Bacula!

Thanks to Arno Lehmann for his excellent and infatigable help and advice to users.

Thanks to all the Bacula users, especially those of you who have contributed ideas, bug reports, patches, and new features.

Thanks to Nicolas Boichat for writing wx-console and the bacula-tray-monitor. These are very nice GUI additions to Bacula.

The original variable expansion code used in the LabelFormat comes from the Open Source Software Project (www.ossp.org). It has been adapted and extended for use in Bacula. This code is now deprecated.

There have been numerous people over the years who have contributed ideas, code, and help to the Bacula project. The file AUTHORS in the main source release file contains a list of contributors. For all those who I have left out, please send me a reminder, and in any case, thanks for your contribution.

Copyrights and Trademarks

Certain words and/or products are Copyrighted or Trademarked such as Windows (by Microsoft). Since they are numerous, and we are not necessarily aware of the details of each, we don't try to list them here. However, we acknowledge all such Copyrights and Trademarks, and if any copyright or trademark holder wishes a specific acknowledgment, notify us, and we will be happy to add it where appropriate.


Bacula Bugs

Zum Glück gibt es in Bacula nicht sehr viele Programmfehler (Bugs), aber dank Dan Langille haben wir eine Bug-Datenbank, wo Fehler gemeldet werden können. Wenn ein Fehler behoben ist, wird normalerweise ein Programmstück das den Fehler korrigiert (Patch), auf der Seite des Fehlerberichts veröffentlicht.

Das Verzeichnis patches im aktuellen SVN enthält eine Liste aller Programmkorrekturen die für ältere Bacula-Versionen veröffentlicht wurden.

Eine "grobe" Übersicht der momentanen Arbeit und bekannter Probleme befindet sich auch in der Datei kernstodo im Hauptverzeichnis der Bacula-Programmquellen.


Variable Expansion

Please note that as of version 1.37, the Variable Expansion is deprecated and replaced by Python scripting (not yet documented).

Variable expansion is somewhat similar to Unix shell variable expansion. Currently (version 1.31), it is used only in format labels, but in the future, it will most likely be used in more places.

General Functionality

This is basically a string expansion capability that permits referencing variables, indexing arrays, conditional replacement of variables, case conversion, substring selection, regular expression matching and replacement, character class replacement, padding strings, repeated expansion in a user controlled loop, support of arithmetic expressions in the loop start, step and end conditions, and recursive expansion.

When using variable expansion characters in a Volume Label Format record, the format should always be enclosed in double quotes (").

For example, ${HOME} will be replaced by your home directory as defined in the environment. If you have defined the variable xxx to be Test, then the reference ${xxx:p/7/Y/r} will right pad the contents of xxx to a length of seven characters filling with the character Y giving YYYTest.

Bacula Variables

Within Bacula, there are three main classes of variables with some minor variations within the classes. The classes are:

Counters
Counters are defined by the Counter resources in the Director's conf file. The counter can either be a temporary counter that lasts for the duration of Bacula's execution, or it can be a variable that is stored in the catalog, and thus retains its value from one Bacula execution to another. Counter variables may be incremented by postfixing a plus sign (+ after the variable name).

Internal Variables
Internal variables are read-only, and may be related to the current job (i.e. Job name), or maybe special variables such as the date and time. The following variables are available:

Year
-- the full year
Month
-- the current month 1-12
Day
-- the day of the month 1-31
Hour
-- the hour 0-24
Minute
-- the current minute 0-59
Second
-- the current second 0-59
WeekDay
-- the current day of the week 0-6 with 0 being Sunday
Job
-- the job name
Dir
-- the Director's name
Level
-- the Job Level
Type
-- the Job type
JobId
-- the JobId
JobName
-- the unique job name composed of Job and date
Storage
-- the Storage daemon's name
Client
-- the Client's name
NumVols
-- the current number of Volumes in the Pool
Pool
-- the Pool name
Catalog
-- the Catalog name
MediaType
-- the Media Type

Environment Variables
Environment variables are read-only, and must be defined in the environment prior to executing Bacula. Environment variables may be either scalar or an array, where the elements of the array are referenced by subscripting the variable name (e.g. ${Months[3]}). Environment variable arrays are defined by separating the elements with a vertical bar (|), thus set Months="Jan|Feb|Mar|Apr|..." defines an environment variable named Month that will be treated as an array, and the reference ${Months[3]} will yield Mar. The elements of the array can have differing lengths.

Full Syntax

Since the syntax is quite extensive, below, you will find the pseudo BNF. The special characters have the following meaning:

 ::=     definition
 ( )     grouping if the parens are not quoted
 |       separates alternatives
 '/'     literal / (or any other character)
 CAPS    a character or character sequence
 *       preceding item can be repeated zero or more times
 ?       preceding item can appear zero or one time
 +       preceding item must appear one or more times

And the pseudo BNF describing the syntax is:

 input       ::= ( TEXT
                 | variable
                 | INDEX_OPEN input INDEX_CLOSE (loop_limits)?
                 )*
 variable    ::= DELIM_INIT (name|expression)
 name        ::= (NAME_CHARS)+
 expression  ::= DELIM_OPEN
                 (name|variable)+
                 (INDEX_OPEN num_exp INDEX_CLOSE)?
                 (':' command)*
                 DELIM_CLOSE
 command     ::= '-' (TEXT_EXP|variable)+
               | '+' (TEXT_EXP|variable)+
               | 'o' NUMBER ('-'|',') (NUMBER)?
               | '#'
               | '*' (TEXT_EXP|variable)+
               | 's' '/' (TEXT_PATTERN)+
                     '/' (variable|TEXT_SUBST)*
                     '/' ('m'|'g'|'i'|'t')*
               | 'y' '/' (variable|TEXT_SUBST)+
                     '/' (variable|TEXT_SUBST)*
                     '/'
               | 'p' '/' NUMBER
                     '/' (variable|TEXT_SUBST)*
                     '/' ('r'|'l'|'c')
               | '%' (name|variable)+
                     ('(' (TEXT_ARGS)? ')')?
               | 'l'
               | 'u'
 num_exp     ::= operand
               | operand ('+'|'-'|'*'|'/'|'%') num_exp
 operand     ::= ('+'|'-')? NUMBER
               | INDEX_MARK
               | '(' num_exp ')'
               | variable
 loop_limits ::= DELIM_OPEN
                 (num_exp)? ',' (num_exp)? (',' (num_exp)?)?
                 DELIM_CLOSE
 NUMBER      ::= ('0'|...|'9')+
 TEXT_PATTERN::= (^('/'))+
 TEXT_SUBST  ::= (^(DELIM_INIT|'/'))+
 TEXT_ARGS   ::= (^(DELIM_INIT|')'))+
 TEXT_EXP    ::= (^(DELIM_INIT|DELIM_CLOSE|':'|'+'))+
 TEXT        ::= (^(DELIM_INIT|INDEX_OPEN|INDEX_CLOSE))+
 DELIM_INIT  ::= '$'
 DELIM_OPEN  ::= '{'
 DELIM_CLOSE ::= '}'
 INDEX_OPEN  ::= '['
 INDEX_CLOSE ::= ']'
 INDEX_MARK  ::= '#'
 NAME_CHARS  ::= 'a'|...|'z'|'A'|...|'Z'|'0'|...|'9'

Semantics

The items listed in command above, which always follow a colon (:) have the following meanings:

 -    perform substitution if variable is empty
 +    perform substitution if variable is not empty
 o    cut out substring of the variable value
 #    length of the variable value
 *    substitute empty string if the variable value is not empty,
      otherwise substitute the trailing parameter
 s    regular expression search and replace. The trailing
      options are: m = multiline, i = case insensitive,
                   g = global,    t = plain text (no regexp)
 y    transpose characters from class A to class B
 p    pad variable to l = left, r = right or c = center,
      with second value.
 %    special function call (none implemented)
 l    lower case the variable value
 u    upper case the variable value

The loop_limits are start, step, and end values.

A counter variable name followed immediately by a plus (+) will cause the counter to be incremented by one.

Examples

To create an ISO date:

  DLT-${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}

on 20 June 2003 would give DLT-2003-06-20

If you set the environment variable mon to

   January|February|March|April|May|...
   File-${mon[${Month}]}/${Day}/${Year}

on the first of March would give File-March/1/2003


Using stunnel to Encrypt Communications to Clients

Prior to version 1.37, Bacula did not have built-in communications encryption. Please see the TLS chapter if you are using Bacula 1.37 or greater.

Without too much effort, it is possible to encrypt the communications between any of the daemons. This chapter will show you how to use stunnel to encrypt communications to your client programs. We assume the Director and the Storage daemon are running on one machine that will be called server and the Client or File daemon is running on a different machine called client. Although the details may be slightly different, the same principles apply whether you are encrypting between Unix, Linux, or Win32 machines. This example was developed between two Linux machines running stunnel version 4.04-4 on a Red Hat Enterprise 3.0 system.

Communications Ports Used

First, you must know that with the standard Bacula configuration, the Director will contact the File daemon on port 9102. The File daemon then contacts the Storage daemon using the address and port parameters supplied by the Director. The standard port used will be 9103. This is the typical server/client view of the world, the File daemon is a server to the Director (i.e. listens for the Director to contact it), and the Storage daemon is a server to the File daemon.

Encryption

The encryption is accomplished between the Director and the File daemon by using an stunnel on the Director's machine (server) to encrypt the data and to contact an stunnel on the File daemon's machine (client), which decrypts the data and passes it to the client.

Between the File daemon and the Storage daemon, we use an stunnel on the File daemon's machine to encrypt the data and another stunnel on the Storage daemon's machine to decrypt the data.

As a consequence, there are actually four copies of stunnel running, two on the server and two on the client. This may sound a bit complicated, but it really isn't. To accomplish this, we will need to construct four separate conf files for stunnel, and we will need to make some minor modifications to the Director's conf file. None of the other conf files need to be changed.

A Picture

Since pictures usually help a lot, here is an overview of what we will be doing. Don't worry about all the details of the port numbers and such for the moment.

  File daemon (client):
                 stunnel-fd1.conf
                   |===========|
  Port 29102  >----| Stunnel 1 |-----> Port 9102
                   |===========|
                 stunnel-fd2.conf
                   |===========|
  Port 9103   >----| Stunnel 2 |-----> server:29103
                   |===========|
  Director (server):
                 stunnel-dir.conf
                   |===========|
  Port 29102  >----| Stunnel 3 |-----> client:29102
                   |===========|
                 stunnel-sd.conf
                   |===========|
  Port 29103  >----| Stunnel 4 |-----> 9103
                   |===========|

Certificates

In order for stunnel to function as a server, which it does in our diagram for Stunnel 1 and Stunnel 4, you must have a certificate and the key. It is possible to keep the two in separate files, but normally, you keep them in one single .pem file. You may create this certificate yourself in which case, it will be self-signed, or you may have it signed by a CA.

If you want your clients to verify that the server is in fact valid (Stunnel 2 and Stunnel 3), you will need to have the server certificates signed by a CA (Certificate Authority), and you will need to have the CA's public certificate (contains the CA's public key).

Having a CA signed certificate is highly recommended if you are using your client across the Internet, otherwise you are exposed to the man in the middle attack and hence loss of your data.

See below for how to create a self-signed certificate.

Securing the Data Channel

To simplify things a bit, let's for the moment consider only the data channel. That is the connection between the File daemon and the Storage daemon, which takes place on port 9103. In fact, in a minimalist solution, this is the only connection that needs to be encrypted, because it is the one that transports your data. The connection between the Director and the File daemon is simply a control channel used to start the job and get the job status.

Normally the File daemon will contact the Storage daemon on port 9103 (supplied by the Director), so we need an stunnel that listens on port 9103 on the File daemon's machine, encrypts the data and sends it to the Storage daemon. This is depicted by Stunnel 2 above. Note that this stunnel is listening on port 9103 and sending to server:29103. We use port 29103 on the server because if we would send the data to port 9103, it would go directly to the Storage daemon, which doesn't understand encrypted data. On the server machine, we run Stunnel 4, which listens on port 29103, decrypts the data and sends it to the Storage daemon, which is listening on port 9103.

Modification of bacula-dir.conf for the Data Channel

The Storage resource of the bacula-dir.conf normally looks something like the following:

Storage {
  Name = File
  Address = server
  SDPort = 9103
  Password = storage_password
  Device = File
  Media Type = File
}

Notice that this is running on the server machine, and it points the File daemon back to server:9103, which is where our Storage daemon is listening. We modify this to be:

Storage {
  Name = File
  Address = localhost
  SDPort = 9103
  Password = storage_password
  Device = File
  Media Type = File
}

This causes the File daemon to send the data to the stunnel running on localhost (the client machine). We could have used client as the address as well.

config Files for stunnel to Encrypt the Data Channel

In the diagram above, we see above Stunnel 2 that we use stunnel-fd2.conf on the client. A pretty much minimal config file would look like the following:

client = yes
[29103]
accept = localhost:9103
connect = server:29103

The above config file does encrypt the data but it does not require a certificate, so it is subject to the man in the middle attack. The file I actually used, stunnel-fd2.conf, looked like this:

#
# Stunnel conf for Bacula client -> SD
#
pid = /home/kern/bacula/bin/working/stunnel.pid
#
# A cert is not mandatory here. If verify=2, a
#  cert signed by a CA must be specified, and
#  either CAfile or CApath must point to the CA's
#  cert
#
cert = /home/kern/stunnel/stunnel.pem
CAfile = /home/kern/ssl/cacert.pem
verify = 2
client = yes
# debug = 7
# foreground = yes
[29103]
accept = localhost:9103
connect = server:29103

You will notice that I specified a pid file location because I ran stunnel under my own userid so I could not use the default, which requires root permission. I also specified a certificate that I have as well as verify level 2 so that the certificate is required and verified, and I must supply the location of the CA (Certificate Authority) certificate so that the stunnel certificate can be verified. Finally, you will see that there are two lines commented out, which when enabled, produce a lot of nice debug info in the command window.

If you do not have a signed certificate (stunnel.pem), you need to delete the cert, CAfile, and verify lines.

Note that the stunnel.pem, is actually a private key and a certificate in a single file. These two can be kept and specified individually, but keeping them in one file is more convenient.

The config file, stunnel-sd.conf, needed for Stunnel 4 on the server machine is:

#
# Bacula stunnel conf for Storage daemon
#
pid = /home/kern/bacula/bin/working/stunnel.pid
#
# A cert is mandatory here, it may be self signed
#  If it is self signed, the client may not use
#  verify
#
cert   = /home/kern/stunnel/stunnel.pem
client = no
# debug = 7
# foreground = yes
[29103]
accept = 29103
connect = 9103

Starting and Testing the Data Encryption

It will most likely be the simplest to implement the Data Channel encryption in the following order:

Encrypting the Control Channel

The Job control channel is between the Director and the File daemon, and as mentioned above, it is not really necessary to encrypt, but it is good practice to encrypt it as well. The two stunnels that are used in this case will be Stunnel 1 and Stunnel 3 in the diagram above. Stunnel 3 on the server might normally listen on port 9102, but if you have a local File daemon, this will not work, so we make it listen on port 29102. It then sends the data to client:29102. Again we use port 29102 so that the stunnel on the client machine can decrypt the data before passing it on to port 9102 where the File daemon is listening.

Modification of bacula-dir.conf for the Control Channel

We need to modify the standard Client resource, which would normally look something like:

Client {
  Name = client-fd
  Address = client
  FDPort = 9102
  Catalog = BackupDB
  Password = "xxx"
}

to be:

Client {
  Name = client-fd
  Address = localhost
  FDPort = 29102
  Catalog = BackupDB
  Password = "xxx"
}

This will cause the Director to send the control information to localhost:29102 instead of directly to the client.

config Files for stunnel to Encrypt the Control Channel

The stunnel config file, stunnel-dir.conf, for the Director's machine would look like the following:

#
# Bacula stunnel conf for the Directory to contact a client
#
pid = /home/kern/bacula/bin/working/stunnel.pid
#
# A cert is not mandatory here. If verify=2, a
#  cert signed by a CA must be specified, and
#  either CAfile or CApath must point to the CA's
#  cert
#
cert   = /home/kern/stunnel/stunnel.pem
CAfile = /home/kern/ssl/cacert.pem
verify = 2
client = yes
# debug = 7
# foreground = yes
[29102]
accept = localhost:29102
connect = client:29102

and the config file, stunnel-fd1.conf, needed to run stunnel on the Client would be:

#
# Bacula stunnel conf for the Directory to contact a client
#
pid = /home/kern/bacula/bin/working/stunnel.pid
#
# A cert is not mandatory here. If verify=2, a
#  cert signed by a CA must be specified, and
#  either CAfile or CApath must point to the CA's
#  cert
#
cert   = /home/kern/stunnel/stunnel.pem
CAfile = /home/kern/ssl/cacert.pem
verify = 2
client = yes
# debug = 7
# foreground = yes
[29102]
accept = localhost:29102
connect = client:29102

Starting and Testing the Control Channel

It will most likely be the simplest to implement the Control Channel encryption in the following order:

Using stunnel to Encrypt to a Second Client

On the client machine, you can just duplicate the setup that you have on the first client file for file and it should work fine.

In the bacula-dir.conf file, you will want to create a second client pretty much identical to how you did for the first one, but the port number must be unique. We previously used:

Client {
  Name = client-fd
  Address = localhost
  FDPort = 29102
  Catalog = BackupDB
  Password = "xxx"
}

so for the second client, we will, of course, have a different name, and we will also need a different port. Remember that we used port 29103 for the Storage daemon, so for the second client, we can use port 29104, and the Client resource would look like:

Client {
  Name = client2-fd
  Address = localhost
  FDPort = 29104
  Catalog = BackupDB
  Password = "yyy"
}

Now, fortunately, we do not need a third stunnel to on the Director's machine, we can just add the new port to the config file, stunnel-dir.conf, to make:

#
# Bacula stunnel conf for the Directory to contact a client
#
pid = /home/kern/bacula/bin/working/stunnel.pid
#
# A cert is not mandatory here. If verify=2, a
#  cert signed by a CA must be specified, and
#  either CAfile or CApath must point to the CA's
#  cert
#
cert   = /home/kern/stunnel/stunnel.pem
CAfile = /home/kern/ssl/cacert.pem
verify = 2
client = yes
# debug = 7
# foreground = yes
[29102]
accept = localhost:29102
connect = client:29102
[29104]
accept = localhost:29102
connect = client2:29102

There are no changes necessary to the Storage daemon or the other stunnel so that this new client can talk to our Storage daemon.

Creating a Self-signed Certificate

You may create a self-signed certificate for use with stunnel that will permit you to make it function, but will not allow certificate validation. The .pem file containing both the certificate and the key can be made with the following, which I put in a file named makepem:

#!/bin/sh
#
# Simple shell script to make a .pem file that can be used
# with stunnel and Bacula
#
OPENSSL=openssl
   umask 77
   PEM1="/bin/mktemp openssl.XXXXXX"
   PEM2="/bin/mktemp openssl.XXXXXX"
   ${OPENSSL} req -newkey rsa:1024 -keyout $PEM1 -nodes \
       -x509 -days 365 -out $PEM2
   cat $PEM1 > stunnel.pem
   echo ""   >>stunnel.pem
   cat $PEM2 >>stunnel.pem
   rm $PEM1 $PEM2

The above script will ask you a number of questions. You may simply answer each of them by entering a return, or if you wish you may enter your own data.

Getting a CA Signed Certificate

The process of getting a certificate that is signed by a CA is quite a bit more complicated. You can purchase one from quite a number of PKI vendors, but that is not at all necessary for use with Bacula.

To get a CA signed certificate, you will either need to find a friend that has setup his own CA or to become a CA yourself, and thus you can sign all your own certificates. The book OpenSSL by John Viega, Matt Mesier & Pravir Chandra from O'Reilly explains how to do it, or you can read the documentation provided in the Open-source PKI Book project at Source Forge: http://ospkibook.sourceforge.net/docs/OSPKI-2.4.7/OSPKI-html/ospki-book.htm. Note, this link may change.

Using ssh to Secure the Communications

Please see the script ssh-tunnel.sh in the examples directory. It was contributed by Stephan Holl.


General Index

exit
Einbinden anderer Konfigurations-Dateien | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands
MAJOR WARNING
!!! MAJOR WARNING !!!
*JobLevel
Bootstrap-Datei Format
*JobType
Bootstrap-Datei Format
--enable-client-only
Konfigurationsoptionen
--enable-conio
Konfigurationsoptionen
--enable-gnome
Konfigurationsoptionen
--enable-largefile
Konfigurationsoptionen
--enable-readline
Konfigurationsoptionen
--enable-smartalloc
Konfigurationsoptionen
--enable-static-cons
Konfigurationsoptionen
--enable-static-dir
Konfigurationsoptionen
--enable-static-fd
Konfigurationsoptionen
--enable-static-sd
Konfigurationsoptionen
--enable-static-tools
Konfigurationsoptionen
--enable-tray-monitor
Konfigurationsoptionen
--enable-wx-console
Konfigurationsoptionen
--sysbindir
Konfigurationsoptionen
--sysconfdir
Konfigurationsoptionen
--with-base-port
Konfigurationsoptionen
--with-dir-group
Konfigurationsoptionen
--with-dir-password
Konfigurationsoptionen
--with-dir-user
Konfigurationsoptionen
--with-dump-email
Konfigurationsoptionen
--with-fd-group
Konfigurationsoptionen
--with-fd-password
Konfigurationsoptionen
--with-fd-user
Konfigurationsoptionen
--with-mysql
Konfigurationsoptionen
--with-pid-dir
Konfigurationsoptionen
--with-postgresql
Konfigurationsoptionen
--with-readline
Konfigurationsoptionen
--with-sd-group
Konfigurationsoptionen
--with-sd-password
Konfigurationsoptionen
--with-sd-user
Konfigurationsoptionen
--with-sqlite
Konfigurationsoptionen
--with-subsys-dir
Konfigurationsoptionen
--with-tcp-wrappers
Konfigurationsoptionen
--with-working-dir
Konfigurationsoptionen
--mandir
Konfigurationsoptionen
--datadir
Konfigurationsoptionen
--disable-nls
Konfigurationsoptionen
--with-sqlite3
Konfigurationsoptionen
--with-python
Konfigurationsoptionen
--with-libintl-prefix
Konfigurationsoptionen
Above, Bacula Configuration Files for the
The Bacula Configuration Files for the Above
Actual Conf Files
The Actual Conf Files
add
Alphabetische Liste der Console-Kommandos
Adding a Second Client
Adding a Second Client
Adding Volumes to a Pool
Adding Volumes to a Pool
Additional Resources
Additional Resources
Advantages
Advantages | Advantages
After bscan
After bscan
aktuelle Implementierung, Einschränkungen der
Einschränkungen der aktuellen Implementierung
Algorithm, Recycling
Recycling Algorithm
Alle Parameter des Update Slots Kommandos
Alle Parameter des Update Slots Kommandos
Alphabetische Liste der Console-Kommandos
Alphabetische Liste der Console-Kommandos | Alphabetische Liste der Console-Kommandos
Alphabetische Liste der Console-Schlüsselwörter
Alphabetische Liste der Console-Schlüsselwörter | Alphabetische Liste der Console-Schlüsselwörter
Alternate Disaster Recovery Suggestion for Win32 Systems
Alternate Disaster Recovery Suggestion for Win32 Systems
Andere Fenster-Manager
Andere Fenster-Manager
Anpassen der Konfigurations-Dateien
Anpassen der Konfigurations-Dateien
Anpassung des mtx-changer Scripts
Autochanger-Test und Anpassung des mtx-changer Scripts
ANSI und IBM Tape Labels
ANSI und IBM Tape Labels
Answers
Answers
anything
Special At (@) Commands
Arbeiten mit dem Autochanger
Arbeiten mit dem Autochanger
Arbeiten mit mehreren Magazinen
Arbeiten mit mehreren Magazinen
Arguments, Command Line
Command Line Arguments
Attributes, Restoring Directory
Restoring Directory Attributes
Authorization Errors
I'm Getting Authorization Errors. What is Going On?
Auto-Start der Dämon-Prozesse
Auto-Start der Dämon-Prozesse
Autochanger Errors
Autochanger Errors
Autochanger Unterstützung
Autochanger Unterstützung
Autochanger, Arbeiten mit dem
Arbeiten mit dem Autochanger
Autochanger, Automatic Labeling Using Your
Automatic Labeling Using Your Autochanger
Autochanger, Simulieren von Barcodes im
Simulieren von Barcodes im Autochanger
Autochanger, unterstützte
Unterstützte Autochanger
Autochanger-Test
Autochanger-Test und Anpassung des mtx-changer Scripts
Autochangers, Supported
Supported Autochanger Models
autodisplay on/off
Alphabetische Liste der Console-Kommandos
Automated Disk Backup
Automated Disk Backup
Automatic Labeling Using Your Autochanger
Automatic Labeling Using Your Autochanger
Automatic Pruning
Automatic Pruning
Automatic Pruning and Recycling Example
Automatic Pruning and Recycling Example
Automatic Volume Labeling
Automatic Volume Labeling
Automatic Volume Recycling
Automatic Volume Recycling
automatische Erzeugung der Bootstrap-Datei
automatische Erzeugung der Bootstrap-Datei
automount on/off
Alphabetische Liste der Console-Kommandos
Autorisation, Namen Passwörter und
Namen, Passwörter und Autorisation
Backing up ACLs on ext3 or XFS filesystems
Backing up ACLs on ext3 or XFS filesystems
Backing Up Portables Using DHCP
Backing Up Portables Using DHCP
Backing up Raw Partitions
Backing up Raw Partitions
Backing Up the WinNT/XP/2K System State
Backing Up the WinNT/XP/2K System State
Backing up to Multiple Disks
Backing up to Multiple Disks
Backing up, Partitions
Backing up Raw Partitions
Backup Strategies
Backup Strategies
Backup, Simple One Tape
Simple One Tape Backup
Backward Compatibility
Backward Compatibility
Bacula aus dem Quellcode kompilieren
Bacula aus dem Quellcode kompilieren
Bacula Autochanger Schnittstelle
Bacula Autochanger Schnittstelle
Bacula Bugs
Bacula Bugs
Bacula Cannot Open the Device
Bacula Cannot Open the Device
Bacula Configuration Files for the Above
The Bacula Configuration Files for the Above
Bacula Console
Bacula Console | Bacula Console
Bacula Copyright, Trademark, and Licenses
Bacula Copyright, Trademark, and Licenses
Bacula Events
Bacula Events
Bacula Frequently Asked Questions
Bacula Frequently Asked Questions
Bacula in Betrieb
Bacula in Betrieb
Bacula installieren
Bacula installieren | Bacula installieren
Bacula internal database is no longer supported, please do not use it.
The Bacula internal database is no longer supported, please do
Bacula Komponenten oder Dienste
Bacula Komponenten oder Dienste
Bacula Projects
Bacula Projects
Bacula Saves But Cannot Restore Files
Bacula Saves But Cannot Restore Files
Bacula Security Issues
Bacula Security Issues
Bacula TLS
Bacula TLS
Bacula Trademark
Why have You Trademarked the Name Bacula®?
Bacula upgraden
Bacula upgraden
Bacula Variables
Bacula Variables
Bacula, als Upgrade
Bacula upgraden
Bacula, Before Running
Before Running Bacula
Bacula, Disaster Recovery Using
Disaster Recovery Using Bacula
Bacula, Was ist
Was ist Bacula?
Bacula, Wer benötigt
Wer benötigt Bacula?
Bacula-web
GUI Programs
Bacula® - RPM Packaging FAQ
Bacula RPM Packaging FAQ
Baculas Konfigurations-Dateien einrichten
Baculas Konfigurations-Dateien einrichten
Baculas momentaner Stand
Baculas Stand
Band-Spezifikationen
Band-Spezifikationen
Bandlaufwerk, Kompatibilitätstest
Test der Kompatibilität von Bacula mit Ihrem Bandlaufwerk
Bandlaufwerke, nicht unterstützte
Nicht unterstützte Bandlaufwerke
Bandlaufwerke, unterstützte
Unterstützte Bandlaufwerke
Barcode Unterstützung
Barcode Unterstützung
Bare Metal Recovery on Linux with a Bacula Rescue CD
Bare Metal Recovery on Linux with a Bacula Rescue CD
Bare Metal Recovery using a LiveCD
Bare Metal Recovery using a LiveCD
Basic Volume Management
Basic Volume Management
Bcopy
bcopy
Bcopy Command Options
bcopy Command Options
Bearbeiten, Die Bacula Konfigurations-Dateien
Die Bacula Konfigurations-Dateien bearbeiten
Beenden des Console-Programms
Beenden des Console-Programs | Beenden des Console-Programs
Before Running Bacula
Before Running Bacula
Beispiel Console-Konfigurations-Datei
Beispiel Console-Konfigurations-Datei
Beispiel ein weiteres, Bootstrap-Datei
ein weiteres Beispiel der Bootstrap-Datei
Beispiel Scripte
Beispiel Scripte
Beispiel-Konfigurationsdatei
eine Beispiel-Konfigurationsdatei
Beispiel-Konfigurationsdatei für mehrere Laufwerke
eine Beispiel-Konfigurationsdatei für mehrere Laufwerke
Belange, FreeBSD
FreeBSD Belange
Benutzung des Console-Programms
Benutzung des Console-Programms | Benutzung des Console-Programms
zum einbinden anderer Dateien
Einbinden anderer Konfigurations-Dateien
Betriebssysteme, Unterstützte
Unterstützte Betriebssysteme | Unterstützte Betriebssysteme
Bextract
bextract
bimagemgr
GUI Programs
Bimagemgr
bimagemgr | bimagemgr
bimagemgr Benutzung
bimagemgr Benutzung
bimagemgr Installation
bimagemgr installation | bimagemgr Installation
bimagemgr Usage
bimagemgr usage
bimagemgr, Benutzung
bimagemgr Benutzung
bimagemgr, Installation
bimagemgr installation | bimagemgr Installation
bimagemgr, Usage
bimagemgr usage
bls
bls
bls, Listing Blocks
Listing Blocks
bls, Listing Jobs
Listing Jobs
Boot with your Bacula Rescue CDROM
Boot with your Bacula Rescue CDROM
Bootstrap-Datei
Die Bootstrap-Datei
Bootstrap-Datei Format
Bootstrap-Datei Format
Brief Tutorial
A Brief Tutorial
Broken pipe
The Client Resource | Storage Resource
bscan
Bootstrap-Datei für bscan
bscan
bscan
bscan Bootstrap-Datei
Bootstrap-Datei für bscan
Bscan, After
After bscan
bscan, Bootstrap-Datei
Bootstrap-Datei für bscan
Bsmtp
bsmtp
Btape
btape
Btape
btape
Btape Commands
btape Commands
Bugs and Other Considerations
Bugs and Other Considerations
Bugs, Bacula
Bacula Bugs
Bugs, Linux Problems or
Linux Problems or Bugs
Build Options
Build Options
Building Bacula with Encryption Support
Building Bacula with Encryption Support
Can Bacula Backup My System To Files instead of Tape?
Can Bacula Backup My System To Files instead of Tape?
cancel jobid
Alphabetische Liste der Console-Kommandos
Cancelling jobs
I want to stop a job. Is there a better
Cannot Access a Client
Bacula Runs Fine but Cannot Access a Client on a
Capabilities
Capabilities
Catalog Resource
The Catalog Resource
Catalog, Using bscan to Compare a Volume to an existing
Using bscan to Compare a Volume to an existing Catalog
CDROM, Bare Metal Recovery on Linux with a Bacula Rescue
Bare Metal Recovery on Linux with a Bacula Rescue CD
CDROM, Boot with your Bacula Rescue
Boot with your Bacula Rescue CDROM
CDROM, Creating a Bacula Rescue
Creating a Bacula Rescue CDROM
Certificate, Creating a Self-signed
Creating a Self-signed Certificate | Creating a Self-signed Certificate
Certificate, Getting a CA Signed
Getting a CA Signed Certificate | Getting a CA Signed Certificate
Certificates
Certificates
Channel, config Files for stunnel to Encrypt the Control
config Files for stunnel to Encrypt the Control Channel
Channel, config Files for stunnel to Encrypt the Data
config Files for stunnel to Encrypt the Data Channel
Channel, Encrypting the Control
Encrypting the Control Channel
Channel, Modification of bacula-dir.conf for the Control
Modification of bacula-dir.conf for the Control Channel
Channel, Modification of bacula-dir.conf for the Data
Modification of bacula-dir.conf for the Data Channel
Channel, Securing the Data
Securing the Data Channel
Channel, Starting and Testing the Control
Starting and Testing the Control Channel
Character Sets
Character Sets
Client
Bootstrap-Datei Format
Client Resource
The Client Resource
Client Resource
The Client Resource | The Client Resource
Client, Adding a Second
Adding a Second Client
Client, Using stunnel to Encrypt to a Second
Using stunnel to Encrypt to a Second Client
Client, Win32 Specific File daemon Command Line Options
Win32 Specific File daemon Command Line
Client/File daemon Configuration
Client/File daemon Configuration
Clients, Considerations for Multiple
Considerations for Multiple Clients
Clients, Using Bacula to Encrypt Communications to
Using stunnel to Encrypt Communications to Clients
Command Line Arguments
Command Line Arguments
Command, Console Restore
The Restore Command
Command, Restore
The Restore Command
Commands, btape
btape Commands
Commands, File Selection
File Selection Commands
Commands, Other Useful Console
Other Useful Console Commands
Commands, Special At 
Special At (@) Commands
Commands, Special dot
Special dot Commands
Communications Errors
Long running jobs die with Pipe Error
Communications Ports Used
Communications Ports Used
Communications, Using ssh to Secure the
Using ssh to Secure the Communications
Completion, Getting Notified of Job
Getting Notified of Job Completion
Compression
Why aren't my files compressed?
Concrete Example
A Concrete Example
Concurrent Disk Jobs
Concurrent Disk Jobs
Concurrent Jobs
The Director Resource | I'm Getting Authorization Errors. What is Going On? | Running Concurrent Jobs
CONDITIONS, TERMS AND
TERMS AND CONDITIONS | TERMS AND CONDITIONS
Config Files for stunnel to Encrypt the Control Channel
config Files for stunnel to Encrypt the Control Channel
Config Files for stunnel to Encrypt the Data Channel
config Files for stunnel to Encrypt the Data Channel
Configuration, Client/File daemon
Client/File daemon Configuration
Configuration, Monitor
Monitor Configuration
Configuration, Python
Python Configuration
Configuration, Storage Daemon
Storage Daemon Configuration
Configuring the Director
Configuring the Director
Considerations, Bugs and Other
Bugs and Other Considerations
Considerations, Important
Important Considerations
Considerations, Security
Security Considerations
Considerations, Windows Compatibility
Windows Compatibility Considerations
Considerations, Windows NTFS Naming
Windows NTFS Naming Considerations
Console Command, Python
Python Console Command
Console Konfiguration
Console Konfiguration | Console Konfiguration | Console Konfiguration
Console Resource
The Console Resource
Console Restore Command
The Restore Command
Console, Bacula
Bacula Console | Bacula Console
Console-Eintrag
Der Console-Eintrag
Console-Kommandos
Console-Kommandos
Console-Programm, die Konfiguration des
Die Konfiguration des Console-Programms
ConsoleFont Eintrag
Der ConsoleFont-Eintrag
Contents, Table of
Table of Contents | Table of Contents
Converting from MySQL to PostgreSQL
Converting from MySQL to PostgreSQL
Copyrights and Trademarks
Copyrights and Trademarks
Count
Bootstrap-Datei Format
Count, Using bscan to Correct the Volume File
Using bscan to Correct the Volume File Count
Counter Resource
The Counter Resource
Crash, Rejected Volumes After a
Rejected Volumes After a Crash
create pool
Alphabetische Liste der Console-Kommandos
Creating a Bacula Rescue CDROM
Creating a Bacula Rescue CDROM
Creating a Pool
Creating a Pool
Creating a Self-signed Certificate
Creating a Self-signed Certificate | Creating a Self-signed Certificate
Creating Holiday Schedules
Creating Holiday Schedules
Credits
Credits
Critical Items
Critical Items
Critical Items to Implement Before Going Production
Critical Items to Implement Before Going Production
CYGWIN, Windows-Systeme mit installiertem
Windows-Systeme mit installiertem CYGWIN
Dämon-Prozesse, Auto-Start der
Auto-Start der Dämon-Prozesse
Daemon Command Line Options
Daemon Command Line Options
Daemon, Configuring the Storage
Die Konfiguration des Storage-Dämon
Daemons, Starting the
Starting the Daemons
Daily Tape Rotation
Daily Tape Rotation
Daily, Weekly, Monthly Tape Usage Example
A Daily, Weekly, Monthly Tape Usage Example
Das /lib/tls Verzeichnis entfernen
Das /lib/tls Verzeichnis entfernen
Data Encryption
Data Encryption | Data Encryption
Data Spooling
Data Spooling
Data Spooling Directives
Data Spooling Directives
Database, Internal Bacula
Internal Bacula Database
Database, Re-initializing the Catalog
Re-initializing the Catalog Database | Re-initializing the Catalog Database | Re-initializing the Catalog Database
Database, Restoring
Restoring When Things Go Wrong
Database, Starting the
Starting the Database
Datei, automatische Erzeugung der Bootstrap-
automatische Erzeugung der Bootstrap-Datei
Datei, Beispiel Console-Konfiguration
Beispiel Console-Konfigurations-Datei
Datei, Beispiel Konfiguration
eine Beispiel-Konfigurationsdatei
Datei, Bootstrap
Die Bootstrap-Datei
Dateien, Anpassen der Konfigurations
Anpassen der Konfigurations-Dateien
Dateien, Einbinden anderer Konfigurations
Einbinden anderer Konfigurations-Dateien
Datenbank Größe
Datenbank Größe
Datenbank, Komprimieren Ihrer MySQL
Komprimieren Ihrer MySQL Datenbank
Datenbank, Komprimieren Ihrer PostgreSQL
Komprimieren Ihrer PostgreSQL Datenbank
Datenbank, Komprimieren Ihrer SQLite
Komprimieren Ihrer SQLite Datenbank
Datenbank, MySQL-Server Has Gone Away-Fehler
MySQL-Server Has Gone Away-Fehler
Datenbank, MySQL-Tabelle ist voll
MySQL-Tabelle ist voll
Datenbank, Reparatur Ihrer MySQL
Reparatur Ihrer MySQL Datenbank
Datenbank, Reparatur Ihrer PostgreSQL
Reparatur Ihrer PostgreSQL Datenbank
Datenbank, Sichern Ihrer Bacula
Sichern Ihrer Bacula Datenbank
Datenbank, Sicherung der Bacula Datenbank - Sicherheitsaspekte
Sicherheitsaspekte
Datenbank-Leistung
Datenbank-Leistung
Datenbank-Leistung und Indexe
Datenbank-Leistung und Indexe
Datenbanken, Sicherung anderer
Sicherung anderer Datenbanken
Datentypen, grundlegende
grundlegende Datentypen
Dbcheck
dbcheck
Dealing with Firewalls
Dealing with Firewalls
Dealing with Win32 Problems
Dealing with Win32 Problems
Debug Daemon Output
Debug Daemon Output
Debugger, Manually Running Bacula Under The
Manually Running Bacula Under The Debugger
debugging
Alphabetische Liste der Console-Kommandos
debugging Win32
Alphabetische Liste der Console-Kommandos
Decrypting with a Master Key
Decrypting with a Master Key
delete
Alphabetische Liste der Console-Kommandos
Dependency-Packages
Dependency-Packages
Design Limitations or Restrictions
Grenzen und Beschränkungen des Software Design
Design, Overall
Overall Design
detailierte Information für jeden Dienst
detailierte Information für jeden Dienst
Details
The Details
Details of Tape Modes
Details of Tape Modes
Details, Practical
Practical Details | Practical Details
Details, Technical
Technical Details
Device Resource
Device Resource
Device, Bacula Cannot Open the
Bacula Cannot Open the Device
Devices that require a mount (DVD)
Devices that require a mount (DVD)
DHCP, Backing Up Portables Using
Backing Up Portables Using DHCP
Die Bacula Konfiguration
Die Bacula Konfiguration
Die Bacula Konfigurations-Dateien bearbeiten
Die Bacula Konfigurations-Dateien bearbeiten
Die in diesem Dokument verwendeten Konventionen
Die in diesem Dokument verwendeten Konventionen
Die Installation des Tray-Monitors
Die Installation des Tray-Monitors
Die Konfiguration des Directors
Die Konfiguration des Directors
Die Konfiguration des Storage-Dämon
Die Konfiguration des Storage-Dämon
Die Vorteile von Bacula gegenüber anderen Sicherungsprogrammen
Die Vorteile von Bacula gegenüber anderen Sicherungsprogrammen
Dienst, detailierte Information für jeden
detailierte Information für jeden Dienst
Dienste, Bacula Komponenten oder
Bacula Komponenten oder Dienste
Diensten, Interaktionen zwischen den Bacula-
Interaktionen zwischen den Bacula-Diensten
Differential Pool
Differential Pool
Difficulties Connecting from the FD to the SD
Difficulties Connecting from the FD to the SD
Directives, Data Spooling
Data Spooling Directives
Directives, DVD
DVD Specific SD Directives | DVD Specific Director Directives
Directives, Prunning
Prunning Directives
Director Eintrag
Der Director-Eintrag
Director Resource
The Director Resource | Director Resource
Director Resource
The Director Resource | The Director Resource
Director Resource Types
Director Resource Types
Director, Configuring the
Configuring the Director
Director, die Konfiguration des
Die Konfiguration des Directors
Directories
Directories
Directories, Excluding Files and
Excluding Files and Directories
disable
Alphabetische Liste der Console-Kommandos
Disadvantages
Disadvantages | Disadvantages
Disaster Recovery
Disaster Recovery
Disaster Recovery of Win32 Systems
Disaster Recovery of Win32 Systems
Disaster Recovery Using Bacula
Disaster Recovery Using Bacula
Disaster, Preparing Solaris Before a
Preparing Solaris Before a Disaster
Disclaimer
Disclaimer
Disk Volumes
Basic Volume Management
Disk, Automated Backup
Automated Disk Backup
Disk, Putting Multiple Systems on Your CD
Putting Multiple Systems on Your Rescue Disk
Disks, Backing up to Multiple
Backing up to Multiple Disks
Does Bacula support Windows?
Does Bacula support Windows?
Dokument, verwendete Konventionen
Die in diesem Dokument verwendeten Konventionen
Domain, Public
Public Domain
Drive, Using btape to Verify your Tape
Using btape to Verify your Tape Drive
Drive, Using btape to Verify your Tape
Using btape to Verify your Tape Drive
DVD Specific Director Directives
DVD Specific Director Directives
DVD Specific SD Directives
DVD Specific SD Directives
DVD Volumes
DVD Volumes
DVD Writing
DVD Volumes
DVD, Devices that require a mount
Devices that require a mount (DVD)
ein weiteres Beispiel der Bootstrap-Datei
ein weiteres Beispiel der Bootstrap-Datei
Einbinden anderer Konfigurations-Dateien
Einbinden anderer Konfigurations-Dateien
Einen File-Dämon oder Client-Prozess kompilieren
Einen File-Dämon oder Client-Prozess kompilieren
einrichten, von Baculas Konfigurations-Dateien
Baculas Konfigurations-Dateien einrichten
Einschränkungen der aktuellen Implementierung
Einschränkungen der aktuellen Implementierung
Einstellung der Aufbewahrungszeiträume
Einstellung der Aufbewahrungszeiträume
Eintrag, Console
Der Console-Eintrag
Eintrag, ConsoleFont
Der ConsoleFont-Eintrag
Eintrag, Director
Der Director-Eintrag
enable
Alphabetische Liste der Console-Kommandos
Enable VSS
Volume Shadow Copy Service
Encrypting the Control Channel
Encrypting the Control Channel
Encryption
Encryption
Encryption Technical Details
Encryption Technical Details
Encryption, Data
Data Encryption
Encryption, Starting and Testing the Data
Starting and Testing the Data Encryption
Ensuring that the Tape Modes Are Properly Set -- Linux Only
Ensuring that the Tape Modes Are Properly Set -- Linux
Errors, Autochanger
Autochanger Errors
Errors, Restore
Restore Errors
Errors, Syslog
Syslog Errors
estimate
Alphabetische Liste der Console-Kommandos
Events
Bacula Events
Example
An Example
Example Client Configuration File
Example Client Configuration File
Example Data Encryption Configuration
Example Data Encryption Configuration
Example Director Configuration File
Example Director Configuration File
Example Migration Jobs
Example Migration Jobs
Example Restore Job Resource
Example Restore Job Resource
Example, Automatic Pruning and Recycling
Automatic Pruning and Recycling Example
Example, Concrete
A Concrete Example
Example, Daily Weekly Monthly Tape Usage
A Daily, Weekly, Monthly Tape Usage Example
Example, Data Encryption Configuration File
Example Data Encryption Configuration
Example, File Daemon Configuration File
Example Data Encryption Configuration
Example, Python
Python Example
Example, TLS Configuration Files
Example TLS Configuration Files
Example, Verify Configuration
A Verify Configuration Example
Examples
Tips and Suggestions | Examples
Examples, FileSet
FileSet Examples
EXB-8900, Hardware Compression
Hardware Compression on EXB-8900
Exclude Files on Windows Regardless of Case
Exclude Files on Windows Regardless of Case
Excluding Files and Directories
Excluding Files and Directories
Executing Scripts on a Remote Machine
Executing Scripts on a Remote Machine
exit
Alphabetische Liste der Console-Kommandos
Expansion, Variable
Variable Expansion
Extracting From Multiple Volumes
Extracting From Multiple Volumes
Extracting With a Bootstrap File
Extracting With a Bootstrap File
Extracting with Include or Exclude Lists
Extracting with Include or Exclude Lists
FAQ, Bacula® - RPM Packaging
Bacula RPM Packaging FAQ
FDL
FDL
Fenster-Manager, Andere
Andere Fenster-Manager
Festlegen der Slots beim Labeln
Festlegen der Slots beim Labeln
Fiduciary License Agreement
Fiduciary License Agreement
File Selection Commands
File Selection Commands
File, Example Client Configuration
Example Client Configuration File
File, Example Director Configuration
Example Director Configuration File
File, Extracting With a Bootstrap
Extracting With a Bootstrap File
File, Maintaining a Valid Bootstrap
Maintaining a Valid Bootstrap File
File, Sample Storage Daemon Configuration
Sample Storage Daemon Configuration File
File, Specifying a Device Name For a
Specifying a Device Name For a File
File, Specifying a Device Name For a
Specifying a Device Name For a File
File, Specifying the Configuration
Specifying the Configuration File
File-Dämon, die Konfiguration des
Die Konfiguration des File-Dämon
FileIndex
Bootstrap-Datei Format
Filename, Selecting Files by
Selecting Files by Filename
Files, Actual Conf
The Actual Conf Files
Files, Bacula Saves But Cannot Restore
Bacula Saves But Cannot Restore Files
Files, Problems Restoring
Problems Restoring Files
Files, Restoring Your
Restoring Your Files
FileSet Examples
FileSet Examples
FileSet Resource
The FileSet Resource
FileSet, Testing Your
Testing Your FileSet
FileSet, Windows Example
A Windows Example FileSet
FileSets, Windows
Windows FileSets
Filesystems, Backing up ACLs on ext3 or XFS
Backing up ACLs on ext3 or XFS filesystems
Fills, When The Tape
When The Tape Fills
Finding Tape Drives and Autochangers on FreeBSD
Finding your Tape Drives and Autochangers on FreeBSD
Firewall Problems
Firewall Problems
Firewalls, Dealing with
Dealing with Firewalls
Firewalls, Windows
Windows Firewalls
Format, Bootstrap
Bootstrap-Datei Format
Format, Konfigurations-Parameter
Konfigurations-Parameter-Format
Found, What To Do When Differences Are
What To Do When Differences Are Found
FreeBSD
FreeBSD
FreeBSD Bare Metal Recovery
FreeBSD Bare Metal Recovery
FreeBSD Belange
FreeBSD Belange
FreeBSD, Finding Tape Drives and Autochangers
Finding your Tape Drives and Autochangers on FreeBSD
FreeBSD, Tape Modes on
Tape Modes on FreeBSD
FreeBSD-Benutzer, Warnung für
Warnung für FreeBSD-Benutzer!!!
Full Pool
Full Pool
Full Syntax
Full Syntax
Functionality, General
General Functionality
General
General | General
General
General | General | General | General
General Functionality
General Functionality
Generating Private/Public Encryption Keypairs
Generating Private/Public Encryption Keys
Geräte, SCSI
Zuordnung der SCSI Geräte
Geräte-Konfigurations-Parameter
Geräte-Konfigurations-Parameter
Getting a CA Signed Certificate
Getting a CA Signed Certificate | Getting a CA Signed Certificate
Getting A Traceback On Other Systems
Getting A Traceback On Other Systems
Getting Debug Output from Bacula
Getting Debug Output from Bacula
Getting Email Notification to Work
Getting Email Notification to Work
Getting Notified of Job Completion
Getting Notified of Job Completion
Getting Notified that Bacula is Running
Getting Notified that Bacula is Running
GNOME
GNOME
gnome-console
GUI Programs
GNU Free Documentation License
GNU Free Documentation License
GNU General Public License
GNU General Public License | GNU GENERAL PUBLIC LICENSE
GNU Lesser General Public License
GNU Lesser General Public License | GNU LESSER GENERAL PUBLIC LICENSE
Going on Vacation
Going on Vacation
GPL
GPL
Größe, Datenbank
Datenbank Größe
Groß/Kleinschreibung und Leerzeichen
Groß/Kleinschreibung und Leerzeichen
grundlegende Datentypen
grundlegende Datentypen
GUI Programs
GUI Programs
Handling, Total Automation of Bacula Tape
Total Automation of Bacula Tape Handling
Hardware Compression on EXB-8900
Hardware Compression on EXB-8900
Have Patience When Starting the Daemons or Mounting Blank Tapes
Have Patience When Starting the Daemons or Mounting Blank Tapes
Heartbeat Interval
The Client Resource | Storage Resource
help
Alphabetische Liste der Console-Kommandos
How Can I Be Sure that Bacula Really Saves and Restores All Files?
Does Bacula really save and restore all files?
How Can You Claim to Handle Unlimited Path and Filename Lengths when All Other Programs Have Fixed Limits?
Do you really handle unlimited path lengths?
How Does It Work?
How Does It Work?
How to Apply These Terms to Your New Libraries
How to Apply These Terms to Your New Libraries
How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
I am Backing Up an Offsite Machine with an Unreliable Connection. The Director Waits Forever for the Client to Contact the SD. What Can I Do?
I am waiting forever for a backup of an offsite
I Am Not Getting Email Notification, What Can I Do?
I Am Not Getting Email Notification, What Can I Do?
I Cannot Get My Windows Client to Start Automatically?
I Cannot Get My Windows Client to Start Automatically?
I did a Full backup last week, but now in running an Incremental, Bacula says it did not find a FULL backup, so it did a FULL backup. Why?
I want an Incremental but Bacula runs it as a
I didn't realize that the backups were not working on my Windows Client. What should I do?
My backups are not working on my Windows Client. What
I Run a Restore Job and Bacula Hangs. What do I do?
I Run a Restore Job and Bacula Hangs. What do
I'm confused by the different Retention periods: File Retention, Job Retention, Volume Retention. Why are there so many?
I'm confused by retention periods
If I Run Multiple Simultaneous Jobs, How Can I Force One Particular Job to Run After Another Job?
How can I force one job to run after another?
implementiert, Was ist
Was implementiert ist
Important Considerations
Important Considerations
Important Migration Considerations
Important Migration Considerations
Important Note
Important Note
In connecting to my Client, I get ERR:Connection Refused. Packet Size too big from File daemon:192.168.1.4:9102 Why?
I get a Connection refused when connecting to my Client
Incorrect File Number
Incorrect File Number
Incorrect Number of Blocks or Positioning Errors
Incorrect Number of Blocks or Positioning Errors
Incremental backups
Incremental backups are not working
Incremental Pool
Incremental Pool
Installation
Win32 Installation
Installation, von Bacula
Bacula installieren
installieren, Bacula
Bacula installieren
Installing and Configuring MySQL
Installing and Configuring MySQL
Installing and Configuring MySQL -- Phase I
Installing and Configuring MySQL -- Phase I
Installing and Configuring MySQL -- Phase II
Installing and Configuring MySQL -- Phase II
Installing and Configuring PostgreSQL
Installing and Configuring PostgreSQL
Installing and Configuring SQLite
Installing and Configuring SQLite
Installing and Configuring SQLite -- Phase I
Installing and Configuring SQLite -- Phase I
Installing and Configuring SQLite -- Phase II
Installing and Configuring SQLite -- Phase II
Installing MySQL from RPMs
Installing MySQL from RPMs
Installing PostgreSQL from RPMs
Installing PostgreSQL from RPMs
Interacting with the Director to Query or Start Jobs
Interacting with the Director to Query or Start Jobs
Interaktionen zwischen den Bacula-Diensten
Interaktionen zwischen den Bacula-Diensten
Internal Bacula Database
Internal Bacula Database
Is Bacula Stable?
Is Bacula Stable?
Issues, Bacula Security
Bacula Security Issues
Items, Critical
Critical Items
Items, Recommended
Recommended Items
Job
Bootstrap-Datei Format
Job Resource
The Job Resource
Job, Running a
Running a Job
JobDefs Resource
The JobDefs Resource
JobId
Bootstrap-Datei Format
Jobs, Interacting with the Director to Query or Start
Interacting with the Director to Query or Start Jobs
Jobs, Running Concurrent
Running Concurrent Jobs
Jobs, verstehen
Jobs und Zeitpläne verstehen
Kaboom, What To Do When Bacula Crashes
What To Do When Bacula Crashes (Kaboom)
Katalog Verwaltung
Katalog Verwaltung
KDE
KDE
Kerns Konfigurations-Skript
Kerns Konfigurations-Skript
Key Concepts and Resource Records
Key Concepts and Resource Records
Kommandos, alle Parameter des Update Slots
Alle Parameter des Update Slots Kommandos
Kommandos, Alphabetische Liste der Console-
Alphabetische Liste der Console-Kommandos | Alphabetische Liste der Console-Kommandos
Kommandos, Console
Console-Kommandos
Kommentare
Kommentare
Kompilierung, eines File-Dämons oder Client-Prozesses
Einen File-Dämon oder Client-Prozess kompilieren
Kompilierung, Weitere Hinweise zur
Weitere Hinweise zur Kompilierung
Komprimieren Ihrer MySQL Datenbank
Komprimieren Ihrer MySQL Datenbank
Komprimieren Ihrer PostgreSQL Datenbank
Komprimieren Ihrer PostgreSQL Datenbank
Komprimieren Ihrer SQLite Datenbank
Komprimieren Ihrer SQLite Datenbank
Konfiguration des Console-Programms
Die Konfiguration des Console-Programms
Konfiguration des File-Dämon
Die Konfiguration des File-Dämon
Konfiguration des Monitor-Programms
Die Konfiguration des Monitor-Programms
Konfiguration, Console
Console Konfiguration | Console Konfiguration | Console Konfiguration
Konfiguration, Die Bacula
Die Bacula Konfiguration
Konfigurations-Parameter-Format
Konfigurations-Parameter-Format
Konfigurationsdateien, Test der
Test der Konfigurationsdateien
Konfigurationsoptionen
Konfigurationsoptionen
label
Alphabetische Liste der Console-Kommandos | Alphabetische Liste der Console-Kommandos
Labeling Volumes with the Console Program
Labeling Volumes with the Console Program
Labeling Your Volumes
Labeling Your Volumes
Labeling, Automatic Volume
Automatic Volume Labeling
Labeln, Festlegen der Slots
Festlegen der Slots beim Labeln
Labels, Tape
ANSI und IBM Tape Labels
Large file support
Can Bacula Backup and Restore Files Greater than 2 Gigabytes?
Laufwerke, mehrere
mehrere Laufwerke
Leerzeichen, Groß/Kleinschreibung
Groß/Kleinschreibung und Leerzeichen
Leistung, Datenbank
Datenbank-Leistung
Leistung, Datenbank und Indexe
Datenbank-Leistung und Indexe
LGPL
LGPL
Libraries, How to Apply These Terms to Your New
How to Apply These Terms to Your New Libraries
License, GNU Free Documentation
GNU Free Documentation License
License, GNU General Public
GNU General Public License | GNU GENERAL PUBLIC LICENSE
License, GNU Lesser General Public
GNU Lesser General Public License | GNU LESSER GENERAL PUBLIC LICENSE
Licenses, Bacula Copyright Trademark
Bacula Copyright, Trademark, and Licenses
Linking Bacula with MySQL
Linking Bacula with MySQL
Linking Bacula with SQLite
Linking Bacula with SQLite
Linux Problems or Bugs
Linux Problems or Bugs
Linux SCSI Tricks
Linux SCSI Tricks
list
Alphabetische Liste der Console-Kommandos
Listing Blocks with bls
Listing Blocks
Listing Jobs with bls
Listing Jobs
Lists, Extracting with Include or Exclude
Extracting with Include or Exclude Lists
LiveCD, Bare Metal Recovery using a LiveCD
Bare Metal Recovery using a LiveCD
llist
Alphabetische Liste der Console-Kommandos
Log Rotation
Log Rotation
Log Watch
Log Watch
Machine, Executing Scripts on a Remote
Executing Scripts on a Remote Machine
Magazine, Arbeiten mit mehreren
Arbeiten mit mehreren Magazinen
Maintaining a Valid Bootstrap File
Maintaining a Valid Bootstrap File
Making Bacula Use a Single Tape
Making Bacula Use a Single Tape
Management, Basic Volume
Basic Volume Management
Manually Changing Tapes
Manually Changing Tapes
Manually Recycling Volumes
Manually Recycling Volumes
Manually resetting the Permissions
Manually resetting the Permissions
Manually Running Bacula Under The Debugger
Manually Running Bacula Under The Debugger
mehrere Laufwerke
mehrere Laufwerke
Message Resource
The Message Resource
messages
Alphabetische Liste der Console-Kommandos
Messages Resource
The Messages Resource | Messages Resource
Messages Resource
Messages Resource | The Messages Resource
Migration
Migration
Migration von SQLite zu MySQL
Migration von SQLite zu MySQL
Mit Bacula beginnen
Mit Bacula beginnen
Modes, Details
Details of Tape Modes
Modes, Tape Blocking
Tape Blocking Modes
Modification of bacula-dir.conf for the Control Channel
Modification of bacula-dir.conf for the Control Channel
Modification of bacula-dir.conf for the Data Channel
Modification of bacula-dir.conf for the Data Channel
Monitor Configuration
Monitor Configuration
Monitor Resource
The Monitor Resource
Monitor-Programm, die Konfiguration des
Die Konfiguration des Monitor-Programms
mount
Alphabetische Liste der Console-Kommandos
Multiple Clients
Considerations for Multiple Clients
Multiple manuals
Why is Your Online Document for Version 1.37 but the
My Catalog is Full of Test Runs, How Can I Start Over?
My Catalog is Full of Test Runs, How Can I
My Windows Client Immediately Dies When I Start It
My Windows Client Immediately Dies When I Start It
MySQL, Installing and Configuring
Installing and Configuring MySQL
MySQL, Installing from RPMs
Installing MySQL from RPMs
MySQL, Linking Bacula with
Linking Bacula with MySQL
MySQL, Migration von SQLite zu
Migration von SQLite zu MySQL
MySQL-Server Has Gone Away-Fehler
MySQL-Server Has Gone Away-Fehler
MySQL-Tabelle ist voll
MySQL-Tabelle ist voll
Namen, Passwörter und Autorisation
Namen, Passwörter und Autorisation
nicht ist, Was Bacula
Was Bacula nicht ist
Nicht unterstützte Bandlaufwerke
Nicht unterstützte Bandlaufwerke
Note, Important
Important Note
Number, Incorrect File
Incorrect File Number
Objects, Python
Python Objects
On what machines does Bacula run?
On what machines does Bacula run?
Optionen, der Konfiguration
Konfigurationsoptionen
Optionen, die wir für die meisten Systeme empfehlen
Optionen, die wir für die meisten Systeme empfehlen
Options, bcopy Command
bcopy Command Options
Options, Daemon Command Line
Daemon Command Line Options
Other Points
Other Points | Other Points
Other Programs
Other Programs
Other Useful Console Commands
Other Useful Console Commands
Output, Debug Daemon
Debug Daemon Output
Overall Design
Overall Design
Packages, Dependency
Dependency-Packages
Parameter, Geräte-Konfiguration
Geräte-Konfigurations-Parameter
Passwörter
Namen, Passwörter und Autorisation
Permissions, Manually resetting the
Manually resetting the Permissions
Phase I, Installing and Configuring MySQL --
Installing and Configuring MySQL -- Phase I
Phase I, Installing and Configuring SQLite --
Installing and Configuring SQLite -- Phase I
Phase II, Installing and Configuring MySQL --
Installing and Configuring MySQL -- Phase II
Phase II, Installing and Configuring SQLite --
Installing and Configuring SQLite -- Phase II
Picture
A Picture
Pipe Errors
Long running jobs die with Pipe Error
Points, Other
Other Points | Other Points
Pool changes
My retention periods don't work
Pool Options to Limit the Volume Usage
Pool Options to Limit the Volume Usage
Pool Resource
The Pool Resource
Pool, Adding Volumes to a
Adding Volumes to a Pool
Pool, Creating a
Creating a Pool
Pool, Differential
Differential Pool
Pool, Full
Full Pool
Pool, Incremental
Incremental Pool
Pools, Volumes und Labels verstehen
Pools, Volumes und Labels verstehen
Post Win32 Installation
Post Win32 Installation
PostgreSQL, Configuring PostgreSQL --
Configuring PostgreSQL
PostgreSQL, Converting from MySQL to
Converting from MySQL to PostgreSQL
PostgreSQL, Installing
Installing PostgreSQL
PostgreSQL, Installing and Configuring
Installing and Configuring PostgreSQL
PostgreSQL, Installing from RPMs
Installing PostgreSQL from RPMs
Practical Details
Practical Details | Practical Details
Preamble
Preamble | Preamble
Preparation for a Bare Metal Recovery
Preparation for a Bare Metal Recovery
Preparing Solaris Before a Disaster
Preparing Solaris Before a Disaster
Problem
The Problem
Problems Restoring Files
Problems Restoring Files
Problems When no Tape in Drive
Problems When no Tape in Drive
Problems, Firewalls
Firewall Problems
Problems, Tips for Resolving
Tips for Resolving Problems
Problems, VSS
VSS Problems
Problems, Windows Backup
Windows Restore Problems
Problems, Windows Ownership and Permissions
Windows Ownership and Permissions Problems
Problems, Windows Restore
Windows Restore Problems
Production, Critical Items to Implement Before Going
Critical Items to Implement Before Going Production
Program, Labeling Volumes with the Console
Labeling Volumes with the Console Program
Program, Quitting the Console
Quitting the Console Program
Programm, Beenden des Console-
Beenden des Console-Programs | Beenden des Console-Programs
Programm, Benutzung des Console-
Benutzung des Console-Programms
Programm, Benutzungs des Console-
Benutzung des Console-Programms
Programs, GUI
GUI Programs
Programs, How to Apply These Terms to Your New
How to Apply These Terms to Your New Programs
Programs, Other
Other Programs
Projects, Bacula
Bacula Projects
prune
Alphabetische Liste der Console-Kommandos
Pruning, Automatic
Automatic Pruning
Prunning Directives
Prunning Directives
Public Domain
Public Domain
purge
Alphabetische Liste der Console-Kommandos
Putting Multiple Systems on Your Rescue Disk
Putting Multiple Systems on Your Rescue Disk
python
Alphabetische Liste der Console-Kommandos
Python Configuration
Python Configuration
Python Console Command
Python Console Command
Python Example
Python Example
Python Objects
Python Objects
Python Scripting
Python Scripting
Quellcode, Kompilation von Bacula aus dem
Bacula aus dem Quellcode kompilieren
query
Alphabetische Liste der Console-Kommandos
Questions, Bacula Frequently Asked
Bacula Frequently Asked Questions
Quick Start
Quick Start | Quick Start
quit
Alphabetische Liste der Console-Kommandos
Quitting the Console Program
Quitting the Console Program
Re-initializing the Catalog Database
Re-initializing the Catalog Database | Re-initializing the Catalog Database | Re-initializing the Catalog Database
Recommended Items
Recommended Items
Record, Sample Director's Console
Sample Director's Console record.
Record, Sample File daemon's Director
Sample File daemon's Director record.
Record, Sample Storage daemon's Director
Sample Storage daemon's Director record.
Records, Key Concepts and Resource
Key Concepts and Resource Records
Recovering Files Written With Fixed Block Sizes
Recovering Files Written With Fixed Block Sizes
Recovery, Bare Metal Recovery using a LiveCD
Bare Metal Recovery using a LiveCD
Recovery, Disaster
Disaster Recovery
Recovery, Disaster Recovery
Disaster Recovery Using Bacula
Recovery, FreeBSD Bare Metal
FreeBSD Bare Metal Recovery
Recovery, Preparation for a Bare Metal
Preparation for a Bare Metal Recovery
Recovery, Solaris Bare Metal
Solaris Bare Metal Recovery
Recovery, Windows Disaster
Windows Disaster Recovery
Recycle Status
Recycle Status
Recycling
My retention periods don't work
Recycling Algorithm
Recycling Algorithm
Recycling All Your Volumes
Recycling All Your Volumes
Recycling, Automatic Volume
Automatic Volume Recycling
Recycling, Restricting the Number of Volumes and
Restricting the Number of Volumes and Recycling
RedHat
RedHat
Rejected Volumes After a Crash
Rejected Volumes After a Crash
relabel
Alphabetische Liste der Console-Kommandos | Alphabetische Liste der Console-Kommandos | Alphabetische Liste der Console-Kommandos | Alphabetische Liste der Console-Kommandos
release
Alphabetische Liste der Console-Kommandos
Release Files
Source Release Files
reload
Alphabetische Liste der Console-Kommandos
Reparatur Ihrer MySQL Datenbank
Reparatur Ihrer MySQL Datenbank
Reparatur Ihrer PostgreSQL Datenbank
Reparatur Ihrer PostgreSQL Datenbank
Requirements
Requirements
Rescue, Bare Metal Recovery using a LiveCD
Bare Metal Recovery using a LiveCD
Rescue, Disaster Recovery
Disaster Recovery Using Bacula
Rescue, FreeBSD Bare Metal
FreeBSD Bare Metal Recovery
Resetting Directory and File Ownership and Permissions on Win32 Systems
Ownership and Permissions on Win32 Systems
Resource, Catalog
The Catalog Resource
Resource, Client
The Client Resource
Resource, Client
The Client Resource | The Client Resource
Resource, Console
The Console Resource
Resource, Counter
The Counter Resource
Resource, Device
Device Resource
Resource, Director
The Director Resource | Director Resource
Resource, Director
The Director Resource | The Director Resource
Resource, Example Restore Job
Example Restore Job Resource
Resource, FileSet
The FileSet Resource
Resource, Job
The Job Resource
Resource, JobDefs
The JobDefs Resource
Resource, Message
The Message Resource
Resource, Messages
The Messages Resource | Messages Resource
Resource, Messages
Messages Resource | The Messages Resource
Resource, Monitor
The Monitor Resource
Resource, Pool
The Pool Resource
Resource, Schedule
The Schedule Resource
Resource, Storage
The Storage Resource | Storage Resource
Resource, Storage
The Storage Resource
Resources, Additional
Additional Resources
Ressource Typen
Ressource Typen
restore
Alphabetische Liste der Console-Kommandos
Restore Command
The Restore Command
Restore Directories
The Restore Command
Restore Errors
Restore Errors
Restoring a Client System
Restoring a Client System
Restoring a Server
Restoring a Server
Restoring Directory Attributes
Restoring Directory Attributes
Restoring Files Can Be Slow
Restoring Files Can Be Slow
Restoring on Windows
Restoring on Windows
Restoring to a Running System
Restoring to a Running System
Restoring When Things Go Wrong
Restoring When Things Go Wrong
Restoring Your Database
Restoring When Things Go Wrong
Restoring Your Files
Restoring Your Files
Restricting the Number of Volumes and Recycling
Restricting the Number of Volumes and Recycling
Restrictions, Design Limitations or
Grenzen und Beschränkungen des Software Design
Retention Periods
My retention periods don't work
Rotation, Daily Tape
Daily Tape Rotation
Rotation, Log
Log Rotation
RPM Install Problems
RPM Install Problems
run
Alphabetische Liste der Console-Kommandos
Running a Job
Running a Job
Running as non-root
Running as non-root
Running Concurrent Jobs
Running Concurrent Jobs
Running the Console Program from a Shell Script
Running the Console from a Shell Script
Running the Verify
Running the Verify
Running, Getting Notified that Bacula is
Getting Notified that Bacula is Running
Sample Director's Console record.
Sample Director's Console record.
Sample File daemon's Director record.
Sample File daemon's Director record.
Sample Storage Daemon Configuration File
Sample Storage Daemon Configuration File
Sample Storage daemon's Director record.
Sample Storage daemon's Director record.
Sample Tray Monitor configuration
Sample Tray Monitor configuration
Schedule problems
All my Jobs are scheduled for the same time. Will
Schedule Resource
The Schedule Resource
Schedules, Creating Holiday
Creating Holiday Schedules
Schedules, Technical Notes on
Technical Notes on Schedules
Schlüsselwörter, Alphabetische Liste der Console
Alphabetische Liste der Console-Schlüsselwörter | Alphabetische Liste der Console-Schlüsselwörter
Schnittstelle, Bacula Autochanger
Bacula Autochanger Schnittstelle
Scratch Pool
The Scratch Pool
Script, Running the Console Program from a Shell
Running the Console from a Shell Script
Scripte, Beispiel
Beispiel Scripte
Scripting, Python
Python Scripting
SCSI Geräte
Zuordnung der SCSI Geräte
SD, Difficulties Connecting from the FD to the
Difficulties Connecting from the FD to the SD
Securing the Data Channel
Securing the Data Channel
Security Considerations
Security Considerations
Security, Using Bacula to Improve Computer
Using Bacula to Improve Computer Security
Selecting Files by Filename
Selecting Files by Filename
Semantics
Semantics
Server, Restoring a
Restoring a Server
setdebug
Alphabetische Liste der Console-Kommandos | Alphabetische Liste der Console-Kommandos
show
Alphabetische Liste der Console-Kommandos | Alphabetische Liste der Console-Kommandos
Shutting down Windows Systems
Shutting down Windows Systems
Sichern Ihrer Bacula Datenbank
Sichern Ihrer Bacula Datenbank
Sicherung anderer Datenbanken
Sicherung anderer Datenbanken
Sicherung der Bacula Datenbank - Sicherheitsaspekte
Sicherheitsaspekte
Sicherungsprogrammen, Die Vorteile von Bacula gegenüber anderen
Die Vorteile von Bacula gegenüber anderen Sicherungsprogrammen
Simple One Tape Backup
Simple One Tape Backup
Simulieren von Barcodes im Autochanger
Simulieren von Barcodes im Autochanger
Simultaneous Jobs
The Director Resource
Size, Tape Hardware Compression and Blocking Size
Tape Hardware Compression and Blocking Size
Skript, Kerns Konfigurations
Kerns Konfigurations-Skript
Slot
Bootstrap-Datei Format
Slots
Slots
Slow, Restoring Files Can Be
Restoring Files Can Be Slow
Solaris
Solaris
Solaris Bare Metal Recovery
Solaris Bare Metal Recovery
Solution
The Solution
Source Files
Source Release Files
) Commands
Special At (@) Commands
Special dot Commands
Special dot Commands
Specifying a Device Name For a File
Specifying a Device Name For a File
Specifying a Device Name For a File
Specifying a Device Name For a File
Specifying a Device Name For a Tape
Specifying a Device Name For a Tape
Specifying a Device Name For a Tape
Specifying a Device Name For a Tape
Specifying the Configuration File
Specifying the Configuration File
Specifying the Configuration File
Specifying the Configuration File
Specifying Volumes
Specifying Volumes
Spezifikationen, Band-
Band-Spezifikationen
Spooling, Data
Data Spooling
SQLite, Installing and Configuring
Installing and Configuring SQLite
SQLite, Linking Bacula with
Linking Bacula with SQLite
SQLite, Testing
Testing SQLite
sqlquery
Alphabetische Liste der Console-Kommandos
Start, Quick
Quick Start | Quick Start
Starting and Testing the Control Channel
Starting and Testing the Control Channel
Starting and Testing the Data Encryption
Starting and Testing the Data Encryption
Starting the Daemons
Starting the Daemons
Starting the Database
Starting the Database
State, Backing Up the WinNT/XP/2K System
Backing Up the WinNT/XP/2K System State
status
Alphabetische Liste der Console-Kommandos
Status, Recycle
Recycle Status
Steps to Take Before Disaster Strikes
Steps to Take Before Disaster Strikes
Storage Daemon Configuration
Storage Daemon Configuration
Storage Resource
The Storage Resource | Storage Resource
Storage Resource
The Storage Resource
Strategies, Backup
Backup Strategies
Stream
Bootstrap-Datei Format
Strikes, Steps to Take Before Disaster
Steps to Take Before Disaster Strikes
Suggestions, Tips and
Tips and Suggestions
Supported Autochanger Models
Supported Autochanger Models
Syntax, Full
Full Syntax
Syslog Errors
Syslog Errors
System, Restoring a Client
Restoring a Client System
System, Restoring to a Running
Restoring to a Running System
Systeme, Empfohlenen Optionen für die meisten
Optionen, die wir für die meisten Systeme empfehlen
Systems, Alternate Disaster Recovery Suggestion for Win32
Alternate Disaster Recovery Suggestion for Win32 Systems
Systems, Disaster Recovery of Win32
Disaster Recovery of Win32 Systems
Systems, Getting A Traceback On Other
Getting A Traceback On Other Systems
Systems, Resetting Directory and File Ownership and Permissions on Win32
Ownership and Permissions on Win32 Systems
Systems, Shutting down Windows
Shutting down Windows Systems
Systems, Using the OnStream driver on Linux
Using the OnStream driver on Linux Systems
Systemvoraussetzungen
Systemvoraussetzungen
Table of Contents
Table of Contents | Table of Contents
Tape Blocking Modes
Tape Blocking Modes
Tape capacity
Why aren't my files compressed?
Tape Hardware Compression and Blocking Size
Tape Hardware Compression and Blocking Size
Tape Modes on FreeBSD
Tape Modes on FreeBSD
Tape, Making Bacula Use a Single
Making Bacula Use a Single Tape
Tape, Specifying a Device Name For a
Specifying a Device Name For a Tape
Tape, Specifying a Device Name For a
Specifying a Device Name For a Tape
Tape, Using btape to Simulate Filling
Using btape to Simulate Filling a Tape
Tapes, Have Patience When Starting the Daemons or Mounting Blank
Have Patience When Starting the Daemons or Mounting Blank Tapes
Tapes, Manually Changing
Manually Changing Tapes
Tapewechsel
Tape-Wechsel
Technical Details
Technical Details
Technical Notes on Schedules
Technical Notes on Schedules
Terminologie
Terminologie
TERMS AND CONDITIONS
TERMS AND CONDITIONS | TERMS AND CONDITIONS
Test der Kompatibilität von Bacula mit Ihrem Bandlaufwerk
Test der Kompatibilität von Bacula mit Ihrem Bandlaufwerk
Test der Konfigurationsdateien
Test der Konfigurationsdateien
Testfind
testfind
Testing SQLite
Testing SQLite
Testing The Traceback
Testing The Traceback
Testing Your FileSet
Testing Your FileSet
Testing Your Tape Drive With Bacula
Testing Your Tape Drive With Bacula
Testing, Incorrect Number of Blocks or Positioning Errors
Incorrect Number of Blocks or Positioning Errors
Thanks
Thanks
Tips and Suggestions
Tips and Suggestions
Tips for Resolving Problems
Tips for Resolving Problems
TLS
Bacula TLS
TLS Configuration Files
Example TLS Configuration Files
Tools, Volume Utility
Volume Utility Tools
Total Automation of Bacula Tape Handling
Total Automation of Bacula Tape Handling
Traceback
Traceback
Traceback, Testing The
Testing The Traceback
Trademark
Trademark
Trademarks, Copyrights and
Copyrights and Trademarks
Tray Monitor Security
Tray Monitor Security
tray-monitor
GUI Programs
Tray-Monitors, Die Installation des
Die Installation des Tray-Monitors
Tricks, Linux SCSI
Linux SCSI Tricks
Tutorial, Brief
A Brief Tutorial
Typen, Ressource
Ressource Typen
Types, Director Resource
Director Resource Types
Unicode
Considerations for Filename Specifications
Uninstalling Bacula on Win32
Uninstalling Bacula on Win32
unmount
Alphabetische Liste der Console-Kommandos
Unterstützte Autochanger
Unterstützte Autochanger
Unterstützte Bandlaufwerke
Unterstützte Bandlaufwerke
Unterstützte Betriebssysteme
Unterstützte Betriebssysteme | Unterstützte Betriebssysteme
Unterstützung, Autochanger
Autochanger Unterstützung
Unterstützung, Barcode
Barcode Unterstützung
update
Alphabetische Liste der Console-Kommandos
Upgrade
Bacula upgraden
Upgrading
Upgrading Bacula Versions | Win32 Installation | Creating a Bacula Rescue CDROM | Installing and Configuring PostgreSQL | Upgrading PostgreSQL
Upgrading Bacula Versions
Upgrading Bacula Versions
Upgrading MySQL
Upgrading MySQL
Upgrading PostgreSQL
Upgrading PostgreSQL
Upgrading, MySQL
Upgrading MySQL
Upgrading, PostgreSQL
Upgrading PostgreSQL
Usage, Pool Options to Limit the Volume
Pool Options to Limit the Volume Usage
Usage, Windows Port
Windows Port Usage
use
Alphabetische Liste der Console-Kommandos
Use it, Bacula internal database is no longer supported please do not
The Bacula internal database is no longer supported, please do
Used, Communications Ports
Communications Ports Used
Using Bacula to Encrypt Communications to Clients
Using stunnel to Encrypt Communications to Clients
Using Bacula to Improve Computer Security
Using Bacula to Improve Computer Security
Using bscan to Compare a Volume to an existing Catalog
Using bscan to Compare a Volume to an existing Catalog
Using bscan to Correct the Volume File Count
Using bscan to Correct the Volume File Count
Using bscan to Recreate a Catalog from a Volume
Using bscan to Recreate a Catalog from a Volume
Using btape to Simulate Filling a Tape
Using btape to Simulate Filling a Tape
Using btape to Verify your Tape Drive
Using btape to Verify your Tape Drive
Using btape to Verify your Tape Drive
Using btape to Verify your Tape Drive
Using File Relocation
Using File Relocation
Using Pools to Manage Volumes
Automated Disk Backup
Using ssh to Secure the Communications
Using ssh to Secure the Communications
Using stunnel to Encrypt to a Second Client
Using stunnel to Encrypt to a Second Client
Using the OnStream driver on Linux Systems
Using the OnStream driver on Linux Systems
Vacation, Going on
Going on Vacation
var name
Alphabetische Liste der Console-Kommandos
Variable Expansion
Variable Expansion
Variables, Bacula
Bacula Variables
Verify Configuration Example
A Verify Configuration Example
Verify, Running the
Running the Verify
version
Alphabetische Liste der Console-Kommandos
Versions, Upgrading Bacula
Upgrading Bacula Versions
Verstehen, von Pools, Volumes und Labels
Pools, Volumes und Labels verstehen
Verwaltung, Katalog
Katalog Verwaltung
verwenden, Welches Datenbanksystem
Welches Datenbanksystem soll verwendet werden?
VolBlock
Bootstrap-Datei Format
VolFile
Bootstrap-Datei Format
VolSessionId
Bootstrap-Datei Format
VolSessionTime
Bootstrap-Datei Format
Volume
Bootstrap-Datei Format
Volume Shadow Copy Service
Volume Shadow Copy Service
Volume Utility Tools
Volume Utility Tools
Volume, Using bscan to Recreate a Catalog from a
Using bscan to Recreate a Catalog from a Volume
Volumes, DVD
DVD Volumes
Volumes, Extracting From Multiple
Extracting From Multiple Volumes
Volumes, Labeling Your
Labeling Your Volumes
Volumes, Manually Recycling
Manually Recycling Volumes
Volumes, Recycling All Your
Recycling All Your Volumes
Volumes, Specifying
Specifying Volumes
Volumes, Using Pools to Manage
Automated Disk Backup
Voraussetzungen, des System
Systemvoraussetzungen
VSS
Volume Shadow Copy Service
VSS Problems
VSS Problems
wait
Alphabetische Liste der Console-Kommandos
WARNING, MAJOR
!!! MAJOR WARNING !!!
Warnung für FreeBSD-Benutzer, , ,
Warnung für FreeBSD-Benutzer!!!
Was Bacula nicht ist
Was Bacula nicht ist
Was implementiert ist
Was implementiert ist
Was ist Bacula?
Was ist Bacula?
Watch, Log
Log Watch
Weitere Hinweise zur Kompilierung
Weitere Hinweise zur Kompilierung
Welches Datenbanksystem soll verwendet werden?
Welches Datenbanksystem soll verwendet werden?
Wer benötigt Bacula?
Wer benötigt Bacula?
What is Bacula?
What is Bacula?
What Is the Really Unique Feature of Bacula?
What Is the Really Unique Feature of Bacula?
What language is Bacula written in?
What language is Bacula written in?
What tape to mount
How to I tell the Job which Volume to use?
What To Do When Bacula Crashes (Kaboom)
What To Do When Bacula Crashes (Kaboom)
What To Do When Differences Are Found
What To Do When Differences Are Found
When I ssh into a machine and start Bacula then attempt to exit, ssh hangs forever.
SSH hangs forever after starting Bacula
When I Start the Console, the Error Messages Fly By. How can I see them?
My Windows Client Immediately Dies When I Start It
When The Tape Fills
When The Tape Fills
Why Does Bacula Ignore the MaxVolumeSize Set in my Pool?
MaxVolumeSize is ignored
Win32
Win32
Win32 Path Length Restriction
Considerations for Filename Specifications
Win32 Specific File daemon Command Line Options
Win32 Specific File daemon Command Line
Win32, Dealing with Problems
Dealing with Win32 Problems
Win32, Installation
Win32 Installation
Win32, Post Installation
Post Win32 Installation
Win32, Uninstalling Bacula
Uninstalling Bacula on Win32
Windows Backup Problems
Windows Restore Problems
Windows Compatibility Considerations
Windows Compatibility Considerations
Windows Disaster Recovery
Windows Disaster Recovery
Windows Example FileSet
A Windows Example FileSet
Windows FileSets
Windows FileSets
Windows Firewalls
Windows Firewalls
Windows NTFS Naming Considerations
Windows NTFS Naming Considerations
Windows Ownership and Permissions Problems
Windows Ownership and Permissions Problems
Windows Port Usage
Windows Port Usage
Windows Restore Problems
Windows Restore Problems
Windows Version of Bacula
The Windows Version of Bacula
Windows, Considerations for Filename Specifications
Considerations for Filename Specifications
Windows, debugging
Alphabetische Liste der Console-Kommandos
Windows, Restoring on
Restoring on Windows
Windows-Systeme mit installiertem CYGWIN
Windows-Systeme mit installiertem CYGWIN
Work, Getting Email Notification to
Getting Email Notification to Work
Work, How Does It
How Does It Work?
Writing DVDs
DVD Volumes
wx-console
GUI Programs
Zeichensätze
Zeichensätze
Zeitpläne, verstehen
Jobs und Zeitpläne verstehen
Zeiträume, Einstellung der Aufbewahrungs-
Einstellung der Aufbewahrungszeiträume
Zuordnung der SCSI Geräte
Zuordnung der SCSI Geräte

Director Index

*Priority
The Client Resource
*WrapCounter
The Counter Resource
a name
The Job Resource
aclsupport
Character Sets
Address
Der Director-Eintrag
Address
The Client Resource | The Storage Resource
Admin
The Job Resource
always
The Job Resource
append
The Messages Resource
Autochanger
The Storage Resource
AutoPrune
The Client Resource | The Pool Resource
AutoPrune
Einstellung der Aufbewahrungszeiträume
Backup
The Job Resource
Bootstrap
The Job Resource
Catalog
The Job Resource | The Catalog Resource
Catalog
The Client Resource | The Counter Resource
Catalog Files
The Pool Resource
CatalogACL
The Console Resource
checkfilechanges
Character Sets
Cleaning Prefix
The Pool Resource
Client
The Job Resource
Client (or FileDaemon)
The Client Resource
Client Run After Job
The Job Resource
Client Run Before Job
The Job Resource
ClientACL
The Console Resource
Clone a Job
The Job Resource
CommandACL
The Console Resource
compression
Character Sets
count
File Selection Commands
Counter
The Counter Resource
Counters
Bacula Variables
days
grundlegende Datentypen
DB Address
The Catalog Resource
DB Name
The Catalog Resource
DB Port
The Catalog Resource
DB Socket
The Catalog Resource
Description
The Director Resource
destination
The Messages Resource | The Messages Resource
Device
The Storage Resource
Differential
The Job Resource
Differential Backup Pool
The Job Resource
Differential Max Wait Time
The Job Resource
DifferentialPool
The Schedule Resource
dir
File Selection Commands
DirAddress
The Director Resource
DirAddresses
The Director Resource
Directive, aclsupport
Character Sets
Directive, checkfilechanges
Character Sets
Directive, compression
Character Sets
Directive, Enable VSS
Character Sets
Directive, Exclude
Character Sets | Character Sets
Directive, FileSet
Character Sets
Directive, fstype
Character Sets
Directive, hardlinks
Character Sets
Directive, hfsplussupport
Character Sets
Directive, ignore case
Character Sets
Directive, Ignore FileSet Changes
Character Sets
Directive, Include
Character Sets
Directive, keepatime
Character Sets
Directive, mtimeonly
Character Sets
Directive, Name
Character Sets
Directive, noatime
Character Sets
Directive, onefs
Character Sets
Directive, portable
Character Sets
Directive, readfifo
Character Sets
Directive, recurse
Character Sets
Directive, regex
Character Sets
Directive, regexdir
Character Sets
Directive, regexfile
Character Sets
Directive, signature
Character Sets | Character Sets
Directive, sparse
Character Sets
Directive, strippath
Character Sets
Directive, verify
Character Sets
Directive, wild
Character Sets
Directive, wilddir
Character Sets
Directive, wildfile
Character Sets
Director
The Director Resource
director
The Messages Resource
directory
grundlegende Datentypen
DIRPort
Der Director-Eintrag
DIRport
The Director Resource
DiskToCatalog
The Job Resource
done
File Selection Commands
Enable VSS
Character Sets | Volume Shadow Copy Service
Environment Variables
Bacula Variables
estimate
File Selection Commands
exclude
Character Sets
Exclude { <file-list> }
Character Sets
Exit Status
The Job Resource
FD Connect Timeout
The Director Resource
FD Port
The Client Resource
file
The Messages Resource
File Retention
The Client Resource
File Retention
Einstellung der Aufbewahrungszeiträume
FileSet
Character Sets
FileSet
The Job Resource
FileSetACL
The Console Resource
find
File Selection Commands
fstype
Character Sets
Full
The Job Resource
Full Backup Pool
The Job Resource
FullPool
The Schedule Resource
hardlinks
Character Sets
hfsplussupport
Character Sets
hours
grundlegende Datentypen
ifnewer
The Job Resource
ifolder
The Job Resource
ignore case
Character Sets
Ignore FileSet Changes
Character Sets
Include { [ Options {<file-options>} ...] <file-list> }
Character Sets
Incremental
The Job Resource
Incremental Backup Pool
The Job Resource
Incremental Max Wait Time
The Job Resource
IncrementalPool
The Schedule Resource
InitCatalog
The Job Resource
integer
grundlegende Datentypen
Internal Variables
Bacula Variables
Job
The Job Resource
Job Retention
The Client Resource
Job Retention
Einstellung der Aufbewahrungszeiträume
JobACL
The Console Resource
JobDefs
The Job Resource
JobStart
Python Objects
keepatime
Character Sets
Label Format
The Pool Resource
Level
The Schedule Resource | The Schedule Resource
Level
The Job Resource
long integer
grundlegende Datentypen
MailCommand
The Messages Resource
mark
File Selection Commands
Max Run Time
The Job Resource
Max Start Delay
The Job Resource
Max Wait Time
The Job Resource
Maximum
The Counter Resource
Maximum Concurrent Jobs
The Director Resource | The Job Resource | The Client Resource | The Storage Resource
Maximum Volume Bytes
The Pool Resource
Maximum Volume Files
The Pool Resource
Maximum Volume Jobs
The Pool Resource
Maximum Volumes
The Pool Resource
MD5
Character Sets
Media Type
The Storage Resource
Messages
The Schedule Resource
Messages
The Director Resource | The Job Resource | The Messages Resource
Minimum
The Counter Resource
minutes
grundlegende Datentypen
months
grundlegende Datentypen
mount
The Messages Resource
mtimeonly
Character Sets
Name
Character Sets
Name
The Director Resource | The Job Resource | The Schedule Resource | The Client Resource | The Storage Resource | The Pool Resource | The Catalog Resource | The Console Resource | The Counter Resource
Name
The Messages Resource
never
The Job Resource
noatime
Character Sets
onefs
Character Sets
Options { <file-options> }
Character Sets
password
grundlegende Datentypen | The Storage Resource | Der Director-Eintrag
Password
The Director Resource | The Client Resource | The Catalog Resource | The Console Resource
Pid Directory
The Director Resource
Pool
The Schedule Resource | The Pool Resource
Pool
The Job Resource
Pool Type
The Pool Resource
PoolACL
The Console Resource
portable
Character Sets
positive integer
grundlegende Datentypen
Prefer Mounted Volumes
The Job Resource
Prefix Links
The Job Resource
Priority
The Job Resource
Prune Files
The Job Resource
Prune Jobs
The Job Resource
Prune Volumes
The Job Resource
Purge Oldest Volume
The Pool Resource
pwd
File Selection Commands
quarters
grundlegende Datentypen
QueryFile
The Director Resource
readfifo
Character Sets
recurse
Character Sets
Recycle
The Pool Resource
Recycle Current Volume
The Pool Resource
Recycle Oldest Volume
The Pool Resource
regex
Character Sets
regexdir
Character Sets
regexfile
Character Sets
Replace
The Job Resource
Rerun Failed Levels
The Job Resource
Reschedule Interval
The Job Resource
Reschedule On Error
The Job Resource
Reschedule Times
The Job Resource
Restore
The Job Resource
restored
The Messages Resource
Run
The Schedule Resource
Run After Job
The Job Resource
Run Before Job
The Job Resource
Run directive
The Job Resource
Schedule
The Schedule Resource
Schedule
The Job Resource
ScheduleACL
The Console Resource
Scripts Directory
The Director Resource
SD Connect Timeout
The Director Resource
SD Port
The Storage Resource
seconds
grundlegende Datentypen
SHA1
Character Sets
signature
Character Sets | Character Sets
size
grundlegende Datentypen
sparse
Character Sets
Spool Attributes
The Job Resource
Spool Data
The Job Resource
SpoolData
The Schedule Resource
Storage
The Schedule Resource | The Storage Resource
Storage
The Job Resource
StorageACL
The Console Resource
strippath
Character Sets
time
grundlegende Datentypen
Type
The Job Resource
unmark
File Selection Commands
Use Volume Once
The Pool Resource
user
The Catalog Resource
Verify
The Job Resource | Character Sets
Verify Job
The Job Resource
Volume Retention
The Pool Resource
Volume Use Duration
The Pool Resource
VolumeToCatalog
The Job Resource
weeks
grundlegende Datentypen
Where
The Job Resource
wild
Character Sets
wilddir
Character Sets
wildfile
Character Sets
Working Directory
The Director Resource
Write Part After Job
The Job Resource | DVD Specific Director Directives
WritePartAfterJob
The Schedule Resource
years
grundlegende Datentypen
yes or no
grundlegende Datentypen

File Daemon Index

<destination>
The Messages Resource
*Archive
Terminologie
*security
The Messages Resource
*Update
Terminologie
-r <job>
Daemon Command Line Options
/about
Win32 Specific File daemon Command Line
/events
Win32 Specific File daemon Command Line
/help
Win32 Specific File daemon Command Line
/install
Win32 Specific File daemon Command Line
/kill
Win32 Specific File daemon Command Line
/remove
Win32 Specific File daemon Command Line
/run
Win32 Specific File daemon Command Line
/service
Win32 Specific File daemon Command Line
/status
Win32 Specific File daemon Command Line
a name
Terminologie | Terminologie
Address
The Director Resource | The Client Resource | The Storage Resource
Administrator
Terminologie
all
The Messages Resource
Backup
Terminologie
Bootstrap File
Terminologie
Catalog
Terminologie
Client
Terminologie
Client (or FileDaemon)
The Client Resource | The Client Resource
Console
Terminologie
Daemon
Terminologie
Debug
The Messages Resource
Differential
Terminologie
Directive
Terminologie
Director
Terminologie | The Director Resource | The Director Resource
DIRPort
The Director Resource
error
The Messages Resource
exit
File Selection Commands
fatal
The Messages Resource
FD Port
The Client Resource
File Attributes
Terminologie
File Daemon
Terminologie
Heartbeat Interval
The Client Resource
help
File Selection Commands
Incremental
Terminologie
info
The Messages Resource
lsmark
File Selection Commands
mail
The Messages Resource
mail on error
The Messages Resource
Maximum Concurrent Jobs
The Client Resource
Monitor
Terminologie | The Monitor Resource
Monitor
The Director Resource
name
grundlegende Datentypen
Name
The Client Resource | The Director Resource | The Monitor Resource | The Director Resource | The Client Resource | The Storage Resource
name-string
grundlegende Datentypen
notsaved
The Messages Resource
operator
The Messages Resource
OperatorCommand
The Messages Resource
Password
The Director Resource | The Monitor Resource | The Client Resource
Pid Directory
The Client Resource
Problems, VSS
VSS Problems
quit
File Selection Commands
Recycle
Prunning Directives
Refresh Interval
The Monitor Resource
Resource
Terminologie
Restore
Terminologie
Retention Period
Terminologie
saved
The Messages Resource
Schedule
Terminologie
SD Port
The Storage Resource
Service
Terminologie
skipped
The Messages Resource
stderr
The Messages Resource
stdout
The Messages Resource
Storage
The Storage Resource
Storage Coordinates
Terminologie
Storage Daemon
Terminologie
string
grundlegende Datentypen
syslog
The Messages Resource
terminate
The Messages Resource
VSS Problems
VSS Problems
warning
The Messages Resource
Working Directory
The Client Resource

Storage Daemon Index

-c <file>
Daemon Command Line Options
-d nn
Daemon Command Line Options
Alert Command
Device Resource
Always Open
Device Resource
Archive Device
Device Resource
Autochanger
Device Resource
Autochanger
Geräte-Konfigurations-Parameter
Autochanger-Konfiguration
Autochanger-Konfiguration | Autochanger-Konfiguration
Automatic mount
Capabilities
Autoselect
Device Resource
Backward Space File
Device Resource
Backward Space Record
Device Resource
Block Positioning
Device Resource
BSF at EOM
Device Resource
Changer Command
Device Resource
Changer Command
Autochanger-Konfiguration | Geräte-Konfigurations-Parameter | Autochanger-Konfiguration
Changer Device
Autochanger-Konfiguration | Autochanger-Konfiguration
Changer Device
Device Resource
Changer Device
Geräte-Konfigurations-Parameter
Close on Poll
Device Resource
Drive Index
Device Resource
Drive Index
Geräte-Konfigurations-Parameter
Fast Forward Space File
Device Resource | Device Resource
Forward Space File
Device Resource
Forward Space Record
Device Resource
Free Space Command
Devices that require a mount (DVD)
Free Space Command
DVD Specific SD Directives
Hardware End of Medium
Device Resource
Heartbeat Interval
Storage Resource
Konfiguration, Autochanger
Autochanger-Konfiguration | Autochanger-Konfiguration
Label media
Capabilities
Maximum block size
Device Resource
Maximum Changer Wait
Device Resource
Maximum Changer Wait
Geräte-Konfigurations-Parameter
Maximum Concurrent Jobs
Storage Resource
Maximum File Size
Device Resource
Maximum Job Spool Size
Device Resource
Maximum Network Buffer Size
Device Resource
Maximum Open Wait
Device Resource
Maximum Open Wait
Device Resource
Maximum Part Size
Device Resource
Maximum Rewind Wait
Device Resource
Maximum Spool Size
Device Resource
Maximum Volume Size
Device Resource
Media Type
Device Resource
Minimum block size
Device Resource
Monitor
Director Resource
Mount Command
DVD Specific SD Directives
Mount Command
Devices that require a mount (DVD)
Mount Point
DVD Specific SD Directives
Mount Point
Devices that require a mount (DVD)
mount storage
Other Useful Console Commands
mtx-changer list
Autochanger-Test und Anpassung des mtx-changer Scripts
mtx-changer load
Autochanger-Test und Anpassung des mtx-changer Scripts
mtx-changer loaded
Autochanger-Test und Anpassung des mtx-changer Scripts
mtx-changer slots
Autochanger-Test und Anpassung des mtx-changer Scripts
mtx-changer unload
Autochanger-Test und Anpassung des mtx-changer Scripts
Name
Autochanger-Konfiguration | Autochanger-Konfiguration
Name
Storage Resource | Director Resource | Device Resource
Offline On Unmount
Device Resource
Password
Director Resource
Password
The Storage Resource
Pid Directory
Storage Resource
quit
Other Useful Console Commands
Random access
Device Resource
Removable media
Device Resource
Requires Mount
Devices that require a mount (DVD)
Requires Mount
DVD Specific SD Directives
Scan
Terminologie
SDAddress
Storage Resource
SDAddresses
Storage Resource
SDPort
Storage Resource
Session
Terminologie
Spool Directory
Device Resource
TWO EOF
Device Resource
Unmount Command
DVD Specific SD Directives
Unmount Command
Devices that require a mount (DVD)
Verify
Terminologie
Volume
Terminologie
Volume Poll Interval
Device Resource
Working Directory
Storage Resource
Write Part Command
Devices that require a mount (DVD)
Write Part Command
DVD Specific SD Directives

Console Index

<destination>
The Messages Resource
AutoPrune
Prunning Directives
Console
Der Console-Eintrag
console
The Messages Resource
ConsoleFont
Der ConsoleFont-Eintrag
Director
Der Director-Eintrag
FDAddress
The Client Resource
FDAddresses
The Client Resource
FDPort
The Client Resource
Font
Der ConsoleFont-Eintrag
Heartbeat Intervall
Der Console-Eintrag
list files jobid
Other Useful Console Commands
list jobid
Other Useful Console Commands
list jobmedia
Other Useful Console Commands
list jobs
Other Useful Console Commands
list jobtotals
Other Useful Console Commands
list media
Other Useful Console Commands
list pools
Other Useful Console Commands
Maximum Network Buffer Size
The Client Resource
messages
Other Useful Console Commands
Name
Der Director-Eintrag | Der ConsoleFont-Eintrag | Der Console-Eintrag
Parameter, Heartbeat
Der Console-Eintrag
Passwort
Der Console-Eintrag
SDConnectTimeout
The Client Resource
status
Other Useful Console Commands
status dir
Other Useful Console Commands
status jobid
Other Useful Console Commands
unmount storage
Other Useful Console Commands
Volume Retention
Prunning Directives

About this document ...

\includegraphics{./bacula-logo.eps}


It comes in the night and sucks the essence from your computers.

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -white -no_subdir -split 0 -toc_stars -white -notransparent -init_file latex2html-init.pl bacula

The translation was initiated by on 2008-10-13


next_inactive up previous
2008-10-13