next_inactive up previous


\includegraphics{./bacula-logo.eps}


Il surgit de la nuit et absorbe l'essence vitale de vos ordinateurs.

Kern Sibbald

Traduit de l'anglais par Ludovic Strappazon














3 January 2008
Ce mode d'emploi documente la version 1.38.11 (28 June 2006) de Bacula
Copyright ©1999-2006, Kern Sibbald



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. Win32 Client Setup Wizard
  2. Win32 Component Selection Dialog
  3. Win32 Directory Selection Dialog
  4. Win32 Client Service Selection
  5. Win32 Client Service Confirmation
  6. Win32 Client Start
  7. Win32 Client Setup Completed

List of Tables

  1. Librairies connues pour fonctionner avec Bacula
  2. WinNT/2K/XP Restore Portability Status
  3. Filename Table Layout
  4. Path Table Layout
  5. File Table Layout
  6. Job Table Layout
  7. Job Types
  8. Job Statuses
  9. File Sets Table Layout
  10. JobMedia Table Layout
  11. Media Table Layout
  12. Pool Table Layout
  13. Client Table Layout
  14. Unsaved Files Table Layout
  15. Counter Table Layout
  16. Version Table Layout
  17. Base Files Table Layout
  18. SQLite vs MySQL Database Comparison


Qu'est-ce que Bacula ?

Bacula est un jeu de programmes qui vous permet (ou à l'administrateur système) de faire des sauvegardes, restaurations, et vérifications des données d'un ordinateur sur un réseau hétérogène. Bacula peut fonctionner complètement sur un seul ordinateur. Il est capable de sauvegarder sur des supports variés, y compris disques et cartouches.

En termes techniques, il s'agit d'un programme de sauvegarde Client/Serveur. Bacula est relativement facile d'utilisation et efficace, tout en offant de nombreuses fonctions avancées de gestion de stockage qui facilitent la recherche et la restauration de fichiers perdus ou endommagés. Grâce à sa conception modulaire, Bacula est échelonnable depuis le simple système constitué d'un ordinateur, jusqu'au système de plusieurs centaines d'ordinateurs disséminés sur un vaste réseau.

Qui a besoin de Bacula ?

Si vous utilisez actuellement un programme tel que tar, dump, ou bru pour sauvegarder vos données, et aimeriez une solution réseau, plus de flexibilité, ou les commodités d'un catalogue, Bacula vous procurera certainement les fonctions supplémentaires que vous recherchez. Cependant, si vous avez peu d'expérience des systèmes Unix ou si vous n'avez pas l'expérience d'un système de sauvegarde sophistiqué, nous ne vous recommandons pas l'utilisation de Bacula, car il est beaucoup plus difficile à installer et utiliser que tar ou dump.

Si vous attendez de Bacula qu'il se comporte comme les programmes simples mentionnés ci-dessus et qu'il écrive sur toute cartouche insérée dans le lecteur, vous éprouverez des difficultés à travailler avec Bacula. Bacula est conu pour protéger vos données en suivant les règles que vous spécifiez, ce qui signifie que la réutilisation d'une cartouche ne se fera qu'en dernier ressort. Il est possible de "contraindre" Bacula à écraser toute cartouche dans le lecteur, mais il est plus facile et plus efficace d'utiliser un outil plus basique pour ce genre d'opérations.

Si vous utilisez Amanda et aimeriez un programme de sauvegarde qui peut écrire sur plusieurs volumes (qui ne soit pas limité par la capacité de vos cartouches), Bacula peut certainement satisfaire vos besoins, d'autant que plusieurs de nos utilisateurs estiment que Bacula est plus simple à installer et utiliser que d'autres programmes équivalents.

Si vous utilisez actuellement un logiciel commercial sophistiqué tel que Legato Networker, ARCserveIT, Arkeia, ou PerfectBackup+, vous pourriez être interessé par Bacula qui fournit la plupart de leurs fonctions et qui est un logiciel libre sous licence GNU version 2.

Composants ou Services de Bacula

Bacula est constitué des cinq composants ou services majeurs suivants :

\includegraphics{./bacula-applications.eps} (remerciements à Aristedes Maniatis pour ce schéma et le suivant)

Pour réaliser avec succès les opérations de sauvegarde et restauration, les quatre services suivants doivent être configurés et lancés : le Director Daemon, le File Daemon, le Storage Daemon et MySQL, PostgreSQL ou SQLite.

Configuration de Bacula

Pour que Bacula comprenne votre système, quels clients vous voulez sauvegarder et comment, vous devez créer un certain nombre de fichiers de configuration. La suite brosse un tableau de ces opérations.

\includegraphics{./bacula-objects.eps}

Conventions utilisées dans ce document

Bacula est en constante évolution, par conséquent, ce manuel ne sera pas toujours en accord avec le code. Si un objet de ce manuel est précédé d'un astérisque (*), cela signifie que cette fonctionnalité particulière n'est pas implémentée. S'il est précédé d'un signe plus (+), cela indique que la fonction est peut-être partiellement implémentée.

Si vous lisez la version de ce manuel fournie avec les sources de Bacula, le paragraphe ci-dessus reste vrai. En revanche, si vous lisez la version en ligne : www.bacula.org/manual, veuillez garder à l'esprit que cette version décrit la version courante de développement de Bacula (celle du CVS) qui peut contenir des fonctionnalités qui n'existent pas dans la version "officielle". De même, il est généralement un peu à la traîne derrière le code.

Démarrage rapide

Pour faire fonctionner Bacula rapidement, nous vous recommandons de commencer par parcourir la section Terminologie ci-dessous, de passer rapidement en revue le chapitre suivant intitulé L'état actuel de Bacula, puis le Guide de démarrage rapide de Bacula, qui vous donnera une vue d'ensemble de la mise en oeuvre de Bacula . Après quoi vous devriez poursuivre avec le chapitre sur L'installation de Bacula, puis le chapitre Comment configurer Bacula, et finalement, le chapitre Exécuter Bacula.

Terminologie

Pour faciliter la communication autour de ce projet, nous fournissons ici les définitions de la terminologie que nous utilisons.

Administrateur
La ou les personne(s) responsable(s) de l'administration du système Bacula.

Sauvegarde
Nous utilisons ce terme pour un job Bacula qui sauvegarde des fichiers.

Fichier Bootstrap (Bootstrap File)
Le bootstrap est un fichier ASCII qui contient, sous une forme compacte, les commandes qui permettent à Bacula ou à l'utilitaire autonome bextract de restaurer les contenus d'un ou plusieurs volumes, par exemple, l'état courant d'un système qui vient d'être sauvegardé. Avec un fichier bootstrap, Bacula peut restaurer votre système sans catalogue. Vous pouvez créer un fichier bootstrap depuis un catalogue pour extraire le fichier que vous voulez.

Catalogue
Le catalogue est utilisé pour stocker des informations sommaires concernant les Jobs et Clients, les fichiers qui ont été sauvegardés ainsi que le ou les volume(s) où ils ont été sauvegardés. L'information stockée dans le catalogue permet à l'administrateur ou aux utilisateurs de déterminer quels jobs ont été exécutés, leur statut, ainsi que d'importantes caractéristiques de chaque fichier sauvegardé. Le catalogue est une ressource en ligne, mais ne contient pas les données pour les fichiers sauvegardés. La plupart des informations stockées dans le catalogue le sont aussi sur les volumes de sauvegarde (i.e. cartouches). Bien sur, les cartouches auront aussi une copie du fichier en plus de ses attributs (voir ci-dessus).

La fonction Catalogue est de celles qui distinguent Bacula de simples programmes de sauvegarde et archivage tels que dump et tar.

Client
Dans la terminologie de Bacula, le mot Client désigne une machine sauvegardée, et est synonyme de File service ou File Daemon. Nous nous y référons assez souvent par "le FD". Un client est défini dans une ressource de fichier de configuration.

Console
Le programme qui interface le Director, permettant à l'administrateur de contrôler Bacula.

Daemon
Terminologie Unix pour un programme toujours présent en arrière plan pour prendre en charge une tâche donnée. Sur les systèmes Windows, ainsi que certains Linux, les daemons sont appelés Services.

Directive
Le terme directive est utilisé pour désigner une entrée ou enregistrement à l'intérieur d'une ressource dans un fichier de configuration qui définit un élément spécifique. Par exemple, la directive Name définit le nom de la ressource.

Director
Le principal daemon serveur de Bacula qui planifie et dirige toutes les opérations de Bacula. Occasionnellement, nous le désignons par "le DIR".

Differentielle (Differential)
Une sauvegarde qui inclut tous les fichiers modifiés depuis le lancement de la dernière sauvegarde complète (Full). Notez que d'autres logiciels de sauvegarde peuvent définir ceci différemment.

Attributs de fichiers
Les Attributs de fichiers sont toutes les informations nécessaires au sujet d'un fichier pour l'identifier, et toutes ses propriétés telles taille, date de création, date de modification, permission, etc. En principe, les attributs sont intégralement manipulés par Bacula de sorte que l'utilisateur n'a jamais à s'en préoccuper. Les attributs n'incluent pas les données du fichier.

File Daemon
Le daemon exécuté sur l'ordinateur client à sauvegarder. Il est aussi désigné par Service Fichier (File Service) et parfois Service Client ou FD.

FileSet
Un FileSet est une ressource d'un fichier de configuration qui définit les fichiers à sauvegarder. Il consiste en une liste de fichiers ou répertoires inclus, une liste de fichiers ou répertoires exclus et la façon dont les fichiers seront stockés (compression, chiffrement, signatures). Pour plus de détails consultez le paragraphe Définition de la Ressource FileSet dans le chapitre Director de ce document.

Incrementale
Une sauvegarde qui inclut tous les fichiers modifiés depuis le lancement de la dernière sauvegarde complète (Full), différentielle, ou incrémentale. Normalement spécifié dans la directive Level (niveau) dans la définition de la ressource Job, ou dans une ressource Schedule.

Job
Un Job Bacula est une ressource de configuration qui définit le travail que Bacula doit effectuer pour sauvegarder ou restaurer un client particulier. Un Job consiste en un Type, (Type : backup, restore, verify, etc.), un Niveau (Level : full, incremental, ...), un FileSet, et un lieu de Stockage où écrire les fichiers (Storage device, Media Pool). Pour plus de détails consultez le chapitre Définition des Ressources Job de ce document.

Monitor
Le programme qui s'interface avec chacun des daemons pour permettre à l'utilisateur ou à l'administrateur de surveiller le statut de Bacula.

Resource
Une ressource est une partie d'un fichier de configuration qui définit une unité spécifique d'information disponible pour Bacula. Par exemple, la ressource Job définit toutes les propriétés d'un Job spécifique : nom, schedule (planification), volume pool, type de sauvegarde, niveau de sauvegarde, etc.

Restore
Une Restore est une ressource de configuration qui décrit l'opération de restauration d'un fichier (perdu ou endommagé) depuis un medium de sauvegarde. C'est l'opération réciproque d'une sauvegarde, sauf que, dans la plupart des cas, une restauration concernera un petit ensemble de fichiers tandis qu'une sauvegarde concerne le plus souvent l'ensemble des fichiers d'un système. Bien sur, après une défaillance de disque(s), Bacula peut être appelé à effectuer une restauration complète de tous les fichiers qui étaient sur le système.

Schedule
Un Schedule est une ressource de configuration qui définit le moment de l'exécution du Job Bacula. Pour utiliser un schedule, la ressource Job se réfère au nom du Schedule. Pour plus de détails, consultez la Définition de la ressource Schedule dans le chapitre Director de ce document.

Service
Terminologie Windows pour désigner un daemon -- Voir plus haut. Elle est maintenant fréquemment utilisée dans les environnements Unix aussi.

Adresses de stockage
Les informations retournées par les Storage services qui localisent de façon unique les fichiers sur un medium de sauvegarde. Elles consistent en deux parties : l'une appartient à chaque fichier sauvegardé, l'autre à l'ensemble du Job. Normalement, cette information est sauvegardée dans le catalogue de sorte que l'utilisateur n'a pas besoin de connaissances particulières des adresses de stockage. L'adresse de stockage inclut les attributs de fichiers (voir plus haut) ainsi que la localisation unique de l'information sur le volume de sauvegarde.

Storage Daemon
Le Storage Daemon, parfois désigné par "SD" est le programme qui écrit les attributs et les données sur un Volume de Stockage (Storage Volume) (Usuellement une cartouche ou un disque).

Session
Désigne en principe le dialogue interne entre le File Daemon et le Storage Daemon. Le File Daemon ouvre une session avec le Storage Daemon pour sauvegarder un Fileset, ou pour le restaurer. Une session est associée à un et un seul Job Bacula (voir plus haut).

Verify
Il s'agit d'un job qui compare les attributs du fichier actuel aux attributs qui ont été préalablement stockés dans le catalogue Bacula. Cette fonction peut être utilisée pour détecter les modifications de systèmes de fichiers critiques, à la façon de Tripwire. L'un des avantages majeurs de l'utilisation de Bacula pour cette tâche est que sur la machine que vous voulez protéger, vous pouvez n'exécuter que le File Daemon. Le Director, le Storage Daemon et le catalogue peuvent résider sur une autre machine. Par conséquent si votre serveur est un jour compromis, il est peu probable que la base de données de vérification ait été trifouillée.

Verify peut aussi être utilisé pour s'assurer que les données les plus récemment écrites sur un volume sont cohérentes avec ce qui figure dans le catalogue (c-à-d il compare les attributs de fichiers), ou encore, confronter le contenu du volume aux fichiers originaux sur le disque.

*Archive
Une opération d'archivage est effectuée après une sauvegarde, et consiste en l'exclusion des volumes sur lesquels les données sont sauvegardées de l'utilisation courante. Ces volumes sont marqués "Archived", et ne sont plus utilisés pour sauvegarder des fichiers. Tous les fichiers contenus sur un Volume Archive sont supprimés du catalogue. PAS ENCORE IMPLEMENTE.

*Update
Une opération Update synchronise les fichiers du système distant sur ceux du local. Ceci est l'équivalent d'une fonctionnalité rdist. PAS ENCORE IMPLEMENTE.

Période de rétention
Bacula reconnait plusieurs sortes de périodes de rétention. Les plus importantes sont la période de rétention des fichiers, la période de rétention des jobs et la période de rétention des volumes. Chacune de ces périodes de rétention désigne la durée pendant laquelle l'enregistrement spécifique sera conservé dans le catalogue. Ceci ne doit pas être confondu avec le temps pendant lequel les données sauvegardées sur un volume sont valides.

La période de rétention des fichiers détermine la durée pendant laquelle les enregistrements concernant les fichiers seront gardés dans le catalogue. Cette période est importante car le volume des enregistrements relatifs aux fichiers occupe, de loin, le plus d'espace dans la base de données. Par conséquent, vous devez vous assurer qu'un "élagage" (NDT : pruning) régulier de ces enregistrements est effectué. (Voir la commande retention de la Console pour plus de détails sur ce sujet).

La période de rétention des jobs est la durée pendant laquelle les enregistrements relatifs aux jobs seront conservés dans le catalogue. Notez que tous les enregistrements relatifs aux fichiers sont attachés aux jobs qui ont sauvegardé ces fichiers. Les enregistrements relatifs aux fichiers peuvent être purgés tout en conservant ceux relatifs aux jobs. Dans ce cas, l'information concernant les jobs exécutés restera disponible, mais pas les détails des fichiers sauvegardés. Normalement, lorsqu'un job est purgé, tous les enregistrements concernant les fichiers qu'il a sauvegardé le sont aussi.

La période de rétention des volumes est la durée minimale de conservation d'un volume avant qu'il ne soit réutilisé. Bacula n'effacera, en principe, jamais un volume qui contient la seule copie de sauvegarde d'un fichier. Dans les conditions idéales, le catalogue maintiendrait les entrées pour tous les fichiers sauvegardés pour tous les volumes courants. Une fois qu'un volume est écrasé, les fichiers qui étaient sauvegardés dessus sont automatiquement effacés du catalogue. Cependant, s'il y a un très gros pool de volumes ou si un volume n'est jamais écrasé, le catalogue pourrait devenir énorme. Pour maintenir le catalogue dans des proportions gérables, les informations de sauvegarde devraient être supprimées après une période de rétention des fichiers définie.

Scan
Une opération de scan consiste en un balayage du contenu d'un volume ou d'une série de volumes. Ces volumes et les informations concernant les fichiers qu'ils contiennent sont restaurés vers le catalogue Bacula. Une fois ces informations restaurées, les fichiers sauvegardés sur ces volumes pourront être aisément restaurés. Cette fonction est particulièrement utile si certains volumes ou jobs ont dépassé leur période de rétention et ont été élagués ou purgés du catalogue. Le balayage des données des volumes est effectué en utilisant le programme bscan. Consultez la section bscan du chapitre sur les utilitaires Bacula de ce manuel pour plus de détails.

Volume
Un volume est une unité d'archivage, usuellement une cartouche ou un fichier nommé sur disque où Bacula stocke les données pour un ou plusieurs jobs de sauvegarde. Tous les volumes Bacula ont un label unique (logiciel) écrit sur le volume par Bacula afin qu'il puisse être assuré de lire le bon volume. (En principe, il ne devrait pas y avoir de confusion avec des fichiers disques, mais avec des cartouches, il est facile de monter la mauvaise).

Ce que Bacula n'est pas

Bacula est un programme de sauvegarde, restauration et vérification, ce n'est pas un système complet de disaster recovery à lui seul, mais il peut en être une partie clef si vous planifiez soigneusement et suivez les instructions incluses dans le chapitre Plan de reprise d'activité avec Bacula de ce manuel.

Avec la planification appropriée, telle que décrite dans le chapitre sur le plan de reprise d'activité, Bacula peut devenir la pièce centrale de votre plan de reprise d'activité. Par exemple, si vous avez créé un(e) disque(tte) boot d'urgence et un(e) disque(tte) de secours Bacula pour sauvegarder les informations de partitionnement courantes de votre disque dur, et maintenu un jeu de sauvegardes complet de votre système, il est possible de reconstruire complètement votre système "depuis le métal brut" (NDT : From bare metal) .

Si vous avez utilisé la directive WriteBootstrap dans votre job ou quelque autre moyen pour sauvegarder un fichier bootstrap valide, vous pourrez l'utiliser pour extraire les fichiers nécessaires (sans utiliser le catalogue et sans chercher manuellement les fichiers à restaurer).

Interactions entre les services Bacula

Le diagramme fonctionnel suivant montre les interactions typiques entre les services Bacula pour un job de type sauvegarde. Chaque bloc représente en général un processus séparé (normalement un daemon). En général, le director surveille le flux d'informations. Il maintient aussi le catalogue. \includegraphics{./flow.eps}


L'état actuel de Bacula

En d'autres termes, ce qui est et ce qui n'est pas actuellement implémenté et fonctionnel.

Ce qui est implémenté

Avantages de Bacula sur d'autres programmes de sauvegarde

Restrictions de l'implémentation actuelle

Limitations ou Restrictions inhérentes à la conception


Caractéristiques système générales indispensables à Bacula

Caractéristiques système générales indispensables à Bacula


Systèmes d'exploitation supportés


Lecteurs de bandes supportés

Même si votre lecteur est dans la liste ci dessous, vérifiez le Chapitre Test des Lecteurs Bandes de ce manuel pour les procédures que vous pouvez utiliser pour vérifier si votre lecteur de bande fonctionnera avec Bacula. Si votre lecteur est en mode bloc fixe, il peut sembler travailler avec Bacula jusqu'à ce que vous essayiez de restaurer et que Bacula tente de se positionner sur la bande. Seuls la procédure ci-dessus et vos propres tests peuvent vous garantir un fonctionnement correct.

Il est très difficile de fournir une liste de lecteurs de bandes supportés, ou de lecteurs qui sont connus pour fonctionner avec Bacula en raison d'un retour limité de la part des usagers. (par conséquent, si vous utilisez Bacula sur un lecteur qui ne figure pas dans la liste, merci de nous le faire savoir). Selon les informations provenant de nos utilisateurs, les lecteurs suivants sont connus pour fonctionner avec Bacula. Un trait d'union dans une colonne signifie ``inconnu'' :

OS Fabr. Media Modèle Capacité
- ADIC DLT Adic Scalar 100 DLT 100GB
- ADIC DLT Adic Fastor 22 DLT -
- - DDS Compaq DDS 2,3,4 -
- Exabyte - Lecteurs Exabyte de moins de dix ans -
- Exabyte - Exabyte VXA drives -
- HP Travan 4 Colorado T4000S -
- HP DLT HP DLT drives -
- HP LTO HP LTO Ultrium drives -
FreeBSD 4.10 RELEASE HP DAT HP StorageWorks DAT72i -
- Overland LTO LoaderXpress LTO -
- Overland - Neo2000 -
- OnStream - OnStream drives (see below) -
- 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 patched RELEASE Seagate AIT-1 STA1701W 35/70GB
Linux Sony DDS-2,3,4 - 4-40GB
Linux Tandberg - Tandbert MLR3 -
FreeBSD Tandberg - Tandberg SLR6 -
Solaris Tandberg - Tandberg SLR75 -
Linux Gentoo ADIC - IBM Ultrium LTO I 100/200 Go

Une liste des Librarires supportées figure dans le chapitre librairies (autochangers) de ce document, ou vous trouverez d'autres lecteurs de bandes qui fonctionne avec Bacula.


Lecteurs de bande non supportés

Auparavant les lecteurs de bandes OnStream IDE-SCSI ne fonctionnaient pas avec Bacula. A partir de la version 1.33 de Bacula et de la version 0.9.14 du pilote noyau ou supérieur,ce lecteur est supporté. Consultez le chapitre de test car vous devez le configurer pour fonctionner en mode blocs de taille fixe.

Les lecteurs QIC sont connus pour avoir nombre de particularités (taille de blocs fixe, et un EOF plutôt que deux pour terminer la bande). En conséquence, vous devrez être particulièrement attentif à sa configuration pour le faire fonctionner avec Bacula.

A l'attention des utilisateurs de FreeBSD !!!

A moins que vous n'ayez appliqué un correctif sur la bibliothèque pthreads de votre systèmes FreeBSD, vous perdrez des données quand Bacula aura rempli une bande et passera à la suivante. La raison en est que les bibliothèques pthreads sans correctifs échouent à retourner un état d'alerte à Bacula signalant que la fin de bande est proche. Consultez le chapitre test des lecteurs de bandes de ce manuel pour d'importantes informations concernant la configuration de votre lecteur de bande pour qu'il soit compatible avec Bacula.

Autochangeurs supportés

Pour des informations sur les libraries (autochangeurs) supportées, allez voir la section Libraries supportées du chapitre Libraries de ce manuel.

Spécifications des cartouches

Nous ne pouvons vraiment pas vous dire quel lecteur acheter pour utiliser Bacula. Cependant, nous pouvons recommander d'éviter les lecteurs DDS. La technologie est plutôt ancienne et ces lecteurs nécessitent de fréquents nettoyages. Les lecteurs DLT sont généralement bien meilleurs (technologie plus récente) et ne requièrent pas autant d'opérations de nettoyage.

Ci-dessous, vous trouverez une table de spécifications de cartouches DLT et LTO qui vous permettra de vous faire une idée de la capacité et de la rapidité des lecteurs et cartouches modernes. Les capacités reportées ici sont les natives, sans compression. Tous les lecteurs modernes pratiquent la compression matérielle, et les fabricants affichent souvent une capacité compressée avec un ratio de 2:1. Le facteur de compression réel dépend principalement des données sauvegardées, mais je pense qu'un ratio 1,5:1 est beaucoup plus raisonnable (autrement dit, multipliez la valeur de la table par 1,5 pour obtenir une estimation grossière de la capacité compressée). Les taux de transfert sont arrondis au GB/hr le plus proche. Les valeurs sont fournies par les divers fabricants.

Le type de media est la désignation du fabricant, vous n'êtes pas obligé de l'utiliser (mais vous devriez...) dans vos ressources de configuration Bacula.

Type de media Type de lecteur Capacité des media Taux de transfert
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


Démarrer avec Bacula

Si vous êtes comme moi, vous voulez faire fonctionner Bacula immédiatement pour en avoir un aperçu, puis, plus tard, vous reviendrez en arrière pour lire et connaître tous les détails. C'est exactement ce que ce chapitre se propose d'accomplir : vous faire avancer rapidement sans tous les détails. Si vous voulez sauter la section sur les Pools, Volumes et Labels, vous pourrez toujours y revenir, mais s'il vous plaît, veuillez lire ce chapitre jusqu'à la fin, et en particulier suivre les instructions pour tester votre lecteur de bandes.

Nous supposons que vous êtes parvenus à construire et installer Bacula, sinon, vous devriez d'abord jeter un oeil aux Prérequis (système) puis au chapitre Compiler et installer Bacula de ce manuel.

Comprendre les Jobs et Schedules

Afin de rendre Bacula aussi flexible que possible, les directives lui sont données en plusieurs endroits. L'instruction principale est la ressource Job, qui définit un job. Un job de type sauvegarde consiste en général en un FileSet, un client, un Schedule pour un ou plusieurs niveaux ou horaires de sauvegardes, un Pool, ainsi que des instructions additionnelles. Un autre point de vue est de considérer le FileSet comme "Que sauvegarder ?", le Client comme "Qui sauvegarder ?", le Schedule comme "Quand sauvegarder ?" et le Pool comme "Où sauvegarder ?" (c'est à dire, "Sur quel volume ?)

Typiquement, une combinaison FileSet/Client aura un job correspondant. La plupart des directives, telles que les FileSets, Pools, Schedules, peuvent être mélangées et partagées entre les jobs. Ainsi, vous pouvez avoir deux définitions (ressources) de jobs sauvegardant différents serveurs et utilisant les mêmes Schedule, FileSet (sauvegardant donc les mêmes répertoires sur les deux machines) et peut-être même les mêmes Pools. Le Schedule définira quel type de sauvegarde sera exécuté et à quel moment (par exemple les Full le mercredi, les incrémentales le reste de la semaine), et lorsque plus d'un job utilise le même Schedule la priorité du job détermine lequel démarre en premier. Si vous avez de nombreux jobs, vous devriez utiliser la directive JobDefs, qui vous permet de définir des paramètres par défaut pour vos jobs, qui peuvent être changés au sein de la ressource Job, mais qui vous évitent de réécrire les mêmes paramètres pour chaque job. En plus des FileSets que vous voulez sauvegarder, vous devriez aussi avoir un job qui sauvegarde votre catalogue.

Enfin, sachez qu'en plus des jobs de type Backup, vous pouvez aussi utiliser des jobs de type restore, verify, admin, qui ont chacun des exigences différentes.

Comprendre les Pools, Volumes et Labels

Si vous avez utilisé un programme tel que tar pour sauvegarder votre système, les notions de Pools, Volumes et labels peuvent vous sembler un peu confuses au premier abord. Un Volume est un simple support physique (cartouche, ou simple fichier) sur lequel Bacula écrit vos données de sauvegarde. Les Pools regroupent les Volumes de sorte qu'une sauvegarde n'est pas restreinte à la capacité d'un unique Volume. Par conséquent, plutôt que de nommer explicitement les Volumes dans votre Job, vous spécifiez un Pool, et Bacula se chargera de sélectionner le prochain Volume utilisable du Pool et vous demandera de le monter.

Bien que les options de base soient spécifiées dans la ressource Pool du fichier de configuration du Director, le Pool réel est géré par le Catalogue Bacula. Il contient les informations de la ressource Pool (bacula-dir.conf) ainsi que les informations concernant tous les Volumes qui ont été ajoutés au Pool. L'ajout de Volumes se fait en principe manuellement depuis la Console grâce à la commande label.

Pour chaque Volume, Bacula gère une quantité d'informations considérable telles que les première et dernière date et heure d'écriture, le nombre de fichiers sur le Volume, le nombre de bytes sur le Volume, le nombre de montages, etc.

Pour que Bacula puisse lire ou écrire sur un Volume physique, celui-ci doit avoir reçu un étiquettage logiciel afin que Bacula soit assuré que le bon Volume est monté. Ceci s'effectue en principe manuellement depuis la Console grâce à la commande label.

Les étapes de création de Pool, ajout de Volumes à ce Pool, et écriture d'étiquettes logicielles sur les Volumes, peuvent sembler pénibles au premier abord, mais en fait, elles sont tout à fait simples à franchir, et elles vous permettent d'utiliser plusieurs Volumes (plutôt que d'être limité à la capacité d'un seul). Les Pools vous procurent aussi une flexibilité importante pour votre politique de sauvegarde. Par exemple, vous pouvez avoir un Pool de Volumes "Daily" pour vos sauvegardes Incrémentales et un Pool de Volumes "Weekly" pour vos sauvegardes complètes (Full). En spécifiant le Pool approprié dans les Jobs de sauvegarde quotidiens et hebdomadaires, vous garantissez qu'aucun Job quotidien n'écrira jamais sur un Volume du Pool réservé aux sauvegardes hebdomadaire et vice versa, et Bacula vous dira quelle cartouche est requise, et quand.

Pour plus de détails concernant les Pools, consultez la section Ressource Pool du chapitre sur la configuration du Director, ou poursuivez votre lecture, nous reviendrons plus tard sur ce sujet.


Paramétrage des fichiers de configuration de Bacula

Après avoir exécuté la commande ./configure ad hoc, make et make install, si c'est la première fois que vous exécutez Bacula, vous devez créer des fichiers de configuration valides pour le Director, le File Daemon, le Storage Daemon et le programme Console. Si vous avez suivi nos recommandations, des fichiers de configuration par défaut ainsi que les binaires des daemons seront situés dans votre répertoire d'installation. Dans tous les cas les binaires se trouvent dans le répertoire que vous avez spécifié au niveau de l'option --sbindir de la commande ./configure, et les fichiers de configuration se trouvent dans le répertoire que vous avez spécifié au niveau de l'option --sysconfdir.

Lors des paramétrages initiaux de Bacula, il vous faudra investir un peu de temps pour modifier les fichiers de configuration par défaut afin de les adapter à votre environnement. Ceci peut nécessiter de redémarrer Bacula plusieurs fois jusqu'à ce que tout fonctionne correctement. Ne cédez pas au désespoir. Une fois que vous aurez créé vos fichiers de configuration, vous n'aurez que rarement besoin de les changer et de redémarrer Bacula. Le gros du travail consistera à changer la cartouche quand elle est pleine.

Configurer le programme Console

Le programme console est utilisé par l'administrateur pour interagir avec le Director et pour arrêter et démarrer manuellement des jobs, ou encore pour obtenir des informations sur les jobs en cours d'exécution ou programmés.

Le fichier de configuration de la Console se trouve dans le répertoire que vous avez spécifié au niveau de l'option --sysconfdir de la commande ./configure et par défaut se nomme console.conf.

Si vous avez choisi de construire la Console GNOME avec l'option --enable-gnome, vous y trouverez également son fichier de configuration par défaut, nommé gnome-console.conf.

Il en va de même pour la console wxWidgets, qui est construite par l'option --enable-wx-console, et le nom du fichier de configuration par défaut est, dans ce cas, wx-console.conf.

Normalement, pour les nouveaux utilisateurs, aucune modification n'est requise pour ces fichiers. Les réglages par défaut sont raisonnables.

Configurer le programme Monitor

Le programme Monitor est typiquement une icône dans la barre des tâches. Cependant, lorsque l'icône est étendue en une fenètre, l'administrateur ou l'utilisateur peut obtenir des informations concernant le Director ou l'état des sauvegardes sur la machine locale ou n'importe quelle autre daemon Bacula configuré.

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

L'image montre le tray-monitor configuré pour trois daemons. En cliquant sur les boutons radio dans le coin en haut à gauche de l'image, vous pouvez voir l'état de chacun des daemons. L'image montre l'état du Storage Daemon (MainSD) sélectionné.

Le fichier de configuration du Monitor se trouve dans le répertoire spécifié au niveau de l'option --sysconfdir de la commande ./configure et se nomme par défaut tray-monitor.conf. En principe, pour les nouveaux utilisateurs, il suffit de changer les permissions de ce fichier pour permettre aux utilisateurs non-root d'exécuter le Monitor, en effet cette application doit être exécuté par le même utilisateur que l'environnement graphique (n'oubliez pas de donner aux non-root le droit d'exécuter bacula-tray-monitor). Ceci ne constitue pas une faille de sécurité tant que vous utilisez les réglages par défaut.

Configurer le File Daemon

Le File Daemon, est le programme qui s'exécute sur chaque machine cliente. A la demande du Director, il détermine les fichiers à sauvegarder et les expédie au Storage Daemon.

Le fichier de configuration du File Daemon se trouve dans le répertoire spécifié au niveau de l'option --sysconfdir de la commande ./configure et se nomme par défaut bacula-fd.conf. Normalement, pour les nouveaux utilisateurs, aucune modification n'est requise pour ce fichier. Les réglages par défaut sont raisonnables. Cependant, si vous envisagez de sauvegarder plus d'une machine, il vous faudra installer le File Daemon avec un fichier de configuration spécifique sur chaque machine à sauvegarder. Les informations concernant chaque File Daemon doivent apparaître dans le fichier de configuration du Director.

Configurer le Director

Le director est le programme central qui contrôle tous les autres daemons. Il planifie et surveille les jobs à exécuter.

Le fichier de configuration du Director se trouve dans le répertoire spécifié au niveau de l'option --sysconfdir de la commande ./configure et se nomme par défaut bacula-dir.conf.

En général, la seule modification nécessaire consiste à faire en sorte que la directive Include de la Ressource FileSet contienne au moins une ligne avec un nom de fichier ou de répertoire valide à sauvegarder.

Si vous ne possédez pas de lecteur DLT, vous voudrez probablement modifier la ressource Storage pour donner un nom plus représentatif de votre périphérique de stockage. Vous pouvez toujours utiliser les noms existants puisque vous êtes libre de les assigner arbitrairement, mais ils doivent s'accorder avec les noms correspondants dans le fichier de configuration du Storage Daemon.

Vous pouvez aussi changer l'adresse électronique pour les notifications vers votre propre adresse e-mail plutôt que vers celle de root (configuration par défaut).

Enfin, si vous avez plusieurs systèmes à sauvegarder, il vous faudra spécifier un File Daemon (ou client) pour chaque système sauvegardé, précisant ses nom, adresse et mot de passe. Nous estimons que baptiser vos daemons du nom de vos systèmes suffixés avec -fd aide beaucoup à corriger les erreurs. Ainsi, si votre système est foobaz, vous nommerez le daemon foobaz-fd. Pour le Director, vous pourriez utiliser foobaz-dir, et foobaz-sd pour le Storage Daemon. Chacun de vos composants de Bacula doit avoir un nom unique Si vous les nommez tous à l'identique, en plus de ne jamais savoir quel daemon envoie quel message, s'ils partagent le même répertoire de travail (working directory), les noms de fichiers temporaires des daemons ne seront pas uniques et vous aurez d'étranges erreurs.

Configurer le Storage Daemon

Le Storage Daemon est responsable, sur demande du Director, de la réception des données en provenance des File Daemons, et de leur écriture sur le medium de stockage, ou, dans le cas d'une restauration, de trouver les données pour les envoyer vers le File Daemon.

Le fichier de configuration du Storage Daemon se trouve dans le répertoire spécifié au niveau de l'option --sysconfdir de la commande ./configure et se nomme par défaut bacula-sd.conf. Modifiez ce fichier pour accorder les noms de périphériques de stockage à ceux que vous possédez. Si le processus d'installation a convenablement détecté votre système, elles seront déjà correctement réglées. Ces ressources de stockage "Name" et "Media Type" doivent être les mêmes que leurs correspondantes du fichier de configuration du Director bacula-dir.conf. Si vous souhaitez sauvegarder vers un fichier plutôt que sur des bandes, la ressource Device doit pointer vers un répertoire où des fichiers seront créés en guise de Volumes lorque vous étiquetterez (label) vos Volumes.

Tester vos Fichiers de Configuration

Vous pouvez tester la validité syntaxique de vos fichiers de configuration, afficher tout message d'erreur et terminer. Par exemple, en supposant que vous avez installé vos binaires et fichiers de configuration dans le même répertoire,

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"

testera le fichier de configuration de chacun des principaux programmes. Si le fichier de configuration est correct, le programme se termine sans rien afficher. Veuillez noter que selon les options de configuration que vous avez choisies, il se peut qu'aucune des commandes ci-dessus ne soit valable sur votre système. Si vous avez installé les binaires dans les répertoires traditionnels d'Unix plutôt que dans un simple répertoire, il vous faudra modifier les commandes ci-dessus en conséquence (pas de "./" devant les commandes, et un chemin devant les fichiers de configuration).

Tester la compatibilité de Bacula avec votre lecteur de bandes

Avant de gaspiller votre temps avec Bacula pour finalement constater qu'il ne fonctionne pas avec votre lecteur de bandes, veuillez s'il vous plaît lire le chapitre btape -- Tester votre lecteur de bandes de ce manuel. Si vous possédez un lecteur standard SCSI moderne sur un Linux ou un Solaris, fort probablement, il fonctionnera, mais mieux vaut tester que d'être déçu. Pour FreeBSD (et probablement les autres xBSD), la lecture du chapitre mentionné ci-dessus est un devoir. Pour FreeBSD, consultez aussi The FreeBSD Diary pour une description détaillée de la méthode pour faire fonctionner Bacula sur votre système. De plus, les utilisateurs de versions de FreeBSD antérieures à 4.9-STABLE datée du lundi 29 décembre 2003 15:18:01 UTC qui prévoient d'utiliser des lecteurs de bandes sont invités à lire le fichier platforms/freebsd/pthreads-fix.txt du répertoire principal de Bacula, qui contient d'importantes informations sur la compatibilité de Bacula avec leur système.

Débarrassez-vous du répertoire /lib/tls

La nouvelle librairie pthreads /lib/tls installée par défaut sur les systèmes Red Hat récents (kernels 2.4.x) est défectueuse. Vous devez la supprimer ou la renommer, puis rebooter votre système avant d'exécuter Bacula, faute de quoi, après environ une semaine de fonctionnement, Bacula se bloquera pour de longues périodes, voire définitivement. Veuillez consulter le chapitre Systèmes supportés pour plus d'informations sur ce problème.

Ce problème n'existe plus avec les noyaux 2.6.

Exécuter Bacula

La partie la plus importante de l'exécution de Bacula est probablement la capacité de restaurer les fichiers. Si vous n'avez pas essayé de récupérer des fichiers au moins une fois, vous subirez une bien plus forte pression le jour où vous devrez réellement le faire, et serez enclin à commettre des erreurs que vous n'auriez pas commises si vous aviez déjà essayé.

Pour avoir rapidement une bonne idée de la façon d'utiliser Bacula, nous vous recommandons fortement de suivre les exemples du chapitre exécuter Bacula de ce manuel, où vous trouverez des informations détaillées sur l'exécution de Bacula.

Rotation des logs

Si vous utilisez le bacula-dir.conf par défaut ou une variante, vous constaterez qu'il récupère toutes les sorties de Bacula dans un fichier. Pour éviter que ce fichier ne croisse sans limites, nous vous recommandons de copier le fichier logrotate depuis scripts/logrotate vers /etc/logrotate.d/bacula. Ainsi les fichiers de logs subiront une rotation mensuelle et seront conservés pour une durée maximum de cinq mois. Vous pouvez éditer ce fichier pour adapter la rotation à votre convenance.

Log Watch

Certains systèmes tels que RedHat et Fedora exécutent le programme logwatch chaque nuit pour analyser vos fichiers de log et vous envoyer un rapport par mail. Si vous souhaitez inclure la sortie de vos jobs Bacula dans ce rapport, veuillez regarder dans le répertoire scripts/logwatch. Le fichier README fournit une brève explication sur la faon d'installer le script, et quelle genre de résultats en attendre.

Reprise d'activité après un désastre (disaster recovery)

Si vous avez l'intention d'utiliser Bacula en tant qu'outil de disaster recovery plutôt que comme un simple programme pour restaurer les fichiers perdus, vous serez intéressé par le chapitre Plan de reprise d'activité avec Bacula de ce manuel.

De toute façon, vous êtes fortement invité à tester soigneusement la restauration de quelques fichiers que vous aurez préalablement sauvegardés, plutôt que d'attendre qu'un désastre ne frappe. Ainsi, vous serez préparé.


Installer Bacula

Prérequis

En général, il vous faudra les sources de la version courante de Bacula, et si vous souhaitez exécuter un client Windows, vous aurez besoin de la version binaire du client Bacula pour Windows. Par ailleurs, Bacula a besoin de certains paquetages externes (tels SQLite, MySQL ou PostgreSQL) pour compiler correctement en accord avec les options que vous aurez choisies. Pour vous simplifier la tâche, nous avons combiné plusieurs de ces programmes dans deux paquetages depkgs (paquetages de dépendances). Ceci peut vous simplifier la vie en vous fournissant tous les paquets nécessaires plutôt que de vous contraindre à les trouver sur la Toile, les charger et installer.

Distribution des fichiers source

A partir de la version 1.38.0, le code source est éclaté en quatre fichiers tar correspondant à quatre modules différents dans le CVS Bacula. Ces fichiers sont :

bacula-1.38.0.tar.gz
Il s'agit de la distribution primaire de Bacula. Pour chaque nouvelle version, le numéro de version (ici, 1.38.0) sera mise à jour.

bacula-docs-1.38.0.tar.gz
Ce fichier contient une copie du répertoire docs, avec les documents pré-construits : Répertoire html anglais, fichier html unique et fichier pdf. Les traductions allemande et franaise sont en cours mais ne sont pas pré-construites.

bacula-gui-1.38.0.tar.gz
Ce fichier contient les programmes graphique en dehors du coeur de l'application. Actuellement, il contient bacula-web, un programme PHP pour produire une vue d'ensemble des statuts de vos jobs Bacula consultable dans un navigateur ; et bimagemgr, un programme qui permet de graver des images de CDROMS depuis un navigateur avec les volumes Bacula.

bacula-rescue-1.8.1.tar.gz
Ce fichier contient le code du CDROM de secours Bacula. Notez que le numéro de version de ce paquetage n'est pas lié à celui de Bacula. En utilisant ce code, vous pouvez graver un CDROM contenant la configuration de votre système et une version statiquement liée du File Daemon. Ceci peut vous permettre de repartitionner et reformater aisément vos disques durs et de recharger votre système avec Bacula en cas de défaillance du disque dur.

Mettre Bacula à jour

Si vous faites une mise à jour de Bacula, vous devriez d'abord lire attentivement les ReleaseNotes de toutes les versions entre votre version installée et celle vers laquelle vous souhaitez mettre à jour. Si la base de données du catalogue a été mise à jour, vous devrez soit réinitialiser votre base de données et repartir de zéro, soit en sauvegarder une copie au format ASCII avant de procéder à sa mise à jour. Ceci est normalement fait lorsque Bacula est compilé et installé par :

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

Ce script de mise à jour peut aussi être trouvé dans le répertoire src/cats des sources de Bacula.

S'il y a eu plusieurs mises à jour de la base de données entre votre version et celle vers laquelle vous souhaitez évoluer, il faudra appliquer chaque script de mise à jour de base de données. Vous pouvez trouver tous les anciens scripts de mise à jour dans le répertoire upgradedb des sources de Bacula. Il vous faudra éditer ces scripts pour qu'ils correspondent à votre configuration. Le script final, s'il y en a un, sera dans le répertoire src/cats comme indiqué dans la ReleaseNote.

Si vous migrez d'une version majeure vers une autre, vous devrez remplacer tous vos composants (daemons) en même temps car, généralement, le protocole inter-daemons aura changé. Par contre, entre deux versions mineures d'une même majeure (par exemple les versions 1.32.x), à moins d'un bug, le protocole inter-daemons ne changera pas. Si cela vous semble confus, lisez simplement les ReleaseNotes très attentivement, elles signaleront si les daemons doivent être mis à jour simultanément.

Enfin, notez qu'il n'est généralement pas nécessaire d'utiliser make uninstall avant de procéder à une mise à jour. En fait, si vous le faites vous effacerez probablement vos fichiers de configuration, ce qui pourrait être désastreux. La procédure normale de mise à jour est simplement make install. En principe, aucun de vos fichiers .conf ou .sql ne sera écrasé.

Pour plus d'informations sur les mises à jour, veuillez consulter la partie Upgrading Bacula Versions du chapitre Astuces de ce manuel


Paquetage de Dépendences

Comme nous l'évoquions plus haut, nous avons combiné une série de programmes dont Bacula peut avoir besoin dans les paquets depkgs et depkgs1. Vous pouvez, bien sur, obtenir les paquets les plus récents directement des auteurs. Le fichier README dans chaque paquet indique où les trouver. Pourtant, il faut noter que nous avons testé la compatibilité des paquets contenus dans les fichiers depkgs avec Bacula.

Vous pouvez, bien sur, obtenir les dernieres versions de ces paquetages de leurs auteurs. Les références nécessaires figurent dans le README de chaque paquet. Quoi qu'il en soit, soyez conscient du fait que nous avons testé la compatibilité des paquetages des fichiers depkgs.

Typiquement, un paquetage de dépendances sera nommé depkgs-ddMMMyy.tar.gz et depkgs1-ddMMMyy.tar.gzdd est le jour où n'ous l'avons publié, MMM l'abbréviation du mois et yy l'année. Par exemple: depkgs-07Apr02.tar.gz. Pour installer et construire ce paquetage (s'il est requis), vous devez:

  1. Créer un répertoire bacula, dans lequel vous placerez les sources de Bacula et le paquetage de dépendances.
  2. Désarchiver le depkg dans le répertoire bacula.
  3. vous déplacer dans le répertoire obtenu: cd bacula/depkgs
  4. exécuter make

La composition exacte des paquetages de dépendance est susceptible de changer de temps en temps, voici sa composition actuelle :

Paquets externes depkgs depkgs1 depkgs-win32
SQLite X - -
mtx X - -
readline - X -
pthreads - - X
zlib - - X
wxWidgets - - X

Notez que certains de ces paquets sont de taille respectable, si bien que l'étape de compilation peut prendre un certain temps. Les instructions ci-dessous construiront tous les paquets contenus dans le répertoire. Cependant, la compilation de Bacula, ne prendra que les morceaux dont Bacula a effectivement besoin.

Une alternative consiste à ne construire que les paquets nécessaires. Par exemple,

cd bacula/depkgs
make sqlite

configurera et construira SQLite et seulement SQLite.

Vous devriez construire les paquets requis parmi depkgs et/ou depkgs1 avant de configurer et compiler Bacula car Bacula en aura besoin dès la compilation.

Même si vous n'utilisez pas SQLite, vous pourriez trouver le paquet depkgs pratique pour construire mtx car le programme tapeinfo qui vient avec peut souvent vous fournir de précieuses informations sur vos lecteurs de bandes SCSI (e.g. compression, taille min/max des blocks,...).

Le paquet depkgs-win32 contient le code source pour les librairies pthreads et zlib utilisées par le client Win32 natif. Vous n'en aurez besoin que si vous prévoyez de construire le client Win32 depuis les sources.


Systèmes Supportés

Veuillez consulter la section Systèmes supportés du chapitre Démarrer avec Bacula de ce manuel.


Construire Bacula à partir des sources

L'installation basique est plutôt simple.

  1. Installez et construisez chaque depkgs comme indiqué plus haut.

  2. Configurez et installez MySQL ou PostgreSQL (si vous le souhaitez): Installer et configurer MySQL Phase I ou Installer et configurer PostgreSQL Phase I. Si vous installez depuis des rpms, et utilisez MySQL, veillez à installer mysql-devel, afin que les fichiers d'en-têtes de MySQL soient disponibles pour la compilation de Bacula. De plus, la librairie client MySQL requièrt la librairie de compression gzip libz.a ou libz.so. Ces librairies sont dans le paquet libz-devel. Sur Debian, vous devrez charger le paquet zlib1g-dev. Si vous n'utilisez ni rpms, ni debs, il vous faudra trouver le paquetage adapté à votre système.

    Notez que si vous avez dejà MySQL ou PostgreSQL sur votre système vous pouvez sauter cette phase pourvu que vous ayez construit "the thread safe libraries'' et que vous ayez déjà installé les rpms additionnels sus-mentionnés.

  3. En alternative à MySQL et PostgreSQL, configurez et installez SQLite, qui fait partie du paquetage depkgs. Installer et configurer SQLite.

  4. Désarchivez les sources de Bacula, de préférence dans le répertoire bacula évoqué ci-dessus.

  5. Déplacez-vous dans ce répertoire.

  6. Exécutez ./configure (avec les options appropriées comme décrit ci-dessus)

  7. Examinez très attentivement la sortie de ./configure, particulièrement les répertoires d'installation des binaires et des fichiers de configuration. La sortie de ./configure est stockée dans le fichier config.out et peut être affichée à volonté sans relancer ./configure par la commande cat config.out.

  8. Vous pouvez relancer ./configure avec des options différentes après une première exécution, cela ne pose aucun problème, mais vous devriez d'abord exécuter:

         make distclean
    

    afin d'être certain de repartir de zéro et d'éviter d'avoir un mélange avec vos premières options. C'est nécessaire parce que ./configure met en cache une bonne partie des informations. make distclean est aussi recommandé si vous déplacez vos fichiers source d'une machine à une autre. Si make distclean échoue, ignorez-le et continuez.

  9. make

    Si vous obtenez des erreurs durant le linking dans le répertoire du Storage Daemon (/etc/stored), c'est probablement parce que vous avez chargé la librairie statique sur votre système. J'ai remarqué ce problème sur un Solaris. Pour le corriger, assurez-vous de ne pas avoir ajouté l'option --enable-static-tools à la commande ./configure.

    Si vous ignorez cette étape (make) et poursuivez immédiatement avec make install, vous commettez deux erreurs sérieuses : d'abord, votre installation va échouer car Bacula a besoin d'un make avant un make install ; ensuite, vous vous privez de la possibilité de vous assurer qu'il n'y a aucune erreur avant de commencer Ć  écrire les fichiers dans vos répertoires système.

  10. make install

  11. Si vous êtes un nouvel utilisateur de Bacula, nous vous recommandons fortement de sauter l'étape suivante et d'utiliser le fichier de configuration par défaut, puis d'exécuter le jeu d'exemples du prochain chapitre avant de revenir modifier vos fichier de configuration pour qu'ils satisfassent vos besoins.

  12. Modifiez les fichiers de configuration de chacun des trois daemons (Directory, File, Storage) et celui de la Console. Pour plus de détails, consultez le chapitre Fichiers de Configuration de Bacula Nous vous recommandons de commencer par modifier les fichiers de configuration fournis par défaut, en faisant les changements minima indispensables. Vous pourrez procéder à une adaptation complète une fois que Bacula fonctionnera correctement. Veuillez prendre garde à modifier les mots de passe qui sont générés aléatoirement, ainsi que les noms car ils doivent s'accorder entre les fichiers de configuration pour des raisons de sécurité.

  13. Créez la base de données Bacula MySQL et ses tables (si vous utilisez MySQL) Installer et configurer MySQL Phase II ou créez la base de données Bacula PostgreSQL et ses tables Installer et configurer PostgreSQL Phase II (si vous utilisez PostgreSQL) ou encore Installer et configurer SQLite Phase II (si vous utilisez SQLite)

  14. Démarrez Bacula (./bacula start) Notez: Le prochain chapitre expose ces étapes en détail.

  15. Lancez la Console pour communiquer avec Bacula.

  16. Pour les deux éléments précédents, veuillez suivre les instructions du chapitre Exécuter Bacula où vous ferez une simple sauvegarde et une restauration. Faites ceci avant de faire de lourdes modifications aux fichiers de configuration, ainsi vous serez certain que Bacula fonctionne, et il vous sera plus familier. Après quoi il vous sera plus facile de changer les fichiers de configuration.
  17. Si après l'installation de Bacula, vous décidez de le déplacer, c'est à dire de l'installer dans un jeu de répertoires différents, procédez comme suit :

          make uninstall
          make distclean
          ./configure (vos-nouvelles-options)
          make
          make install
    

Si tout se passe bien, ./configure déterminera correctement votre système et configurera correctement le code source. Actuellement, FreeBSD, Linux (RedHat), et Solaris sont supportés. Des utilisateurs rapportent que le client Bacula fonctionne sur MacOS X 10.3 tant que le support readline est désactivé.

Si vous installez Bacula sur plusieurs systèmes identiques, vous pouvez simplement transférer le répertoire des sources vers ces autres systèmes et faire un "make install''. Cependant s'il y a des différences dans les librairies, ou les versions de systèmes, ou si vous voulez installer sur un système différent, vous devriez recommencer à partir de l'archive tar compressée originale. Si vous transférez un répertoire de sources où vous avez déjà exécuté la commande ./configure, vous DEVEZ faire:

make distclean

avant d'exécuter à nouveau ./configure. Ceci est rendu nécessaire par l'outil GNU autoconf qui met la configuration en cache, de sorte que si vous réutilisez la configuration d'une machine Linux sur un Solaris, vous pouvez être certain que votre compilation échouera. Pour l'éviter, comme mentionné plus haut, recommencez depuis l'archive tar, ou faites un "make distclean''.

En général, vous voudrez probablement sophistiquer votre configure pour vous assurer que tous les modules que vous souhaitez soient construits et que tout soit placé dans les bons répertoires.

Par exemple, sur RedHat, on pourrait utiliser ceci:

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

Notez: l'avantage de cette configuration pour commencer, est que tout sera mis dans un seul répertoire, que vous pourrez ensuite supprimer une fois que vous aurez exécuté les exemples du prochain chapitre, et appris comment fonctionne Bacula. De plus, ceci peut être installé et exécuté sans être root.

Pour le confort des développeurs, j'ai ajouté un script defaultconfig au répertoire examples. Il contient les réglages que vous devriez normalement utiliser, et chaque développeur/utilisateur devrait le modifier pour l'accorder à ses besoins. Vous trouverez d'autres exemples dans ce répertoire.

Les options --enable-conio ou --enable-readline sont utiles car elles fournissent un historique de lignes de commandes et des capacités d'édition à la Console. Si vous avez inclus l'une ou l'autre option, l'un des deux paquets termcap ou ncurses sera nécessaire pour compiler. Sur certains systèmes, tels que SUSE, la librairie termcap n'est pas dans le répertoire standard des librairies par conséquent, l'option devrait être désactivée ou vous aurez un message tel que:

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

lors de la compilation de la Console Bacula. Dans ce cas, il vous faudra placer la variable d'environnement LDFLAGS avant de compiler.

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

Les mêmes contraintes de librairies s'appliquent si vous souhaitez utiliser les sous-programmes readlines pour l'édition des lignes de commande et l'historique, ou si vous utilisez une librairie MySQL qui requiert le chiffrement. Dans ce dernier cas, vous pouvez exporter les librairies additionnelles comme indiqué ci-dessus ou, alternativement, les inclure directement en paramètres de la commande ./configure comme ci-dessous :

 LDFLAGS="-lssl -lcyrpto" \
    ./configure \
          <vos-options>

Veuillez noter que sur certains systèmes tels que Mandriva, readline tend à "avaler'' l'invite de commandes, ce qui le rend totalement inutile. Si cela vous arrive, utilisez l'option "disable'', ou si vous utilisez une version postérieure à 1.33 essayez --enable-conio pour utiliser une alternative à readline intégrée. Il vous faudra tout de même termcap ou ncurses, mais il est peu probable que le paquetage conio gobe vos invites de commandes.

Readline n'est plus supporté depuis la version 1.34. Le code reste disponible, et si des utilisateurs soumettent des patches, je serai heureux de les appliquer. Cependant, étant donné que chaque version de readline semble incompatible avec les précédentes, et qu'il y a des différences significatives entre les systèmes, je ne puis plus me permettre de le supporter.


Quelle base de données utiliser ?

Avant de construire Bacula, vous devez décider si vous voulez utiliser SQLite, MySQL ou PostgreSQL. Si vous n'avez pas déjà MySQL ou PostgreSQL sur votre machine, nous vous recommandons de démarrer avec SQLite. Ceci vous facilitera beaucoup l'installation car SQLite est compilé dans Bacula et ne requiert aucune administration. SQLite fonctionne bien et sied bien aux petites et moyennes configurations (maximum 10-20 machines). Cependant, il nous faut signaler que plusieurs utilisateurs ont subi des corruptions inexpliquées de leur catalogue SQLite. C'est pourquoi nous recommandons de choisir MySQL ou PostgreSQL pour une utilisation en production.

Si vous souhaitez utiliser MySQL pour votre catalogue Bacula, consultez le chapitre Installer et Configurer MySQL de ce manuel. Vous devrez installer MySQL avant de poursuivre avec la configuration de Bacula. MySQL est une base de données de haute qualité très efficace et qui convient pour des configurations de toutes tailles. MySQL est légèrement plus complexe à installer et administrer que SQLite en raison de ses nombreuses fonctions sophistiquées telles que userids et mots de passe. MySQL fonctionne en tant que processus distinct, est réellement une solution professionnelle et peut prendre en charge des bases de données de dimension quelconque.

Si vous souhaitez utiliser PostgreSQL pour votre catalogue Bacula, consultez le chapitre Installer et Configurer PostgreSQL de ce manuel. Vous devrez installer PostgreSQL avant de poursuivre avec la configuration de Bacula. PostgreSQL est très similaire à MySQL bien que tendant à être un peu plus conforme à SQL92. PostgreSQL possède beaucoup plus de fonctions avancées telles que les transactions, les procédures stockées, etc. PostgreSQL requiert une certaine connaissance pour son installation et sa maintenance.

Si vous souhaitez utiliser SQLite pour votre catalogue Bacula, consultez le chapitre Installer et Configurer SQLite de ce manuel.

Démarrage rapide

Il y a de nombreuses options et d'importantes considérations données ci-dessous que vous pouvez passer pour le moment si vous n'avez eu aucun problème lors de la compilation de Bacula avec une configuration simplifiée comme celles montrées plus haut.

Si le processus ./configure ne parvient pas à trouver les librairies spécifiques (par exemple libintl), assurez vous que le paquetage approprié est installé sur votre système. S'il est installé dans un répertoire non standard (au moins pour Bacula), il existe dans la plupart des cas une option parmi celles énumérées ci-dessous (ou avec "./configure --help") qui vous permettra de spécifier un répertoire de recherche. D'autres options vous permettent de désactiver certaines fonctionnalités (par exemple --disable-nls).

Si vous souhaitez vous jeter à l'eau, nous vous conseillons de passer directement au chapitre suivant, et d'exécuter le jeu d'exemples. Il vous apprendra beaucoup sur Bacula, et un Bacula de test peut être installé dans un unique répertoire (pour une destruction aisée) et exécuté sans être root. Revenez lire les détails de ce chapitre si vous avez un quelconque problème avec les exemples, ou lorsque vous voudrez effectuer une installation réelle.

TAQUET MISE A JOUR


Options de la commande configure

Les options en ligne de commande suivantes sont disponibles pour configure afin d'adapter votre installation à vos besoins.

--sysbindir=<binary-path>
Définit l'emplacement des binaires Bacula.

--sysconfdir=<config-path>
Définit l'emplacement des fichiers de configuration de Bacula.

--mandir=<path>
Par défaut, Bacula installe une simple page de manuel dans /usr/share/man. Si vous voulez qu'elle soit installée ailleurs, utilisez cette options pour spécifier le chemin voulu. Notez que les principaux documents Bacula en HTML et PDF sont dans une archive tar distincte des sources de distribution de Bacula.

--datadir=<path>
Si vous traduisez Bacula ou des parties de Bacula dans une autre langue, vous pouvez spécifier l'emplacement des fichiers .po avec l'option --datadir. Vous devez installer manuellement tout fichier .po qui n'est pas (encore) installé automatiquement.

--enable-smartalloc
Permet l'inclusion du code Smartalloc de détection de tampons orphelins (NDT : orphaned buffer). Cette option est vivement recommandée. Nous n'avons jamais compilé sans elle, aussi vous pourriez subir des désagréments si vous ne l'activez pas. Dans ce cas, réactivez simplement cette option. Nous la recommandons car elle aide à détecter les fuites de mémoire. Ce paramètre est utilisé lors de la compilation de Bacula.

--enable-gnome
Si vous avez installé GNOME sur votre ordinateur, vous devez spécifier cette option pour utiliser la Console graphique GNOME. Vous trouverez les binaires dans le répertoire src/gnome-console.

--enable-wx-console
Si vous avez installé wxWidgets sur votre ordinateur, vous devez spécifier cette option pour utiliser la Console graphique wx-console. Vous trouverez les binaires dans le répertoire src/wx-console. Ceci peut être utile aux utilisateurs qui veulent une Console graphique, mais ne souhaitent pas installer Gnome, car wxWidgets peut fonctionner avec les librairies GTK+, Motif ou même X11.

--enable-tray-monitor
Si vous avez installé GTK sur votre ordinateur et utilisez un gestionnaire de fenêtre compatible avec le système de notification standard FreeDesktop (tels KDE et GNOME), vous pouvez utiliser une interface graphique pour surveiller les daemons Bacula en activant cette option. Les binaires seront placés dans le répertoire src/tray-monitor.

--enable-static-tools
Avec cette option, les utilitaires relatifs au Storage Daemon (bls, bextract, et bscan) seront liés statiquement, ce qui vous permet de les utiliser même si les librairies partagées ne sont pas chargées. Si vous avez des difficultés de type "linking'' à la compilation du répertoire src/stored, assurez-vous d'avoir désactivé cette option, en ajoutant éventuellement --disable-static-tools.

--enable-static-fd
Avec cette option, la compilation produira un static-bacula-fd en plus du File Daemon standard. Cette version qui inclut les librairies statiquement liées est requise pour la reconstruction complète d'une machine après un désastre. Cette option est largement surpassée par l'usage de make static-bacula-fd du répertoire src/filed. L'option --enable-client-only décrite plus loin est aussi intéressante pour compiler un simple client sans les autres parties du programme.

Pour lier un binaire statique, l'éditeur de liens a besoin des versions statiques de toutes les librairies utilisées, aussi les utilisateurs rencontrent fréquemment des erreurs d'édition de liens à l'utilisation de cette option. La première chose à faire est de s'assurer d'avoir la librairie glibc statiquement liée sur votre système. Ensuite, il faut s'assurer de ne pas utiliser les options --openssl ou --with-python de la commande configure, car elle requierent des librairies supplémentaires. Vous devriez pouvoir activer ces options, mais il vous faudra charger les librairies statiques additionnelles correspondantes.

--enable-static-sd
Avec cette option, la compilation produira un static-bacula-sd en plus du Storage Daemon standard. Cette version qui inclut les librairies statiquement liées peut se révéler utile pour la reconstruction complète d'une machine après un désastre.

Pour lier un binaire statique, l'éditeur de liens a besoin des versions statiques de toutes les librairies utilisées, aussi les utilisateurs rencontrent fréquemment des erreurs d'édition de liens à l'utilisation de cette option. La première chose à faire est de s'assurer d'avoir la librairie glibc statiquement liée sur votre système. Ensuite, il faut s'assurer de ne pas utiliser les options --openssl ou --with-python de la commande configure, car elle requierent des librairies supplémentaires. Vous devriez pouvoir activer ces options, mais il vous faudra charger les librairies statiques additionnelles correspondantes.

--enable-static-dir
Avec cette option, la compilation produira un static-bacula-dir en plus du Director Daemon standard. Cette version qui inclut les librairies statiquement liées peut se révéler utile pour la reconstruction complète d'une machine après un désastre.

Pour lier un binaire statique, l'éditeur de liens a besoin des versions statiques de toutes les librairies utilisées, aussi les utilisateurs rencontrent fréquemment des erreurs d'édition de liens à l'utilisation de cette option. La première chose à faire est de s'assurer d'avoir la librairie glibc statiquement liée sur votre système. Ensuite, il faut s'assurer de ne pas utiliser les options --openssl ou --with-python de la commande configure, car elle requierent des librairies supplémentaires. Vous devriez pouvoir activer ces options, mais il vous faudra charger les librairies statiques additionnelles correspondantes.

--enable-static-cons
Avec cette option, la compilation produira une static-console et une static-gnome-console en plus de la Console standard standard. Cette version qui inclut les librairies statiquement liées peut se révéler utile pour la reconstruction complète d'une machine après un désastre.

Pour lier un binaire statique, l'éditeur de liens a besoin des versions statiques de toutes les librairies utilisées, aussi les utilisateurs rencontrent fréquemment des erreurs d'édition de liens à l'utilisation de cette option. La première chose à faire est de s'assurer d'avoir la librairie glibc statiquement liée sur votre système. Ensuite, il faut s'assurer de ne pas utiliser les options --openssl ou --with-python de la commande configure, car elle requierent des librairies supplémentaires. Vous devriez pouvoir activer ces options, mais il vous faudra charger les librairies statiques additionnelles correspondantes.

--enable-client-only
Avec cette option, la compilation produira seulement le File Daemon et les librairies qui lui sont nécessaires. Aucun des autres daemons, outils de stockage, ni la console ne sera compilé. De même, un make install installera seulement le File Daemon. Pour obtenir tous les daemons, vous devez la désactiver. Cette option facilite grandement la compilation sur les simples clients.

Pour lier un binaire statique, l'éditeur de liens a besoin des versions statiques de toutes les librairies utilisées, aussi les utilisateurs rencontrent fréquemment des erreurs d'édition de liens à l'utilisation de cette option. La première chose à faire est de s'assurer d'avoir la librairie glibc statiquement liée sur votre système. Ensuite, il faut s'assurer de ne pas utiliser les options --openssl ou --with-python de la commande configure, car elle requierent des librairies supplémentaires. Vous devriez pouvoir activer ces options, mais il vous faudra charger les librairies statiques additionnelles correspondantes.

--enable-largefile
Cette option (activée par défaut) provoque la compilation de Bacula avec le support d'adressage de fichiers 64 bits s'il est disponible sur votre système. Ainsi Bacula peut lire et écrire des fichiers de plus de 2 GBytes. Vous pouvez désactiver cette option et revenir à un adressage de fichiers 32 bits en utilisant --disable-largefile.

--disable-nls
Bacula utilise par défaut les librairies GNU Native Language Support (NLS). Sur certaines machines, ces librairies peuvent être inexistante, ou ne pas fonctionner correctement (particulièrement sur les implémentations non Linux). dans ce genre de situations, vous pouvez neutraliser l'utilisation de ces librairies avec l'option --disable-nls. Dans ce cas, Bacula reviendra à l'usage de l'anglais.

--with-sqlite=<sqlite-path>
Cette option permet l'utilisation de la base de données SQLite versions 2.8.x. Il n'est, en principe, pas nécessaire de spécifier le chemin sqlite-path car Bacula recherche les composants requis dans les répertoires standards (depkgs/sqlite). voyez Installer et Configurer SQLite pour plus de détails.

Voyez aussi la note ci-dessous, après le paragraphe --with-postgreSQL

--with-sqlite3=<sqlite3-path>
Cette option permet l'utilisation de la base de données SQLite versions 3.x. Il n'est, en principe, pas nécessaire de spécifier le chemin sqlite3-path car Bacula recherche les composants requis dans les répertoires standards (depkgs/sqlite3). voyez Installer et Configurer SQLite pour plus de détails.

Voyez aussi la note ci-dessous, après le paragraphe --with-postgreSQL

--with-mysql=<mysql-path>
Cette option permet la compilation des services de Catalogue de Bacula. Elle implique que MySQL tourne déjà sur votre système, et qu'il soit installé dans le chemin mysql-path que vous avez spécifié. Si cette option est absente, Bacula sera compilé automatiquement avec le code de la base Bacula interne. Nous recommandons d'utiliser cette option si possible. Si vous souhaitez utilisez cette option, veuillez procéder à l'installation de MySQL ( Installer and Configurer MySQL) avant de procéder à la configuration.

Voyez aussi la note ci-dessous, après le paragraphe --with-postgreSQL

--with-postgresql=<postgresql-path>
Cette option déclare un chemin explicite pour les librairies PostgreSQL si Bacula ne les trouve pas dans le répertoire par défaut.

Notez que pour que Bacula soit configuré correctement, vous devez spécifier l'une des quatre options de bases de données supportées : --with-sqlite, --with-sqlite3, --with-mysql, ou --with-postgresql, faute de quoi ./configure échouera.

--with-openssl=<path>
Cette option est requise si vous souhaitez activer TLS (ssl) dans Bacula. Normalement, la spécification du chemin path n'est pas nécessaire car le processus de configuration recherche les librairies OpenSSL dans les emplacements standard du système. L'activation d'OpenSSL dans Bacula permet des communications sécurisées entre les daemons. Pour plus d'informations sur l'usage de TLS, consultez le chapitre Bacula TLS de ce manuel.

--with-python=<path>
Cette option active le support Python dans Bacula. Si le chemin n'est pas spécifié, le processus de configuration recherchera les librairies Python dans leurs emplacements standard. S'il ne peut trouver les librairies , il vous faudra fournir le chemin vers votre répertoire de librairies Python. Voyez le chapitre Python pour plus de détails sur l'utilisation de scripts Python.

--with-libintl-prefix=<DIR>
Cette option peut être utilisée pour indiquer à Bacula de rechercher dans DIR/include et DIR/lib les fichiers d'en tête libintl et les librairies requises pour Native Language Support (NLS).

--enable-conio
Cette option permet la compilation d'une petite et légère routine en alternative à readline, beaucoup plus facile à configurer, même si elle nécessite aussi les librairies termcap ou ncurses.

--with-readline=<readline-path>
Spécifie l'emplacement de readline. En principe, Bacula devrait le trouver s'il est dans une librairie standard. Sinon, et si l'option --with-readline n'est pas renseignée, readline sera désactivé. Cette option affecte la compilation de Bacula. Readline fournit le programme Console avec un historique des lignes de commandes et des capacités d'édition. Readline n'est désormais plus supporté, ce qui signifie que vous l'utilisez à vos risques et périls

--enable-readline
Active le support readline. Désactivé par défaut en raison de nombreux problèmes de configuration, et parce que le paquetage semble devenir incompatible.

--with-tcp-wrappers=<path>
Cette option précise que vous voulez TCP wrappers (man hosts_access(5)) compilé dans Bacula. Le chemin est facultatif puisque Bacula devrait, en principe, trouver les librairies dans les répertoires standards. Cette option affecte la compilation. Lorsque vous spécifierez vos restrictions dans les fichiers /etc/hosts.allow ou /etc/hosts.deny, n'utilisez pas l'option twist (man hosts_options(5)) ou le processus Bacula sera stoppé.

Pour plus d'informations sur la configuration et les tests de TCP wrappers, consultez la section Configurer et Tester TCP Wrappers du chapitre sur la sécurité.

--with-working-dir=<working-directory-path>
Cette option est obligatoire et spécifie un répertoire dans lequel Bacula peut placer en toute sécurité les fichiers qui resteront d'une exécution à l'autre. Par exemple, si la base de données interne est utilisée, Bacula stockera ces fichiers dans ce répertoire. Cette option n'est utilisée que pour modifier les fichiers de configuration de Bacula. Vous pourrez éventuellement effectuer cette modification directement en les éditant plus tard. Le répertoire spécifié ici n'est pas automatiquement créé par le processus d'installation, aussi vous devez veiller à ce qu'il existe avant votre première utilisation de Bacula.

--with-base-port=<port=number>
Bacula a besoin de trois ports TCP/IP pour fonctionner (un pour la Console, un pour le Storage Daemon et un pour le File Daemon). L'option --with-baseport permet d'assigner automatiquement trois ports consécutifs à partir du port de base spécifié. Vous pouvez aussi changer les numéros de ports dans les fichiers de configuration. Cependant, vous devez prendre garde à ce que les numéros de ports se correspondent fidèlement dans chacun des trois fichiers de configuration. Le port de base par défaut est 9101, ce qui assigne les ports 9101 à 9103. Ces ports (9101, 9102 et 9103) ont été officiellement assigné à Bacula par l'IANA. Cette option n'est utilisée que pour modifier les fichiers de configuration de Bacula. Vous pouvez à tout moment faire cette modification en éditant directement ces fichiers.

--with-dump-email=<email-address>
Cette option spécifie l'adresse e-mail qui recevra tous les core dump. Cette option n'est en principe utilisée que par les développeurs.

--with-pid-dir=<PATH>
Ceci précise le répertoire de stockage du fichier d'id de processus lors de l'exécution. La valeur par défaut est : /var/run. Le répertoire spécifié ici n'est pas automatiquement créé par le processus d'installation, aussi vous devez veiller à ce qu'il existe avant votre première utilisation de Bacula.

--with-subsys-dir=<PATH>
Cette option précise le répertoire de stockage des fichiers verrous du sous-système lors de l'exécution. Le répertoire par défaut est /var/run/subsys. Veillez à ne pas spécifier le même répertoire que pour l'option sbindir. Ce répertoire n'est utilisé que par les scripts de démarrage automatique. Le répertoire spécifié ici n'est pas automatiquement créé par le processus d'installation, aussi vous devez veiller à ce qu'il existe avant votre première utilisation de Bacula.

--with-dir-password=<Password>
Cette option vous permet de préciser le mot de passe d'accès au Director (contacté, en principe, depuis la console). S'il n'est pas précisé, configure en créé un aléatoirement.

--with-fd-password=<Password>
Cette option vous permet de préciser le mot de passe d'accès au File Daemon (contacté, en principe, depuis le Director). S'il n'est pas précisé, configure en créé un aléatoirement.

--with-sd-password=<Password>
Cette option vous permet de préciser le mot de passe d'accès au Storage Daemon (contacté, en principe, depuis le File Daemon). S'il n'est pas précisé, configure en créé un aléatoirement.

--with-dir-user=<User>
Cette option vous permet de spécifier l'UserId utilisé pour l'exécution du Director. Le Director doit être démarré en tant que root, mais n'a pas besoin d'être exécuté en tant que root. Après avoir effectué les opérations d'initialisation préliminaires, il peut redescendre au niveau de l'UserId spécifié dans cette option. Si vous utilisez cette option, vous devez créer l'utilisateur User avant d'exécuter make install, car le répertoire de travail de Bacula appartiendra à cet utilisateur.

--with-dir-group=<Group>
Cette option vous permet de spécifier le GroupId utilisé pour l'exécution du Director. Le Director doit être démarré en tant que root, mais n'a pas besoin d'être exécuté en tant que root. Après avoir effectué les opérations d'initialisation préliminaires, il peut redescendre au niveau du GroupId spécifié dans cette option. Si vous utilisez cette option, vous devez créer le groupe Group avant d'exécuter make install, car le répertoire de travail de Bacula appartiendra à ce groupe.

--with-sd-user=<User>
Cette option vous permet de spécifier l'UserId utilisé pour exécuter le Storage Daemon. Le Storage Daemon doit être démarré en tant que root, mais n'a pas besoin d'être exécuté en tant que root. Après avoir effectué les opérations d'initialisation préliminaires, il peut redescendre au niveau de l'UserId spécifié dans cette option. Si vous utilisez cette option, veillez à ce que le Storage Daemon ait accès à tous les périphériques de stockage dont il a besoin.

--with-sd-group=<Group>
Cette option vous permet de spécifier le GroupId utilisé pour exécuter le Storage Daemon. Le Storage Daemon doit être démarré en tant que root, mais n'a pas besoin d'être exécuté en tant que root. Après avoir effectué les opérations d'initialisation préliminaires, il peut redescendre au niveau du GroupId spécifié dans cette option.

--with-fd-user=<User>
Cette option vous permet de spécifier l'UserId utilisé pour exécuter le File Daemon. Le File Daemon doit être démarré et, dans la plupart des cas, exécuté en tant que root, de sorte que cette option n'est utilisée que dans des cas bien particuliers. Malgré tout, après avoir effectué les opérations d'initialisation préliminaires, il peut redescendre au niveau de l'UserId spécifié dans cette option.

--with-fd-group=<Group>
Cette option vous permet de spécifier le GroupId utilisé pour exécuter le File Daemon. Le File Daemon doit être démarré et, dans la plupart des cas, exécuté en tant que root, de sorte que cette option n'est utilisée que dans des cas bien particuliers. Malgré tout, après avoir effectué les opérations d'initialisation préliminaires, il peut redescendre au niveau du GroupId spécifié dans cette option.

Notez: de nombreuses options supplémentaires vous sont présentées lorsque vous entrez ./configure --help, mais elles ne sont pas implémentées.

Options recommandées pour la plupart des systèmes

Pour la plupart des systèmes, nous recommandons de commencer avec les options suivantes :

./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

Si vous souhaitez installer Bacula dans un répertoire d'installation plutôt que de l'exécuter depuis le répertoire de compilation, (comme le feront les développeurs la plupart du temps), vous devriez aussi inclure les options --sbindir et --sysconfdir avec les chemins appropriés. Aucune n'est nécessaire si vous ne vous servez pas de "make install'', comme c'est le cas pour la plupart des travaux de développement. Le processus d'installation va créer les répertoires sbindir et sysconfdir s'ils n'existent pas, mais il ne créera pas les répertoires pid-dir, subsys-dir ni working-dir, aussi assurez vous qu'ils existent avant de lancer Bacula. L'exemple ci-dessous montre la façon de procéder de Kern.

RedHat

Avec 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

ou

 
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

ou une installation RedHat complètement traditionnelle :

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=$HOME/var/run \
  --with-subsys-dir=/var/lock/subsys
  --enable-conio

Notez que Bacula suppose que les répertoires /var/bacula, /var/run et /var/lock/subsys existent, ils ne seront pas crées par le processus d'installation.

D'autre part, avec gcc 4.0.1 20050727 (Red Hat 4.0.1-5) sur processeur AMD64 et sous CentOS4 64 bits, un bug du compilateur génère du code erroné qui conduit Bacula à des erreurs de segmentation. Typiquement, vous le rencontrerez d'abord avec le Storage Daemon. La solution consiste à s'assurer que Bacula est compilé sans optimisation (normalement -O2)

Solaris

Pour installer Bacula depuis les sources, il vous faudra les paquetages suivants sur votre système (ils ne sont pas installés par défaut) : libiconv, gcc 3.3.2, stdc++, libgcc ( pour les librairies stdc++ and gcc_s ), make 3.8 ou plus récent.

Il vous faudra probablement aussi ajouter /usr/local/bin et /usr/css/bin à PATH pour ar.

#!/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

Comme mentionné ci-dessus, le processus d'installation va créer les répertoires sbindir et sysconfdir s'ils n'existent pas, mais il ne créera pas les répertoires pid-dir, subsys-dir ni working-dir, aussi assurez vous qu'ils existent avant de lancer Bacula.

Notez que vous pouvez aussi avoir besoin des paquetages suivants pour installer Bacula depuis les sources :

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

Veuillez consulter: The FreeBSD Diary pour une description détaillée de la méthode pour faire fonctionner Bacula sur votre système. De plus, les utilisateurs de versions de FreeBSD antérieures à la 4.9-STABLE du lundi 29 décembre 2003 15:18:01 qui envisagent d'utiliser des lecteurs de bandes doivent consulter le chapitre Tester son lecteur de bandes de ce manuel pour d'importantes informations sur la configuration des lecteurs pour qu'ils soient compatibles avec Bacula.

Si vous utilisez Bacula avec MySQL, vous devriez prendre garde à compiler MySQL avec les threads natifs de FreeBSD plutôt qu'avec ceux de Linux, car c'est avec ceux là qu'est compilé Bacula et le mélange des deux ne fonctionnera probablement pas.

Win32

Pour installer la version binaire Win32 du File Daemon, consultez le chapitre Installation sur systèmes Win32 de ce document.


Systèmes Windows avec CYGWIN installé

A partir de la version 1.34, Bacula n'utilise plus CYGWIN pour le client Win32. Il est cependant encore compilé sous un environnement CYGWIN -- Bien que vous puissiez probablement le faire avec seulement VC Studio. Si vous souhaitez compiler le client Win32 depuis les sources, il vous faudra Microsoft C++ version 6.0 ou supérieur. Dans les versions de Bacula antérieures à la 1.33, CYGWIN était utilisé.

Notez qu'en dépit du fait que la plupart des éléments de Bacula puissent compiler sur les systèmes Windows, la seule partie que nous avons testée et utilisée est le File Daemon.

Finalement, vous devriez suivre les instructions d'installation de la section Win32 Installation sur systèmes Win32 de ce document en occultant la partie qui décrit la décompression de la version binaire.

Le script Configure de Kern

Voici le script que j'utilise pour compiler sur mes machines Linux de "production'':

#!/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

Notez que je fixe le port de base à 9101, ce qui signifie que Bacula utilisera le port 9101 pour la console Director, le port 9102 pour le File Daemon, et le 9103 pour le Storage Daemon. Ces ports devraient être disponibles sur tous les systèmes étant donné qu'ils ont été officiellement attribués à Bacula par l'IANA (Internet Assigned Numbers Authority). Nous recommandons fortement de n'utiliser que ces ports pour éviter tout conflit avec d'autres programmes. Ceci est en fait la configuration par défaut si vous n'utilisez pas l'option --with-baseport.

Vous pouvez aussi insérer les entrées suivantes dans votre fichier /etc/services de façon à rendre les connections de Bacula plus aisées à repérer (i.e. netstat -a):

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

Installer Bacula

Avant de personnaliser vos fichiers de configuration, vous voudrez installer Bacula dans son répertoire définitif. tapez simplement:

make install

Si vous avez précédemment installé Bacula, les anciens binaires seront écrasés, mais les anciens fichiers de configuration resteront inchangés, et les "nouveaux'' recevront l'extension .new. Généralement, si vous avez déjà installé et exécuté Bacula, vous préfèrerez supprimer ou ignorer les fichiers de configuration avec l'extension .new

Compiler un File Daemon (ou Client)

Si vous exécutez le Director et le Storage Daemon sur une machine et si vous voulez sauvegarder une autre machine, vous devez avoir un File Daemon sur cette machine. Si la machine et le système sont identiques, vous pouvez simplement copier le binaire du File Daemon bacula-fd ainsi que son fichier de configuration bacula-fd.conf, puis modifier le nom et le mot de passe dans bacula-fd.conf de façon à rendre ce fichier unique. Veillez à faire les modifications correspondantes dans le fichier de configuration du Director (bacula-dir.conf).

Si les architectures, les systèmes, ou les versions de systèmes diffèrent, il vous faudra compiler un File Daemon sur la machine cliente. Pour ce faire, vous pouvez utiliser la même commande ./configure que celle utilisée pour construire le programme principal, soit en partant d'une copie fraiche du répertoire des sources, soit en utilisant make distclean avant de lancer ./configure.

Le File Daemon n'ayant pas d'accès au catalogue, vous pouvez supprimer les option --with-mysql ou --with-sqlite. Ajoutez l'option --enable-client-only. Ceci va compiler seulement les librairies et programmes clients, et donc éviter d'avoir à installer telle ou telle base de données. Lancez make avec cette configuration, et seul le client sera compilé.

Démarrage automatique des Daemons

Si vous souhaitez que vos daemons soient lancés automatiquement au démarrage de votre système (une bonne idée !), une étape supplémentaire est requise. D'abord, le processus ./configure doit reconnaître votre système -- ce qui signifie que ce doit être une plate-forme supportée et non inconnue, puis vous devez installer les fichiers dépendants de la plate-forme comme suit :

(devenez root)
make install-autostart

Notez que la fonction d'autodémarrage n'est implémentée que pour les systèmes que nous supportons officiellement (actuellement FreeBSD, RedHat Linux, et Solaris), et n'a été pleinement testée que sur RedHat Linux.

make install-autostart installe les scripts de démarrage apropriés ainsi que les liens symboliques nécessaires. Sur RedHat Linux, Ces scripts résident dans /etc/rc.d/init.d/bacula-dir /etc/rc.d/init.d/bacula-fd, et /etc/rc.d/init.d/bacula-sd. Toutefois, leur localisation exacte dépend de votre système d'exploitation.

Si vous n'installez que le File Daemon, tapez:

make install-autostart-fd

Autres notes concernant la compilation

Pour recompiler tout exécutable, tapez

make

dans le répertoire correspondant.. Afin d'éliminer tous les objets et binaires (y compris les fichiers temporaires nommés 1,2 ou 3 qu'utilise Kern), tapez

make clean

Pour un nettoyage exhaustif en vue de distribution, entrez:

make distclean

Notez que cette commande supprime les Makefiles. Elle est en principe lancée depuis la racine du répertoire des sources pour les préparer à la distribution. Pour revenir de cet état, vous devez réexécuter la commande ./configure à la racine des sources puisque tous les Makefiles ont été détruits.

Pour ajouter un nouveau fichier dans un sous-répertoire, éditez Makefile.in dans ce sous-répertoire, puis faites un simple make. Dans la plupart des cas, le make reconstruira le Makefile à partir du nouveau Makefile.in. Dans certains cas, il peut être nécessaire d'exécuter make une deuxième fois. Dans les cas extrèmes, remontez à la racine des sources et entrez make Makefiles.

Pour ajouter des dépendances:

make depend

La commande make depend insère les fichiers d'en-têtes de dépendances aux Makefile et Makefile.in pour chaque fichier objet. Cette commande devrait être lancée dans chaque répertoire où vous modifiez les dépendances. En principe, il suffit de l'exécuter lorsque vous ajoutez ou supprimez des sources ou fichiers d'en-têtes. make depend est invoqué automatiquement durant le processus de configuration.

Pour installer:

make install

En principe, vous n'utilisez pas cette commande si vous êtes en train de développer Bacula, mais si vous vous apprétez à l'exécuter pour sauvegarder vos systèmes.

Après avoir lancé make install, les fichiers suivants seront installés sur votre système (à peu de choses près). La liste exacte des fichiers installés et leur localisation dépend de votre commande c./configure (e.g. gnome-console et gnome-console.conf ne sont pas installés si vous ne configurez pas GNOME. De même, si vous utilisez SQLite plutôt que MySQL, certains fichiers seront différents.

bacula
bacula-dir
bacula-dir.conf
bacula-fd
bacula-fd.conf
bacula-sd
bacula-sd.conf
bacula-tray-monitor
tray-monitor.conf
bextract
bls
bscan
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
stopmysql
wx-console
wx-console.conf

Installer Tray Monitor

Le Tray Monitor est déjà installé si vous avez utilisé l'option --enable-tray-monitor de la commande configure et exécuté make install.

Comme vous n'exécutez pas votre environnement graphique en tant que root (si vous le faites, vous devriez changer cette mauvaise habitude), n'oubliez pas d'autoriser votre utilisateur à lire tray-monitor.conf, et exécuter bacula-tray-monitor (ceci ne constitue pas une faille de sécurité).

Puis, connectez vous à votre environnement graphique (KDE, Gnome, ou autre), lancez bacula-tray-monitor avec votre utilisateur et observez si l'icone d'une cartouche apparaît quelque part sur l'écran, usuellement dans la barre des tâches. Sinon, suivez les instructions suivantes relatives à votre gestionnaire de fenêtres.

GNOME

System tray, ou zone de notification si vous utilisez la terminologie GNOME, est supporté par GNOME depuis la version 2.2. Pour l'activer, faites un click droit sur un de vos espaces de travail, ouvrez le menu Ajouter à ce bureau, puis Utilitaire et enfin, cliquez sur Zone de notification. (NDT: A valider)

KDE

System tray est supporté par KDE depuis la version 3.1. Pour l'activer, faites un click droit sur la barre de tâches, ouvrez le menu Ajouter, puis Applet, enfin cliquez sur System Tray.

Autres gestionnaires de fenêtres

Lisez la documentation pour savoir si votre gestionnaire de fenêtres supporte le standard systemtray de FreeDesktop, et comment l'activer le cas échéant.

Modifier les fichiers de configuration de Bacula

Consultez le chapitre Configurer Bacula de ce manuel pour les instructions de configuration de Bacula.


Une brève documentation

Ce chapitre vous guidera à travers les étapes nécessaires pour exécuter Bacula. Pour cela, nous supposons que vous avez installé Bacula, peut être dans un simple répertoire comme le décrit le chapitre précédent, auquel cas vous pouvez exécuter Bacula sans être root pour ces tests. Nous supposons d'autre part que vous n'avez pas modifié les fichiers de configuration. Dans le cas contraire, nous vous recommandons de désinstaller Bacula et de le réinstaller sans rien modifier. Les exemples de ce chapitre utilisent les fichiers de configuration par défaut, et créent les volumes dans le répertoire /tmp de votre disque. De plus, les données sauvegardées seront celle du répertoire des sources de Bacula où vous l'avez compilé. Par conséquent, tous les daemons peuvent être exécutés sans les droits root pour ces tests. Notez bien qu'en production, vos File Daemons devront être exécutés en tant que root. Voyez le chapitre sur la sécurité pour plus d'informations sur ce sujet.

Voici les étapes que nous suivrons :

  1. cd <install-directory>
  2. Démarrer la base de données (si vous utilisez MySQL ou PostgreSQL)
  3. Démarrer les daemons avec ./bacula start
  4. Lancer le programme Console pour interagir avec le Director
  5. Lancer un job
  6. Lorsqu'un volume est plein, le démonter, s'il s'agit d'une cartouche, en étiqueter une nouvelle et poursuivre. Dans ce chapitre, nous n'écrirons que sur des volumes fichier, aussi vous n'avez pas à vous inquiéter au sujet des cartouches pour le moment.
  7. Tester la restauration de quelques fichiers depuis le volume fraichement écrit pour s'assurer de la validité de la sauvegarde et qu'il est possible de restaurer. Mieux vaut essayer avant qu'un désastre ne survienne...
  8. Ajouter un second client.

Chacune de ces étapes est décrite en détail ci-dessous.

Avant d'exécuter Bacula

Avant d'utiliser Bacula pour la première fois en production, nous vous recommandons d'exécuter la commande du programme ainsi qu'il est décrit dans le chapitre Programmes utilitaires de ce manuel. Ce programme vous aidera à vous assurer que votre lecteur de bandes fonctionne correctement avec Bacula. Si vous avez un lecteur moderne de marque HP, Sony, ou Quantum DDS ou DLT qui fonctionne sous Linux ou Solaris, vous pouvez probablement vous dispenser de faire ce test car Bacula est bien testé avec ces lecteurs et ces systèmes. Dans tous les autres cas, vous êtes fortement encouragé à exécuter les tests avant de poursuivre. btape dispose aussi d'une commande fill qui tente de reproduire le comportement de Bacula lorsqu'il remplit une cartouche et qu'il poursuit son écriture sur la suivante. Vous devriez songer à faire ce test, sachez cependant qu'il peut être long (environ 4 heures sur mon lecteur) de remplir une cartouche de haute capacité.


Démarrer la base de données

Si vous utilisez MySQL ou PostgreSQL pour votre catalogue Bacula, vous devez démarrer la base de données avant d'essayer de lancer un job pour éviter d'obtenir des messages d'erreur au démarrage de Bacula. J'utilise les scripts startmysql et stopmysql pour démarrer mon MySQL local. Notez que si vous utilisez SQLite, vous n'aurez pas à utiliser startmysql ou stopmysql. Si vous utilisez ceci en production, vous souhaiterez probablement trouver un moyen pour démarrer automatiquement MySQL ou PostgreSQL après chaque redémarrage du système.

Si vous utilisez SQLite (c'est à dire, si vous avez spécifié l'option --with-sqlite=xxx de la commande ./configure, vous n'avez rien à faire. SQLite est démarrée automatiquement par Bacula.


Démarrer les daemons

Que vous ayez compilé Bacula depuis les sources ou que vous ayez installé les rpms, tapez simplement :

./bacula start

dans votre répertoire d'installation pour démarrer les trois daemons.

Le script bacula lance le Storage Daemon, le File Daemon et le Director Daemon, qui tournent tous trois en tant que daemons en tâche de fond. Si vous utilisez la fonction de démarrage automatique de Bacula, vous pouvez, au choix, lancer les trois daemons lors du démarrage, ou au contraire les lancer individuellement avec les scripts bacula-dir, bacula-fd, et bacula-sd usuellement situés dans /etc/init.d, bien que leur localisation effective soit dépendante du système d'exploitation.

Notez que seul le File Daemon a été porté sur les systèmes Windows, et qu'il doit être démarré différamment. Veuillez consulter le chapitre La version Windows de Bacula de ce manuel.

Les paquetages rpm configurent les daemons pour qu'ils s'exécutent en tant qu'utilisateur root et en tant que groupe bacula. Le processus d'installation rpm se charge de créer le groupe bacula s'il n'existe pas sur le système. Tout utilisateur ajouté au groupe bacula hérite de l'accès aux fichiers créés par les daemons. Pour modifier ce comportement, éditez les scripts de démarrage des daemons :

puis redémarrez-les.

Le chapitre installation de ce manuel indique comment installer les scripts de démarrage automatique des daemons.

Interagir avec le Director pour l'interroger sur l'état de Bacula ou lancer des jobs

Pour communiquer avec le Director et pour s'enquérir de l'état de Bacula ou de jobs en cours d'exécution, tapez simplement :

./bconsole

dans le répertoire de plus haut niveau.

Si vous avez installé la console GNOME et utilisé l'option --enable-gnome de la commande configure, vous pouvez aussi utiliser la console GNOME en tapant :

./gnome-console

Vous pouvez aussi utiliser le programme wxWidgets wx-console.

Pour simplifier, nous ne décrirons ici que le programme ./bconsole. La plus grande partie de ce qui est décrit ici s'applique aussi aux programmes ./gnome-console et wx-console.

La commande ./bconsole lance le programme Console, qui se connecte au Director. Bacula étant un programme réseau, vous pouvez utiliser la Console depuis n'importe quelle machine de votre réseau. Cependant, la plupart du temps le Console est exécutée sur la même machine que le Director. En principe, la Console devrait produire un affichage similaire à :

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

L'astérisque est l'invite de commande de la console.

Tapez help pour obtenir la liste des commandes disponibles :

*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
*

Pour plus de détails sur les commandes de la console, consultez le chapitre Console de ce manuel.


exécuter un job

A ce stade, nous supposons que vous avez :

En outre, nous supposons pour le moment que vous utilisez les fichiers de configuration par défaut.

Maintenant, entrez les commandes suivantes :

show filesets

Vous devriez obtenir quelque chose comme :

FileSet: name=Full Set
      O M
      N
      I /home/kern/bacula/regress/build
      N
      E /proc
      E /tmp
      E /.journal
      E /.fsck
      N
FileSet: name=Catalog
      O M
      N
      I /home/kern/bacula/regress/working/bacula.sql
      N

Il s'agit d'un FileSet prédéfini qui sauvegardera le répertoire des sources de Bacula. Les noms de répertoires qui seront réellement affichés devraient correspondre à votre configuration. Dans une perspective de tests, nous avons choisi un répertoire de taille et de complexité modérée (environ 40 Mo). Le FileSet Catalog est utilisé pour sauvegarder le catalogue Bacula et nous ne nous y attarderons pas pour le moment. Les entrées I sont les fichiers ou répertoires qui seront inclus dans la sauvegarde, tandis que les entrées E sont ceux qui en seront exclus, quand aux entrées O, ce sont les options spécifiées pour ce FileSet. Vous pouvez changer ce qui est sauvegardé en modifiant la ligne File = de la ressource FileSet.

Il est maintenant temps de lancer votre première sauvegarde. Nous allons sauvegarder votre répertoire sources de Bacula vers un volume File dans votre répertoire /tmp afin de vous montrer combien c'est facile. Saisissez :

status dir

Vous devriez obtenir :

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
====

Où les dates et le nom du Director seront différents et en accord avec votre installation. Ceci montre qu'une sauvegarde incrémentale est planifiée pour le job Client1 à 1h05, et qu'une sauvegarde full est planifiée pour le job BackupCatalog à 1h10. Vous devriez remplacer le nom Client1 par celui de votre machine, sinon vous risquez la confusion lorsque vous ajouterez de nouveaux clients. Pour ma machine réelle, j'utilise Rufus plutôt que Client1.

A présent, tapez :

status client

Vous devriez obtenir :

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.
====

Dans ce cas, le client se nomme rufus-fd, votre nom sera différent, mais la ligne qui débute par rufus-fd Version... est produite par votre File Daemon, nous sommes donc maintenant surs qu'il fonctionne.

Finalement, faites de même pour votre Storage Daemon :

status storage

Vous devriez obtenir :

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.
====

Vous noterez que le périphérique du Storage Daemon par défaut est nommé File et qu'il utilise le périphérique /tmp, qui n'est actuellement pas ouvert.

Maintenant, lancez un job :

run

Vous devriez obtenir :

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):

Ici, Bacula affiche la liste des trois différents jobs que vous pouvez exécuter. Choisissez le numéro 1 et validez (entrée).

Vous devriez obtenir :

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):

Prenez un peu de temps pour examiner cet affichage et le comprendre. Il vous est demandé de valider, modifier ou annuler l'exécution d'un job nommé Client1 avec le FileSet Full Set que nous avons affiché plus haut en incrémental sur votre client rufus, utilisant le périphérique de stockage File et le pool Default à la date indiquée sur la ligne "When".

Nous avons le choix de valider (yes), modifier un ou plusieurs des paramètres ci-dessus (mod), ou de ne pas exécuter le job (no).

Validez l'exécution du job (yes), vous devriez immédiatement obtenir l'invite de commande de la console (un astérisque). Après quelques minutes, la commande messages devrait produire un résultat tel que :

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

Le premier message signale qu'aucune sauvegarde full n'a jamais été faite, et que par conséquent Bacula élève votre incrémentale en une Full (ce comportement est normal). Le second message indique que le job a démarré avec le JobId 1 et le troisième message vous informe que Bacula ne peut trouver aucun volume dans le pool Default sur lequel écrire les données du job. Ceci est normal, car nous n'avons encore créé (ou étiqueté) aucun volume. Bacula vous fournit tous les détails concernant le volume dont il a besoin.

A ce point, le job est bloqué en attente d'un volume. Vous pouvez le vérifier en utilisant la commande status dir. Pour continuer, vous devez créer un volume sur lequel Bacula pourra écrire. Voici la manipulation :

label

Bacula devrait afficher :

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

Entrez un nom commenant par une lettre et ne contenant que des chiffres et des lettres (périodes, tirets et souligné "_" sont aussi autorisés). Par exemple entrez TestVolume001, vous devriez obtenir :

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

Finalement, tapez la commande messages, vous devriez obtenir quelque chose comme :

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.

Si rien ne se passe dans l'immédiat, vous pouvez continuer de rentrer la commande messages jusqu'à ce que le job se termine, ou utiliser la commande autodisplay on afin que les messages soient affichés dès-qu'ils sont disponibles.

si vous faites ls -l dans votre répertoire /tmp, vous verrez l'élément suivant :

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

Il s'agit du volume File que vous venez juste d'écrire, et qui contient toutes les données du job que vous venez d'exécuter. Si vous exécutez d'autres jobs, il seront ajoutés à la suite de ce volume, à moins que vous n'ayez spécifié un autre comportement.

Vous vous demandez peut-être s'il va vous falloir étiqueter vous même chaque volume que Bacula sera amené à utiliser. La réponse, en ce qui concerne les volumes disque tels que celui que nous avons utilisé, est non. Il est possible de paramétrer Bacula pour qu'il créée lui même les volumes. En revanche, pour les volumes de type cartouche, il vous faudra très probablement étiqueter chaque volume que vous voulez utiliser.

Si vous souhaitez en rester là, saisissez simplement quit dans la console, puis stoppez Bacula avec ./bacula stop. Pour nettoyer votre installation des résultats de vos tests, supprimez le fichier /tmp/TestVolume001, et réinitialiser votre catalogue en utilisant :

./drop_bacula_tables
./make_bacula_tables

Notez bien que ceci supprimera toutes les informations concernant les jobs précédemment exécutés et que, si c'est sans doute ce que vous souhaitez faire en fin de phase de test, ce n'est généralement pas une opération souhaitable en utilisation normale.

Si vous souhaitez essayer de restaurer les fichiers que vous venez de sauvegarder, lisez la section suivante.

Restaurer vos fichiers

Si vous avez utilisé la configuration par défaut et sauvegardé les sources de Bacula comme dans la démonstration ci-dessus, vous pouvez restaurer les fichiers sauvegardés en saisissant les commandes suivantes dans la Console :

restore all

Vous obtiendrez :

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):

Comme vous pouvez le constater, les options sont nombreuses, mais pour l'instant, choisissez l'option 5 afin de sélectionner la dernière sauvegarde effectuée. Vous obtiendrez :

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: /
$

(J'ai tronqué l'affichage à droite par soucis de lisibilité.) Comme vous pouvez le constater au début de cet affichage, Bacula connaît vos clients, et puisque vous n'en avez qu'un, il est automatiquement sélectionné. Il en va de même pour le FileSet. Bacula produit alors une liste de tous les jobs qui constituent la sauvegarde courante. Dans le cas présent, il n'y en a qu'un. Notez que le Storage Daemon est aussi sélectionné automatiquement. Bacula est maintenant en mesure de produire une arborescence à partir de tous les fichiers qui ont été sauvegardés (il s'agit d'une représentation en mémoire de votre système de fichiers). A ce stade, vous pouvez utiliser les commandes cd , ls et dir pour naviguer dans l'arborescence et voir quels fichiers peuvent être restaurés. Par exemple, si je saisis cd /home/kern/bacula/bacula-1.30 suivi de dir, j'obtiens la liste de tous les fichiers du répertoire source de Bacula. Pour plus d'information sur ce sujet, veuillez consulter le chapitre La commande Restore.

Pour quitter, tapez simplement :

done

Vous obtiendrez :

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):

Si vous acceptez (yes), vos fichiers seront restaurés vers le répertoire /tmp/bacula-restores. Si vous préférez restaurer les fichiers à leurs emplacements d'origine, vous devez utiliser l'option mod et régler explicitement le paramètre Where à vide ou "/". Nous vous conseillons de poursuivre avec yes. Après quelques instants, la commande messages devrait produire la liste des fichiers restaurés, ainsi qu'un résumé du job qui devrait ressembler à ceci :

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.

Après avoir quitté la Console, vous pouvez examiner les fichiers dans le répertoire /tmp/bacula-restores, il contient l'arborescence avec tous vos fichiers. Supprimez-le après avoir vérifié :

rm -rf /tmp/bacula-restore

Quitter le programme Console

Saisissez simplement la commande quit.

Ajouter un client

Si vous êtes parvenus à faire fonctionner tous les exemples ci-dessus, vous êtes sans doute prèt à ajouter un nouveau client (File Daemon), c'est à dire une seconde machine que vous souhaitez sauvegarder. La seule chose à installer sur la nouvelle machine est le binaire bacula-fd (ou bacula-fd.exe pour Windows) et son fichier de configuration bacula-fd.conf. Vous pouvez démarrer en copiant le fichier précédemment créé moyennant une modification mineure pour l'adapter au nouveau client : changez le nom de File Daemon (rufus-fd dans l'exemple ci-dessus) en le nom que vous avez choisi pour le nouveau client. Le mieux est d'utiliser le nom de la machine. Par exemple :

...
#
# "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
}
...

devient :

...
#
# "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
}
...

rufus-fd est devenu matou-fd (je ne montre qu'une partie du fichier). Le choix des noms vous appartient. Pour l'instant, je vous recommande de ne rien changer d'autre. Plus tard, vous changerez le mot de passe.

Installez cette configuration sur votre seconde machine. Il vous faut maintenant ajouter quelques lignes à votre bacula-dir.conf pour définir le nouveau File Daemon. En vous basant sur l'exemple initial qui devrait être installé sur votre système, ajoutez les lignes suivantes (essentiellement, une copie des lignes existantes avec seulement les noms modifiés) à votre 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
}

Assurez-vous que le paramètre Address de la ressource Storage a pour valeur le nom pleinement qualifié et non quelque chose comme "localhost". L'adresse spécifiée est envoyée au client et doit être un nom pleinement qualifié. Si vous utilisez "localhost", l'adresse du Storage Daemon ne sera pas résolue correctement, il en résultera un timeout lorsque le File Daemon échouera à connecter le Storage Daemon.

Il n'y a rien d'autre à faire. J'ai copié les ressources existantes pour créer un second job (Matou) pour sauvegarder le second client (matou-fd). le client se nomme matou-fd et le job Matou, le fichier bootstrap est modifié mais tout le reste est inchangé. Ceci signifie que Matou sera sauvegardé avec la même planification sur les mêmes cartouches. Vous pourrez changer ceci plus tard, pour le moment, restons simples.

La seconde modification consiste en l'ajout d'une nouvelle ressource Client qui définit matou-fd et qui a l'adresse correcte matou (mais dans la vraie vie, vous pouvez avoir besoin d'un nom pleinement qualifié ou d'une adresse IP. J'ai aussi conservé le même mot de passe (xxxxx dans l'exemple).

A ce stade, il suffit de redémarrer Bacula pour qu'il prenne en compte vos modifications. L'invite que vous avez vu plus haut devrait maintenant inclure la nouvelle machine.

Pour une utilisation en production vous voudrez probablement utiliser plusieurs pools et différentes planifications. Il vous appartient de faire les adaptations qui seyent à vos besoins. Dans tous les cas, n'oubliez pas de changer les mots de passe dans les fichiers de configuration du Director et du Client pour des raisons de sécurité.

Vous trouverez des astuces importantes concernant le changement des noms et mots de passe, ainsi qu'un diagramme décrivant leurs correspondances dans la section Erreurs d'authentification du chapitre FAQ de ce manuel.


Lorsque la cartouche est pleine

Si vous avez planifié votre job, il viendra un moment où la cartouche sera pleine et où Bacula ne pourra continuer. Dans ce cas, Bacula vous enverra un message tel que :

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

Ceci indique que Bacula a reēu une erreur d'écriture à cause de la carouche pleine. Bacula va maintenant rechercher une cartouche utilisable dans le pool spécifié pour le job. Dans la situation idéale, vous avez réglé correctement vos rétentions et spécifié que vos cartouches peuvent être recyclées automatiquement. Dans ce cas, Bacula recycle automatiquement vos cartouches sorties de rétention et est en mesure de réécrire dessus. Pour plus d'informations sur le recyclage, veuillez consulter le chapitre Recyclage de ce manuel. Si vous constatez que vos cartouches ne sont pas recyclées correctement, consultez la section sur le Recyclage manuel du chapitre Recyclage.

Si comme moi, vous avez un très grand nombre de cartouches que vous étiquetez avec la date de première écriture, si vous n'avez pas réglé vos périodes de rétention, Bacula ne trouvera pas de cartouche dans le pool et il vous enverra un message tel que :

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

Ce message sera répété une heure plus tard, puis deux heures plus tard et ainsi de suite en doublant à chaque fois l'intervalle à concurrence d'un jour jusqu'à ce que vous créiez un volume.

Que faire dans cette situation ?

La réponse est simple : d'abord, fermez le lecteur à l'aide de la commande unmount du programme Console. Si vous n'avez qu'un lecteur, il sera sélectionné automatiquement, sinon assurez-vous de démonter celui spécifié dans le message (dans ce cas STD-10000).

Ensuite, retirez la cartouche du lecteur et insérez-en une vierge. Notez que sur certains lecteurs anciens, il peut être nécessaire d'écrire une marque de fin de fichier (mt -f /dev/nst0 weof) pour éviter que le lecteur ne déroule toute la cartouche lorsque Bacula tente de lire le label. (NDT : j'ai un doute, la vo dit : "to prevent the drive from running away when Bacula attempts to read the label.")

Finalement, utilisez la commande label dans la console pour écrire un label sur le nouveau volume. la commande label va contacter le Storage Daemon pour qu'il écrive l'étiquette logicielle. Si cette opération se termine correctement, le nouveau volume est ajouté au pool et la commande mount est envoyée au Storage Daemon. Voyez les sections précédentes de ce chapitre pour plus de détails sur l'étiquetage des cartouches.

Bacula peut maintenant poursuivre le job et continuer d'écrire les données sauvegardées sur le nouveau volume.

Si Bacula cycle sur un pool de volumes, au lieu du message ci-dessus "Cannot find any appendable volumes.", Bacula peut vous demander de monter un volume particulier. Dans ce cas, essayez de le satisfaire. Si, pour quelque raison, vous n'avez plus le volume, vous pouvez monter n'importe quel autre volume du pool, pourvu qu'il soit utilisable, Bacula l'utilisera. La commande list volumes du programme Console permet de déterminer les volumes utilisables et ceux qui ne le sont pas.

Si, comme moi, vous avez paramétré correctement vos périodes de rétention, mais n'avez plus aucun volume libre, vous pouvez ré-étiqueter et ré-utiliser un volume comme suit :

Pour ré-étiqueter manuellement le volume, suivez les étapes supplémentaire ci-dessous :

D'autres commandes utiles de la console Bacula

status dir
Affiche un état de tous les jobs en cours d'exécution ainsi que tous les jobs programmés dans les prochine 24 heures

status
Le programme Console vous invite à sélectionner un daemon, puis il s'enquiert de l'état de ce daemon.

status jobid=nn
Affiche un état du JobId nn s'il est en cours d'exécution. Le Storage Daemon est aussi contacté pour produire un état du job.

list pools
Affiche la liste des pools définis dans le catalogue.

list media
Affiche la liste des média définis dans le catalogue.

list jobs
Affiche la liste de tous les jobs enregistrés dans le catalogue et squi ont été exécutés.

list jobid=nn
Affiche le JobId nn depuis le catalogue.

list jobtotals
Affiche les totaux pour tous le jobs du catalogue.

list files jobid=nn
Affiche la liste des fichiers sauvegardés pour le JobId nn.

list jobmedia
Affiche des informations relatives aux média utilisés pour chaque job exécuté.

messages
Affiche tous les messages redirigés vers la console.

unmount storage=storage-name
Démonte le lecteur associé au périphérique de stockage désigné par storage-name s'il n'est pas en cours d'utilisation. Cette commande est utile si vous souhaitez que Bacula libère le lecteur.

mount storage=storage-name
Le lecteur associé au périphérique de stockage est monté à nouveau. Lorsque Bacula atteint la fin d'un volume et vous demande d'en monter un nouveau, vous devez utiliser cette commande après avoir introduit une nouvelle cartouche dans le lecteur. En effet, c'est le signal qui indique à Bacula qu'il peut commencer à lire ou écrire sur la cartouche.

quit
Permet de quitter le programme Console.

La plupart des commandes citées ci-dessus, à l'exception de list, vous invitent à compléter la liste des arguments fournis si vous vous contentez d'entrer le nom de la commande.

Débugger la sortie des daemons

Si vous voulez débugger la sortie des daemons en cours d'exécution, lancez-les, depuis le répertoire d'installation, comme suit :

./bacula start -d100

Cette possibilité peut vous fournir une aide précieuse si vos daemons ne démarrent pas correctement. Normalement, la sortie des daemons est dirigée vers le périphérique NULL, avec un niveau de débuggage supérieur à zéro, elle est dirigée vers le terminal de lancement.

Pour stopper les trois daemons, tapez simplement :

./bacula stop

dans le répertoire d'installation.

L'exécution de bacula stop peut signaler des pids non trouvés. C'est Ok, spécialement si l'un des bacula stop est mort, ce qui est très rare.

Pour faire une sauvegarde complète (Full) du système, chaque File Daemon doit être exécuté en tant que root afin d'avoir les permissions requises pour accéder à tous les fichiers. Les autres daemons n'ont pas besoin des privilèges root. Cependant, le Storage Daemon doit être capable d'accéder aux lecteurs, ce qui Sur beaucoup de systèmes, n'est possible que pour root. Vous pouvez, au choix, exécuter le Storage Daemon en tant que root, ou changer les permissions sur les lecteurs pour autoriser les accès non-root. MySQL et PostgreSQL peuvent être installés et exécutés avec un userid quelconque, les privilèges root ne sont pas requis.

Soyez patient lorsque vous démarrez les daemons ou montez des cartouches vierges

Lorsque vous lancez les daemons Bacula, le Storage Daemon tente d'ouvrir tous les périphériques de stockage définis et de vérifier le volumes courrament montés. Il n'accepte aucune connection de la console tant que tous les périphériques n'ont pas été vérifiés. Une cartouche qui a été utilisé précédemment doit être rembobinée, ce qui, sur certain lecteurs, peut prendre plusieurs minutes. Par conséquent, vous devriez faire preuve d'un peu de patience lorsue vous tentez de contacter le Storage Daemon pour la première fois après le lancement de Bacula. Si vous avez un accès visuel à votre lecteur, celui-ci devrait être prèt à l'emploi lorsque son témoin lumineux cesse de clignoter.

Les mêmes considérations s'appliquent si vous avez monté une cartouche vierge dans un lecteur tels qu'un HP DLT. Il peut s'écouler une à deux minutes avant que le lecteur se rende compte que la cartouche est vierge. Si vous tentez de la monter pendant cette période, il est probable que vous aller geler votre pilote SCSI (c'est le cas sur mon système RedHat). Par conséquent, nous vous enjoignons une fois encore à être patient lors de l'insertion de cartouches vierges. Laissez le lecteur s'initialiser avant de tenter d'y accéder.

Problèmes de connection du FD vers le SD

Si l'un ou plusieurs de vos File Daemons rencontre des difficultés à se connecter au Storage Daemon, c'est très probablement que vous n'avez pas utilisé un nom pleinement qualifié pour la directive Address de la ressource Storage du fichier de configuration du Director. Le résolveur de la machine cliente (celle qui exécute le FD) doit être capable de résoudre le nom que vous avez spécifié dans cette directive en une adresse IP. Un exemple d'adresse ne fonctionnant pas est localhost. Un exemple qui pourrait fonctionner : megalon. Un exemple qui a encore plus de chances de fonctionner : magalon.mydomain.com. Sur les systèmes Win32, si vous ne disposez pas d'un bon résolveur (c'est souvent le cas sur Win98), vous pouvez essayer en utilisant une adresse IP plutôt qu'un nom.

Si votre adresse est correcte, assurez vous qu'aucun autre programme n'utilise le port 9103 sur la machine qui héberge le Storage Daemon. Les numéros de ports de Bacula sont autorisés par l'IANA, et ne devraient donc pas être utilisés par d'autres programmes, mais il semble que certaines imprimantes HP les utilisent. Exécutez la commande netstat -a sur la machine qui héberge le Storage Daemon pour déterminer qui utilise le port 9103 (utilisé pour les communications du FD vers le SD).

Options en ligne de commande des Daemons

Chacun des trois daemons (Director, File, Storage) acceptent quelques options sur la ligne de commande. En général, chacun d'entre eux, de même que le programme Console, admet les otpions suivantes :

-c <file>
Définit le fichier de configuration à utiliser. La valeur par défaut est le nom du daemon suivi de conf, par exemple bacula -dir.conf pour le Director, bacula-fd pour le File Daemon, et bacula-sd.conf pour le Storage Daemon.

-d nn
Fixe le niveau de débuggage à la valeur nn. Les niveaux les plus élevé permettent d'afficher plus d'information sur STDOUT concernant ce que le daemon est en train de faire.

-f
Exécute le daemon en arrière plan. Cette option est requise pour exécuter les daemons avec le debugger.

-s
Ne pas capturer les signaux. Cette option est requise pour exécuter les daemons avec le debugger.

-t
Lire les fichiers de configuration et afficher les messages d'erreur, et quitter immédiatement. Très utile pour tester la syntaxe de nouveaux fichiers de configuration.

-v
Mode verbeux. Utile pour rendre les messages d'erreur et d'information plus complets.

-?
Affiche la version et la liste des options.

Le Director a les options spécifiques suivantes :

-r <job>
Exécute le job désigné immédiatement. Ceci ne devrait servir qu'à des fins de débuggage.

Le File Daemon les options spécifiques suivantes :

-i
Suppose que le daemon est appelé par inetd ou xinetd. Dans ce cas, le daemon suppose qu'une connection est déjà établie et qu'elle est passée en tant que STDIN. Le daemon s'arrète dès que la connection se termine.

Le Storage Daemon n'a pas d'options spécifiques.

Le programme Console n'a pas d'options spécifiques.


Créer un Pool

La création de pool est automatique au démarrage de Bacula, aussi si vous comprenez déjà le concept de pools et leur fonctionnement, vous pouvez passer à la section suivante.

Lorsque vous exécutez un job, Bacula doit déterminer quel volume utiliser pour sauvegarder le FileSet. Plutôt que de spécifier un volume directement, vous spécifiez l'ensemble de volumes dans lequel vous autorisez Bacula à puiser lorsqu'il lui faut un volume pour écrire les données sauvegardées.Dès lors, Bacula se charge de sélectionner le premier volume utilisable dans le pool approprié au périphérique que vous avez spécifié pour le job exécuté. Lorsqu'un volume est plein, Bacula change son VolStatus de Append en Full, et utilise le volume suivant, et ainsi de de suite. S'il n'y a pas de volume utilisable, Bacula envoie un message à l'opérateur pour réclamer la création d'un volume approprié.

Bacula garde trace des noms de pools, des volumes contenus dans les pools, et de plusieurs caractéristiques de chacun de ces volumes.

Lorsque Bacula démarre, il s'assure que toutes les définitions de ressources Pool ont été enregistrées dans le catalogue. Vous pouvez le vérifier avec la commande :

list pools

du programme Console, qui devrait produire quelque chose comme :

*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        |
+--------+---------+---------+---------+----------+-------------+
*

Si vous tentez de créer un pool existant, Bacula affiche :

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

Etiqueter vos Volumes

Bacula exige que chaque volume comporte une étiquette (NDT : label) logicielle. Il existe plusieurs stratégies pour étiqueter les volumes. Celle que j'utilise consiste à les étiqueter à l'aide du programme Console au fur et à mesure qu'ils sont requis par Bacula. Ainsi, lorsqu'il a besoin d'un volume qu'il ne trouve pas dans son catalogue, Bacula m'envoie un e-mail pour m'enjoindre à ajouter un volume au pool. J'utilise alors la commande label dans la console pour étiqueter un nouveau volume et le définir dans le catalogue, après quoi Bacula est en mesure de l'utiliser. Alternativement, je peux utiliser la commande relabel pour ré-étiquter un volume qui n'est plus utilisé, pourvu qu'il ait le VolStatus Purged.

Une autre stratégie consiste à étiqueter un ensemble de volumes, et à les utiliser au fur et à mesure que Bacula les réclame. C'est le plus souvent ce qui est fait lorsque vous cyclez sur un groupe de volumes, par exemple avec une librairie. Pour plus de détails sur le recyclage, veuillez consulter le chapitre Recyclage automatique des volumes de ce manuel.

Si vous exécutez un job Bacula alors que vous n'avez pas de volumes étiquetés dans le pool concerné, Bacula vous en informe, et vous pouvez les créer "à la volée". Dans mon cas, j'étiquette mes cartouches avec la date, par exemple : DLT-18April02. Voyez ci-dessous pour plus de détails sur l'usage de la commande label.

Etiquetage des volumes dans la console

L'étiquetage des volumes se fait, en principe, avec le programme Console.

  1. ./bconsole
  2. label

Si Bacula annonce que vous ne pouvez étiqueter une cartouche au motif qu'elle porte déjà une étiquette, démontez-la avec la commande unmount, puis recommencez avec une cartouche vierge.

Etand donné que le support de stockage physique est différent pour chaque périphérique, la commande label vous propose une liste de ressources Storage définies telle que celle-ci :

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

A ce stade, vous devriez avoir une cartouche vierge dans votre lecteur d'un type correspondant à la ressource Storage que vous avez sélectionné.

Bacula vous demande le nom du volume :

Enter new Volume name:

S'il proteste :

Media record for Volume xxxx already exists.

Cela signifie que le nom de volume xxxx que vous avez entré existe dèjà dans le catalogue. Vous pouvez afficher la liste des média définis avec la commande list media. Notez que la colonne LastWritten a ici été tronquée pour permettre un affichage propre.

+---------------+---------+--------+----------------+-----/~/-+------------+-----+
| 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 |
+---------------+---------+--------+----------------+-----/~/-+------------+-----+

Une fois que Bacula a vérifié que le volume n'existe pas encore, il vous demande le pool dans lequel vous souhaitez que le volume soit créé. S'il n'existe qu'un pool, il est sélectionné automatiquement.

Si la cartouche est étiquetée correctement, un enregistrement de volume est aussi créé dans le pool. Ainsi, le nom du volume et tous ses attributs apparaîtront lorque vous afficherez les volumes du pool. De plus, le volume est disponible pour les sauvegardes, pourvu que le MediaType coØincide avec celui requis par le Storage Daemon.

Lorsque vous avez étiqueté la cartouche, vous n'avez répondu qu'à quelques questions la concernant -- principalement son nom, et éventuellement le Slot. Cependant, un enregistrement de volume dans le catalogue (connu au niveau interne en tant qu'enregistrement Media) contient un certain nombre d'attributs. La plupart d'entre eux sont renseignés selon les valeurs par défaut qui ont été définies lors de la création du pool (au trement dit, le pool comporte la plupart des attributs par défaut utilisés lors de la création d'un volume).

Il est aussi possible d'ajouter des media aux pools sans les étiqueter physiquement. C'est la fonction de la commande add. Pour plus d'informations, veuillez consulterle chapitre Console de ce manuel.


Adapter les fichiers de configuration

Lors de son démarrage, chacun des programmes qui composent Bacula lit un fichier de configuration spécifié sur la ligne de commande, ou par défaut bacula-dir.conf, bacula-fd.conf, bacula-sd.conf, ou console.conf pour le Director Daemon, le File Daemon, le Storage Daemon, et le programme Console respectivement.

Chaque service (Director, Client, Storage, Console) possède son propre fichier de configuration qui contient un groupe de directives. Dans la suite, nous désignerons ces groupes de directives par le mot Ressource. Les ressources son très similaires d'un service à l'autre, mais peuvent contenir des directives différentes selon les services. Par exemple, dans le fichier de configuration du Director, la ressource Director définit le nom du Director, quelques paramètres généraux du Director et son mot de passe. Dans le fichier de configuration du File Daemon, la ressource Director spécifie les Directors autorisés à utiliser le File Daemon.

Avant de lancer Bacula pour la première fois, vous devez adapter chaque fichier de configuration. Des fichiers de configuration auront été créés par le processus d'installation, mais il doivent être modifiés pour correspondre à votre système. Le schéma suivant donne une vue globale des ressources.

\includegraphics{./bacula-objects.eps}
(Remerciements à Aristedes Maniatis pour ce schéma.)

Format des directives

Bien qu'il ne soit pas nécessaire de connaître le détail de toutes les directives possibles, une connaissance basique des ressources Bacula est indispensable. Chaque directive contenue dans une ressource (entre accollades) est composé d'un mot-clef suivi du signe "='', suivi d'une ou plusieurs valeurs. Le mot clef doit être l'un de ceux connus par Bacula, et peut comporter des caractères majuscules et minuscules ainsi que des espaces.

Chaque définition de ressource DOIT comporter la directive Name, et peut optionnellement comporter la directive Description. La directive Name est utilisée pour identifier de façon unique la ressource. La directive Description sera utilisé lors de l'affichage pour offrir une identification plus aisée de la ressource. Par exemple :

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

Définit la ressource Director avec le nom "MyDir'' et le répertoire de travail $HOME/bacula/bin/working. En général, si vous voulez utiliser des espaces dans le nom à droite du signe "='', vous devez l'entourer de doubles quotes. Sinon, les quotes ne sont généralement pas requises car une fois définies, les chaînes quotées et non quotées sont toutes équivalentes.

Commentaires

Lors de la lecture d'un fichier de configuration, les lignes blanches sont ignorées, et tout ce qui suit le caractère dièse (#) jusqu'à la fin de la ligne est considéré comme commentaire. Un point virgule (;) indique la fin logique d'une ligne et tout ce qui suit le point virgule est considéré comme le paramètre suivant. Un paramètre qui apparaît seul sur une ligne ne nécessite pas de point virgule, vous ne verrez donc pas beaucoup de points virgule dans les exemples de ce manuel.

Casse et espaces

La casse (majuscules/minuscules) et les espaces sont totalement ignorées dans les mots-clef des directives des ressources (la partie à gauche du signe "='').

A l'intérieur des mots-clef (à gauche du signe "=''), les espaces ne sont pas significatives. Ainsi, les mots-clef : name, Name, et N a m e sont tous identiques.

Les espaces après le signe "='' et avant le premier caractère de la valeur son ignorées.

En général, les espaces à l'intérieur d'une valeur sont significatives (non ignorées), et si la valeur est un nom, vous devez l'encadrer de doubles quotes pour que l'espace soit acceptée. Les noms peuvent contenir jusqu'à 127 caractères. Actuellement, un nom peut contenir n'importe quel caractère ASCII. A l'intérieur d'une chaîne quotée, tout caractère précédé d'un backslash (\) est pris tel quel (utile pour insérer des backslashes et doubles quotes (")).

Veuillez cependant noter que les noms de ressource Bacula ainsi que certains autres noms seront sévèrement limités dans l'avenir pour ne plus autoriser que les lettres (y compris accentuées ISO), nombres, et une poignée de caractères spéciaux (espaces, underscores, ...). Tous les autres caratères et ponctuations seront prohibés.

Inclure d'autres fichiers de configuration

Si vous souhaitez éclater votre fichier de configuration en fichiers plus petits, l'inclusion est possible avec la syntaxe @NomDeFichiernom de fichier est le chemin absolu vers un le fichier à inclure. Toute donnée primitive peut être remplacée par une spécification @NomDeFichier. Par exemple

Director { Name=@xxx est valide et substituera le fichier xxx à @xxx, mais Director { Name@xxx = something n'est pas valide puisque @xxx apparaît au milieu d'un (???mot clef/directive/...???)

Types de données primitives reconnus

Lorsqu'il parcourt les enregistrements de ressource, Bacula classe les données selon les types enumérés ci-dessous. En première lecture, cette liste peut vous paraître accablante, mais en réalité, tout y est d'une logique élégante et directe.

name
Un mot-clef ou un nom constitué de caractères alphanumériques, incluant le trait d'union, underscore et dollar. Le premier caractère d'un name doit être une lettre. La longueur d'un name est actuellement limitée à 127 caractères. Typiquement, les mots-clef apparaîssent à gauche d'un signe ''=". Les mots-clef ne peuvent être quotés.

name-string
Une name-string est similaire à un name excepté qu'elle peut être quotée et ainsi contenir des caractères supplémentaires. La longueur des name-strings est limitée à 127 caractères. Typiquement, on les utilise à droite d'un signe ''=", (i.e. ce sont les valeurs à associer aux mots-clef).

string
Une chaîne quotée contenant potentiellement n'importe quel caractère, y compris les espaces, ou une chaîne non quotée. Une string peut avoir une longueur quelconque. Typiquement, les strings sont les valeurs qui correspondent aux noms de fichiers, répertoires, ou noms de commandes système. Un Backslash (\) change le prochain caractère en lui même, de sorte que pour inclure une double quote dans une chaîne, vous devez la préceder d'un Backslash. Il en va de même pour inclure un Backslash.

directory
Un directory (Répertoire) est une chaîne, quotée ou non. Un directory est transmis à votre shell standard pour expansion lorsqu'il est scanné. Ainsi, des constructions telles que $HOME sont interprétées correctement.

password
Il s'agit d'un mot de passe Bacula. Il est stocké en interne sous un format brouillé par MD5.

integer
Une valeur entière relative (positive ou négative) sur 32 bits.

positive integer
Une valeur entière positive sur 32 bits.

long integer
Une valeur entière sur 64 bits. Typiquement, ce sont les valeurs telles que le nombre de bytes, qui peuvent dépasser 4 milliards et ainsi nécessitent une valeur sur 64 bits.

yes|no
Soit yes, soit no.

size
Une taille specifiée en bytes. Typiquement, il s'agit d'une entrée au format scientifique (avec virgule flottante) suivie d'un modificateur optionnel. L'entrée est stockée en tant qu'entier sur 64 bits. Si un modificateur est spécifié, il doit suivre immédiatement la valeur, sans espace. Les modificateurs suivants sont reconnus:

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 Une heure, ou une durée spécifiée en secondes. Une valeur time est stockée en interne en tant qu'entier sur 64 bits, mais il est spécifié en deux parties: un nombre et un modificateur. Le nombre peut être un entier ou un nombre à virgule flottante. S'il est spécifié en virgule flottante, il sera arrondi à l'entier le plus proche. Le modificateur est obligatoire et suit le nombre avec ou sans espace intercalée. Les modificateurs suivants sont reconnus:

seconds
secondes

minutes
minutes (60 secondes)

hours
heures (3600 secondes)

days
jours (3600*24 secondes)

weeks
semaines (3600*24*7 secondes)

months
mois (3600*24*30 secondes)

quarters
trimestres (3600*24*91 secondes)

years
années (3600*24*365 secondes)

Toute abbréviation des ces modificateurs est aussi autorisée (i.e. seconds peut être spécifié par sec ou s. Une spécification m sera interprétée en tant que mois.

La spécification d'une durée peut comporter autant de couples nombre/modificateur que vous le souhaitez. Par exemple:

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

sont des spécifications valides (à partir de la version 1.35.1).

Note! Dans les versions de Bacula antérieures à 1.31, le modificateur était optionnel. Il est désormais obligatoire.

Types de Ressources

La table suivante énumère tous les types de ressource de la version courante de Bacula. Elle montre quelle ressource doit être définie pour chaque service (daemon). Les fichiers de configuration par défaut contiennent au moins un exemple de chaque ressource permise, aussi ne soyez pas angoissé à l'idée d'avoir à créer toutes ces directives ex nihilo.

Resource Director Client Storage Console
Autochanger No No Yes No
Catalog Oui Non Non Non
Client Oui Oui Non Non
Console Oui Non Non Oui
Device Non Non Oui Non
Director Oui Oui Oui Oui
FileSet Oui Non Non Non
Job Oui Non Non Non
JobDefs Oui Non Non Non
Message Oui Oui Oui Non
Pool Oui Non Non Non
Schedule Oui Non Non Non
Storage Oui Non Oui Non


Noms, mots de passe et autorisations

Pour qu'un daemon puisse en contacter un autre, il lui faut s'authentifier avec un mot de passe. Dans la plupart des cas, le mot de passe est associé à un nom particulier, de sorte que nom et mot de passe doivent correspondre.

Les fichiers de configuration par défaut sont automatiquement définis avec des autorisations correctes et des mots de passe aléatoires. Si vous modifiez ces fichiers, vous devrez être attentif à leur cohérence.

Voici un schéma des correspondances que doivent respecter les couples ''nom/mot de passe" des différents fichiers de configurations.

\includegraphics{./Conf-Diagram.eps}

Dans la colonne de gauche, vous trouverez les ressources Director, Storage et Client, avec leurs noms et mots de passe -- ils sont tous dans le fichier bacula-dir.conf. Dans la colonne de droite figurent les valeurs correspondantes dans les fichiers de configuration de la Console, du Storage Daemon (SD) et du File Daemon (FD).

Veuillez noter que l'adresse fd-sd, qui apparaît dans la ressource Storage du Director, précédée d'une atérisque est transmise au File Daemon sous forme symbolique. Le File Daemon la résout alors en une adresse IP. Pour cette raison, vous devez utiliser soit une adresse IP, soit une adresse pleinement qualifiée. Une adresse telle que localhost, n'étant pas pleinement qualifiée, sera résolue par le File Daemon en l'hôte local du File Daemon, ce qui n'est probablement pas le résultat désiré. Le mot de passe utilisé par le File Daemon pour autoriser la communication avec le Storage Daemon est temporaire et unique pour chaque job. Il n'est spécifié dans aucun fichier de configuration.

Informations détaillées sur chaque daemon

Les détails de chaque ressource et des directives permises sont décrits dans les chapitres suivants.

Les fichiers de configuration suivants doivent être définis:


Configurer le Director

Parmi tous les fichiers de configuration requis pour exécuter Bacula, celui du Director est le plus compliqué, et c'est celui que vous modifierez le plus souvent, en ajoutant des clients ou en modifiant les FileSets.

Pour une discussion générale concernant les fichiers et ressources ainsi que les types de données reconnus par Bacula, veuillez consulter le chapitre Configuration de ce manuel.

Les types de ressources du Director

Les types de ressources du Director sont :

Job, JobDefs, Client, Storage, Catalog, Schedule, FileSet, Pool, Director, et Messages. Nous les présentons ici dans l'ordre le plus logique (relativement au fichier de configuration du Director) :


La ressource Director

La ressource Director définit les attributs du Director exécuté sur le réseau. Dans l'implémentation actuelle, il n'y a qu'une ressource Director, mais la réalisation finale contiendra plusieurs Directors pour maintenir la redondance de la base des indexes et média.

Director
Début de la ressource Director. Une ressource Director et une seule doit être définie.

Name = <nom>
Le nom du Director utilisé par l'administrateur système. Cette directive est requise

Description = < texte>
Le champ texte contient une description du Director qui sera affichée dans l'interface graphique. Cette directive est optionnelle.

Password = <UA-password>
Spécifie le mot de passe qui doit être fourni par la Console Bacula par défaut pour être autorisée. Le même mot de passe doit apparaître dans la ressource Director du fichier de configuration de la console. Pour plus de sécurité, le mot de passe ne transite jamais sur le réseau, l'authentification se fait via un échange de type challenge-response d'un hash code créé avec le mot de passe. Cette directive est requise. Si vous disposez de /dev/random ou bc sur votre machine, Bacula génèrera un mot de passe aléatoire lors du processus d'installation, sinon il sera laissé blanc et vous devrez en définir un manuellement.

Messages = <Nom-de-ressource-Messages>
La ressource messages spécifie où doivent être délivrés les messages du Director qui ne sont pas associés à un job spécifique. La plupart des messages sont relatifs à un job et seront dirigés vers la ressource messages spécifiée par le job. Cependant, quelques messages peuvent être générés lorsque aucun job n'est actif. Cette directive est requise.

Working Directory = <Répertoire>
Cette directive spécifie un répertoire où le Director peut déposer ses fichiers d'états. Ce répertoire ne devrait être utilisé que par Bacula, mais il peut être partagé par d'autres daemons Bacula. Notez cependant que si ce répertoire est partagé avec d'autres daemons Bacula, vous devez vous assurer que le nom Name donné à chaque daemon est unique afin d'éviter des collisions entre les fichiers temporaires utilisés. Par défaut, le processus de configuration de Bacula créé des noms de daemons uniques en les postfixant avec -dir, -fd et -sd. Les substitutions shell standard sont effectuées à la lecture du fichier de configuration, de sorte que des valeurs telles que $HOME seront correctement substituées. Cette directive est requise.

Si vous avez spécifié un utilisateur et/ou un groupe pour le Director lors de la configuration avec les options --with-dir-user et/ou --with-dir-group de la commande ./configure, le répertoire de travail Working Directory doit appartenir doit appartenir à ce groupe et à cet utilisateur.

Pid Directory = <Répertoire>
Cette directive spécifie un répertoire où le Director peut déposer son fichier d'Id de processus. Ce fichier est utilisé pour stopper Bacula et prévenir l'exécution simultanée de plusieurs copies de Bacula. Les substitutions shell standard sont effectuées à la lecture du fichier de configuration, de sorte que des valeurs telles que $HOME seront correctement substituées.

Typiquement, sur les systèmes Linux, vous utiliserez ici /var/run. Si vous n'installez pas Bacula dans les répertoires système, vous pouvez utiliser le répertoire de travail Working Directory défini plus haut. Cette directive est requise.

Scripts Directory = <Directory>
Cette directive spécifie le répertoire dans lequel le Director devra rechercher le script Python de démarrage DirStartup.py. Ce répertoire peut être partagé par d'autres daemons Bacula.Les substitutions shell standard sont effectuées à la lecture du fichier de configuration, de sorte que des valeurs telles que $HOME seront correctement substituées. Cette directive est optionnelle.

QueryFile = <Path>
Cette directive spécifie un répertoire et un fichier dans lequel le Director peut trouver les requêtes SQL préétablies pour la commande Query de la Console. Les substitutions shell standard sont effectuées à la lecture du fichier de configuration, de sorte que des valeurs telles que $HOME seront correctement substituées. Cette directive est requise.

Maximum Concurrent Jobs = <nombre>

Où <nombre> est le nombre maximal de jobs qui peuvent être exécutés simultanément par le Director. La valeur par défaut est 1, mais vous pouvez utiliser une valeur plus grande. Notez que le format des volumes devient beaucoup plus compliqué avec plusieurs jobs exécutés simultanément. De ce fait, les restaurations peuvent prendre beaucoup plus de temps si Bacula doit faire le tri parmi les segments entremélés de ces jobs. Ceci peut être évité en s'arrangeant pour que chacun des jobs exécutés simultanément écrive sur un volume distinct. Une autre possibilité consiste à utiliser le data spooling : les données seront d'abord "spoolées" sur disque simultanément, ensuite les fichiers "spool" seront écrits séquentiellement sur le volume.

Dans certains cas, des directives telles que Maximum Volume Jobs ne sont pas correctement synchronisées avec le nombre de jobs simultanés, et des problèmes de synchronisation subtils peuvent survenir, aussi des tests minutieux sont recommandés.

Actuellement, il n'y a aucun paramètre de configuration pour régler ou limiter le nombre de connections par console. Un maximum de cinq connection simultanées est autorisé.

Pour plus de détails concernant l'exécution simultanée de plusieurs jobs, consultez la partie Exécution simultanée de plusieurs jobs du chapitre Astuces de ce manuel.

FD Connect Timeout = <durée>
durée est le délai durant lequel le Director tente de contacter le File Daemon pour démarrer un job. Une fois ce délai écoulé, le Director supprimera le job. La valeur par défaut est 30 minutes.

SD Connect Timeout = <durée>
durée est le délai durant lequel le Director tente de contacter le Storage Daemon pour démarrer un job. Une fois ce délai écoulé, le Director supprimera le job. La valeur par défaut est 30 minutes.

DirAddresses = <Spécification-adresses-IP>
Spécifie les ports et adresses sur lesquels le Director se met en attente de connections de Consoles Bacula. La meilleure explication est sans doute un exemple :

 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
    }
 }

où "ip", "ip4", "ip6", "addr", et "port sont les mots clef. Notez que les adresses peuvent être spécifiées sous forme de quadruplets pointés, ou suivant la notation à doubles points IPv6, ou encore sous forme de nom symbolique (seulement pour la spécification ip). D'autre part, le port peut être spécifié par un nombre, ou par une valeur mnémonique du fichier /etc/services. Si un port n'est pas précisé, celui par défaut sera utilisé. Si une section ip est spécifiée, la résolution peut être faite soit par IPv4, soit par IPv6. Si ip4 est spécifié, seules les résolutions IPv4 seront permises. Il en va de même avec ip6.

Notez que si vous utilisez la directive DirAddresses, vous ne devez utiliser ni la directive DirPort, ni la directive DirAddress dans la même ressource.

DIRport = <numéro-de-port>
Spécifie le port (un entier positif) sur lequel le Director est à l'écoute de connections de Consoles Bacula. Ce même numéro de port doit être spécifié dans la ressource Director du fichier de configuration de la console. La valeur par défaut est 9101, aussi, il n'est en principe pas nécessaire de renseigner cette directive. Elle n'est pas requise si vous spécifiez des DirAdresses.

DirAddress = <Adresse-IP>
Cette directive est optionnelle. Lorsqu'elle est spécifiée, le Director n'accepte de connections Console que de l'adresse spécifiée Adresse-IP, qui peut être soit un nom de domaine, soit une adresse IP au format quadruplet pointé ou chaîne quotée. Si cette directive n'est pas spécifiée, le Director acceptera des connections de Console de toute adresse valide. Notez que contrairement à la spécification DirAdresses décrite plus haut, cette directive ne permet de spécifier qu'une seule adresse. Cette directive n'est pas requise si vous utilisez la directive DirAdresses.

Voici un exemple d'une ressource Director valide :

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


La ressource Job

La ressource Job définit un Job (sauvegarde, restauration,...) que Bacula doit exécuter. Chaque définition de ressource Job contient le nom d'un client, la liste des éléments à sauvegarder (FileSet), la planification (Schedule) pour ce Job, le lieu où sauvegarder ces données (Storage Device) et quel groupe de media utiliser (Pool). En effet, chaque ressource Job doit répondre aux questions : "Quoi ?", "Où ?", "Quand ?" et "Comment ?" soit, respectivement Fileset, Storage, Schedule, Type et Niveau (Sauvegarde/Restauration - Full/Differentielle/Incrémentale). Notez que le FileSet doit être spécifié lors des restaurations pour des raisons historiques, mais il n'est plus utilisé.

Un seul type (Backup, Restore, ...) peut être spécifié pour un Job donné. Si vous voulez sauvegarder plusieurs FileSets sur le même client, vous devez définir un Job pour chacun d'entre eux.

Job
Début de la ressource Job. Il faut définir au moins une ressource Job.

Name = <name>
Le nom du Job. Ce nom peut être utilisé avec la commande Run du programme Console pour lancer un Job. Si le nom contient des espaces, il doit être placé entre quotes. C'est généralement une bonne idée de nommer vos Jobs du nom du Client qu'ils sauvegardent, afin de les identifier aisément.

Lors de l'exécution d'un Job, son nom unique est composé du nom que vous avez spécifié ici suffixé avec la date et l'heure de sa planification. Cette directive est requise.

Enabled = <yes|no>
irective!Enable Cette directive permet d'activer ou désactiver l'exécution automatique d'un job par le planificateur.

Type = <job-type>
La directive Type spécifie le type de Job, qui peut être l'un des suivants : Backup, Restore, Verify, ou Admin. Cette directive est requise. Pour chaque type de Job, il existe différents niveaux, qui seront décrits dans les prochains paragraphes.

Backup
Définit une sauvegarde. En principe, vous aurez au moins un job de type Backup par client sauvegardé. A moins que vous ne désactiviez le catalogue, la plupart des données et statistiques concernant les fichiers sauvegardées seront écrites dans le catalogue.

Restore
Définit une restauration. En principe, vous ne créerez qu'un seul job de ce type, que vous utiliserez comme un prototype que vous modifierez à l'aide de la console lorsque vous devrez restaurer. Bien que certaines informations basiques soient conservées dans le catalogue lors de restaurations, leur quantité est infime en regard des informations stockées pour une sauvegarde -- par exemple, aucune entrée de nom de fichier n'est générée, puisqu'aucun fichier n'est sauvegardé.

Verify
Définit un Job de type Verify. Le Jobs de type verify permettent de comparer le catalogue au système de fichiers ou à ce qui a été sauvegardé. Vous pouvez l'utiliser pour vous assurer qu'une cartouche de données est lisible, mais aussi comme un système de détection d'intrusion à la fade Tripwire.

Admin
Définit un Job de type Admin. Un Admin peut s'utiliser pour "élaguer" périodiquement le catalogue, si vous ne souhaitez pas que ceci soit fait à la fin de chaque sauvegarde. Bien que les Jobs de type admin soient enregistrés dans le catalogue, la quantité de données générée est infime.

Level = <job-level>
La directive Level spécifie le niveau d'exécutiondu job par défaut. Chaque type de job a son propre jeu de niveaux qui peuvent être spécifiés. Le niveau d'exécution est en général surchargé par une valeur différente spécifiée dans la ressource Schedule. Cette directive n'est pas requise mais doit être spécifiée soit ici, soit en tant que surcharge dans la ressource Schedule.

Pour un job de type Backup le niveau doit être l'un des suivants :

Full
Tous les fichiers du FileSet, qu'ils aient été modifiés ou non.

Incremental
Tous les fichiers modifiés depuis la dernière sauvegarde valide du FileSet spécifié pour le même job. Si le Director ne peut trouver une sauvegarde Full antérieure, le niveau du job sera élevé en une sauvegarde Full. Lorsque le Director recherche une Full valide dans le catalogue, il recherche un job avec les caractéristiques suivantes :

  • le même nom de job ;
  • le même nom de client ;
  • le même FileSet (toute modification de la définition du FileSet telle que l'ajout ou la suppression de fichiers dans les sections Include ou Exclude constitue un changement de FileSet).
  • le niveau requis (Full, Differential ou Incremental)
  • le job s'est terminé normalement, c'est à dire un qu'il ne s'est pas terminé en échec, et n'a pas été effacé.

Si toutes les conditions ci-dessus ne sont pas réalisées, le Director augmentera la sauvegarde incrémentale en une sauvegarde Full. Dans le cas contraire, la sauvegarde incrémentale sera effectuée normalement.

Le File Daemon (Client) détermine les fichiers à sauvegarder pour une incrémentale par comparaison de l'heure de démarrage du Job précédent (Full, Différentiel ou Incrémental) avec les dates de dernière modification de chaque fichier (st_mtime) et de ses attributs (st_ctime). Si le fichier ou ses attributs ont changés depuis cette date de démarrage, alors le fichier sera sauvegardé.

Veuillez noter que certains logiciels anti-virus peuvent modifier la date st_time lors de leurs opérations de scan. Ainsi, si l'antivirus modifie la date d'accès (st_atime), qui n'est pas utilisée par Bacula, il provoquera une modification du st_ctime et conduira Bacula à sauvegarder les fichiers concernés lors des incrémentales et différentielles. Dans le cas de l'antivirus Sophos, vous pouvez éviter cet inconvénient en utilisant l'option --no-reset-atime. Pour les autres logiciels, voyez leurs manuels.

Lorsque Bacula effectue une sauvegarde incrémentale, tous les fichiers modifiés présents sur le système sont sauvegardés. Cependant, tout fichier supprimé depuis la dernière Full demeure dans le catalogue, ce qui signifie que si vous effectuez une restauration à partir de sauvegardes incrémentales (et de la Full associée), les fichiers supprimés depuis la dernière Full seront aussi restaurés. Ces fichiers n'apparaîtront plus dans le catalogue après avoir fait une nouvelle sauvegarde Full. Le processus pour supprimer ces fichiers du catalogue lors d'une incrémentale ralentirait fortement les sauvegardes incrémentales. Il n'est actuellement pas implémenté dans Bacula.

De plus, si vous déplacez un répertoire plutôt que de le copier, les fichiers qu'il contient voient leurs dates de dernière modification (st_mtime) et de dernier accès (st_ctime) inchangés. Par conséquent, ces fichiers ne seront probablement sauvegardés par aucune incrémentale ou différentielle, puisque ces dernières ne se réfèrent qu'à ces indicateurs. Aussi, il est préférable de copier un dossier avant de supprimer l'original plutôt que de le déplacer, si vous voulez qu'il soit correctement sauvegardé.

Differential
Tous les fichiers modifiés depuis la dernière sauvegarde Full valide du FileSet spécifié pour le même job. Si le Director ne peut trouver une sauvegarde Full antérieure, le niveau du job sera élevé en une sauvegarde Full. Lorsque le Director recherche une Full valide dans le catalogue, il recherche un job avec les caractéristiques suivantes :

  • le même nom de job ;
  • le même nom de client ;
  • le même FileSet (toute modification de la définition du FileSet telle que l'ajout ou la suppression de fichiers dans les sections Include ou Exclude constitue un changement de FileSet).
  • le Job était une sauvegarde FULL
  • le Job s'est terminé normalement, c'est à dire qu'il ne s'est pas terminé en échec, et n'a pas été effacé.

Si toutes les conditions ci-dessus ne sont pas réalisées, le Director augmentera la sauvegarde différentielle en une sauvegarde Full. Dans le cas contraire, la sauvegarde différentielle sera effectuée normalement.

Le File Daemon (Client) détermine les fichiers à sauvegarder pour une différentielle par comparaison de l'heure de démarrage de la dernière sauvegarde Full avec les dates de dernière modification de chaque fichier (st_mtime) et de ses attributs (st_ctime). Si le fichier ou ses attributs ont changés depuis cette date de démarrage, alors le fichier sera sauvegardé. La date de démarrage utilisée est affiché après le Since du rapport de Job. Dans de rares cas, certains fichiers sont sauvegardés deux fois à cause de l'utilisation de la date de démarrage de la sauvegarde précédente, mais ceci assure qu'aucun changement n'est perdu. Comme pour les incrémentales, vous devriez vous assurer que les horloges de votre serveur Bacula et de vos clients sont synchronisées, ou aussi proches que possible, pour éviter le risque d'omission d'un fichier. Notez qu'à partir de la version 1.33, Bacula effectue automatiquement ces ajustements de sorte que les horloges utilisées par Bacula soient synchrones.

Veuillez noter que certains logiciels anti-virus peuvent modifier la date st_time lors de leurs opérations de scan. Ainsi, si l'antivirus modifie la date d'accès (st_atime), qui n'est pas utilisée par Bacula, il provoquera une modification du st_ctime et conduira Bacula à sauvegarder les fichiers concernés lors des incrémentales et différentielles. Dans le cas de l'antivirus Sophos, vous pouvez éviter cet inconvénient en utilisant l'option --no-reset-atime. Pour les autres logiciels, voyez leurs manuels.

Lorsque Bacula effectue une sauvegarde différentielle, tous les fichiers modifiés présents sur le système sont sauvegardés. Cependant, tout fichier supprimé depuis la dernière Full demeure dans le catalogue, ce qui signifie que si vous effectuez une restauration à partir de sauvegardes différentielles (et de la Full associée), les fichiers supprimés depuis la dernière Full seront aussi restaurés. Ces fichiers n'apparaîtront plus dans le catalogue après avoir fait une nouvelle sauvegarde Full. Le processus pour supprimer ces fichiers du catalogue lors d'une incrémentale ralentirait fortement les sauvegardes différentielles. Il n'est actuellement pas implémenté dans Bacula, mais plannifié pour une future version de Bacula.

Comme noté ci-dessus, si vous déplacez un répertoire plutôt que de le copier, les fichiers qu'il contient voient leurs dates de dernière modification (st_mtime) et de dernier accès (st_ctime) inchangés. Par conséquent, ces fichiers ne seront probablement sauvegardés par aucune incrémentale ou différentielle, puisque ces dernières ne se réfèrent qu'à ces indicateurs. Aussi, il est préférable de copier un dossier avant de supprimer l'original plutôt que de le déplacer, si vous voulez qu'il soit correctement sauvegardé.

Régulièrement, quelqu'un demande à quoi servent les sauvegardes différentielles du moment que les incrémentales récupèrent tous les fichiers modifiés. Il existe plusieurs réponses à cette question, mais la plus importante à mes yeux est de combiner toutes les incrémentales et différentielles depuis la dernière full en une seule différentielle. Ceci a deux effets : 1. La redondance. 2. Plus important, la réduction du nombre de volumes requis pour faire une restauration en éliminant la nécessité de lire tous les volumes des précédentes incrémentales depuis la dernière full.

Pour un Job de type Restore, aucun niveau ne doit être spécifié.

Pour un Job de type Verify, le niveau peut être l'un des suivants :

InitCatalog
Examine le FileSet spécifié et stocke les attributs de fichiers dans le catalogue. Vous pouvez vous interroger sur l'intérêt d'un Job qui ne sauvegarde aucun fichier. La réponse est de pouvoir utiliser Bacula comme vous utiliseriez Tripwire, en d'autres termes, ce type de Jobs vous permet de sauvegarder l'état d'un ensemble de fichiers défini par un FileSet afin de pouvoir ultérieurement contrôler si rien n'a été modifié, supprimé ou ajouté. Ceci peut être utilisé pour détecter une intrusion. Typiquement, vous spécifiez un FileSet qui contient l'ensemble des fichiers qui ne devraient pas changer (par exemple /sbin, /boot, /lib, /bin, ...). Ensuite, vous exécutez le Job verify de niveau InitCatalog après l'installation de votre système, puis après chaque modification (mise à jour). Ensuite, lorsque vous souhaitez contrôler l'état de votre système de fichiers, vous utilisez un Job Verify, level = Catalog afin de comparer le résultat de votre InitCatalog avec l'état actuel de votre système de fichiers.

Catalog
Compare l'état actuel des fichiers et l'état précédemment sauvegardé lors d'un InitCatalog. Toutes les anomalies sont rapportées. Les objets du rapport sont déterminés par les options verify spécifiées dans la directive Include du FileSet spécifié (voyez la ressource FileSet ci-dessous pour plus de détails). Typiquement, cette commande sera exécutée quotidiennement pour contrôler toute modification de votre système de fichier.

Attention ! Si vous exécutez deux jobs Verify Catalog simultanément sur le même client, les résultats seront probablement erronnés. En effet, Verify Catalog modifie le catalogue lors de son exécution afin de détecter les nouveaux fichiers.

VolumeToCatalog
Ce niveau permet de lire les attributs de fichiers écrits sur le Volume lors du dernier Job. Les attributs de fichiers sont comparés aux valeurs sauvegardées dans le catalogue et toute différence est rapportée. Ceci est similaire au niveau Catalog, sauf que ce sont les attributs des fichiers du volume plutôt que ceux des fichiers du disque qui sont comparés aux attributs sauvegardés dans le catalogue. Bien que les attributs et signatures (MD5 ou SHA1) soient comparés, les données réelles ne le sont pas (elles ne figurent pas dans le catalogue).

Attention ! Si vous exécutez deux jobs Verify VolumeToCatalog simultanément sur le même client, les résultats seront probablement erronnés. En effet, Verify VolumeToCatalog modifie le catalogue lors de son exécution afin de détecter les nouveaux fichiers.

DiskToCatalog
Ce niveau permet de lire les fichiers tels qu'ils sont actuellement sur le disque et de comparer leurs attributs actuels avec ceux stockés dans le catalogue lors de la dernière sauvegarde pour le Job spécifié par la directive VerifyJob. Ce niveau diffère du niveau Catalog décrit plus haut en ce qu'il ne se réfère pas à un Job Verify antérieur, mais à la dernière sauvegarde. Lorsque vous utilisez ce niveau , vous devez renseigner les option Verify de la section Include. Ces options déterminent quels attributs seront comparés.

Cette commande peut se révéler très utile si vous avez des problèmes de disque car elle comparera l'état actuel de votre disque avec la dernière sauvegarde valide, qui peut remonter à plusieurs jobs.

Notez que l'implémentation actuelle (1.32c) n'identifie pas les fichiers qui ont été supprimés.

Verify Job = <Job-Resource-Name> Si vous exécutez un job verify sans cette directive, le dernier job exécuté sera comparé avec le catalogue, ce qui signifie que votre commande verify doit succéder immédiatement à une sauvegarde. Si vous spécifiez un Verify Job, Bacula trouvera le dernier job exécuté avec ce nom. Ceci vous permet d'exécuter toutes vos sauvegardes, puis d'exécuter les jobs Verify sur les sauvegardes de votre choix (le plus souvent, un VolumeToCatalog de sorte que la cartouche qui vient juste d'être écrite est relue).

JobDefs = <JobDefs-Resource-Name> Si un nom de JobDef est spécifié dans la définition d'un Job, toutes les valeurs définies dans la ressource JobDef concernée seront utilisées en tant que valeurs par défaut pour le Job. Toute valeur explicitement spécifiée dans la définition du Job outrepasse la valeur par défaut définie par le JobDef. L'utilisation de cette directive permet d'écrire des ressources Job plus compactes, où la majeure partie des directives sont définies dans un ou plusieurs JobDefs. C'est particulièrement pratique si vous avez de nombreux Jobs similaires avec des variations mineures telles que différents clients. Un exemple basique de l'utilisation d'un Jobdef est fourni dans le fichier bacula-dir.conf par défaut.

Bootstrap = <bootstrap-file> La directive Bootstrap spécifie un fichier bootstrap qui, s'il est fourni, sera utilisé lors des restaurations et ignoré par tout les autres Jobs. Le fichier bootstrap contient la liste des cartouches nécessaires pour la restauration ainsi que les index des fichiers à restaurer (localisation sur la cartouche). Cette directive est optionnelle, et n'est utilisée que pour les restaurations. De plus, elle peut être modifiée lorsqu'une restauration est lancée depuis la console.

Si vous utilisez la commande Restore dans la console pour lancer une restauration, le fichier bootstrap sera créé automatiquement à partir des fichiers que vous avez sélectionnés pour la restauration.

Pour plus de détails concernant les fichiers bootstrap, veuillez consulter le chapitre Restaurer des fichiers avec le fichier Bootstrap de ce manuel.

Write Bootstrap = <bootstrap-file-specification> La directive writebootstrap spécifie le de fichier Bootstrap où Bacula écrira lors de chaque sauvegarde. Ainsi, cette directive s'applique exclusivement aux jobs de type sauvegarde. Si la sauvegarde est une Full, Bacula écrase le contenu du fichier spécifié. Sinon, Bacula ajoute les nouveaux enregistrements Bootstrap à la fin du fichier.

En utilisant cette fonction, vous aurez constamment un fichier bootstrap capable de recouvrer l'état le plus récent de votre système. Le fichier bootstrap devrait être écrit sur un disque monté sur une autre machine, de sorte que vous puissiez en disposer immédiatement en cas de défaillance de votre disque dur. Une alternative consiste à copier le fichier sur une autre machine après chaque mise à jour.

Si la spécification de fichier bootstrap débute par une barre verticale (|), Bacula considère la spécification comme un nom de programme vers lequel les les enregistrement bootstrap seront redirigés. Ce peut être, par exemple, un script qui vous envoie par e-mail les enregistrements bootstrap.

Pour plus de détails sur l'utilisation de fichiers bootstrap, veuillez consulter le chapitre intitulé Le Fichier Bootstrap de ce manuel.

Client = <client-resource-name> La directive Client spécifie le Client (File Daemon) à utiliser dans le Job. Le client est exécuté sur la machine à sauvegarder. Il expédie les fichiers requis au Storage Daemon lors des sauvegardes, et reoit les fichiers du Storage Daemon lors des restaurations. Pour plus de détails, consultez la section Ressource Client de ce chapitre. Cette deirective est requise.

FileSet = <FileSet-resource-name> La directive FileSet spécifie le FileSet à utiliser dans le Job concerné. Le FileSet définit les répertoires et fichiers à sauvegarder, ainsi que les options à utiliser pour les sauvegarder (par exemple la compression,...). Un Job ne peut contenir qu'un seul FileSet. Pour plus de détails, consultez la section Ressource FileSet de ce chapitre. Cette directive est requise.

Messages = <messages-resource-name> La directive Messages définit la ressource Message qui doit être utilisée pour le job concerné. Ainsi, elle détermine le comment et où seront délivrés les différents messages de Bacula. Par exemple, vous pouvez diriger certains messages vers un fichier de logs, tandis que d'autres seront envoyés par e-mail. Pour plus de détails, consultez le chapitre Ressource Messages de ce manuel. Cette directive est requise.

Pool = <pool-resource-name> La directive Pool spécifie le jeu de volumes qui doit être utilisé pour sauvegarder vos données. De nombreuses installations de Bacula n'utiliseront que le pool défini par défaut Default. Toutefois, si vous voulez spécifier différents jeux de volumes pou différents clients ou différents jobs, vous voudrez probablement utiliser les Pools. Pour plus de détails, consultez la section Ressource Pool de ce chapitre. Cette directive est requise

Full Backup Pool = <pool-resource-name> La directive Full Backup Pool spécifie un Pool à utiliser pour les sauvegardes Full. Cette directive outrepasse toute autre spécification de Pool lors d'une sauvegarde Full. Cette directive est optionnelle.

Differential Backup Pool = <pool-resource-name> La directive Differential Backup Pool spécifie un Pool à utiliser pour les sauvegardes Différentielles. Cette directive outrepasse toute autre spécification de Pool lors d'une sauvegarde Différentielle. Cette directive est optionnelle.

Incremental Backup Pool = <pool-resource-name> La directive Incremental Backup Pool spécifie un Pool à utiliser pour les sauvegardes Incrémentales. Cette directive outrepasse toute autre spécification de Pool lors d'une sauvegarde Incrémentale. Cette directive est optionnelle.

Schedule = <schedule-name> La directive Schedule définit la planification du job. Le schedule détermine la date et l'instant où le job doit être lancé automatiquement, et le niveau (Full, Différentiel, Incrémental...) du job en question. Cette directive est optionnelle. Si elle est omise, le job ne pourra être exécuté que manuellement via la Console. Bien que vous puissiez vous contenter d'une ressource Schedule simple pour tout job, vous pouvez aussi définir des ressources Schedule avec plusieurs directives Run, afin de lancer le job à différentes heures. Chacune de ces directives Run permet d'outrepasser les valeurs par défaut de Level, Pool, Storage et Messages ressources. Ceci autorise une grande souplesse d'utilisation d'un simple job. Pour plus de détails, consultez le chapitre. Ressource Schedule de ce manuel.

Storage = <storage-resource-name> La directive Storage définit le nom du service storage que vous souhaitez utiliser pour sauvegarder les données du FileSet. Pour plus de détails, consultez le chapitre Ressource Storage de ce manuel. Cette directive est requise.

Max Start Delay = <time> La directive Max Start Delay spécifie le délai maximal entre l'horaire planifié (dans le schedule) et l'horaire effectif de démarrage du job. Par exemple, un job peut être programmé pour démarrer à 1h, mais être mis en attente à cause d'autres jobs en cours d'exécution. Si le Max Start Delay a été réglé à 3600, le job sera supprimmé s'il n'a pas démarré à 2h. Ceci peut se révéler utile pour, par exemple, éviter qu'un job s'exécute duant les heures ouvrables. La valeur par défaut est 0 (pas de limite).

Max Run Time = <time> La directive Max Run Time spécifie le délai alloué pour l'exécution complète d'un job depuis son lancement (pas nécessairement à l'heure de sa programmation) jusqu'à sa fin. Cette directive est implémentée depuis la version 1.33.

Max Wait Time = <time> La directive Max Wait Time spécifie le délai maximum durant lequel un job peut rester bloqué en attente d'une ressource (par exemple, en attente du montage d'une cartouche ou encore en attente des Storage ou File Daemon occupés à d'autres tāches) depuis son lancement (pas nécessairement à l'heure de sa programmation) jusqu'à sa fin. Cette directive est implémentée depuis la version 1.33.

Incremental Max Wait Time = <time>
Cette directive spécifie le temps maximum durant lequel une sauvegarde incrémentale peut rester bloquée en attente d'une ressource (par exemple, en attente d'une cartouche ou des File ou Storage daemons), compté à partir du démarrage du job, (pas nécessairement l'heure à laquelle le job a été programmé). Notez que si un Max Wait Time a été spécifié, il peut aussi s'appliquer au job.

Differential Max Wait Time = <time>
Cette directive spécifie le temps maximum durant lequel une sauvegarde différentielle peut rester bloquée en attente d'une ressource (par exemple, en attente d'une cartouche ou des File ou Storage daemons), compté à partir du démarrage du job, (pas nécessairement l'heure à laquelle le job a été programmé). Notez que si un Max Wait Time a été spécifié, il peut aussi s'appliquer au job.

Prefer Mounted Volumes = <yes|no>
Si cette directive est activée (c'est le cas par défaut), le Director ordonne au Storage daemon de sélectionner de préférence soit une librairie, soit un lecteur avec un volume valide déjà monté, plutôt qu'un lecteur pas prèt. Si aucun lecteur n'est prèt, c'est le premier lecteur prèt qui sera sélectionné.

Si cette directive est désactivée, le Storage daemon privilégiera les lecteurs inutilisés. Ce mode de fonctionnement peut être très utile pour ces sites avec de nombreux lecteurs qui où il peut être préférable de maximiser le flux des sauvegardes au prix d'une utilisation d'un plus grand nombre de lecteurs et de cartouches. Afin d'optimiser l'utilisation de plusieurs lecteurs, vous voudrez probablement lancer chacun de vos jobs l'un après l'autre avec un intervalle de 5 secondes environ. Ceci aidera à assurer que chaque nuit, le même lecteur (volume) est sélectionné pour le même job. Autrement, lors d'une restauration, vous pourriez trouver vos fichiers dispersés sur beaucoup plus de volumes que nécessaire.

Prune Jobs = <yes|no> En principe, l'élagage des jobs du catalogue est spécifié pour chaque client dans sa propre ressource Client par la directive AutoPrune. Si cette directive est spécifiée (normalement, non) et si la valeur est yes, elle outrepasse la valeur spécifiée dans la ressource Client. La valeur par défaut est no.

Prune Files = <yes|no> En principe, l'élagage des fichiers du catalogue est spécifié pour chaque client dans sa propre ressource Client par la directive AutoPrune. Si cette directive est spécifiée (normalement, non) et si la valeur est yes, elle outrepasse la valeur spécifiée dans la ressource Client. La valeur par défaut est no.

Prune Volumes = <yes|no> En principe, l'élagage des volumes du catalogue est spécifié pour chaque client dans sa propre ressource Client par la directive AutoPrune. Si cette directive est spécifiée (normalement, non) et si la valeur est yes, elle outrepasse la valeur spécifiée dans la ressource Client. La valeur par défaut est no.

Run Before Job = <command> La commande spécifiée est exécutée en tant que programme externe avant le lancement du job. Tout retour de la commande sur la sortie standard est incluse dans le rapport de job de Bacula. La chaîne bf command doit être un nom de programme valide ou un script shell. Cette directive n'est pas requise, mais si elle est définie, et si le code retour d'exécution du programme est différent de zéro, le job qui a lancé le programme est effacé. D'autre part, la chaîne bf command est parcourue puis envoyée vers la fonction execvp(), ce qui signifie que le chemin de la commande est recherché pour son exécution, mais qu'il n'y a aucune interprétation shell. Par conséquent, si vous voulez utiliser des commandes complexes ou toute fonctionnalité du shell telle que la redirection, vous devez appeler un script shell où vous mettrez vos commandes. Avant de soumettre la commande spécifiée au système d'exploitation, Bacula effectue les substitutions suivantes :

    %% = %
    %c = Nom du client
    %d = Nom du Director
    
    %e = Statut de sortie du job
    %i = JobId
    %j = Nom unique du job
    %l = Niveau du job
    %n = Nom du job
    %s = Temps Depuis (NDT : Since Time)
    %t = Type de job (Backup,...)
    %v = Nom de volume
    

Le le code de statut de fin de job peut prendre les valeurs suivantes :

Aussi, si vous l'utilisez dans une ligne de commande, il vous faudra l'encadrer de quotes.

Depuis la version 1.30, Bacula contrôle le statut de sortie du programme RunBeforeJob. S'il est différent de zéro, le job se termine en erreur. Lutz Kittler a fait remarquer que ceci peut être un moyen aisé pour modifier vos schedules pour les vacances. Par exemple, supposons que vous fassiez habituellement des sauvegardes Full le vendredi, mais que jeudi et vendredi soient fériés. Pour éviter d'avoir à changer les cartouches entre jeudi et vendredi alors que personne n'est au bureau, vous pouvez créer un RunBeforeJob qui retourne un statut non nul jeudi et zéro les autres jours. Ainsi, le job de jeudi ne sera pas exécuté, et la cartouche que vous avez inséré mercredi sera disponible pour la Full de vendredi.

Run After Job = <command> La commande spécifiée est exécutée en tant que programme externe après la fin du job. La chaîne bf command doit être un nom de programme valide ou un script shell. Cette directive n'est pas requise. Si le code de sortie du programme est non nul, Bacula affiche un message d'avertissement (warning). Avant de soumettre la commande spécifiée au système d'exploitation, Bacula effectue les substitutions de caractères décrites au paragraphe Run Before Job

Un exemple d'utilisation de cette directive est donné au chapitre Astuces de ce manuel. Lisez le paragraphe Run After Failed Job si vous voulez exécuter une commande lorqu'un job se termine avec un statut anormal.

Run After Failed Job = <command>
La commande spécifiée est exécutée en tant que programme externe après la fin du job lorqu'il se termine avec un statut d'erreur. Cette directive est optionnelle. La chaîne command doit être le nom d'un programme ou d'un script shell. Si le code de sortie du programme est non nul, Bacula affiche un mesage d'avertissement (warning). Avant de soumettre la commande spécifiée au système d'exploitation, Bacula effectue les substitutions de caractères décrites au paragraphe Run Before Job. Notez que vous pouvez, si vous le souhaitez, spécifier ici le même programme que celui que vous avez utilisé pour la direcive Run After Job, de sorte que votre programme soit exécuté quel que soit l'issue du job.

Le chapitre Trucs et astuces de ce manuel propose un exemple d'utilisation de cette directive.

Client Run Before Job = <command> Cette directive est similaire à Run Before Job excepté que la commande est exécutée sur la machine cliente. Les mêmes restrictions s'appliquent aux sytèmes Unix que celles signalées pour Run Before Job.

Lorsque vous spécifiez un chemin absolu vers un exécutable, si le chemin ou le nom de l'exécutable contient des espaces ou des caractères spéciaux, il faut les protéger par des quotes. Il en va de même des éventuels arguments.

Considérations particulières à Windows D'autre part, pour les clients Windows à partir de la version 1.33, notez bien que vous devez fournir un chemin correct pour votre script, et que le script peut avoir l'extension .com, .exe, ou .bat. Si vous spécifiez un chemin, vous devez aussi spécifier l'extension complète. Les commandes à la façon d'Unix ne fonctionneront pas, à moins que vous n'ayez installé et correctement configuré Cygwin en plus (et séparément) de Bacula.

La commande peut être n'importe quel programme reconnu par cmd.exe ou command.com comme un fichier exécutable. Spécifier une extension de fichier exécutable est optionnel, à moins qu'il y ait une ambiguïté (par exemple ls.bat, ls.exe).

Bacula cherche la commande dans le répertoire "System %Path%" (Dans la boîte de dialogue des variables d'environnement vous avez les variables "système" et "utilisateurs". Si bacula-fd fonctionne en tant que service, seules les variables d'environnement systèmes sont accessibles.)

Les variables d'environnement système peuvent être invoquées avec la syntaxe %var% et utilisées comme portion du nom de la commande ou des arguments.

Lorsque la spécification du chemin absolu d'un exécutable ou le nom de l'exécutable contient des espaces ou des caractères spéciaux, ils doivent être quotés. Il en va de même pour les arguments.

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

Les caractères spéciaux &()[]{}^=;!'+,`~ devront être quotés s'ils font partie d'un nom de fichier ou d'un argument.

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

Quelques suggestions de Phil Stracchino pour l'exécution sur les machines Win32 avec le File Daemon Win32 natif :

  1. Vous pourriez utiliser la directive ClientRunBeforeJob pour spécifier un fichier .bat qui exécute les commandes coté client plutôt que d'essayer d'exécuter (par exemple) regedit /e directement.
  2. Le fichier batch devrait retourner explicitement 0 lors des exécutions correctes.
  3. Le chemin vers le fichier batch devrait être spécifié au format Unix :

    ClientRunBeforeJob = ``c:/bacula/bin/systemstate.bat''

    plutôt qu'au format DOS/Windows :

    ClientRunBeforeJob = ``c:\bacula\bin\systemstate.bat'' INCORRECT

L'exemple suivant d'utilisation de la directive Client Run Before Job a été soumis par un utilisateur :
Vous pourriez écrire un script shell pour sauvegarder une base DB2 dans un FIFO. Voici le script en question :

 #!/bin/sh
 # ===== backupdb.sh
 DIR=/u01/mercuryd

 mkfifo $DIR/dbpipe
 db2 BACKUP DATABASE mercuryd TO $DIR/dbpipe WITHOUT PROMPTING &
 sleep 1

La ligne suivante dans la ressource Job du fichier bacula-dir.conf :

 Client Run Before Job = "su - mercuryd -c \"/u01/mercuryd/backupdb.sh '%t'
'%l'\""
Lorsque le job est exécuté, vous obtiendrez un message de sortie du script annoant que la sauvegarde a démarré. Même si la commande est exécutée en arrière plan avec &, le job bloquera jusqu'à la commande "db2 BACKUP DATABASE", et la sauvegarde se fige. Pour remédier à cette situation, la ligne "db2 BACKUP DATABASE" devrait être modifiée en :
 db2 BACKUP DATABASE mercuryd TO $DIR/dbpipe WITHOUT PROMPTING > $DIR/backup.log
2>&1 < /dev/null &
Il est important de rediriger l'entrée et la sortie d'une commande en arrière plan vers /dev/null pour éviter le bloquage du script.

Client Run After Job = <command> Cette directive est similaire à Run After Job sauf qu'elle est exécutée sur la machine cliente. Veuillez consulter les notes concernant les clients Windows dans le paragraphe Client Run Before Job ci-dessus.

Rerun Failed Levels = <yes|no> Si la valeur de cette directive est yes (no par défaut), et si Bacula détecte qu'un job antérieur d'un niveau plus élevé (Full ou différentiel), alors le job est élevé au niveau le plus haut. Ceci est particulièrement utile pour sauvegarder les pc portables qui peuvent être fréquemment inaccessibles. En effet, après l'échec d'une Full, vous souhaiterez probablement que la prochaine sauvegarde soit de niveau Full plutôt qu'Incremental ou Différentiel.

Spool Data = <yes|no> Si la valeur de cette directive est yes (no par défaut), le Storage Daemon aura pour consigne de stocker les données dans un fichier spoule sur disque plutôt que de les écrire directement sur bande. Lorsque toutes les données sont dans le spoule ou lorsque la taille maximale fixée pour le fichier spoule est atteinte, les données sont déchargées du spoule vers les bandes. Lorsque la valeur de cette directive est yes, la directive Spool Attributes est aussi automatiquement mise à la valeur yes. L'utilisation de cette fonctionnalité prévient les arrêts et redémarrage incessants lors des incrémentales. Elle ne doit pas être utilisée si vous sauvegardez sur disque.

Spool Attributes = <yes|no> La valeur par défaut est no, ce qui signifie que le Storage Daemon envoie les attributs de fichiers au Director au moment où ils (les fichiers) sont ecrits sur la bande. Cependant, si vous souhaitez éviter le risque de ralentissement dû aux mises à jour du catalogue, vous pouvez régler cette directive à yes, dans ce cas, le Storage Daemon stockera les attributs de fichiers dans un fichier tampon du Working Directory pour ne les transmettre au Director qu'à la fin de l'écriture sur bande des données du job.

Where = <directory> Cette directive ne concerne que les jobs de type Restauration. Elle permet de spécifier un préfixe au nom du répertoire où tous les fichiers sont restaurés. Ceci permet de restaurer les fichiers en un emplacement différent de celui où ils ont été sauvegardés. Si Where n'est pas renseigné, ou si sa valeur est backslash (/), les fichiers sont restaurés à leur emplacement d'origine. Par défaut, nous avons donné à Where la valeur /tmp/bacula-restores dans les fichiers de configuration fournis en exemple, ceci afin d'éviter l'écrasement accidentel de vos fichiers.

Replace = <replace-option> Cette directive ne concerne que les jobs de type Restauration. Elle précise la conduite à adopter dans l'éventualité où Bacula serait conduit à restaurer un fichier ou un répertoire qui existe déjà. Les options suivantes sont disponibles :

always
Lorsque le fichier à restaurer existe déjà, il est supprimé et remplacé par la copie sauvegardée.

ifnewer
Si le fichier sauvegardé (sur bande) est plus récent que le fichier existant, le fichier existant est supprimé et remplacé par la copie sauvegardée.

ifolder
Si le fichier sauvegardé (sur bande) est plus ancien que le fichier existant, le fichier existant est supprimé et remplacé par la copie sauvegardée.

never
Si le fichier sauvegardé existe déjà, Bacula renonce à restaurer ce fichier.

Prefix Links=<yes|no> Si la valeur de cette directive est Yes et si un préfixe de chemin Where est spécifié, alors ce dernier s'applique aussi aux liens absolus. La valeur par défaut est No. Lorsque cette directive est à Yes, tous les liens absolus seront aussi modifiés pour pointer vers le nouveau répertoire. En principe, c'est ce qui est souhaité : l'ensemble du répertoire restauré conserve sa cohérence interne. Cependant, si vous voulez replacer les fichiers ultérieurement à leurs emplacements d'origine, tous les liens absolus seront brisés.

Maximum Concurrent Jobs = <number> Où <number> est le nombre maximum de jobs de la ressource Job courrante qui peuvent être exécutés simultanément. Notez que cette directive ne limite que les jobs avec le même nom que la ressource dans laquelle elle figure. Toute autre restriction du nombre maximum de jobs simultanés, que ce soit au niveau du Director, du Client ou de la ressource Storage, s'applique en plus de de la limite stipulée ici. LA valeur par défaut est 1, mais vous pouvez utiliser une valeur plus grande. Nous vous recommandons fortement de lire attentivement le paragraphe WARNING sous Maximum Concurrent Jobs dans la section concernant la ressource Director.

Reschedule On Error = <yes|no> Si cette directive est activée, alors si le job se termine en erreur, il sera reprogrammé en accord avec les directives Reschedule Interval et Reschedule Times. Si vous supprimez le job, il ne sera pas reprogrammé. La valeur par défaut est no.

Cette spécification peut se révéler utile pour les pc portables ainsi que pour toutes les machines qui ne sont pas connectées au réseau en permanence.

Reschedule Interval = <time-specification> Si cette directive est activée, alors si le job se termine en erreur, il sera reprogrammé après l'intervalle de temps stipulé par time-specification. Consultez la section the time specification formats du chapitre Configurer Bacula pour plus de détails sur les spécifications de temps. Si aucun intervalle n'est spécifié, le job ne sera pas reprogrammé en cas d'erreur.

Reschedule Times = <count> Cette directive précise le nombre maximal de tentatives d'exécution du job. S'il est fixé à zéro (valeur par défaut), le job sera reprogrammé indéfiniment.

Run = <job-name>
La directive Run (à ne pas confondre avec l'option Run dans un Schedule) vous permet de démarrer ou de cloner des jobs. En utilisant les mots-clef de clonage (voir ci dessous), vous pouvez sauvegarder les mêmes données (ou presque les mêmes) vers deux (ou plus) lecteurs en même temps. Le nom de job job-name est en principe le même que celui de la ressource job courante (créant ainsi un clone). Cependant, ce peut être n'importe quel nom de job, de sorte qu'un job peut démarrer d'autre jobs liés. La partie après le signe égale doit être encadrée de double quotes, et peut contenir toute chaîne ou jeu d'options (surcharges) qui pourraient être spécifiées à l'utilisation de la commande Run dans la Console. Par exemple, storage=DDS-4 .... De plus, deux mots-clef spéciaux vous permettent de cloner le job courant : level=%l et since=%s. le %l du mot clef level permet d'entrer le niveau réel du job courant et le %s du mot clef since permet d'imposer la même date pour la comparaison que celle utilisée par le job courant.a Notez que dans le cas du mot-clef since, le %s doit être encadré de double quotes, qui doivent être elles mêmes précédées de barres obliques arrières puisque elles sont déjà entre double quotes. Par exemple :

       run = "Nightly-backup level=%s since=\"%s\" storage=DDS-4"
    
Un job cloné ne démarrera pas de nouveaux clones, aussi il n'est pas possible de les cascader.

Priority = <number> Cette directive vous permet de contrôler l'ordre d'exécution des jobs en spécifiant un entier positif non nul. Plus grand est ce nombre, plus basse est la priorité du job. En supposant que vous n'exécutiez pas de jobs simultanés, tous les jobs en file d'attente avec la priorité 1 seront exécutés avant ceux avec la priorité 2, et ainsi de suite, sans prise en compte de l'ordre original de planification.

La priorité affecte seulement les jobs en file d'attente, et non les jobs déja en cours d'exécution. Si un ou plusieurs jobs de priorité 2 sont déjà en cours d'exécution, et si un nouveau job est programmé avec la priorité 1, les jobs en cours d'exécution doivent se terminer pour que le job de priorité 1 puisse démarrer.

La priorité par défaut est 10.

Si vous voulez exécutez plusieurs jobs simultanés, ce qui n'est pas recommandé, vous devriez garder les points suivants à l'esprit :

Si vous avez plusieurs jobs de priorités différentes, il est préférable de ne pas les démarrer exactement à la même heure, car Bacula doit les examiner un à la fois. Si, par hazard, Bacula commence par traiter un job de priorité inférieure, il sera exécuté avant votre job de priorité élevé. Pour éviter cette situation, démarrez l'un quelconque des jobs de priorité élevée quelques secondes avant ceux de basse priorité. Ainsi, vous serez assuré que Bacula examine les jobs dans l'ordre voulu et que votre schéma de priorités sera respecté.

Write Part After Job = <yes|no> Cette directive est implémentée depuis la version 1.37. Si la valeur de cette directive est yes (no par défaut), un nouveau "fichier partition" (ndt : part file) sera créé après la fin du job.

Cette directive devrait être activée lors de l'écriture sur des périphérique qui requièrent un montage (par exemple, les DVDs), afin de vous assurer que le fichier partition courant, celui qui contient les données de ce job, est envoyé vers le périphérique, et qu'aucune donnée n'est laissée dans le fichier temporaire sur le disque dur. Quoi qu'il en soit, avec certains supports tels que les DVD+R et DVD-R, beaucoup d'espace (environ 10 Mb) est perdu à chaque fois qu'un fichier partition est écrit. Aussi, si vous exécutez plusieurs jobs à la suite, vous devriez régler cette directive à no pour tous ces jobs sauf le dernier, pour éviter un gaspillage important d'espace, tout en ayant la certitude que les données sont bien écrites sur le médium lorsque tous les jobs sont achevés.

Cette directive est ignorée avec les bandes et les périphériques FIFO.

Voici un exemple de définition de ressource Job valide.

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


La ressource JobDefs

La ressource Jobdefs admet toutes les directives qui peuvent apparaître dans une ressource Job. Une ressource Jobdefs ne créé en aucun cas un Job, son rôle est de pouvoir être désignée dans une ressource Job comme un ensemble de paramètres par défaut. Ceci permet de définir plusieurs jobs similaires avec concision, en ne mentionnant, pour chaque job, que les différences avec les valeurs par défaut spécifiées dans la ressource Jobdefs.


La ressource Schedule

La ressource Schedule offre un moyen pour planifier automatiquement un Job, mais aussi la possibilité de surcharger les paramètres par défaut de Level, Pool, Storage, et Messages ressources. Si une ressource Schedule n'est pas spécifiée dans un job, ce job ne peut être exécuté que manuellement. En général, vous spécifierez une action et le moment de son lancement.

Schedule
Début des directives Schedule. La ressource Schedule n'est pas requise, mais il vous en faudra au moins une si vous souhaitez que vos jobs soient exécutés automatiquement.

Name = <name>
Le nom du Schedule défini. Cette directive est requise.

Run = <Job-overrides> <Date-time-specification>
La directive Run définit quand un job doit être exécuté, et les éventuelles surcharges à appliquer. Il est possible de spécifier plusieurs directives run au sein d'une ressource Schedule, elles seront toutes appliquées. Si vous avez deux directives Run qui démarrent au même moment, deux jobs seront lancés simultanément (en fait, avec une seconde d'écart).

La directive Job-overrides permet d'outrepasser les spécifications de Level, Storage, Messages et Pool écrites dans la ressource Job. De plus, les spécifications FullPool, DifferentialPool et IncrementalPool permettent de passer outre les spécification de Pool, en accord avec le niveau (level) effectif d'exécution du job.

L'utilisation de surcharges permet de peaufiner le paramétrage d'un job particulier. Par exemple, vous pourriez surcharger une spécification Messages qui enverrait vos logs de backups vers un fichier, de faon à ce qu'ils vous soient envoyés par mails pour les Fulls hebdomadaires ou mensuelles.

Les directives Job-overrides sont spécifiées en tant que mot-clef=valeur où le mot-clef est l'un des suivants : Level, Storage, Messages, Pool, FullPool, DifferentialPool ou IncrementalPool, et la valeur est définie selon le format adapté à la directive. Vous pouvez spécifier plusieurs surcharges Job-overrides en une seule directive Run en les séparant par des espaces ou des trailing comas (traduction ?). Par exemple :

Level=Full
Tous les fichiers du FileSet qu'ils aient ou non changé.

Level=Incremental
Tous les fichiers qui ont changé depuis la dernière sauvegarde.

Pool=Weekly
Spécifie l'utilisation du Pool nommé Weekly.

Storage=DLT_Drive
Spécifie l'utilisation du lecteur DLT_Drive pour périphérique de stockage.

Messages=Verbose
Spécifie l'utilisation de la ressource messages Verbose pour le job.

FullPool=Full

Spécifie l'utilisation du Pool nommé Full si le job est une sauvegarde Full, ou s'il a été élevé en Full bien qu'ayant été lancé en tant que différentiel ou incrémental.

DifferentialPool=Differential
Spécifie l'utilisation du Pool nommé Differential si le job est une sauvegarde différentielle.

IncrementalPool=Incremental
Spécifie l'utilisation du Pool nommé Incremental si le job est une sauvegarde incrémentale.

SpoolData=yes|no
Indique à Bacula d'ordonner au Storage Daemon de placer les données sur un spool disque avant de les envoyer vers les cartouches.

WritePartAfterJob=yes|no
Indique à Bacula d'ordonner au Storage Daemon d'écrire le fichier partition courant vers le périphérique lorsque le job s'achève (voir la directive Write Part After Job dans la ressource Job).

Date-time-specification Détermine la planification d'exécution du job. La spécification est une répétition, et, par défaut, Bacula est paramétré pour exécuter un job au début de chaque heure de chaque jour de chaque semaine de chaque mois de chaque année. Ce n'est probablement pas ce que vous souhaitez, aussi vous devez préciser ou limiter les moments où vous souhaitez voir vos jobs exécutés. Toute spécification est supposée cyclique et servira à limiter le cycle par défaut. Ceci se fait en spécifiant des masques ou des horaires, jours de la semaine, jours du mois, semaines du mois, semaines de l'année et mois de l'année où vous voulez exécuter le job. En combinant ces possibilités, vous pouvez définir une planification qui se répète à presque n'importe quelle fréquence.

Concrètement, vous devez définir les mois, jour, heure et minute où le job est à exécuter. Parmis ces quatre objets, le jour est particulier en ce qu'il peut spécifier un jour du mois (1,2,...31) ou de la semaine (Monday, Tuesday,...Sunday). Enfin, vous pouvez aussi spécifier un jour de la semaine pour restreindre la planification à la première, deuxième, troisième, quatrième ou cinquième semaine du mois.

Par exemple, si vous spécifiez seulement un jour de la semaine, disons Mardi, le job sera exécuté toutes les heures de chaque mardi de chaque mois. La raison en est que les paramètres Mois et Heure sont restés à leurs valeurs par défaut : chaque mois et chaque heure.

Notez que, par défaut, sans autre spécification, votre job s'exécutera au début de chaque heure. Si vous souhaitez que votre job s'exécute plus souvent qu'une fois par heure, il vous faudra définir plusieurs spécifications run avec pour chacune une minut différente.

Les dates et horaires d'exécutions des jobs peuvent être spécifiés comme suit, en 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> |
                    <week-keyword> <wday-keyword>
                    <day-range> | <wday-range> |
                    <daily-keyword>
<month-spec>      = <month-keyword> | <month-range> |
                    <monthly-keyword>
<date-time-spec>  = <month-spec> <day-spec> <time-spec>

Notez que les spécifications de semaine et d'année suivent les définitions ISO standard de semaine et année, où la semaine 1 est la semaine qui contient le premier jeudi de l'année, ou alternativement, la semaine qui contient le quatrième jour de janvier. Les semaines sont numérotées w01 à w53. w00 est pour Bacula la semaine qui précède la première semaine ISO (c'est à dire celle qui contient les quelques premiers jours de l'année si aucun n'est un jeudi). w00 n'est pas définie dans les spécifications ISO. Une semaine commence le Lundi et se termine le Dimanche.

Voici un exemple de ressource Schedule nommée WeeklyCycle qui exécute un job de niveau Full chaque Dimanche à 1h05 et un job de niveau incrémental du Lundi au Samedi à 1h05 :

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

Voici un exemple de cycle mensuel :

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
}

Le premier de chaque mois :

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

Toutes les dix 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
}

Notes techniques sur les Schedules

Au niveau interne, Bacula considère un schedule en tant que bit masque. Il y a six masques et un champ minute pour chaque schedule. Les masques sont heure, jour du mois (mday), jour de la semaine (wday), semaine du mois (wom), et semaine de l'année (woy). Le schedule est initialisé de faon à avoir les bits de chacun de ces masques positionnés, ce qui signifie qu'au début de chaque heure, le job sera exécuté. Quand vous spécifiez un mois pour la première fois, le masque est effacé et le bit correspondant au mois sélectionné est ajouté au masque. Si vous spécifiez un second mois, le bit correspondant est aussi ajouté. Ainsi, lorsque Bacula examine le masque pour voir si les bits placés correspondent à la date courante, votre job ne sera exécuté que pendant les deux mois que vous avez spécifiés. De même, si vous spécifiez un horaire, le masque Heure est effacé et le bit correspondant à l'heure que vous avez spécifiée est placé, les minutes sont quant à elles stockées dans le champ Minutes.

Pour chacun de vos schedules, vous pouvez visualiser le masque associé grāce à la commande show schedules du programme Console. Notez que le bit masque est "zero based", et que Dimanche est le premier jour de la semaine (bit 0)


La ressource FileSet

La ressource FileSet définit les fichiers à inclure dans une sauvegarde. Pour chaque job de type sauvegarde, il est nécessaire de définir au moins une ressource FileSet. Un FileSet consiste en une liste de fichiers ou répertoires à inclure, une liste de fichiers ou répertoires à exclure, et diverses options de sauvegardes telles que compression, chiffrement et signatures qui doivent être appliquées à chaque fichier.

Toute modification de la liste des fichiers inclus provoque la création par Bacula d'un nouveau FileSet (défini par le nom et la somme de contrôle MD5 du contenu du paragraphe Include). Chaque fois qu'un nouveau FileSet est créé, Bacula s'assure que la première sauvegarde est une Full.

FileSet
Début de la ressource FileSet. Au moins une ressource FileSet doit être définie.

Name = <name>
Le nom de la ressource FileSet. Cette directive est requise.

Ignore FileSet Changes = <yes|no>
Si cette directive est activée (yes), toute modification des listes d'inclusion ou d'exclusion du FileSet sera ignorée et Bacula n'élèvera pas la prochaine sauvegarde en Full. La valeur par défaut est no, ainsi, si vous modifiez une des listes d'inclusion ou d'exclusion du FileSet, Bacula forcera une sauvegarde Full pour assurer que tout soit bien sauvegardé proprement. Il n'est pas recommandé d'activer cette directive. Cette directive est disponible à partir de Bacula 1.35.4.

Include { [ Options {<file-options>} ...] <file-list> }

Options { <file-options> }

Exclude { <file-list> }
La ressource Include doit contenir une liste de répertoires et/ou fichiers à traiter lors de la sauvegarde. Normalement, tous les fichiers trouvés dans tous les sous-répertoires de tout répertoire de la liste d'inclusion des fichiers seront sauvegardés. La ressource Include peut aussi comporter une ou plusieurs ressources Options qui spécifient des paramètres tels que la compression à appliquer à tous les fichiers ou à n'importe quel sous ensemble de fichiers à sauvegarder.

Le nombre de ressources Include par FileSet n'est pas limité, chacune ayant sa propre liste de répertoires et/ou fichiers à sauvegarder et ses propres paramètres définis par une ou plusieurs ressources Options. La liste de fichiers file-list consiste en un nom de fichier ou répertoire par ligne. Les noms de répertoire doivent être spécifiés sans slash final.

Vous devez toujours spécifier des chemins absolus pour tout fichier ou répertoire que vous placez dans un FileSet. De plus, sur les machines Windows, vous devez toujours préfixer le répertoire ou nom de fichier d'une spécification de disque (par exemple : c:/xxx) en utilisant le séparateur de répertoire Unix (slash /).

Le comportement par défaut de Bacula en ce qui concerne le traitement des répertoires est de descendre récursivement dans chaque répertoire et de sauvegarder tous les fichiers et sous-répertoires. Par défaut, Bacula ne suit pas les systèmes de fichiers transverses (en terminologie Unix, les points de montage). Ceci signifie que si vous spécifiez la partition racine ( par exemple /), Bacula sauvegardera seulement la partition racine, et aucun des systèmes de fichiers montés. De faon analogue, sur les systèmes Windows, vous devez expliciter chacun des disques que vous souhaitez sauvegarder (par exemple c:/ et d:/...). De plus, au moins pour les systèmes Windows, il sera la plupart du temps nécessaire d'encadrer chaque spécification de doubles quotes, particulièrement si le nom du répertoire (ou du fichier) comporte des espaces. La commande df des systèmes Unix vous fournira la liste des répertoires qu'il vous faudra spécifier pour tout sauvegarder. Voyez ci-dessous pour un exemple.

Soyez attentif à ne pas inclure un répertoire deux fois, car il serait sauvegardé deux fois, ce qui gaspillerait l'espace sur votre périphérique de sauvegarde. Cette erreur est facile à commettre. Par exemple :

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

Sur un système Unix où /usr est un sous répertoire (plutôt qu'un système de fichiers monté), cette ressource Include sauvegarderait /usr deux fois. Dans ce cas, sur les versions antérieures à 1.32f-5-09Mar04, en raison d'un bug, vous ne pourriez restaurer les fichiers liés physiquement sauvegardés deux fois.

Si vous avez utilisé des versions de Bacula antérieures à 1.34.3, vous noterez ces modifications dans la syntaxe des FileSets :

  1. il n'y a pas de signe égale (=) après le "include" et avant l'accolade ouvrante ({) ;
  2. chaque répertoire (ou nom de fichier) à sauvegarder est précédé de "File =" ;
  3. les options qui apparaissaient précédemmant sur la ligne Include doivent désormais être spécifiées dans leur propre ressource Options.

La ressource Options est optionnelle, mais lorsqu'elle est spécifiée, elle doit contenir une liste de lignes "mot-clef=valeur" relatives aux options à appliquer à la liste de fichiers/répertoires. Plusieurs ressources Options peuvent être spécifiées l'une après l'autre. Lorsqu'un fichier se trouve dans un dossier spécifié, les options sont appliquées au nom de fichier pour savoir s'il doit être sauvegardé, et comment. Les ressources Options sont appliquées dans l'ordre où elles apparaîssent dans le FileSet jusqu'à ce qu'il y en ait une qui corresponde. Une ressource Options qui ne contient pas de directive wild (spécification de caractère joker, voir ci-dessous) est considérée comme concernant tous les fichiers. Il est important de bien comprendre ceci, car une fois que Bacula a déterminé que des Options s'appliquent à un fichier donné, ce fichier sera sauvegardé sans tenir compte d'aucunes des éventuelles autres ressources Options. Ceci signifie que toute ressource Options avec caractères joker doit apparaître avant une ressource Options sans caractères joker.

Si, pour quelque raison, Bacula applique toutes les ressources Options à un fichier sans qu'aucune ne corresponde (en général à cause de caractères joker qui ne correspondent pas), par défaut Bacula sauvegardera le fichier. Ceci est assez logique si vous considérez la situation sans options, où vous souhaitez que tout soit sauvegardé. De plus, dans le cas ou aucune correspondance n'est trouvée, Bacula utilise les options de la dernière ressource Options. Par conséquent, si vous souhaitez définir un jeu d'options par défaut, vous devriez les placer dans la dernière ressource Options.

Les directives disponibles pour les ressources Options sont les suivantes :

compression=GZIP
Tous les fichiers sauvegardés sont compressés (NDT : compression logicielle, par opposition à la compression matérielle effectuée par le lecteur) au format GNU ZIP. Chaque fichier est compressé individuellement par le File Daemon. S'il y a un problème à la lecture d'une cartouche au niveau de l'enregistrement d'un fichier, il affectera tout au plus ce fichier et aucun des autres fichiers de la cartouche. La plupart du temps, cette option n'est pas nécessaire si vous avez un lecteur de bandes moderne qui applique sa propre compression. En fait, si vous activez les deux compressions simultanément, il se peut que vos fichiers occupent plus d'espace sur le volume qu'avec une seule.

La compression logicielle est particulièrement intéressante lorsque vous sauvegardez sur disque, et peut être d'un grand secours si vous avez un ordinateur rapide mais un réseau lent.

La spécification GZIP utilise le niveau de compression six par défaut (i.e. GZIP est équivalent à GZIP6). Si vous voulez utiliser un niveau différent (de 1 à 9), vous pouvez le spécifier en ajoutant le numéro du niveau voulu à la fin du mot GZIP, sans espace. Ainsi, compression=GZIP1 désigne la compression la moins efficace, mais l'algorithme le plus rapide, tandis que compression=GZIP9 est le niveau de compression le plus élevé, mais requière plus de puissance de calcul. Selon la documentation GZIP, les niveaux de compression supérieurs à 6 ne procurent généralement que peu de compression supplémentaire alors qu'ils sont plutôt exigeants en puissance de calcul.

signature=SHA1
La signature SHA1 est calculée pour tous les fichiers sauvegardés. L'algorithme SHA1 est réputé plus lent que MD5, mais bien meilleur d'un point de vue cryptographique (i.e. beaucoup moins de collisions et probabilité de piratage bien inférieure.). Nous recommandons fortement d'activer l'une ou l'autre des options SHA1 ou MD5 par défaut pour tous les fichiers. Notez que seule l'une de ces deux options peut être activée pour tout fichier.

signature=MD5
La signature MD5 est calculée pour tous les fichiers sauvegardés. Activer cette option résulte en une charge CPU supplémentaire de l'ordre de 5% pour chaque fichier sauvegardé. D'autre part, la signature MD5 ajoute 16 octets supplémentaires au catalogue pour chaque fichier sauvegardé. Nous recommandons fortement d'activer l'une ou l'autre des options SHA1 ou MD5 par défaut pour tous les fichiers.

verify=<options>
Les "options-lettres" sont utilisées lors de l'exécution de jobs de type Verify de niveau Level=Catalog et de niveau Level=DiskToCatalog. Les options peuvent être n'importe quelle combinaison de ces lettres.

i
compare les inodes

p
compare bits de permissions

n
compare le nombre de liens

u
compare les user ids

g
compare les group ids

s
compare les tailles

a
compare les date d'accès (access time)

m
compare les dates de modification (st_mtime)

c
compare les dates de changement (st_ctime)

s
signale tout fichier dont la taille a diminué

5
compare les signatures MD5

1
compare les signatures SHA1

Le jeu d'options pins5 (qui compare les bits de permissions, les inodes, les nombres de liens, la taille des fichiers et les signatures MD5) est très utile pour des jobs de type verify de niveaux Level=Catalog ou Level=DiskToCatalog.

onefs=yes|no
Si cette option est activée (valeur yes, par défaut), Bacula ne changera pas de système de fichiers. Autrement dit, il ne sauvegardera pas les systèmes de fichiers montés sur des sous-répertoires. Si vous souhaitez sauvegarder plusieurs systèmes de fichiers, vous pouvez les énumérer explicitement. Une autre possibilité consiste à désactiver l'option onefs (onefs=no) afin que Bacula sauvegarde les systèmes de fichiers montés trouvés dans les répertoires listés dans votre FileSet. Ainsi, si vous avez des systèmes de fichiers NFS ou Samba montés sur un répertoire listé dans le FileSet, ils seront aussi sauvegardés. En principe, il est préférable d'activer cette option et de nommer explicitement chaque système de fichier que vous voulez sauvegarder. Ce nommage explicite évite le risque de tomber dans une boucle infinie de systèmes de fichiers. Voyez l'exemple ci-dessous pour plus de détails.

portable=yes|no
Si cette option est activée (la valeur par défaut est no), le File Daemon sauvegarde les fichiers win32 dans un format portable, mais tous les attributs de fichiers win32 ne seront pas sauvegardés ni restaurables. La valeur par défaut est no, ce qui signifie que sur les systèmes Win32, les données sont sauvegardées en utilisant les appels Windows API et sur les WinNT/2k/XP, tous les attributs de sécurité et de propriété sont correctement sauvegardés et restaurés. Cependant, ce format n'est pas portable aux autres systèmes -- par exemple UNIX, Win95/98/Me. Lors de la sauvegarde de systèmes Unix, cette option est ignorée, et à moins que vous n'ayez un besoin spécifique de portabilité de vos sauvegardes, nous recommandons d'accepter la valeur par défaut (no) de sorte qu'un maximum d'informations concernant vos fichiers soit sauvegardé.

recurse=yes|no
Si cette option est activée (la valeur par défaut est yes), Bacula descend récursivement dans tout sous-répertoire trouvé, à moins qu'il ne soit explicitement exclu par une définition exclude. Si vous désactivez cette option (recurse=no), Bacula sauvegardera toutes les entrées de sous- répertoires, mais n'entrera pas dans ces sous-répertoires, et ainsi ne sauvegardera pas les fichiers ou épertoires contenus dans ces sous-répertoires. En principe, vous préfèrerez la valeur par défaut (yes).

sparse=yes|no
Cette option active un code spécial qui détecte les fichiers clairsemés tels ceux créés par ndbm. Elle est désactivée par défaut (sparse=no), de sorte qu'aucun contrôle n'est fait pour rechercher les fichiers clairsemés. Vous pouvez l'activer sans danger sur des fichiers non clairsemés, cependant elle entraîne une légère charge supplémentaire pour la détection de tampons remplis de zéros (buffers of all zero), et un léger surplus d'espace sur l'archive de sortie sera utilisé pour ssauver les adresses de recherche de chaque enregistrement non-nul trouvé.

Restrictions: Bacula lit les fichiers dans des tampons de 32K. Si le tampon entier est rempli de zéros, il sera traité en tant que bloc clairsemé, et ne sera pas écrit sur la cartouche. En revanche, si une partie quelconque du tampon est non-nulle, le tampon sera intégralement copié sur la cartouche, avec éventuellement des secteurs de disque (généralement 4098 octets) entièrement nuls. La détection par Bacula des blocs clairsemés a lieu sur des blocs de 32K plutôt que sur des blocs de taille déterminée par le système. Si quelqu'un considère ceci comme un réelle problème, merci d'envoyer une demande de modification en exposant les raisons. Ce code est apparu avec la version 1.27 de Bacula.

Si vous n'êtes pas familier avec les notions de fichiers clairsemés, prenons pour exemple un fichier où vous écrivez 512 octets à l'adresse 0, puis 512 octets à l'adresse 1 million. Le système d'exploitation n'allouera que deux blocs, et rien n'est alloué pour l'espace vide. Pourtant, lorsque vous lisez le fichier clairsemé, le système retourne tous les zéros comme si l'espace était alloué, et si vous sauvegardez un tel fichier, vous utiliserez beaucoup d'espace sur le volume pour écrire des zéros. Pire encore, lorsque vous restaurez ce fichier à son emplacement initial, tous les emplacements précédemment vides seront cette fois alloués, occupant ainsi beaucoup plus d'espace disque. En activant l'option sparse, Bacula recherchera spécifiquement l'espace vide dans les fichiers afin d'éviter ces inconvénients. Le prix à payer est que Bacula doit d'abord examiner chaque bloc lu avant de l'écrire. Sur un système lent, ceci peut-être important. Si vous suspectez certains de vos fichiers d'être clairsemés, vous devriez mesurer les performances et gains d'espace avec et sans l'options, ou ne l'activer que pour les fichiers effectivement clairsemés.

readfifo=yes|no
Cette option, si elle est activée, indique au client de lire les données (lors d'une sauvegarde) et de les écrire (lors d'une restauration) sur un FIFO (pipe) explicitement explicitement mentionné dans le FileSet. Dans ce cas, vous devez avoir un programme actif qui écrit sur ce FIFO dans le cas d'une sauvegarde, ou qui le lit dans le cas d'une restauration. (Ceci peut être accompli par la directive RunBeforeJob). Si cette condition n'est pas satisfaite, Bacula demeurera en suspens indéfiniment en lecture/écriture du FIFO. Lorsque cette option est désactivée (par défaut), le Client sauvegarde simplement l'entrée du répertoire pour le FIFO.

mtimeonly=yes|no
Cette option, si elle est activée, indique au client que la sélection de fichiers lors d'une sauvegarde incrémentale ou différentielle ne doit se référer qu'aux valeurs de st_mtime du paquet stat(). La valeur par défaut est no, ce qui signifie que la sélection de fichiers à sauvegarder se base sur les deux valeurs st_mtime et st_ctime. En général, il n'est pas recommandé d'activer cette option.

keepatime=yes|no
Avec cette option activée, Bacula rétablit le champ st_atime (date d'accès) des fichiers qu'il sauvegarde à leur valeur d'avant la sauvegarde. Cette option n'est généralement pas recommandée car il existe peu de programmes qui utilisent st_atime, et la charge de la sauvegarde se trouve augmentée par les appels systèmes nécessaires pour rétablir les dates. (Je ne suis pas sur que ceci fonctionne sous Win32).

wild=<string>
Spécifie une chaîne de caractères jokers à appliquer aux fichiers. Notez que si Exclude n'est pas activée, cette chaîne sélectionnera les fichiers à sauvegarder. Si au contraire Exclude=yes est spécifié, la chaîne sélectionnera les fichiers à exclure de la sauvegarde. Plusieurs directives wild-card peuvent être spécifiées et sont appliquées séquentiellement jusqu'à ce que l'une d'elles corresponde.

regex=<string>
Spécifie une expression régulière étendue POSIX à appliquer aux fichiers. Cette directive est disponible à partir de Bacula 1.35. Si Exclude n'est pas activée, cette expression régulière sélectionnera les fichiers à sauvegarder. Si au contraire Exclude=yes est spécifié, elle sélectionnera les fichiers à exclure de la sauvegarde. Plusieurs directives regex peuvent être spécifiées et sont appliquées séquentiellement jusqu'à ce que l'une d'elles corresponde.

exclude=yes|no
Lorsque cette option est activée, tout fichier qui correspond aux options est exclu de la sauvegarde. La valeur par défaut est no.

aclsupport=yes|no
Si cette option est activée, et si vous avez installé la librarie POSIX libacl sur votre système, Bacula sauvegardera Listes de Contrôles d'Accès (ACL) UNIX des fichiers et répertoires telles que définies dans IEEE Std 1003.1e version 17 et "POSIX.1e" (abandonné). Cette fonction n'est disponible que sur UNIX et dépend de la librairie ACL. Bacula est automatiquement compilé avec le support ACL si la librairie libacl est installée sur votre système (ceci est reporté dans le fichier config.out). Lors de la restauration, Bacula tentera de restaurer les ACLs. S'il n'y a pas de support ACL sur le système cible, Bacula ne restaurera que les fichiers et répertoires sans les informations ACL. Veuillez noter que si vous sauvegardez un système de fichiers EXT3 ou XFS avec le support des ACLs, et que vous restaurez vers un système de fichiers sans ACLs (tel , peut-être reiserfs), les ACLs seront ignorées.

<file-list> est une liste de répertoires et/ou noms de fichiers spécifiés avec la directive File =. Pour inclure des noms contenant des espaces, entourez-les de guillemets (doubles quotes).

Il existe quelques notations particulières pour spécifier des fichiers et répertoires dans une liste de fichiers file-list. Les voici :

Voici un exemple de définition de ressource FileSet valide. Notez que le premier Include insère le contenu du fichier /etc/backup.list lors du démarrage de Bacula (i.e. le @).

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

Notez que dans l'exemple ci-dessus, tous les fichiers mentionnés dans /etc/backup.list seront compressé avec GZIP, qu'une signature SHA1 sera calculée sur le contenu des fichiers (leurs données), et que la prise en charge particulière des fichiers clairsemés (sparse) s'appliquera.

Les deux répertoires /root/myfile et /usr/lib/another_file seront aussi sauvegardés sans aucune option, mais tous les fichiers à extension .o de ces répertoires seront exlus de la sauvegarde.

Supposons que vous vouliez sauvegarder tout sauf /tmp sur votre système. La commande df vous fournit le résultat suivant :

[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

Si vous vous contentez de spécifier / dans votre liste d'inclusions, Bacula ne sauvegardera que le système de fichiers /dev/hda5. Pour sauvegarder tous vos systèmes de fichiers sans inclure les systèmes de fichiers montés Samba ou NFS et en excluant /tmp, /proc, .journal, et .autofsck, que vous ne voulez ni sauvegarder ni restaurer, vous pouvez utiliser ce qui suit :

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

/tmp étant sur son propre système de fichiers et n'étant pas explicitement nommé dans la liste d'inclusion, il n'est pas nécessaire de le spécifier dans la liste d'exclusion. Cependant, il peut être préférable de le faire malgré tout par souci de clarté et au cas où il ne serait plus sur sa propre partition après un remplacement de disques.

Ayez conscience qu'il peut être très dangereux de permettre à Bacula de traverser ou changer de système de fichiers au gré des ppoints de montage. Par exemple, avec ce qui suit :

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

vous sauvegardez une partition NFS montée (/mnt/matou), et puisque onefs est désactivée, Bacula traverse les systèmes de fichiers. Si jamais /mnt/matou contient lui même un point de montage où le système de fichiers de la machine sauvegardée est monté, ce qui est souvent le cas, vous vous retrouvez pris dans un boucle récursive, et la sauvegarde ne se terminera jamais.

Le FileSet suivant sauvegarde une partition raw :

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

Lorsque vous sauvegardez et restaurez une partition raw, vous devriez vous assurer qu'aucun autre processus, y compris le système, n'écrit sur cette partition. En guise de précaution, nous recommandons ardemment de ne sauvegarder en mode raw que des partitions non montées, ou montées en lecture seule. Ceci peut être fait si nécessaire avec la directive RunBeforeJob.

Considérations sur les FileSets Windows

Si vous saisissez des noms de fichiers Windows, les chemins des répertoires devraient être précédés de double-points (comme dans "c:"). Cependant, les séparateurs de champs doivent être spécifiés selon la convention Unix (c'est à dire, la barre oblique avant : "/"). Si vous souhaitez inclure une apostrophe dans un nom de fichier, précédez-la d'une barre oblique arrière (\\). Par exemple, vous pourriez utiliser ce qui suit pour sauvegarder le répertoire "My Documents" d'une machine Windows :

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

Pour que les listes d'exclusion fonctionnent correctement sous Windows, vous devez observer les règles suivante :

Merci à Thiago Lima pour nous avoir résumé les points ci-dessus. Si vous rencontrez des difficultés pour faire fonctionner vos listes d'inclusion ou d'exclusion, songez à utiliser la commande estimate job=xxx listing documentée dans le chapitre Console chapter de ce manuel.

Sur les systèmes Win32, si vous déplacez un répertoire ou si vous renommez un fichier de la liste à sauvegarder, et si une Full a déjà eu lieu, Bacula ne saura reconnaître qu'il existe de nouveaux fichiers à sauvegarder lors d'une incrémentale ou d'une différentielle (faites-en le reproche à Microsoft, pas à moi !). Pour pallier à ce problème, veuillez copier tout répertoire ou fichier de la zone sauvegardée. Si vous ne disposez pas de suffisamment d'espace disque, déplacez-les, mais lancez alors une sauvegarde Full.

Exclusion de fichiers et répertoires

Vous pouvez aussi inclure des noms de fichiers ou chemins absolus, en plus de l'utilisation de caractères jokers et de la directive Exclude=yes dans les ressources Options comme exposé ci-dessus, en ajoutant simplement les fichiers à exclure dans une ressource Exclude du FileSet. Par exemple :

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
  }
}

Un exemple de FileSet Windows

Cet exemple est une contribution de Phil Stracchino :

This is my Windows 2000 fileset:
FileSet {
  Name = "Windows 2000 Full Set"
  Include {
    Options {
       signature=MD5
    }
    File = c:/
  }
  Exclude {
# Most of these files are excluded not because we don't want
#  them, but because Win2K won't allow them to be backed up
#  except via proprietary Win32 API calls.
    File = "/Documents and Settings/*/Application Data/*/Profiles/
           */*/Cache/*"
    File = "/Documents and Settings/*/Local Settings/Application Data/
           Microsoft/Windows/[Uu][Ss][Rr][Cc][Ll][Aa][Ss][Ss].*"
    File = "/Documents and Settings/*/[Nn][Tt][Uu][Ss][Ee][Rr].*"
    File = "/Documents and Settings/*/Cookies/*"
    File = "/Documents and Settings/*/Local Settings/History/*"
    File = "/Documents and Settings/*/Local Settings/
           Temporary Internet Files/*"
    File = "/Documents and Settings/*/Local Settings/Temp/*"
    File = "/WINNT/CSC"
    File = "/WINNT/security/logs/scepol.log"
    File = "/WINNT/system32/config/*"
    File = "/WINNT/msdownld.tmp/*"
    File = "/WINNT/Internet Logs/*"
    File = "/WINNT/$Nt*Uninstall*"
    File = "/WINNT/Temp/*"
    File = "/temp/*"
    File = "/tmp/*"
    File = "/pagefile.sys"
  }
}

Remarque : les trois lignes coupées de cette liste d'exclusion ne l'ont été que pour des motifs de mise en page, elles doivent en réalité être écrites sur une seule ligne.

L'ancienne ressource FileSet

L'ancienne Ressource FileSet des versions antérieures à 1.34.3 est obsolète, mais fonctionne encore. Nous vous encourageons à utiliser la nouvelle forme, car le code correspondant sera supprimé à partir de la version 1.37.

Tester vos FileSets

Si vous voulez vous faire une idée précise de ce qui sera effectivement sauvegardé par un FileSet, ou si vous voulez vous assurer de l'efficacité d'une liste d'exclusion, vous pouvez utiliser la commande estimate du programme Console. Voyez estimate command dans le chapitre Console de ce manuel.

Considerations sur le nommage Windows NTFS

Les noms de fichiers NTFS contenant des caractères Unicode (i.e. > 0xFF) ne peuvent, pour le moment, être nommé eplicitement. Vous devez inclure de tels fichiers en désignant un répertoire de niveau supérieur ou une lettre de disque ne contenant pas de caractère Unicode.


La ressource Client

La ressource Client définit les attributs des clients servis (sauvegardés) par ce Director. Il faut une ressource Client par machine sauvegardée.

Client (ou FileDaemon)
Début des directives Client.

Name = <name>
Le nom du client qui sera utilisé dans la directive Job de la ressource ou dans une commande run de la Console. Cette directive est requise.

Address = <address>
L'adresse d'un File Daemon Bacula est un nom d'hôte, un nom pleinement qualifié ou une adresse réseau au format quatre octets pointés. Cette directive est requise.

FD Port = <port-number>
Où le port est le numéro de port auquel le le File Daemon peut être contacté. La valeur par défaut est 9102.

Catalog = <Catalog-resource-name>
Cette directive spécifie le nom de la ressource catalog à utiliser pour ce client. Cette directive est requise.

Password = <password>
Il s'agit ici du mot de passe à utiliser lors de la connection avec le File Daemon, aussi le fichier de configuration de la machine à sauvegarder doit définir le même mot de passe pour être connecté par ce Director. Cette directive est requise. Si vous disposez de /dev/random ou de bc sur votre machine, Bacula génère des mots de passe aléatoires lors du processus de configuration. Dans le cas contraire, le mot de passe est laissé blanc.

File Retention = <time-period-specification>
La directive File Retention définit la période pendant laquelle Bacula conservera les enregistrements File dans le catalogue. Lors de l'expiration de cette période, si la directive AutoPrune est active (yes), Bacula élague le catalogue des enregistrements File dont l'āge est supérieur à la période de rétention. Notez que ceci n'affecte que les enregistrements du catalogue, et non vos sauvegardes archivées.

Les enregistrements File peuvent en fait être conservés pour une période inférieure à celle affectée à cette directive dans les cas où vous avez spécifié des périodes plus courtes pour les directives Job Retention ou Volume Retention. La plus courte des trois prend le pas sur les autres. Les durées peuvent être exprimées en secondes, minutes, heures, jours, semaines, mois, trimestres ou années. Consultez le chapitre Adapter les fichiers de configuration de ce manuel pour plus de détails sur les spécifications de durées.

La valeur par défaut est de 60 jours.

Job Retention = <time-period-specification>
La directive Job Retention définit la période pendant laquelle Bacula conservera les enregistrements Job dans le catalogue. Lors de l'expiration de cette période, si la directive AutoPrune est active (yes), Bacula élague le catalogue des enregistrements File dont l'āge est supérieur à la période de rétention. Notez que ceci n'affecte que les enregistrements du catalogue, et non vos sauvegardes archivées.

Si un enregistrement de Job est sélectionné pour élagage, tous les enregistrements File et JobMedia associés seront aussi élagués du catalogue, sans qu'il ne soit tenu compte de la période File Retention définie. Par conséquent, vous utiliserez, en principe, une période File Retention inférieure à la période Job retention. La période Job retention peut en fait s'avérer inférieure à la valeur que vous avez spécifiée si vous avez affecté une valeur inférieure à la directive Volume Retention dans la ressource Pool. Les périodes Job retention et Volume retention sont appliquées indépendamment, la plus petite prend le pas sur l'autre.

Les durées peuvent être exprimées en secondes, minutes, heures, jours, semaines, mois, trimestres ou années. Consultez le chapitre Adapter les fichiers de configuration de ce manuel pour plus de détails sur les spécifications de durées.

La valeur par défaut est 180 jours.

AutoPrune = <yes|no>
Si AutoPrune est réglé à yes (valeur par défaut), Bacula (dans les versions au delà de 1.20) applique automatiquement les périodes File retention et Job retention pour le client à la fin du job. Si vous spécifiez AutoPrune = no, l'élagage ne se fera pas et votre catalogue grossira à chaque job. L'élagage n'affecte que les données du catalogue, et non les données stockées sur les volumes.

Maximum Concurrent Jobs = <number>
<number> désigne le nombre maximum de jobs qui peuvent être lancés simultanément sur le client concerné. Notez que cette directive ne limite que les jobs pour les clients qui ont le même nom que la ressource dans laquelle elle apparaît. Toutes les autres restrictions du nombre maximum de jobs simultanés telles que celles spécifiées dans les ressources Director, Job, ou Storage s'appliquent aussi en plus de toute limite fixée ici. La valeur par défaut est 1, mais vous pouvez spécifier une valeur plus grande. Nous recommandons fortement de lire les MISES EN GARDE de la section Maximum Concurrent Jobs du chapitre Configurer le Director.

Priority = <number>
<number> spécifie la priorité de ce client par rapport aux autres clients que le Director sauvegarde simultanément. La priorité admet une valeur entre 1 et 1000. Les clients sont ordonnés de sorte que ceux dont la valeur de priorité sont les plus petites sont traités les premiers (Ceci n'est pas encore implémenté).

Voici un exemple d'une définition de ressource Client valide :

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


La ressource Storage

La ressource Storage définit les Storage Daemons disponibles pour le Director.

Storage
Début des ressources Storage. Il faut en spécifier au moins une.

Name = <name>
Le nom de la ressource Storage. Ce nom apparaît au niveau de la directive Storage spécifiée dans la ressource Job et est requise.

Address = <address>
Où l'adresse est un nom d'hôte, une adresse pleinement qualifiée, ou une adresse IP. Notez bien que l'adresse spécifiée ici sera transmise au File Daemon qui l'utilisera alors pour contacter le Storage Daemon. Aussi, ce n'est pas une bonne idée d'utiliser localhost en tant que nom, il vaut mieux utiliser un nom de machine pleinement qualifié, ou une adresse IP. Cette directive est requise.

SD Port = <port>
Où "port" est le port à utiliser pour contacter le Storage Daemon pour les informations et pour exécuter les jobs. Ce même numéro de port doit apparaître dans la ressource Storage du fichier de configuration du Storage Daemon. Le port par défaut est 9103.

Password = <password>
Il s'agit du mot de passe à utiliser lors de l'établissement de la connection avec les services Storage. Ce même mot de passe doit aussi apparaître dans la ressource Director du fichier de configuration du Storage Daemon. Cette directive est requise. Si vous avez soit /dev/random, soit bc sur votre machine, Bacula génèrera un mot de passe aléatoire lors du processus de configuration. Dans le cas contraire, ce champ sera laissé blanc.

Device = <device-name>
Cette directive spécifie le nom (pour le Storage Daemon) du périphérique à utiliser pour le stockage. Ce nom n'est pas le nom de périphérique physique, mais le nom de périphérique logique qui a été défini par la directive Name de la ressource Device du fichier de configuration du Storage Daemon. Si le périphérique est une librairie, vous devez utiliser le nom défini au niveau de la directive Name défini dans la définition de la ressource Autochanger du Storage Daemon. Vous pouvez utiliser le nom de votre choix (y compris le nom de périphérique physique) à concurrence de 127 caractères. Le nom de périphérique physique associé à ce périphérique est spécifié dans le fichier de configuration du Storage Daemon (en tant qu'Archive Device). Prenez garde à ne pas définir deux directives Storage Resource dans le Director qui pointent vers le même périphérique du Storage Daemon. Il pourrait en résulter un blocage du Storage Daemon si celui-ci tente d'utiliser le même périphérique deux fois. Cette directive est requise.

Media Type = <MediaType>
Cette directive spécifie le type de média à utiliser pour stocker les données. Il s'agit d'une chaîne de caractères arbitraire n'excédant pas 127 caractères. Ce peut être ce que vous voulez, cependant, il est préférable de la choisir de manière à décrire le médium de stockage utilisé (par exemple : Fichier, DAT, ''HP DLT8000``, 8mm,...). D'autre part, il est esentiel d'avoir une spécification Media Type unique pour chaque type de média de stockage. Si vous avez deux lecteurs DDS-4 avec des formats incompatibles et une librairie DDS-4, vous devriez certainement spécifier des Media Types distincts. Lors d'une restauration, supposons qu'un Media Type DDS-4 est associé avec le le job, Bacula peut décider d'utiliser tout Storage Daemon qui supporte le Media Type DDS-4 sur tout lecteur qui le supporte.

Actuellement, Bacula n'autorise qu'un seul type de media. Par conséquent, si vous disposez d'un lecteur qui en supporte plusieurs, vous pouvez utiliser une chaîne unique pour désigner les volumes de l'un ou l'autre type, par exemple Media Type = DDS-3-4 pour les types DDS-3 et DDS-4, mais ces volumes ne seront montés que sur les lecteurs spécifiés comme acceptant les deux types : DDS-3-4

Si vous voulez contraindre Bacula à utiliser un seul Storage Daemon ou un seul lecteur, vous devez spécifier un Media Type unique pour ce lecteur. C'est un point important qui devrait être bien compris. Notez que ceci s'applique également aux volumes disque. Si vous définissez plus d'une ressource Device disque dans votre fichier de configuration du Storage Daemon, les volumes sur ces deux devices seront en fait incompatibles car l'un ne pourra être monté sur l'autre puisqu'ils se trouvent dans des répertoires différents. C'est pourquoi vous devriez probablement plutôt utiliser deux Media Types distincts pour vos deux devices disque (même si vous pensez à eux comme ayant l'un et l'autre le type File).

Vous trouverez pus de détails à ce sujet dans le chapitre Gestion des volumes : fondements (NDT:basic volumes management) de ce manuel.

Le MediaType spécifié ici doit correspondre au MediaType spécifié dans la ressource Device du fichier de configuration du Storage Daemon. Cette directive est requise, et est utilisée par le Director et le Storage Daemon pour s'assurer qu'un volume sélectionné automatiquement dans un Pool correspond à un périphérique physique. Si un Storage Daemon gère plusieurs périphériques (par exemple, s'il écrit sur plusieurs volumes de type File sur différentes partitions), cette directive vous permet de préciser exactement quel périphérique utiliser.

Comme mentionné ci-dessus, la valeur spécifiée dans la ressource Storage du Director doit s'accorder avec celle spécifiée dans la ressource Device du fichier de configuration du Storage Daemon. Ceci représente aussi un contrôle supplémentaire pour assurer que vous n'essayez pas d'écrire les données destinées à un lecteur DLT sur un lecteur 8mm.

Autochanger = <yes|no>
Si vous spécifiez yes pour cette commande (la valeur par défaut est no), alors Bacula requérira un numéro de Slot lorsque vous utiliserez les commandes label et add pour créer un nouveau volume. Ceci simplifie la création des enregistrements de Volumes dans le catalogue si vous disposez d'une librairie. Si vous omettez de spécifier le Slot, la robotique ne sera pas utilisée. Cependant, vous pouvez modifier le Slot associé à un volume à tout moment grāce à la commande update volume du programme Console. Lorqu'autochanger est activée, l'algorithme utilisé par Bacula pour rechercher des volumes utilisables est modifié de faon à prendre en compte tout volume supposé contenu dans la librairie. Si aucun volume in changer n'est trouvé, Bacula tente de recycler, élaguer..., et s'il ne trouve toujours aucun volume, Bacula recherche un volume présent ou non dans la librairie. Privilégier les volumes présents dans la librairie permet de minimiser les interventions d'un opérateur.

Pour que la robotique soit utilisée, vous devez aussi spécifier Autochanger = yes dans la ressource La Ressource Device du fichier de configuration du Storage Daemon, ainsi que d'autres paramètres importants du Storage Daemon. Vous trouverez plus d'information à ce sujet dans le chapitre Utiliser une librairie de ce manuel.

Maximum Concurrent Jobs = <number>
Où <number> est le nombre maximum de jobs utilisant la ressource Storage courante qui peuvent être exécutés simultanément. Notez que cette directive ne limite que les jobs qui utilisent ce Storage Daemon. Toute autre limitation du nombre maximum de jobs simultanés au niveau des ressources Director, Job ou Client est aussi appliquée en plus de celle fixée ici. La valeur par défaut est 1, mais vous pouvez utiliser une valeur plus importante. Nous vous recommandons fortement de lire les MISES EN GARDE de la section Maximum Concurrent Jobs du chapitre Configurer le Director.

Alors qu'il est possible de définir des nombres maximum de jobs simultanés supérieurs à 1 dans les ressource Director, Job et Client, vous devriez porter une attention particulière au paramétrage de cette directive pour le Storage Daemon. En conservant la valeur 1, vous évitez que deux jobs écrivent simultanément sur le même volume ce qui, quoique supporté, n'est pas recommandé actuellement.

Voici un exemple de ressource Storage valide :

# 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
}


La ressource Pool

La ressource Pool définit l'ensemble des volumes de stockage (cartouches ou fichiers) à la disposition de Bacula pour écrire les données. En configurant différents Pools, vous pouvez déterminer quel ensemble de volumes (ou média) reoit les données sauvegardées. Ceci permet, par exemple, de stocker toutes les sauvegardes Full sur un ensemble de volumes, et les sauvegardes différentielles et incrémentales sur un autre. De même, vous pouvez assigner un ensemble de volumes à chaque machine sauvegardée. Tout ceci peut être réalisé aisément en définissant plusieurs pools.

Un autre aspect important d'un pool est qu'il contient des attributs par défaut (Nombre maximum de jobs, période de rétention, drapeau de recyclage,...) qui sont conférés à tout volume lui appartenant lors de sa création. Ceci vous évite d'avoir à répondre à un grand nombre de questions lorsque vous étiquettez (label) un nouveau volume. Chacun de ces attributs peut ensuite être modifié sur chaque volume individuellement avec la commande update du programme Console. Notez que vous devez préciser explicitement quel pool est à utiliser avec chaque job. Bacula ne recherche pas automatiquement le pool correct.

Dans la plupart des installations de Bacula, toutes les sauvegardes de toutes les machines vont vers un unique jeu de volumes. Dans ce cas, vous n'utiliserez probablement que le pool par défaut Default. Si votre stratégie de sauvegarde vous impose à monter chaque jour une cartouche différente, vous voudrez probablement définir des pools distincts pour chaque jour. Pour plus d'informations à ce sujet, consultez le chapitre Stratégies de sauvegarde de ce manuel.

Pour utiliser un pool, vous devez suivre trois étapes :

D'abord, le pool doit être défini dans le fichier de configuration du Director. Ensuite le pool doit être enregistré dans le catalogue. Ceci est fait automatiquement par le Director à chaque fois qu'il démarre, ou peut être réalisé manuellement à l'aide de la commande create du programme Console. Enfin, si vous modifiez la définition du pool dans le fichier de configuration du Director et redémarrez Bacula, le pool sera mis à jour automatiquement, ce qui peut aussi être réalisé manuellement avec la commande update pool du programme Console pour rafraichir l'image du catalogue. C'est cette image du catalogue plutôt que l'image de la ressource du Director qui est utilisée pour les attributs de volume par défaut. Notez que pour que le pool soit automatiquement créé ou mis à jour, il doit être référencé explicitement par une ressource Job.

Ensuite le médium physique doit être étiquetté. L'étiquettage peut être réalisé soit par la commande label du programme Console, soit en utilisant le programme btape. La méthode à privilégier est la première.

Finallement, vous devez ajouter des noms de volumes (et leurs attributs) au pool. Pour que les volumes soient utilisés par Bacula, ils doivent être du même Media Type que l'Archive Device spécifiée pour le job. (Autrement dit, si vous vous apprétez à sauvegarder vers un lecteur DLT, le pool doit contenir des volumes DLT, puisque des volumes 8mm ne peuvent être montés sur un lecteur DLT). Le Media Type revêt une importance particulière si vous sauvegardez vers des fichiers. Lorsque vous exécutez un job, vous devez explicitement préciser le pool. Bacula sélectionne dès lors automatiquement le prochain volume du pool à utiliser, en s'assurant que le Media Type de tout volume sélectionné est bien celui requis par la ressource Storage spécifiée pour le job.

Si vous utilisez la commande label du programme Console pour étiquetter les volumes, il sont automatiquement ajoutés au pool, aussi cette dernière étape n'est généralement pas requise.

Il est aussi possible d'ajouter des volumes au catalogue sans avoir explicitement étiquetté les volumes physiques. Ceci s'effectue avec la commande add du programme Console.

Comme mentionné plus haut, à chaque démarrage, Bacula examine tous les pools associés à chaque catalogue, et si un enregistrement n'existe pas encore, il est créé à partir de la définition du pool dans la ressource. Bacula devrait probablement effectuer un update pool si vous modifiez la définition du pool mais, actuellement, vous devez le faire manuellement avec la commande update pool du programme Console.

La ressource Pool définie dans le fichier de configuration du Director peut contenir les directives suivantes :

Pool
Début de la ressource Pool. Il faut définir au moins une ressource Pool.

Name = <name>
Le nom du pool. Pour la plupart des applications, vous utiliserez le pool par défaut nommé Default. Cette directive est requise.

Number of Volumes = <number>
Cette directive spécifie le nombre de volumes (cartouches ou fichiers) contenus dans le pool. En principe, il est défini et mis à jour automatiquement par la routine de maintenance du catalogue de Bacula.

Maximum Volumes = <number>
Cette directive spécifie le nombre maximum de volumes contenus dans le pool. Cette directive est optionnelle. Si elle est omise ou réglée à 0, tout nombre de volumes est permis. En général, cette directive est utile pour les librairies, où il y a un nombre fixé de volumes, ou pour le stockage sur fichier si vous voulez vous assurer que les sauvegardes sur disque ne deviennent pas trop nombreuses ou ne consomment pas trop d'espace.

Pool Type = <type>
Cette directive définit le type du pool, qui correspond au type du job exécuté. Cette directive est requise et peut prendre l'une des valeurs suivantes :

Backup
*Archive
*Cloned
*Migration
*Copy
*Save

Use Volume Once = <yes|no>
Cette directive, si elle est active (valeur yes) stipule que chaque volume ne doit être utilisé qu'une seule fois. C'est particulièrement utile si le volume est un fichier et si vous voulez un nouveau fichier pour chaque nouvelle sauvegarde. La valeur par défaut est no (autrement dit, les volumes peuvent être utilisés plusieurs fois). Cette directive sera très certainement bientôt obsolète, aussi nous vous recommandons d'utiliser Maximum Volume Jobs = 1 à la place.

La valeur définie par cette directive dans le fichier de configuration du Director est la valeur par défaut utilisée lorsqu'un nouveau volume est créé. Modifier la valeur dans le fichier de configuration ne changera pas ce qui est stocké sur le volume. Pour changer cette valeur pour un volume existant, vous devez utiliser la commande update du programme Console.

Maximum Volume Jobs = <positive-integer>
Cette directive spécifie le nombre maximum de jobs qui peuvent être écrits sur le volume. La valeur par défaut est zéro, ce qui signifie que le nombre de jobs sur un volume n'est pas limité. Sinon, lorsque le nombre de jobs sauvegardés sur le volume atteint la valeur positive-integer spécifiée, le volume est marqué Used. Dès lors, il ne peut plus être utilisé pour y ajouter des jobs, tout comme dans le cas d'un volume avec le statut Full, mais il peut être recyclé si le recyclage est activé. En spécifiant MaximumVolumeJobs = 1 vous obtenez le même effet que celui que vous obtiendriez avec UseVolumeOnce = yes.

Notez que la valeur définie par cette directive dans le fichier de configuration du Director est la valeur par défaut utilisée lors de la création d'un volume. Une fois le volumes créé, modifier la valeur dans le fichier de configuration ne changera pas ce qui est stocké sur le volume. Pour changer cette valeur pour un volume existant, vous devez utiliser la commande update du programme Console.

Maximum Volume Files = <positive-integer>
Cette directive spécifie le nombre maximum de fichiers qui peuvent être écrits sur le volume. La valeur par défaut est zéro, ce qui signifie que le nombre de fichiers sur un volume n'est pas limité. Sinon, lorsque le nombre de fichiers sauvegardés sur le volume atteint la valeur positive-integer spécifiée, le volume est marqué Used. Dès lors, il ne peut plus être utilisé pour y ajouter des jobs, tout comme dans le cas d'un volume avec le statut Full, mais il peut être recyclé si le recyclage est activé. Ce n'est qu'à la fin d'un job que Cette valeur est controlée, et que le statut du volume est éventuellement changé en Used.

La valeur définie par cette directive dans le fichier de configuration du Director est la valeur par défaut utilisée lors de la création d'un volume. Une fois le volumes créé, modifier la valeur dans le fichier de configuration ne changera pas ce qui est stocké sur le volume. Pour changer cette valeur pour un volume existant, vous devez utiliser la commande update du programme Console.

Maximum Volume Bytes = <size>
Cette directive spécifie le nombre maximum d'octets qui peuvent être écrits sur le volume. La valeur par défaut est zéro, ce qui signifie qu'il n'y a d'autre limite que la capacité physique du volume. Sinon, lorsque le nombre d'octets sauvegardés sur le volume atteint la valeur size spécifiée, le volume est marqué Used. Dès lors, il ne peut plus être utilisé pour y ajouter des jobs, tout comme dans le cas d'un volume avec le statut Full, mais il peut être recyclé si le recyclage est activé. Ce n'est qu'à la fin d'un job que Cette valeur est controlée, et que le statut du volume est éventuellement changé en Used.

La valeur définie par cette directive dans le fichier de configuration du Director est la valeur par défaut utilisée lors de la création d'un volume. Une fois le volumes créé, modifier la valeur dans le fichier de configuration ne changera pas ce qui est stocké sur le volume. Pour changer cette valeur pour un volume existant, vous devez utiliser la commande update du programme Console.

Volume Use Duration = <time-period-specification>
Cette directive définit la période durant laquelle le volume peut être utilisé en écriture, à compter de la première opération d'écriture de données. La valeur par défaut est zéro, ce qui signifie que le volume peut être écrit indéfiniment . Sinon, lorsque la durée depuis la première écriture excède la période time-period-specification spécifiée, le volume est marqué Used. Dès lors, il ne peut plus être utilisé pour y ajouter des jobs, tout comme dans le cas d'un volume avec le statut Full, mais il peut être recyclé si le recyclage est activé. L'usage de la commande status dir applique des algorithmes similaires à l'éxecution de jobs, aussi lors d'une telle commande, le statut du volume peut être modifié. Lorsque le volume est recyclé, il peut à nouveau être utilisé.

Vous pourriez utiliser cette directive, par exemple, si vous avez un volume dédié aux sauvegardes incrémentales, et un volume dédié aux Fulls hebdomadaires. Une fois que la Full est passée, vous pouvez préférer utiliser un autre volume pour les incrémentales. Ceci peut être accompli en règlant la période Volume Use Duration à six jours pour les volumes des incrémentales. Autrement dit, celui-ci sera utilisé durant les six jours qui suivent une full, puis un autre volume d'incrémentales sera utilisé. Veillez à utiliser des périodes relativement courtes telles que 23 heures, ou vous pourriez placer Bacula en situation de devoir attendre tout un week-end le montage d'une cartouche par l'opérateur pour pouvoir terminer une sauvegarde.

Ce n'est qu'à la fin d'un job que Cette valeur est controlée, et que le statut du volume est éventuellement changé en Used, ce qui signifie que bien que la période Volume Use Duration puisse avoir expiré, l'entrée correspondante du catalogue ne sera pas mise à jour jusqu'à ce que le prochain job utilisant ce volume soit exécuté.

La valeur définie par cette directive dans le fichier de configuration du Director est la valeur par défaut utilisée lors de la création d'un volume. Une fois le volumes créé, modifier la valeur dans le fichier de configuration ne changera pas ce qui est stocké sur le volume. Pour changer cette valeur pour un volume existant, vous devez utiliser la commande update volume du programme Console.

Catalog Files = <yes|no>
Cette directive précise si les noms des fichiers sauvegardés doivent ou non être enregistrés dans le catalogue. La valeur par défaut est yes. L'avantage de désactiver cette option (Catalog Files = No) est d'avoir un catalogue significativement plus petit. L'inconvénient est de ne pas pouvoir produire de liste des fichiers sauvegardés pour chaque job à partir du catalogue (autrement dit, vous ne pourrez naviguer dans les fichiers sauvegardés). Ainsi, sans les enregistrements de fichiers, vous ne pourrez utiliser la commande restore, ni aucune des autres commandes du programme Console qui se réfèrent aux enregistrements de fichiers.

AutoPrune = <yes|no>
Si AutoPrune est activée (yes), ce qui est le cas par défaut, Bacula (depuis la version 1.20) applique automatiquement la période de rétention des volumes lorsqu'un nouveau volumes est requis ou lorsqu'il n'existe aucun volume utilisable dans le pool. L'élagage des volumes consiste à supprimer du catalogue les jobs expirés (ceux qui sont plus anciens que la période de rétention), et rend possible le recyclage de ces volumes

Volume Retention = <time-period-specification>
La directive Volume Retention définit la période durant laquelle Bacula conserve les enregistrements Job associés au volume dans le catalogue. Lors de l'expiration de cette période, si AutoPrune est activée, Bacula peut supprimer les enregistrements Job plus anciens que la période time-period-specification spécifiée s'il est nécessaire de libérer un volume. Tous les enregistrements de fichiers associés à des jobs supprimés sont aussi supprimés. Les durées peuvent être exprimées en secondes, minutes, heures, jours, semaines, mois, trimestres ou années. La période Volume Retention s'applique indépendamment des périodes Job Retention et File Retention définies dans la ressource Client. Ceci signifie que la période la plus courte est celle qui s'applique.Notez bien que lorsque la période Volume Retention a été atteinte les enregistrements de Job et ceux de fichiers sont supprimmés les uns et les autres. Cet élagage peut aussi se produire à l'exécution de la commande status dir car elle applique des algorithmes similaires à ceux utilisés pour déterminer le prochain volume disponible.

Il est important de savoir que lorsque la période Volume Retention expire, Bacula ne recycle pas systématiquement le volume concerné. Il tente de conserver les données intactes aussi longtemps que possible avant d'écrire sur ce volume.

La valeur par défaut est 365 jours. Notez que cette directive règle la valeur par défaut pour chaque enregistrement de volume du catalogue lorsque le volume est créé. Cette valeur du catalogue peut ensuite être modifiée avec la commande update du programme Console.

En définissant plusieurs pools avec différentes périodes de rétention (volume retention), vous pouvez efficacement gérer vos cartouches avec, par exemple un pool de cartouches recyclé chaque semaine, un autre recyclé chaque mois, et ainsi de suite. Cependant, il faut bien garder à l'esprit que si votre période de rétention Volume Retention est trop courte, il peut arriver que votre dernière sauvegarde Full valide soit supprimée, de sorte que vous n'ayez plus une sauvegarde complète de votre système, et que votre prochaine incrémentale soit élevée en une Full. Par conséquent, la valeur minimum de la période Volume Retention devrait être au moins le double de l'intervalle séparant vos Fulls. Autrement dit, pour des Fulls mensuelles, la période Volume Retention devrait être supérieure ou égale à deux mois.

Notez que la valeur définie par cette directive dans le fichier de configuration du Director est la valeur par défaut utilisée lors de la création d'un volume. Une fois le volumes créé, modifier la valeur dans le fichier de configuration ne changera pas ce qui est stocké sur le volume. Pour changer cette valeur pour un volume existant, vous devez utiliser la commande update du programme Console.

Recycle = <yes|no>
Cette directive spécifie la valeur par défaut pour le recyclage des volumes purgés. Si elle est activée (yes) et si Bacula a besoin d'un volume mais n'en trouve aucun utilisable, il recherche alors les volumes purgés (c'est à dire ceux dont tous les jobs et fichiers ont expiré et ont, de fait, été supprimés du catalogue). Si un volume est recyclé, toutes les données précedemment écrites sur ce volumes seront écrasées. Si le recyclage est désactivé (no), le volume ne sera pas recyclé, et ainsi les données resteront valides. Si vous souhaitez réutiliser un volume dont le drapeau de recyclage est no (0 dans le catalogue), vous devez manuellement le changer en yes (commande update).

Notez que la valeur définie par cette directive dans le fichier de configuration du Director est la valeur par défaut utilisée lors de la création d'un volume. Une fois le volumes créé, modifier la valeur dans le fichier de configuration ne changera pas ce qui est stocké sur le volume. Pour changer cette valeur pour un volume existant, vous devez utiliser la commande update du programme Console.

Recycle Oldest Volume = <yes|no>
Cette directive indique au Director de rechercher le volume le plus ancien du pool lorsq'un nouveau est requis par le Storage Daemon et qu'aucun autre n'est disponible. Le catalog est alors élagué dans le respect des périodes Job, File et Volume Retention, c'est pourquoi cette directive est, de très loin, préférable à directive Purge Oldest Volume.

Cette directive peut être utile si vous avez un nombre fixe de volumes dans un pool et que vous voulez cycler sur ces volumes après avoir spécifié les périodes de rétention qui conviennent.

Recycle Current Volume = <yes|no>
Si Bacula a besoin d'un nouveau volume, cette directive lui indique d'élaguer le volume dans le respect des périodes Job, File et Volume Retention. Si tous les jobs sont élagués, (c'est à dire si le volume est purgé), alors le volume est recyclé et sera utilisé pour la prochaine opération d'écriture. Cette directive respecte toutes les périodes Job, File et Volume Retention, c'est pourquoi elle est , de très loin, préférable à la directive Purge Oldest Volume.

Cette directive peut être utile si vous avez un nombre fixe de volumes dans un pool et que vous voulez cycler sur ces volumes après avoir spécifié les périodes de rétention qui élaguent les volumes avant que vous n'ayez terminé le cycle sur les volumes.

Purge Oldest Volume = <yes|no>
Cette directive indique au Director de rechercher le volume utilisé le plus ancien dans le pool lorsqu'un nouveau volume est requis par le Storage Daemon et qu'aucun n'est disponible. Le catalogue est alors purgé sans égards pour les périodes de rétention des fichiers et jobs écrits sur ce volume. Le volume est alors recyclé pour être utilisé pour la prochaine opération d'écriture. Cette directive outrepasse toute période de rétention (Job, File, ou Volume) que vous avez pu spécifier par ailleurs.

Cette directive peut être utile si vous avez un nombre fixe de volumes dans un pool et que vous voulez cycler sur ces volumes lorsque tous les volumes sont pleins, sans avoir à vous soucier de paramétrer les périodes de rétentions qui conviendraient. Cependant, en l'utilisant, vous courrez le risque de perdre toutes vos données.

Soyez conscient que Purge Oldest Volume ne fait aucun cas d'aucune période de rétention. Si vous activez cette directive alors que vous ne possédez qu'un seul volume, ce volume sera systématiquement écrasé tout de suite après avoir été rempli ! Aussi, assurez vous au moins d'avoir un nombre décent de volumes dans votre pool avant d'exécuter un job. Si vous voulez que les périodes de rétention soient prises en compte, n'utilisez pas cette directive. Pour spécifier une période de rétention, utilisez la directive Volume Retention (voir ci dessus).

Je recommande fortement de ne pas utiliser cette directive, car il est certain que tôt ou tard, Bacula recyclera un volume contenant des données valides et récentes. La valeur par défaut est no

Cleaning Prefix = <string>
Cette directive définit un préfixe qui, s'il correspond au début du nom d'un volume lors de son étiquettage, indique à Bacula que le volume en question est une cartouche de nettoyage, qui aura le statut VolStatus = Cleaning. Ainsi Bacula ne tentera jamais d'utiliser cette cartouche. Cette option est particulièrement utile avec les librairies équipées de lecteurs de codes barres où, conventionnellement, les codes barres commenant par CLN sont traités en tant que cartouches de nettoyage.

Label Format = <format>
Cette directive précise le format des étiquettes des volumes de ce pool. La directive Format est utilisée comme un patron pour créer de nouveaux noms de volumes lors de l'étiquettage automatique.

Le format devrait être spécifié entre guillemets, et consiste en une chaîne de lettres, chiffres et caractères spéciaux tiret (-), souligné (_), double point (:) et point (.), qui sont considérés valides pour un nom de volume.

De plus, le format peut comporter des caractères variables qui seront substituées par un algorithme complexe, ce qui permet de créer des noms de volumes avec plusieurs formats différents. En tous les cas, le processus d'expansion des variables doit aboutir au jeu de caractères définis comme légaux dans le dernier paragraphe. Généralement, ces caractères variables commencent par un signe dollar ($) ou un crochet droit ([). Si vous spécifiez des caractères variables vous devriez toujours les encadrer de guillemets. Pour plus de détails sur ce sujet, veuillez consulter le chapitre Variable Expansion de ce manuel.

Si aucun caractère variable n'est découvert dans la chaîne, le nom de volume sera constitué de la chaîne format suffixée du nombre de volumes dans le pool plus un, au format 4 chiffres et avec des zéros en tête. Par exemple, avec Label Format = ''File-``, les volumes seront nommés File-0001, File-0002, ...

Exception faite des variables spécifiques aux jobs, vous pouvez tester votre LabelFormat en utilisant la section var command du chapitre Console de ce manuel.

Dans la plupart des cas, vous devriez encadrer la spécification de format (la partie à droite du signe égale) entre guillemets. Notez que cette directive est obsolète et qu'elle est remplacée, à partir de la version 1.37 par un script Python pour la création des noms de volumes.

Pour qu'un pool puisse être utilisé lors d'une sauvegarde, il faut qu'il lui soit associé au moins un volume. Les volumes sont créés et affectés aux pools avec les commandes label ou add du programme Bacula Console. Outre l'affectation du volume au pool (c'est à dire son référencement dans le catalogue), le volume physique doit recevoir une étiquette logicielle valide pour que Bacula l'accepte. Ceci peut être réalisé automatiquement grāce à la commande label. D'autre part, Bacula peut effectuer cette opération automatiquement si l'instruction lui en est donné, mais cette fonctionnalité n'est pas encore pleinement implémentée.

Voici un exemple d'une définition de ressource Pool valide :

 
Pool {
  Name = Default
  Pool Type = Backup
}

Le Scratch Pool

En général, vous pouvez nommer vos pool à votre guise, il existe cependant une importante restriction : le pool nommé Scratch, s'il existe, se comporte comme une réserve de volumes où Bacula pourra puiser s'il ne trouve aucun volume utilisable dans le pool normalement utilisé par le job. Le volume est alors déplacé du pool Scratch vers le pool en défaut.


La ressource Catalog

La ressource Catalog précise quel catalogue utiliser pour le job courant. Actuellement, Bacula ne peut utiliser qu'un type de serveur de bases de données défini lors de sa configuration : SQLite, MySQL, PostgreSQL. En revanche, vous pouvez utiliser autant de catalogues que vous le souhaitez. Par exemple, vous pouvez avoir un catalogue par client, ou encore un catalogue pour les sauvegardes, un autre pour les jobs de type Verify et un troisième pour les restaurations.

Catalog
Début de la ressource Catalog. Il faut au moins une ressource Catalogue.

Name = <name>
Le nom du Catalog. Il n'a pas besoin d'être en relation avec le nom sur le serveur de base de données. Ce nom sera repris dans la ressource Client, indiquant ainsi que toutes les données relatives à ce client sont maintenues dans ce catalogue. Cette directive est requise.*

password = <password>
Cette directive spécifie le mot de passe à utiliser pour se connecter au catalogue. Cette directive est requise.

DB Name = <name>
Cette directive spécifie le nom de la base de données. Si vous utilisez plusieurs catalogues, vous spécifiez lequel ici. Si vous utilisez un serveur de bases de données externe plutôt que l'intégré, vous devez spécifier un nom connu du serveur (autrement dit, le nom que vous avez utilisé lorsque vous avez créé les tables Bacula.). Cette directive est requise.

user = <user>
L'utilisateur habilité à se connecter au catalogue. Cette directive est requise.

DB Socket = <socket-name>
Il s'agit du nom d'un socket à utiliser sur la machine locale pour se connecter au catalogue. Cette directive n'est utilisée que par MySQL, elle est ignorée par SQLite. Normalement, si ni DB Socket, ni DB Address ne sont spécifiées, MySQL utilise le socket par défaut.

DB Address = <address>
Il s'agit de l'adresse du serveur de bases de données. En principe, vous utiliserez cette directive plutôt que DB Socket si le serveur de bases de données est une autre machine. Dans ce cas, vous spécifierez aussi le port DB Port. Cette directive n'est utilisée que par MySQL, et ignorée par SQLite. Elle est optionnelle.

DB Port = <port>
Cette directive définit le port à utiliser en conjonction avec DB Address pour accéder au catalogue s'il est hébergé sur une autre machine. Elle n'est utilisée que par MySQL, et ignorée par SQLite. Elle est optionnelle.

Voici un exemple d'une définition de ressource Catalog valide :

Catalog
{
  Name = SQLite
  dbname = bacula;
  user = bacula;
  password = ""                       # no password = no security
}

en voici une deuxième pour un catalogue sur une autre machine :

Catalog
{
  Name = MySQL
  dbname = bacula
  user = bacula
  password = ""
  DB Address = remote.acme.com
  DB Port = 1234
}

La ressource Messages

Pour les détails sur la ressource Messages, veuillez consulter le chapitre La ressource Messages de ce manuel.


La ressource Console

A partir de la version 1.33 de Bacula, l'administrateur dispose de trois sortes de consoles différentes pour interagir avec le Director. Ces trois types de consoles comportent trois niveaux de sécurité différents.

La ressource Console est optionnelle. Les directives suivantes sont permises dans le fichier de configuration du Director.

Name = <name>
Le nom de la console. Ce nom doit être en conjonction avec celui spécifié dans le fichier de configuration de la Console (comme c'est le cas pour les définitions de clients).

Password = <password>
Spécifie le mot de passe qu'une console nommée doit fournir pour être autorisée. Le même mot de passe doit apparaître dans la ressource Console du fichier de configuration de la Console. Pour plus de sécurité, le mot de passe n'est jamais réellement transmis à travers le réseau, mais plutôt un code de hachage de type challenge response créé à partir du mot de passe. Cette directive est requise. Si vous disposez de /dev/random ou bc sur votre machine, Bacula génèrera aléatoirement ce mot de passe lors du processus de configuration, autrement, il sera laissé blanc.

JobACL = <name-list>
Cette directive est utilisée pour spécifier une liste de noms de ressources Job qui peuvent être accédés par la console. Sans cette directive, la console ne peut accéder à aucune des ressources Job définies dans le fichier de configuration du Director. Plusieurs ressources Job peuvent être spécifiées en les séparant par des virgules, et/ou en spécifiant plusieurs directives JobACL. Par exemple, la directive peut être spécifiée ainsi :

    JobACL = kernsave, "Backup client 1", "Backup client 2"
    JobACL = "RestoreFiles"

Avec cette spécificaton, la console peut accéder aux ressources du Director pour les quatre jobs désignés par la directive JobACL, et uniquement à eux.

ClientACL = <name-list>
Cette directive est utilisée pour spécifier une liste de noms de ressources Client iaccessibles par la console.

StorageACL = <name-list>
Cette directive est utilisée pour spécifier une liste de noms de ressources Storage accessibles par la console.

ScheduleACL = <name-list>
Cette directive est utilisée pour spécifier une liste de noms de ressources Schedule accessibles par la console.

PoolACL = <name-list>
Cette directive est utilisée pour spécifier une liste de noms de ressources Pool accesibles ar la console.

FileSetACL = <name-list>
Cette directive est utilisée pour spécifier une liste de noms de ressources FileSet accessibles par la console.

CatalogACL = <name-list>
Cette directive est utilisée pour spécifier une liste de noms de ressources Catalog accessibles par la console.

CommandACL = <name-list>
Cette directive est utilisée pour spécifier une liste de commandes de la console qui peuvent être exécutées par la console.

En plus des différents noms de ressources du Director et de commandes, le mot-clef spécial *all* peut être spécifié dans chacune des directives ACL ci-dessus. Sa présence signifie que toute ressource ou commande (pourvu qu'elle soit appropriée à la directive) est acceptée. Pour un exemple de fichier de configuration, voyez le chapitre Configuration de la console de ce manuel


La ressource Counter

La ressource Counter définit une variable-compteur qui peut être accédée par le processus d'expansion de variables utilisé pour la création de d'étiquettes (labels) de volumes avec la directive LabelFormat. Consultez le paragraphe sur la directive LabelFormat de ce chapitre pour plus de détails.

Counter
Début de la ressource Counter. les directives Counter sont optionnelles.

Name = <name>
iLe nom de la variable-compteur. Il s'agit du nom que vous utiliserez pour vous référer à cette variable et accéder à sa valeur.

Minimum = <integer>
Spécifie la valeur minimale de la variable-compteur. Cette valeur devient celle par défaut. Si elle n'est pas fournie, sa valeur est zéro.

Maximum = <integer>
Spécifie la valeur maximale de la variable-compteur. Si elle n'est pas fournie, ou si elles est réglée à zéro, la variable compteur peut prendre une valeur maximale de 2 147 483 648 ($2^{31}$). Au delà de cette valeur, le compteur est remis au minimum.

*WrapCounter = <counter-name>
Si cette valeur est spécifiée, lorsque la variable-compteur dépasse le maximum et est remise au minimum, le compteur spécifié par la directive WrapCounter est incrémenté. (Ceci n'est, pour le moment, pas implémenté.)

Catalog = <catalog-name>
Si cette directive est spécifiée, le compteur et sa valeur sont sauvegardés dans le catalogue spécifié. Dans le cas contraire, le compteur est redéfini à chaque démarrage de Bacula.


Voici un exemple complet de fichier de configuration du Director.

Un exemple de fichier de configuration du Director pourrait être le suivant :

#
# 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
}


Configuration du Client/File Daemon

General

La configuration du Client (ou File Daemon) est l'une des plus simples à effectuer. En principe, vous n'aurez rien à modifier au fichier par défaut en dehors du nom du Client afin d'identifier clairement les messages d'erreur.

Pour un discours général sur les fichiers de configuration et ressources incluant les types de données reconnues par Bacula, veuillez consulter le chapitre Configuration de ce manuel. Les ressources suivantes doivent être définies :


La ressource Client

La ressource Client (ou File Daemon) définit le nom du Client (en tant que client du Director), ainsi que le port sur lequel le Client écoute les connections du Director.

Client (ou FileDaemon)
Début des enregistrements du client. Il ne doit y avoir qu'une seule ressource Client dans le fichier de configuration puisqu'il définit les propriétés du programme client courrant.

Name = <name>
Le nom du client qui doit être utilisé par le Director lors de la connection. Généralement, c'est une bonne idée d'utiliser un nom en relation avec la machine de faon à identifier facilement les messages d'erreur si vous avez plusieurs clients. Cette directive est requise.

Working Directory = <Directory>
Cette directive spécifie le répertoire dans lequel le File Daemon peut placer ses fichiers de statuts. Il ne devrait être utilisé que par Bacula, mais il peut être partagé par d'autres daemons Bacula, pourvu que les noms de daemons définis par la directive Name soient uniques pour chaque daemon. Cette directive est requise.

Sur les systèmes Win32, vous pouvez, dans certaines circonstances, être amené à spécifier une lettre de disque au niveau de la spécification du répertoire. Aussi, assurez-vous que ce répertoire est bien accessible en écriture par l'utilisateur SYSTEM, faute de quoi les restaurations peuvent échouer (le fichier bootstrap transféré au File Daemon par le Director est temporairement placé dans ce répertoire avant d'être transmis au Storage Daemon).

Pid Directory = <Directory>
Cette directive spécifie le répertoire dans lequel le Director peut placer son fichier d'Id de processus. Le fichier d'Id de processus est utilisé pour stopper Bacula et prévenir l'exécution simultanée de plusieurs copies de Bacula. Cette directive est requise. L'évaluation standard du shell de Directory est faite lorsque le fichier de configuration est lu, de sorte que des valeurs telles que $HOME seront correctement substituées.

Typiquement, sur les systèmes Linux, vous utiliserez la valeur /var/run pour cette directive. Si vous n'installez pas Bacula dans les répertoires du système, vous pouvez utiliser le Working Directory tel que défini ci-dessus.

Heartbeat Interval = <time-interval>
Cette directive définit un intervalle de temps. Chaque "pulsation" du Storage Daemon reue par le File Daemon est transmise au Director. De plus, si aucune pulsation n'est reue du Storage Daemon (et donc pas transmise au Director) le File Daemon envoie une pulsation à ces deux daemons afin de conserver les canaux actifs. La valeur par défaut est zéro, ce qui désactive les pulsations. Cette fonction est particulièrement utile si vous avez un routeur tels que les 3com qui ne suivent pas les standards Internet et expirent une connection valide après une courte période en dépit de l'activation de keepalive. Il en résulte en général un message "broken pipe error".

Si vous continuez de recevoir de messages broken pipe malgré Heartbeat Interval, et si vous utilisez Windows, vous devriez envisager de mettre à jour votre pilote ethernet. Il s'agit d'un problème connu des pilotes NVidia NForce 3 (4.4.2 17/05/2004). Vous pouvez aussi essayer la procédure suivante suggérée par Thomas Simmons pour les machines Win32 :

Démarrer > Panneau de configuration > connections réseau

Faites un click droit sur connection pour l'adaptateur nvidia et sélectionnez "propriétés". Sous l'onglet "Général", cliquez "Configurer...". Sous l'onglet "Avancé", désactivez l'option "Checksum Offload" et cliquez "Ok" pour sauvegarder la modification.

L'absence de communication, ou des interruptions dans les communications peuvent aussi être causées par des firewalls Linux si vous avez une règle qui limite les connections ou le trafic.

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>
Où <number> est le nombre maximum de jobs qui peuvent être exécutés simultanément. La valeur par défaut est 2, mais vous pouvez mettre une valeur plus importante. Tout contact du Director (par exemple : requête de statut, de lancement de job...) est considéré comme un job, aussi, si vous souhaitez garder la possibilité de faire une requête de statut status dans la console alors qu'un job est en cours, vous devez régler cette valeur supérieure à 1.

FDAddresses = <IP-address-specification>
Spécifie les ports et adresses sur lesquels le Director écoute les connections de consoles Bacula. La meilleure explication est probalement un exemple :

 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
    }
 }

où ip, ip4, ip6, addr, et port sont tous des mots-clef. Notez que les adresses peuvent être spécifiées aussi bien en quadruplets pointés qu'en notation IPv6 double pointée ou avec des noms symboliques (seulement pour la la spécification d'ip). De même, les ports peuvent être spécifié sous forme de nombres, ou avec les valeurs mnémoniques du fichier /etc/services. Si un port n'est pas spécifié, la valeur par défaut est utilisée. Si une section ip est spécifiée, la résolution peut s'effectuer avec IPv4 et IPv6. Si ip4 est spécifié, alors seule la résolution IPv4 est permise, il en va de même avec ip6.

FDPort = <port-number>
Cette directive spécifie le numéro de port sur lequel le Client est en attente de connections du Director. Le numéro spécifié ici doit s'accorder avec le numéro FDPort spécifié dans la ressource Client du fichier de configuration du Director. La valeur par défaut est 9102.

FDAddress = <IP-Address>
Cette directive est optionnelle. Si elle est spécifiée, le serveur File Daemon (serveur pour les connections du Director) est alors lié à l'adresse spécifiée IP-Address, qui est soit un nom de domaine, soit une adresse IP spécifiée au format quadruplet pointé. Si cet enregistrement n'est pas spécifié, le File Daemon se lie alors à toute adresse disponible (c'est le comportement par défaut).

SDConnectTimeout = <time-interval>
Cette directive définit l'intervalle de temps durant lequel le File Daemon tente de se connecter au Storage Daemon. La valeur par défaut est 30 minutes Si aucune connection n'est établie durant cet intervalle, le File Daemon efface le Job.

Maximum Network Buffer Size = <bytes>
Où <bytes> spécifie la taille initiale du tampon réseau à utiliser avec le File Daemon. Cette taille sera revue à la baisse si elle est trop importante jusqu'à ce qu'elle soit acceptée par le système d'exploitation. Soyez circonspect avec cette directive car si la valeur est trop importante, elle sera diminuée par pas de 512 octets jusqu'à ce qu'elle convienne au système d'exploitation, ce qui peut requérir un grand nombre d'appels systèmes. La valeur par défaut est 32 768 octets.

Voici un exemple d'une définition de ressource Client valide :

Client {                              # this is me
  Name = rufus-fd
  WorkingDirectory = $HOME/bacula/bin/working
  Pid Directory = $HOME/bacula/bin/working
}


La ressource Director

La ressource Director définit le nom et le mot de passe des Directors autorisés à contacter ce client.

Director
Début des enregistrements de Director. Il peut y avoir un nombre quelconque de ressources Director dans le fichier de configuration du Client. Chacune définit un Director autorisé à contacter ce Client.

Name = <name>
Le nom du Director qui peut contacter ce Client. Ce nom doit être le même que celui spécifié au niveau de la ressource Director dans le fichier de configuration du Director. Cette directive est requise.

Password = <password>
Spécifie le mot de passe qui doit être fourni par le Director pour être autorisé. Ce mot de passe doit être le même que celui spécifié dans la ressource Client du fichier de configuration du Director. Cette directive est requise.

Monitor = <yes|no>
Si cette directive est réglée à no (valeur par défaut), ce Director dispose d'un accès total à ce Client. Dans le cas contraire (yes), ce Director est seulement autorisé à relever le statut courant de ce Client.

Veuillez noter que si ce Director est utilisé à des fins de surveillance, nous vous recommandons fortement de mettre cette directive à yes pour éviter de sérieux problèmes de sécurité.

Ainsi, plusieurs Directors peuvent être autorisés à utiliser les services de ce Client. Chaque Director aura un nom différent, et, en principe, un mot de passe différent.

Voici un exemple d'une définition de ressource Director valide :

#
# 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
}


La ressource Message

Voyez le chapitre La ressource Messages de ce manuel pour plus de détails sur la ressource Messages.

Il doit y avoir au moins une ressource Messages définie dans le fichier de configuration du Client.


Un exemple de fichier de configuration de Client

Voici un exemple de fichier de configuration de Client :

#
# 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
}


Configuration du Storage Daemon

General

Le fichier de configuration du Storage Daemon a relativement peu de définitions de resources. Cependant, en raison du nombre pléthorique de media et de systèmes, il doit être hautement paramétrable. Par conséquent, il existe un nombre assez important de directives dans la déficnition de ressource Devices qui vous permet de définir toutes les caractéristiques de votre périphérique de stockage. Heureusement, avec les matériels modernes, les valeurs par défaut sont généralement suffisantes, et très peu de directives sont réellement indispensables.

Des exemples de directives de ressources device connues pour fonctionner pour beaucoup de lecteurs de bandes communs peuvent être trouvés dans le répertoire : <bacula-src>/examples/devices. La plupart seront énumérés ici.

Pour un discussion générale concernant les fichiers de configuration de Bacula, les ressources et les types de données reconnus, veuillez consulter le chapitre Configuration de ce manuel. Les définitions de ressources Storage suivantes doivent être définies :


Ressource Storage

En général, les propriétés spécifiées au niveau de la ressource Storage définissent des propriétés globales du Storage Daemon. Chaque fichier de configuration de Storage Daemon doit avoir sa propre définition de ressource Storage.

Name = <Storage-Daemon-Name>
Spécifie le nom du Storage Daemon. Cette directive est requise.
Working Directory = <Répertoire>
Cette directive spécifie un répertoire où le Storage Daemon peut placer ses fichiers d'état. Ce répertoire ne devrait être utilisé que par Bacula, mais peut être partagé par d'autres daemons Bacula, pourvu que les noms donnés à chaque daemon soient uniques. Cette directive est requise.

Pid Directory = <Répertoire>
Cette directive spécifie un répertoire où le Storage Daemon peut déposer son fichier d'Id de processus. Ce fichier est utilisé pour stopper Bacula et prévenir l'exécution simultanée de plusieurs copies de Bacula. Les substitutions shell standard sont effectuées à la lecture du fichier de configuration, de sorte que des valeurs telles que $HOME seront correctement substituées.

Typiquement, sur les systèmes Linux, vous utiliserez ici /var/run. Si vous n'installez pas Bacula dans les répertoires système, vous pouvez utiliser le répertoire de travail Working Directory défini plus haut. Cette directive est requise.

Heartbeat Interval = <Période>
Cette directive définit la période des pulsations émises par le Storage Daemon vers le File Daemon lorqu'il (le SD) se trouve en situation d'attente du montage d'une cartouche par l'opérateur. La valeur par défaut est zéro, ce qui désactive les pulsations. Cette fonctionnalité est particulièrement utile si vous avez un routeur (tel que les 3Com) qui ne suit pas les standards Internet et expire une connection valide après une courte durée, bien que keepalive soit activé. Ceci produit habituellement un message d'erreur du type broken pipe.

Maximum Concurrent Jobs = <nombre>
Où <nombre> est nombre maximal de jobs qui peuvent être exécutés simultanément. La valeur par défaut est fixée à 10, mais vous pouvez définir une valeur plus grande. Chaque connexion depuis le Director (par exemple une requête de statut, le lancement d'un job...) est considérée comme un job, aussi, si vous voulez conserver la possibilité d'utiliser la commande status dans la console alors qu'un job est en cours d'exécution, vous devez utiliser une valeur strictement supérieure à 1. Pour exécuter plusieurs jobs simultanément, vous devez paramétrer plusieurs autres directives dans le fichier de configuration du Director. Selon ce que vous voulez faire, il faudra intervenir sur l'un ou l'autre paramètre, mais vous devrez presque surement régler le paramètre Maximum Concurrent Jobs de la ressource Storage du fichier de configuration du Director, et peut-être aussi ceux des ressources Job et Client.

SDAddresses = <Adresse IP>
Précise les ports et adresses sur lesquels le Storage Daemon est à l'écoute de connections du Director. En principe, les valeurs par défaut sont suffisantes, et vous n'avez pas besoin d'utiliser cette directive. La meilleure explication du fonctionnement de cette directive est certainement un exemple :

 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
    }
}

où "ip", "ip4", "ip6", "addr", et "port" sont des mots-clef. Notez que les adresses peuvent être spécifiées sous forme de quadruplets pointés, de nom symboliques (uniquement dans la spécification "ip") ou en notation IPv6 à double points. Le port peut quand à lui être spécifié par son numéro, ou par sa valeur mnémonique du fichier /etc/services. Si un port n'est pas spécifié, la valeur par défaut est utilisée. Si une section ip est spécifiée, la résolution peut être réalisée par ipv4 ou ipv6. En revanche, si ip4 ou ip6 est spécifiée, seule la résolution correspondante fonctionne.

Vous pouvez, avec ces directives, remplacer les valeurs des directives SDPort et SDAddress montrées ci-dessous.

SDPort = <Numéro de port>
Spécifie le numéro de port sur lequel le Storage Daemon écoute les connexions en provenance du Director. La valeur par défaut est 9103.

SDAddress = <Adresse IP>
Cette directive est optionnelle. Lorsqu'elle est spécifiée, le Storage Daemon n'accepte de connections (de Director(s) ou de File(s) Daemon(s)) que de l'adresse spécifiée Adresse-IP, qui peut être soit un nom de domaine, soit une adresse IP au format quadruplet pointé. Si cette directive n'est pas spécifiée, le Storage Daemon acceptera des connections de de toute adresse valide.

Voici une définition typique d'une ressource Storage Daemon :

#
# "Global" Storage daemon configuration specifications appear
# under the Storage resource.
#
Storage {
  Name = "Storage daemon"
  Address = localhost
  WorkingDirectory = "~/bacula/working"
  Pid    Directory = "~/bacula/working"
}


La ressource Director

La ressource Director spécifie le nom du Director qui est autorisé à utiliser les services du Storage Daemon. Il peut exister plusieurs ressources Director. Le nom et le mot de passe du Director doivent s'accorder avec leurs homologues dans le fichier de configuration du Storage Daemon.

Name = <Nom-du-Director>
Spécifie le nom du Director autorisé à se connecter au Storage Daemon. Cette directive est requise.

Password = <Mot-de-passe-du-Director>
Spécifie le mot de passe qui doit être soumis par le Director susnommé. Cette directive est requise.

Monitor = <yes|no>
Si cette directive est désactivée (no), ce qui est le cas par défaut, ce Director dispose d'un accès illimité à ce Storage Daemon. Dans le cas contraire, ce Director est bridé de faon à pouvoir seulement récupérer le statut courant de ce Storage Daemon.

Si ce Director est utilisé par un superviseur, nous vous recommandons fortement d'activer cette directive pour éviter de sérieux problèmes de sécurité.

Voici un exemple d'une définition de ressource Director valide :

Director {
  Name = MainDirector
  Password = my_secret_password
}

La Ressource Device

La ressource Device spécifie les détails de chaque périphérique (en général, un lecteur de bandes) qui peut être utilisé par le Storage Daemon. Un Storage Daemon peut disposer de plusieurs ressources Device. En général, les propriétés spécifiées dans la ressource Device sont spécifiques au périphérique.

Name = Nom-de-périphérique
Spécifie le nom que le Director devra utiliser pour désigner ce périphérique. Il s'agit d'un nom logique, c'est une chaîne qui peut comporter jusqu'à 127 caractères. C'est en général une bonne idée d'utiliser un nom qui corresponde au nom "humain" du périphérique (NDT: la vo dit "the english name"). Le nom physique du périphérique est spécifié au niveau de la directive Archive Device décrite ci-dessous. Le nom que vous spécifiez ici est aussi utilisé dans le fichier de configuration de votre Director au niveau de la directive Device de sa ressource Storage.

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.

Device Type = type-specification
The Device Type specification allows you to explicitly tell Bacula what kind of device you are defining. It the type-specification may be one of the following:
File
Tells Bacula that the device is a file. It may either be a file defined on fixed medium or a removable filesystem such as USB. All files must be random access devices.
Tape
The device is a tape device and thus is sequential access. Tape devices are controlled using ioctl() calls.
Fifo
The device is a first-in-first out sequential access read-only or write-only device.
DVD
The device is a DVD. DVDs are sequential access for writing, but random access for reading.

The Device Type directive is not required, and if not specified, Bacula will attempt to guess what kind of device has been specified using the Archive Device specification supplied. There are several advantages to explicitly specifying the Device Type. First, on some systems, block and character devices have the same type, which means that on those systems, Bacula is unlikely to be able to correctly guess that a device is a DVD. Secondly, if you explicitly specify the Device Type, the mount point need not be defined until the device is opened. This is the case with most removable devices such as USB that are mounted by the HAL daemon. If the Device Type is not explicitly specified, then the mount point must exist when the Storage daemon starts.

This directive was implemented in Bacula version 1.38.6.

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 them to anything you want, but they must be known to the volume database to keep track of which storage daemons can read which volumes. In general, each different storage type should have a unique Media Type associated with it. 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.

In addition, if you are using disk storage, each Device resource will generally have a different mount point or directory. In order for Bacula to select the correct Device resource, each one must have a unique Media Type.

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 = time
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.

Maximum Rewind Wait = time
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 = time
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 = time
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 and hence are available in version 1.38.6.

As of version 1.39.5, the directives "Requires Mount", "Mount Point", "Mount Command", and "Unmount Command" apply to removable filesystems such as USB in addition to DVD.

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.

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 Configuration

General

The Console configuration file is the simplest of all the configuration files, and in general, you should not need to change it except for the password. It simply contains the information necessary to contact the Director or Directors.

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 Console Resource definition must be defined:


The Director Resource

The Director resource defines the attributes of the Director running on the network. You may have multiple Director resource specifications in a single Console configuration file. If you have more than one, you will be prompted to choose one when you start the Console program.

Director
Start of the Director records.

Name = <name>
The director name used to select among different Directors, otherwise, this name is not used.

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.

Password = <password>
Where the password is the password needed for the Director to accept the Console connection. This password must be identical to the Password specified in the Director resource of the Director's configuration file. This record is required.

An actual example might be:

Director {
  Name = HeadMan
  address = rufus.cats.com
  password = xyz1erploit
}

The ConsoleFont Resource

The ConsoleFont resource is available only in the GNOME version of the console. It permits you to define the font that you want used to display in the main listing window.

ConsoleFont
Start of the ConsoleFont records.

Name = <name>
The name of the font.

Font = <Pango Font Name>
The string value given here defines the desired font. It is specified in the Pango format. For example, the default specification is:

Font = "LucidaTypewriter 9"

Thanks to Phil Stracchino for providing the code for this feature.

An different example might be:

ConsoleFont {
  Name = Default
Font = "Monospace 10"
}


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. However, if it is specified, you can use ACLs (Access Control Lists) in the Director's configuration file to restrict the particular console (or user) to see only information pertaining to his jobs or client machine.

The following configuration files were supplied by Phil Stracchino. For example, if we define the following in the user's bconsole.conf file (or perhaps the wx-console.conf file):

 Director {
   Name = MyDirector
   DIRport = 9101
   Address = myserver
   Password = "XXXXXXXXXXX"    # no, really.  this is not obfuscation.
}
 
 Console {
   Name = restricted-user
   Password = "UntrustedUser"
}

Where the Password in the Director section is deliberately incorrect, and the Console resource is given a name, in this case restricted-client. Then in the Director's bacula-dir.conf file (not directly accessible by the user), we define:

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
}

the user logging into the Director from his Console will get logged in as restricted-client, and he will only be able to see or access a Job with the name Restricted Client Save a Client with the name restricted-client, a Storage device main-storage, any Schedule or Pool, a FileSet named Restricted Client's File, a Catalog named DefaultCatalog, and the only command he can use in the Console is the run command. In other words, this user is rather limited in what he can see and do with Bacula.

Console Commands

For more details on running the console and its commands, please see the Bacula Console chapter of this manual.


Sample Console Configuration File

An example Console configuration file might be the following:

#
# 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

General

The Bacula Console (sometimes called the User Agent) is a program that allows the user or the System Administrator, to interact with the Bacula Director daemon while the daemon is running.

The current Bacula Console comes in two versions: a shell interface (TTY style), and a GNOME GUI interface. Both permit the administrator or authorized users to interact with Bacula. You can determine the status of a particular job, examine the contents of the Catalog as well as perform certain tape manipulations with the Console program.

In addition, there is a wx-console built with wxWidgets that allows a graphic restore of files. As of version 1.34.1 it is in an early stage of development, but it already is quite useful.

Since the Console program interacts with the Director through the network, your Console and Director programs do not necessarily need to run on the same machine.

In fact, a certain minimal knowledge of the Console program is needed in order for Bacula to be able to write on more than one tape, because when Bacula requests a new tape, it waits until the user, via the Console program, indicates that the new tape is mounted.

Console Configuration

When the Console starts, it reads a standard Bacula configuration file named bconsole.conf or gnome-console.conf in the case of the GNOME Console version. This file allows default configuration of the Console, and at the current time, the only Resource Record defined is the Director resource, which gives the Console the name and address of the Director. For more information on configuration of the Console program, please see the Console Configuration File Chapter of this document.

Running the Console Program

After launching the Console program (bconsole), it will prompt you for the next command with an asterisk (*). (Note, in the GNOME version, the prompt is not present; you simply enter the commands you want in the command text box at the bottom of the screen.) Generally, for all commands, you can simply enter the command name and the Console program will prompt you for the necessary arguments. Alternatively, in most cases, you may enter the command followed by arguments. The general format is:

 <command> <keyword1>[=<argument1>] <keyword2>[=<argument2>] ...

where command is one of the commands listed below; keyword is one of the keywords listed below (usually followed by an argument); and argument is the value. The command may be abbreviated to the shortest unique form. If two commands have the same starting letters, the one that will be selected is the one that appears first in the help listing. If you want the second command, simply spell out the full command. None of the keywords following the command may be abbreviated.

For example:

list files jobid=23

will list all files saved for JobId 23. Or:

show pools

will display all the Pool resource records.

Stopping the Console Program

Normally, you simply enter quit or exit and the Console program will terminate. However, it waits until the Director acknowledges the command. If the Director is already doing a lengthy command (e.g. prune), it may take some time. If you want to immediately terminate the Console program, enter the .quit command.

There is currently no way to interrupt a Console command once issued (i.e. Ctrl-C does not work). However, if you are at a prompt that is asking you to select one of several possibilities and you would like to abort the command, you can enter a period (.), and in most cases, you will either be returned to the main command prompt or if appropriate the previous prompt (in the case of nested prompts). In a few places such as where it is asking for a Volume name, the period will be taken to be the Volume name. In that case, you will most likely be able to cancel at the next prompt.

Alphabetic List of Console Commands

The following commands are currently implemented:

add [pool=<pool-name> storage=<storage> jobid=<JobId>]
This command is used to add Volumes to an existing Pool. The Volume names entered are placed in the Catalog and thus become available for backup operations. Normally, the label command is used rather than this command because the label command labels the physical media (tape) and does the equivalent of the add command. This command affects only the Catalog and not the physical media (data on Volumes). The physical media must exist and be labeled before use (usually with the label command). This command can, however, be useful if you wish to add a number of Volumes to the Pool that will be physically labeled at a later time. It can also be useful if you are importing a tape from another site. Please see the label command below for the list of legal characters in a Volume name.

autodisplay on/off
This command accepts on or off as an argument, and turns auto-display of messages on or off respectively. The default for the console program is off, which means that you will be notified when there are console messages pending, but they will not automatically be displayed. The default for the gnome-console program is on, which means that messages will be displayed when they are received (usually within 5 seconds of them being generated).

When autodisplay is turned off, you must explicitly retrieve the messages with the messages command. When autodisplay is turned on, the messages will be displayed on the console as they are received.

automount on/off
This command accepts on or off as the argument, and turns auto-mounting of the tape after a label command on or off respectively. The default is on. If automount is turned off, you must explicitly mount the tape after a label command to use it.

cancel [jobid=<number> job=<job-name>]
This command is used to cancel a job and accepts jobid=nnn or job=xxx as an argument where nnn is replaced by the JobId and xxx is replaced by the job name. If you do not specify a keyword, the Console program will prompt you with the names of all the active jobs allowing you to choose one.

Once a Job is marked to be canceled, it may take a bit of time (generally within a minute) before it actually terminates, depending on what operations it is doing.

create [pool=<pool-name>]
This command is used to create a Pool record in the database using the Pool resource record defined in the Director's configuration file. So in a sense, this command simply transfers the information from the Pool resource in the configuration file into the Catalog. Normally this command is done automatically for you when the Director starts providing the Pool is referenced within a Job resource. If you use this command on an existing Pool, it will automatically update the Catalog to have the same information as the Pool resource. After creating a Pool, you will most likely use the label command to label one or more volumes and add their names to the Media database.

When starting a Job, if Bacula determines that there is no Pool record in the database, but there is a Pool resource of the appropriate name, it will create it for you. If you want the Pool record to appear in the database immediately, simply use this command to force it to be created.

delete [volume=<vol-name> pool=<pool-name> job jobid=<id>]
The delete command is used to delete a Volume, Pool or Job record from the Catalog as well as all associated catalog Volume records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.

If the keyword Volume appears on the command line, the named Volume will be deleted from the catalog, if the keyword Pool appears on the command line, a Pool will be deleted, and if the keyword Job appears on the command line, a Job and all its associated records (File and JobMedia) will be deleted from the catalog. The full form of this command is:

delete pool=<pool-name>

or

delete volume=<volume-name> pool=<pool-name> or

delete JobId=<job-id> JobId=<job-id2> ... or

delete Job JobId=n,m,o-r,t ...

The first form deletes a Pool record from the catalog database. The second form deletes a Volume record from the specified pool in the catalog database. The third form deletes the specified Job record from the catalog database. The last form deletes JobId records for JobIds n,m,o,p, q,r, and t. Where each one of the n,m,... is, of course, a number.

estimate
Using this command, you can get an idea how many files will be backed up, or if you are unsure about your Include statements in your FileSet, you can test them without doing an actual backup. The default is to assume a Full backup. However, you can override this by specifying a level=Incremental or level=Differential on the command line. A Job name must be specified or you will be prompted for one, and optionally a Client and FileSet may be specified on the command line. It then contacts the client which computes the number of files and bytes that would be backed up. Please note that this is an estimate calculated from the number of blocks in the file rather than by reading the actual bytes. As such, the estimated backup size will generally be larger than an actual backup.

Optionally you may specify the keyword listing in which case, all the files to be backed up will be listed. Note, it could take quite some time to display them if the backup is large. The full form is:

estimate job=<job-name> listing client=<client-name> fileset=<fileset-name> level=<level-name>

Specification of the job is sufficient, but you can also override the client, fileset and/or level by specifying them on the estimate command line.

As an example, you might do:

     @output /tmp/listing
     estimate job=NightlySave listing level=Incremental
     @output

which will do a full listing of all files to be backed up for the Job NightlySave during an Incremental save and put it in the file /tmp/listing.

help
This command displays the list of commands available.

label
This command is used to label physical volumes. The full form of this command is:

label storage=<storage-name> volume=<volume-name> slot=<slot>

If you leave out any part, you will be prompted for it. The media type is automatically taken from the Storage resource definition that you supply. Once the necessary information is obtained, the Console program contacts the specified Storage daemon and requests that the tape be labeled. If the tape labeling is successful, the Console program will create a Volume record in the appropriate Pool.

The Volume name is restricted to letters, numbers, and the special characters hyphen (-), underscore (_), colon (:), and period (.). All other characters including a space are illegal. This restriction is to ensure good readability of Volume names to reduce operator errors.

Please note, when labeling a blank tape, Bacula will get read I/O error when it attempts to ensure that the tape is already labeled. If you wish to avoid getting these messages, please write and EOF mark on your tape before attempting to label it:

       mt rewind
       mt weof

The label command can fail for a number of reasons:

  1. The Volume name you specify is already in the Volume database.
  2. The Storage daemon has a tape already mounted on the device, in which case you must unmount the device, insert a blank tape, then do the label command.
  3. The tape in the device is already a Bacula labeled tape. (Bacula will never relabel a Bacula labeled tape unless it is recycled and you use the relabel command).
  4. There is no tape in the drive.

There are two ways to relabel a volume that already has a Bacula label. The brute force method is to write an end of file mark on the tape using the system mt program, something like the following:

       mt -f /dev/st0 rewind
       mt -f /dev/st0 weof

Then you use the label command to add a new label. However, this could leave traces of the old volume in the catalog.

The preferable method to relabel a tape is to first purge the volume, either automatically, or explicitly with the purge command, then use the relabel command described below.

If your autochanger has barcode labels, you can label all the Volumes in your autochanger one after another by using the label barcodes command. For each tape in the changer containing a barcode, Bacula will mount the tape and then label it with the same name as the barcode. An appropriate Media record will also be created in the catalog. Any barcode that begins with the same characters as specified on the "CleaningPrefix=xxx" directive in the Director's Pool resource, will be treated as a cleaning tape, and will not be labeled. However, an entry for the cleaning tape will be created in the catalog. For example with:

        Pool {
          Name ...
          Cleaning Prefix = "CLN"
        }

Any slot containing a barcode of CLNxxxx will be treated as a cleaning tape and will not be mounted. Note, the full form of the command is:

update storage=xxx pool=yyy slots=1-5,10 barcodes

list
The list command lists the requested contents of the Catalog. The various fields of each record are listed on a single line. The various forms of the list command are:
   list jobs
   
   list jobid=\lt{}id\gt{}
   
   list job=\lt{}job-name\gt{}
   
   list jobmedia
   
   list jobmedia jobid=\lt{}id\gt{}
   
   list jobmedia job=\lt{}job-name\gt{}
   
   list files jobid=\lt{}id\gt{}
   
   list files job=\lt{}job-name\gt{}
   
   list pools
   
   list clients
   
   list jobtotals
   
   list volumes
   
   list volumes jobid=\lt{}id\gt{}
   
   list volumes pool=\lt{}pool-name\gt{}
   
   list volumes job=\lt{}job-name\gt{}
   
   list volume=\lt{}volume-name\gt{}  

   list nextvolume job=\lt{}job-name\gt{}
   
   list nextvol job=\lt{}job-name\gt{}

What most of the above commands do should be more or less obvious. In general if you do not specify all the command line arguments, the command will prompt you for what is needed.

The list nextvol command will print the Volume name to be used by the specified job. You should be aware that exactly what Volume will be used depends on a lot of factors including the time and what a prior job will do. It may fill a tape that is not full when you issue this command. As a consequence, this command will give you a good estimate of what Volume will be used but not a definitive answer. In addition, this command may have certain side effect because it runs through the same algorithm as a job, which means it may automatically purge or recycle a Volume.

If you wish to add specialized commands that list the contents of the catalog, you can do so by adding them to the query.sql file. However, this takes some knowledge of programming SQL. Please see the query command below for additional information. See below for listing the full contents of a catalog record with the llist command.

As an example, the command list pools might produce the following output:

+------+---------+---------+---------+----------+-------------+
| 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 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. The various forms of the mount command are:

mount storage=<storage-name>

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 10 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=<client-name> where=<path> pool=<pool-name> fileset=<fileset-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.

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 the tracing will be enabled, and the daemon where the setdebug applies will be placed in trace mode, and all debug output will go to the file bacula.trace in the current directory of the daemon. Normally, tracing is used 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: directors, clients, counters, jobs, storages, catalogs, schedules, filesets, groups, pools, messages, 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 twenty-four 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>]

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 10 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, which means that it may prune or recycle a Volume; 2. The Volume listed is only a best 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"

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=\lt{}storage-name\gt{}

unmount [ jobid=\lt{}id\gt{} | job=\lt{}job-name\gt{} ]

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
   Slot
   InChanger Flag
   Pool
   Volume Files
   Volume from Pool
   All Volumes from Pool

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 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 and All Volumes from Pool, the following values are updated from the Pool record: Recycle, VolRetention, VolUseDuration, MaxVolJobs, MaxVolFiles, and MaxVolBytes.

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

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.

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
.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.
.jobs                 list all job names
.levels               list all levels
.filesets             list all fileset names
.clients              list all client names
.pools                list all pool names
.types                list job types
.msgs                 return any queued messages
.messages             get quick messages
.help                 help command output
.quit                 quit
.status               get status output
.exit                 quit

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 Program 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.


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:


The Bacula Console Restore Command

General

Below, we will discuss restoring files with the Console restore command, which is the recommended way of doing it. However, 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. You will 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 your Files have been pruned, 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):

As an example, suppose that we select item 5 (restore to most recent state). 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: Kerns Files
Select FileSet resource (1-2):

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, enter the command restore all.

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 restore job will require the following Volumes:
   
   DLT-19Jul02
   DLT-04Aug02
128401 files selected to restore.
Run Restore job
JobName:    kernsrestore
Bootstrap:  /home/kern/bacula/working/restore.bsr
Where:      /tmp/bacula-restores
Replace:    always
FileSet:    Kerns Files
Client:     Rufus
Storage:    SDT-10000
JobId:      *None*
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:    Kerns 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:

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. Again send me the full job report output. If you are able to determine the block size your drive was previously using, you should try that size if 512 does not work.
  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.

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. I'll try to provide a few ideas how to get out of these problem situations.

Problem
Your catalog has been damaged and Bacula either doesn't work or prints errors.
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.

Assuming the above does not resolve the problem, you will need to restore or rebuild your catalog.

Problem
How do I restore my catalog?
Solution
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. You will then need to follow the instructions for your database type to recreate the database from the ASCII backup file.

Solution
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
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
Use bls to indicate where it is on the tape. 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 Job totals:
     2: List up to 20 places where a File is saved regardless of the directory:
     3: List where the most recent copies of a file are saved:
     4: List last 20 Full Backups for a Client:
     5: List all backups for a Client after a specified time
     6: List all backups for a Client
     7: List Volume Attributes for a selected Volume:
     8: List Volumes used by selected JobId:
     9: List Volumes to Restore All Files:
    10: List Pool Attributes for a selected Pool:
    11: List total files/bytes by Job:
    12: List total files/bytes by Volume:
    13: List Files for a selected JobId:
    14: List Jobs stored in a selected MediaId:
    15: List Jobs stored for a given Volume name:
Choose a query (1-15):


Catalog Maintenance

Without proper setup and maintenance, your Catalog may continue to grow indefinitely as you run Jobs and backup Files. How fast the size of your Catalog grows depends on the number of Jobs you run and how many files they backup. By deleting records within the database, you can make space available for the new records that will be added during the next Job. By constantly deleting old expired records (dates older than the Retention period), your database size will remain constant.

If you started with the default configuration files, they already contain reasonable defaults for a small number of machines (less than 5), so if you fall into that case, catalog maintenance will not be urgent if you have a few hundred megabytes of disk space free. Whatever the case may be, some knowledge of retention periods will be useful.

Setting Retention Periods

Bacula uses three Retention periods: the File Retention period, the Job Retention period, and the Volume Retention period. Of these three, the File Retention period is by far the most important in determining how large your database will become.

The File Retention and the Job Retention are specified in each Client resource as is shown below. The Volume Retention period is specified in the Pool resource, and the details are given in the next chapter of this manual.

File Retention = <time-period-specification>
The File Retention record 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. The pruning will occur at the end of a backup Job for the given Client. Note that the Client database record contains a copy of the File and Job retention periods, but Bacula uses the current values found in the Director's Client resource to do the pruning.

Since File records in the database account for probably 80 percent of the size of the database, you should carefully determine exactly what File Retention period you need. Once the File records have been removed from the database, you will no longer be able to restore individual files in a Job. However, with Bacula version 1.37 and later, as long as the Job record still exists, you will be able to restore all files in the job.

Retention periods are specified in seconds, but as a convenience, there are a number of modifiers that permit easy specification in terms of minutes, hours, days, weeks, months, quarters, or years on the record. See the Configuration chapter of this manual for additional details of modifier specification.

The default File retention period is 60 days.

Job Retention = <time-period-specification>
The Job Retention record 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 Job Retention period. Note, 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.

As mentioned above, once the File records are removed from the database, you will no longer be able to restore individual files from the Job. However, as long as the Job record remains in the database, you will be able to restore all the files backuped for the Job (on version 1.37 and later). As a consequence, it is generally a good idea to retain the Job records much longer than the File records.

The retention period is specified in seconds, but as a convenience, there are a number of modifiers that permit easy specification in terms of minutes, hours, days, weeks, months, quarters, or years. See the Configuration chapter of this manual for additional details of modifier specification.

The default Job Retention period is 180 days.

AutoPrune = <yes/no>
If AutoPrune is set to yes (default), Bacula will automatically apply the File retention period and the Job retention period for the Client at the end of the Job.

If you turn this off by setting it to no, your Catalog will grow each time you run a Job.

Compacting Your MySQL Database

Over time, as noted above, your database will tend to grow. I've noticed that even though Bacula regularly prunes files, MySQL does not effectively use the space, and instead continues growing. To avoid this, from time to time, you must compact your database. Normally, large commercial database such as Oracle have commands that will compact a database to reclaim wasted file space. MySQL has the OPTIMIZE TABLE command that you can use, and SQLite version 2.8.4 and greater has the VACUUM command. We leave it to you to explore the utility of the OPTIMIZE TABLE command in MySQL.

All database programs have some means of writing the database out in ASCII format and then reloading it. Doing so will re-create the database from scratch producing a compacted result, so below, we show you how you can do this for MySQL, PostgreSQL and SQLite.

For a MySQL database, you could write the Bacula database as an ASCII file (bacula.sql) then reload it by doing the following:

mysqldump -f --opt bacula > bacula.sql
mysql bacula < bacula.sql
rm -f bacula.sql

Depending on the size of your database, this will take more or less time and a fair amount of disk space. For example, if I cd to the location of the MySQL Bacula database (typically /opt/mysql/var or something similar) and enter:

du bacula

I get 620,644 which means there are that many blocks containing 1024 bytes each or approximately 635 MB of data. After doing the msqldump, I had a bacula.sql file that had 174,356 blocks, and after doing the mysql command to recreate the database, I ended up with a total of 210,464 blocks rather than the original 629,644. In other words, the compressed version of the database took approximately one third of the space of the database that had been in use for about a year.

As a consequence, I suggest you monitor the size of your database and from time to time (once every 6 months or year), compress it.

Repairing Your MySQL Database

If you find that you are getting errors writing to your MySQL database, or Bacula hangs each time it tries to access the database, you should consider running MySQL's database check and repair routines. The program you need to run depends on the type of database indexing you are using. If you are using the default, you will probably want to use myisamchk. For more details on how to do this, please consult the MySQL document at: http://www.mysql.com/doc/en/Repair.html.

If the errors you are getting are simply SQL warnings, then you might try running dbcheck before (or possibly after) using the MySQL database repair program. It can clean up many of the orphaned record problems, and certain other inconsistencies in the Bacula database.

Repairing Your PostgreSQL Database

The same considerations apply that are indicated above for MySQL. That is, consult the PostgreSQL documents for how to repair the database, and also consider using Bacula's dbcheck program if the conditions are reasonable for using (see above).

Performance Issues

There are a considerable number of ways each of the databases can be tuned to improve the performance. Going from an untuned database to one that is properly tuned can make a difference of a factor of 100 or more in the time to insert or search for records.

For each of the databases, you may get significant improvements by adding additional indexes. The comments in the Bacula make_xxx_tables give some indications as to what indexes may be appropriate.

For MySQL, what seems to be very important is to use the examine the my.cnf file. You may obtain significant performances by switching to the my-large.cnf or my-huge.cnf files that come with the MySQL source code.

For SQLite3, one significant factor in improving the performance is to ensure that there is a "PRAGMA synchronous = NORMAL;" statement. This reduces the number of times that the database flushes the in memory cache to disk. There are other settings for this PRAGMA that can give even further performance improvements at the risk of a database corruption if your system crashes.

For PostgreSQL, you might want to consider turning fsync off. Of course doing so can cause corrupted databases in the even of a machine crash. There are many different ways that you can tune PostgreSQL, the following document discusses a few of them: http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html.

There is also a PostgreSQL FAQ question number 3.3 that may answer some of your questions about how to improve performance of the PostgreSQL engine: http://www.postgresql.org/docs/faqs.FAQ.html#3.3.

Compacting Your PostgreSQL Database

Over time, as noted above, your database will tend to grow. I've noticed that even though Bacula regularly prunes files, PostgreSQL has a VACUUM command that will compact your database for you. Alternatively you may want to use the vacuumdb command, which can be run from a cron job.

All database programs have some means of writing the database out in ASCII format and then reloading it. Doing so will re-create the database from scratch producing a compacted result, so below, we show you how you can do this for PostgreSQL.

For a PostgreSQL database, you could write the Bacula database as an ASCII file (bacula.sql) then reload it by doing the following:

pg_dump bacula > bacula.sql
cat bacula.sql | psql bacula
rm -f bacula.sql

Depending on the size of your database, this will take more or less time and a fair amount of disk space. For example, you can cd to the location of the Bacula database (typically /usr/local/pgsql/data or possible /var/lib/pgsql/data) and check the size.

Compacting Your SQLite Database

First please read the previous section that explains why it is necessary to compress a database. SQLite version 2.8.4 and greater have the Vacuum command for compacting the database.

cd {\bf working-directory}
echo 'vacuum;' | sqlite bacula.db

As an alternative, you can use the following commands, adapted to your system:

cd {\bf working-directory}
echo '.dump' | sqlite bacula.db > bacula.sql
rm -f bacula.db
sqlite bacula.db < bacula.sql
rm -f bacula.sql

Where working-directory is the directory that you specified in the Director's configuration file. Note, in the case of SQLite, it is necessary to completely delete (rm) the old database before creating a new compressed version.

Migrating from SQLite to MySQL

You may begin using Bacula with SQLite then later find that you want to switch to MySQL for any of a number of reasons: SQLite tends to use more disk than MySQL, SQLite apparently does not handle database sizes greater than 2GBytes, ... Several users have done so by first producing an ASCII "dump" of the SQLite database, then creating the MySQL tables with the create_mysql_tables script that comes with Bacula, and finally feeding the SQLite dump into MySQL using the -f command line option to continue past the errors that are generated by the DDL statements that SQLite's dump creates. Of course, you could edit the dump and remove the offending statements. Otherwise, MySQL accepts the SQL produced by SQLite.

Backing Up Your Bacula Database

If ever the machine on which your Bacula database crashes, and you need to restore from backup tapes, one of your first priorities will probably be to recover the database. Although Bacula will happily backup your catalog database if it is specified in the FileSet, this is not a very good way to do it, because the database will be saved while Bacula is modifying it. Thus the database may be in an instable state. Worse yet, you will backup the database before all the Bacula updates have been applied.

To resolve these problems, you need to backup the database after all the backup jobs have been run. In addition, you will want to make a copy while Bacula is not modifying it. To do so, you can use two scripts provided in the release make_catalog_backup and delete_catalog_backup. These files will be automatically generated along with all the other Bacula scripts. The first script will make an ASCII copy of your Bacula database into bacula.sql in the working directory you specified in your configuration, and the second will delete the bacula.sql file.

The basic sequence of events to make this work correctly is as follows:

Assuming that you start all your nightly backup jobs at 1:05 am (and that they run one after another), you can do the catalog backup with the following additional Director configuration statements:

# Backup the catalog database (after the nightly save)
Job {
  Name = "BackupCatalog"
  Type = Backup
  Client=rufus-fd
  FileSet="Catalog"
  Schedule = "WeeklyCycleAfterBackup"
  Storage = DLTDrive
  Messages = Standard
  Pool = Default
  RunBeforeJob = "/home/kern/bacula/bin/make_catalog_backup"
  RunAfterJob  = "/home/kern/bacula/bin/delete_catalog_backup"
  Write Bootstrap = "/home/kern/bacula/working/BackupCatalog.bsr"
}
# This schedule does the catalog. It starts after the WeeklyCycle
Schedule {
  Name = "WeeklyCycleAfterBackup
  Run = Full sun-sat at 1:10
}
# This is the backup of the catalog
FileSet {
  Name = "Catalog"
  Include = signature=MD5 {
     @working_directory@/bacula.sql
  }
}

Be sure to write a bootstrap file as in the above example. It is preferable to write or copy the bootstrap file to another computer. It will allow you to quickly recover the database backup should that be necessary. If you do not have a bootstrap file, it is still possible to recover your database backup, but it will be more work and take longer.

Backing Up Third Party Databases

If you are running a database in production mode on your machine, Bacula will happily backup the files, but if the database is in use while Bacula is reading it, you may back it up in an unstable state.

The best solution is to shutdown your database before backing it up, or use some tool specific to your database to make a valid live copy perhaps by dumping the database in ASCII format. I am not a database expert, so I cannot provide you advice on how to do this, but if you are unsure about how to backup your database, you might try visiting the Backup Central site, which has been renamed Storage Mountain (www.backupcentral.com). In particular, their Free Backup and Recovery Software page has links to scripts that show you how to shutdown and backup most major databases.

Database Size

As mentioned above, if you do not do automatic pruning, your Catalog will grow each time you run a Job. Normally, you should decide how long you want File records to be maintained in the Catalog and set the File Retention period to that time. Then you can either wait and see how big your Catalog gets or make a calculation assuming approximately 154 bytes for each File saved and knowing the number of Files that are saved during each backup and the number of Clients you backup.

For example, suppose you do a backup of two systems, each with 100,000 files. Suppose further that you do a Full backup weekly and an Incremental every day, and that the Incremental backup typically saves 4,000 files. The size of your database after a month can roughly be calculated as:

   Size = 154 * No. Systems * (100,000 * 4 + 10,000 * 26)

where we have assumed 4 weeks in a month and 26 incremental backups per month. This would give the following:

   Size = 154 * 2 * (100,000 * 4 + 10,000 * 26)
or
   Size = 308 * (400,000 + 260,000)
or
   Size = 203,280,000 bytes

So for the above two systems, we should expect to have a database size of approximately 200 Megabytes. Of course, this will vary according to how many files are actually backed up.

Below are some statistics for a MySQL database containing Job records for five Clients beginning September 2001 through May 2002 (8.5 months) and File records for the last 80 days. (Older File records have been pruned). For these systems, only the user files and system files that change are backed up. The core part of the system is assumed to be easily reloaded from the RedHat rpms.

In the list below, the files (corresponding to Bacula Tables) with the extension .MYD contain the data records whereas files with the extension .MYI contain indexes.

You will note that the File records (containing the file attributes) make up the large bulk of the number of records as well as the space used (459 Mega Bytes including the indexes). As a consequence, the most important Retention period will be the File Retention period. A quick calculation shows that for each File that is saved, the database grows by approximately 150 bytes.

      Size in
       Bytes   Records    File
 ============  =========  ===========
          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

This database has a total size of approximately 450 Megabytes.

If we were using SQLite, the determination of the total database size would be much easier since it is a single file, but we would have less insight to the size of the individual tables as we have in this case.

Note, SQLite databases may be as much as 50% larger than MySQL databases due to the fact that all data is stored as ASCII strings. That is even binary integers are stored as ASCII strings, and this seems to increase the space needed.


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
}


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
}


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 Support

Autochangers -- General

Bacula provides autochanger support for reading and writing tapes. In order to work with an autochanger, Bacula requires three things, each of which is explained in more detail after this list:

In version 1.37, there is a new Autochanger resource that permits you to group Device resources thus creating a multi-drive autochanger. If you have a multi-drive autochanger, you must use this new resource. If you have a single drive autochanger, it is recommended, but not required.

Bacula uses its own mtx-changer script to interface with a program that actually does the tape changing. Thus in principle, mtx-changer can be adapted to function with any autochanger program. The current version of mtx-changer works with the mtx program. However, FreeBSD users have provided a script in the examples/autochangers directory that allows Bacula to use the chio program.

Bacula also supports autochangers with barcode readers. This support includes two Console commands: label barcodes and update slots. For more details on these commands, see the "Barcode Support" section below.

Current Bacula autochanger support does not include cleaning, stackers, or silos. However, under certain conditions, you may be able to make Bacula work with stackers (gravity feed and such). Support for multi-drive autochangers requires the Autochanger resource introduced in version 1.37. This resource is also recommended for single drive autochangers.

In principle, if mtx will operate your changer correctly, then it is just a question of adapting the mtx-changer script (or selecting one already adapted) for proper interfacing. You can find a list of autochangers supported by mtx at the following link: http://mtx.badtux.net/compatibility.php. The home page for the mtx project can be found at: http://mtx.badtux.net/.

If you are having troubles, please use the auto command in the btape program to test the functioning of your autochanger with Bacula. When Bacula is running, please remember that for many distributions (e.g. FreeBSD, Debian, ...) the Storage daemon runs as bacula.tape rather than root.root, so you will need to ensure that the Storage daemon has sufficient permissions to access the autochanger.

Knowing What SCSI Devices You Have

Under Linux, you can

cat /proc/scsi/scsi

to see what SCSI devices you have available. You can also:

cat /proc/scsi/sg/device_hdr /proc/scsi/sg/devices

to find out how to specify their control address (/dev/sg0 for the first, /dev/sg1 for the second, ...) on the Changer Device = Bacula directive.

Under FreeBSD, you can use:

camcontrol devlist

To list the SCSI devices as well as the /dev/passn that you will use on the Bacula Changer Device = directive.

Please check that your Storage daemon has permission to access this device.

The following tip for FreeBSD users comes from Danny Butroyd: n reboot bacula will NOT have permissions to control the device /dev/pass0 (assuming this is your changer device). To get around this just edit the /etc/devfs.conf file and add the following to the bottom of the config file:

own     pass0   root:bacula
perm    pass0   0666
own     nsa0.0  root:bacula
perm    nsa0.0    0666
I have given the bacula group permission to write to the nsa0.0 device too just to be on the safe side. To bring these changes into effect just run:-

/etc/rc.d/devfs restart

Basically this will stop you having to change permissions on these devices to make bacula work when operating the AutoChanger after a reboot.

Example Scripts

Please read the sections below so that you understand how autochangers work with Bacula. Although we supply a default mtx-changer script, your autochanger may require some additional changes. If you want to see examples of configuration files and scripts, please look in the <bacula-src>/examples/devices directory where you will find an example HP-autoloader.conf Bacula Device resource, and several mtx-changer scripts that have been modified to work with different autochangers.

Slots

To properly address autochangers, Bacula must know which Volume is in each slot of the autochanger. Slots are where the changer cartridges reside when not loaded into the drive. Bacula numbers these slots from one to the number of cartridges contained in the autochanger.

Bacula will not automatically use a Volume in your autochanger unless it is labeled and the slot number is stored in the catalog and the Volume is marked as InChanger. For each Volume in your changer, you will, using the Console program, assign a slot. This information is kept in Bacula's catalog database along with the other data for the volume. If no slot is given, or the slot is set to zero, Bacula will not attempt to use the autochanger even if all the necessary configuration records are present. In addition, the console mount command does not cause Bacula to operate the autochanger, it only tells Bacula to read any tape that may be in the drive.

You can check if the Slot number and InChanger flag are set by doing a:

list Volumes

in the Console program.

Multiple Devices

Some autochangers have more than one read/write device (drive). The new Autochanger resource introduced in version 1.37 permits you to group Device resources, where each device represents a drive. The Director may still reference the Devices (drives) directly, but doing so, bypasses the proper functioning of the drives together. Instead, the Director (in the Storage resource) should reference the Autochanger resource name. Doing so permits the Storage daemon to ensure that only one drive uses the mtx-changer script at a time, and also that two drives don't reference the same Volume.

Multi-drive requires the use of the Drive Index directive in the Device resource of the Storage daemon's configuration file. Drive numbers or the Device Index are numbered beginning at zero, which is the default. To use the second Drive in an autochanger, you need to define a second Device resource and set the Drive Index to 1 for that device. In general, the second device will have the same Changer Device (control channel) as the first drive, but a different Archive Device.

Device Configuration Records

Configuration of autochangers within Bacula is done in the Device resource of the Storage daemon. Four records: Autochanger, Changer Device, Changer Command, and Maximum Changer Wait control how Bacula uses the autochanger.

These four records, permitted in Device resources, are described in detail below. Note, however, that the Changer Device and the Changer Command directives are not needed in the Device resource if they are present in the Autochanger resource.

Autochanger = Yes|No
The Autochanger record specifies that the current device is or is not an autochanger. The default is no.

Changer Device = <device-name>
In addition to the Archive Device name, you must specify a Changer Device name. This is because most autochangers are controlled through a different device than is used for reading and writing the cartridges. For example, on Linux, one normally uses the generic SCSI interface for controlling the autochanger, but the standard SCSI interface for reading and writing the tapes. On Linux, for the Archive Device = /dev/nst0, you would typically have Changer Device = /dev/sg0. Note, some of the more advanced autochangers will locate the changer device on /dev/sg1. Such devices typically have several drives and a large number of tapes.

On FreeBSD systems, the changer device will typically be on /dev/pass0 through /dev/passn.

On Solaris, the changer device will typically be some file under /dev/rdsk.

Please ensure that your Storage daemon has permission to access this device.

Changer Command = <command>
This record is used to specify the external program to call and what arguments to pass to it. The command is assumed to be a standard program or shell script that can be executed by the operating system. This command is invoked each time that Bacula wishes to manipulate the autochanger. The following substitutions are made in the command before it is sent to the operating system for execution:

      %% = %
      %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

An actual example for using mtx with the mtx-changer script (part of the Bacula distribution) is:

Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"

Where you will need to adapt the /etc/bacula to be the actual path on your system where the mtx-changer script resides. Details of the three commands currently used by Bacula (loaded, load, unload) as well as the output expected by Bacula are give in the Bacula Autochanger Interface section below.

Maximum Changer Wait = <time>
This record is used to define the maximum amount of time that Bacula will wait for an autoloader to respond to a command (e.g. load). The default is set to 120 seconds. If you have a slow autoloader you may want to set it longer.

If the autoloader program fails to respond in this time, it will be killed and Bacula will request operator intervention.

Drive Index = <number>
This record allows you to tell Bacula to use the second or subsequent drive in an autochanger with multiple drives. Since the drives are numbered from zero, the second drive is defined by

Device Index = 1

To use the second drive, you need a second Device resource definition in the Bacula configuration file. See the Multiple Drive section above in this chapter for more information.

In addition, for proper functioning of the Autochanger, you must define an Autochanger resource.

An Example Configuration File

The following two resources implement an 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;
  Mount Anonymous Volumes = no;
}

where you will adapt the Archive Device, the Changer Device, and the path to the Changer Command to correspond to the values used on your system.

A Multi-drive Example Configuration File

The following resources implement a multi-drive autochanger:

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;
  Mount Anonymous Volumes = no;
}

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;
  Mount Anonymous Volumes = no;
}

where you will adapt the Archive Device, the Changer Device, and the path to the Changer Command to correspond to the values used on your system.

Specifying Slots When Labeling

If you add an Autochanger = yes record to the Storage resource in your Director's configuration file, the Bacula Console will automatically prompt you for the slot number when the Volume is in the changer when you add or label tapes for that Storage device. If your mtx-changer script is properly installed, Bacula will automatically load the correct tape during the label command.

You must also set Autochanger = yes in the Storage daemon's Device resource as we have described above in order for the autochanger to be used. Please see the Storage Resource in the Director's chapter and the Device Resource in the Storage daemon chapter for more details on these records.

Thus all stages of dealing with tapes can be totally automated. It is also possible to set or change the Slot using the update command in the Console and selecting Volume Parameters to update.

Even though all the above configuration statements are specified and correct, Bacula will attempt to access the autochanger only if a slot is non-zero in the catalog Volume record (with the Volume name).

If your autochanger has barcode labels, you can label all the Volumes in your autochanger one after another by using the label barcodes command. For each tape in the changer containing a barcode, Bacula will mount the tape and then label it with the same name as the barcode. An appropriate Media record will also be created in the catalog. Any barcode that begins with the same characters as specified on the "CleaningPrefix=xxx" command, will be treated as a cleaning tape, and will not be labeled. For example with:

Please note that Volumes must be pre-labeled to be automatically used in the autochanger during a backup. If you do not have a barcode reader, this is done manually (or via a script).

Pool {
  Name ...
  Cleaning Prefix = "CLN"
}

Any slot containing a barcode of CLNxxxx will be treated as a cleaning tape and will not be mounted.

Dealing with Multiple Magazines

If you have several magazines or if you insert or remove cartridges from a magazine, you should notify Bacula of this. By doing so, Bacula will as a preference, use Volumes that it knows to be in the autochanger before accessing Volumes that are not in the autochanger. This prevents unneeded operator intervention.

If your autochanger has barcodes (machine readable tape labels), the task of informing Bacula is simple. Every time, you change a magazine, or add or remove a cartridge from the magazine, simply do

update slots

in the Console program. This will cause Bacula to request the autochanger to return the current Volume names in the magazine. This will be done without actually accessing or reading the Volumes because the barcode reader does this during inventory when the autochanger is first turned on. Bacula will ensure that any Volumes that are currently marked as being in the magazine are marked as no longer in the magazine, and the new list of Volumes will be marked as being in the magazine. In addition, the Slot numbers of the Volumes will be corrected in Bacula's catalog if they are incorrect (added or moved).

If you do not have a barcode reader on your autochanger, you have several alternatives.

  1. You can manually set the Slot and InChanger flag using the update volume command in the Console (quite painful).
  2. You can issue a

    update slots scan
    

    command that will cause Bacula to read the label on each of the cartridges in the magazine in turn and update the information (Slot, InChanger flag) in the catalog. This is quite effective but does take time to load each cartridge into the drive in turn and read the Volume label.

  3. You can modify the mtx-changer script so that it simulates an autochanger with barcodes. See below for more details.

Simulating Barcodes in your Autochanger

You can simulate barcodes in your autochanger by making the mtx-changer script return the same information that an autochanger with barcodes would do. This is done by commenting out the one and only line in the list) case, which is:

  ${MTX} -f $ctl status | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"

at approximately line 99 by putting a # in column one of that line, or by simply deleting it. Then in its place add a new line that prints the contents of a file. For example:

cat /etc/bacula/changer.volumes

Be sure to include a full path to the file, which can have any name. The contents of the file must be of the following format:

1:Volume1
2:Volume2
3:Volume3
...

Where the 1, 2, 3 are the slot numbers and Volume1, Volume2, ... are the Volume names in those slots. You can have multiple files that represent the Volumes in different magazines, and when you change magazines, simply copy the contents of the correct file into your /etc/bacula/changer.volumes file. There is no need to stop and start Bacula when you change magazines, simply put the correct data in the file, then run the update slots command, and your autochanger will appear to Bacula to be an autochanger with barcodes.

The Full Form of the Update Slots Command

If you change only one cartridge in the magazine, you may not want to scan all Volumes, so the update slots command (as well as the update slots scan command) has the additional form:

update slots=n1,n2,n3-n4, ...

where the keyword scan can be appended or not. The n1,n2, ... represent Slot numbers to be updated and the form n3-n4 represents a range of Slot numbers to be updated (e.g. 4-7 will update Slots 4,5,6, and 7).

This form is particularly useful if you want to do a scan (time expensive) and restrict the update to one or two slots.

For example, the command:

update slots=1,6 scan

will cause Bacula to load the Volume in Slot 1, read its Volume label and update the Catalog. It will do the same for the Volume in Slot 6. The command:

update slots=1-3,6

will read the barcoded Volume names for slots 1,2,3 and 6 and make the appropriate updates in the Catalog. If you don't have a barcode reader or have not modified the mtx-changer script as described above, the above command will not find any Volume names so will do nothing.

FreeBSD Issues

If you are having problems on FreeBSD when Bacula tries to select a tape, and the message is Device not configured, this is because FreeBSD has made the tape device /dev/nsa1 disappear when there is no tape mounted in the autochanger slot. As a consequence, Bacula is unable to open the device. The solution to the problem is to make sure that some tape is loaded into the tape drive before starting Bacula. This problem is corrected in Bacula versions 1.32f-5 and later.

Please see the Tape Testing chapter of this manual for important information concerning your tape drive before doing the autochanger testing.

Testing the Autochanger and Adapting Your mtx-changer Script

Before attempting to use the autochanger with Bacula, it is preferable to "hand-test" that the changer works. To do so, we suggest you do the following commands (assuming that the mtx-changer script is installed in /etc/bacula/mtx-changer):

Make sure Bacula is not running.

/etc/bacula/mtx-changer /dev/sg0 list 0 /dev/nst0 0
This command should print:

   1:
   2:
   3:
   ...

or one number per line for each slot that is occupied in your changer, and the number should be terminated by a colon (:). If your changer has barcodes, the barcode will follow the colon. If an error message is printed, you must resolve the problem (e.g. try a different SCSI control device name if /dev/sg0 is incorrect. For example, on FreeBSD systems, the autochanger SCSI control device is generally /dev/pass2.

/etc/bacula/mtx-changer /dev/sg0 slots 0 /dev/nst0 0
This command should return the number of slots in your autochanger.

/etc/bacula/mtx-changer /dev/sg0 unload
If a tape is loaded, this should cause it to be unloaded.

/etc/bacula/mtx-changer /dev/sg0 load 3 /dev/nst0 0
Assuming you have a tape in slot 3, it will be loaded into the read slot (0).

/etc/bacula/mtx-changer /dev/sg0 loaded 0 /dev/nst0 0
It should print "3"

/etc/bacula/mtx-changer /dev/sg0 unload

Once all the above commands work correctly, assuming that you have the right Changer Command in your configuration, Bacula should be able to operate the changer. The only remaining area of problems will be if your autoloader needs some time to get the tape loaded after issuing the command. After the mtx-changer script returns, Bacula will immediately rewind and read the tape. If Bacula gets rewind I/O errors after a tape change, you will probably need to insert a sleep 20 after the mtx command, but be careful to exit the script with a zero status by adding exit 0 after any additional commands you add to the script. This is because Bacula checks the return status of the script, which should be zero if all went well.

You can test whether or not you need a sleep by putting the following commands into a file and running it as a script:

#!/bin/sh
/etc/bacula/mtx-changer /dev/sg0 unload
/etc/bacula/mtx-changer /dev/sg0 load 3
mt -f /dev/st0 rewind
mt -f /dev/st0 weof

If the above script runs, you probably have no timing problems. If it does not run, start by putting a sleep 30 or possibly a sleep 60 in the script just after the mtx-changer load command. If that works, then you should move the sleep into the actual mtx-changer script so that it will be effective when Bacula runs.

A second problem that comes up with a small number of autochangers is that they need to have the cartridge ejected before it can be removed. If this is the case, the load 3 will never succeed regardless of how long you wait. If this seems to be your problem, you can insert an eject just after the unload so that the script looks like:

#!/bin/sh
/etc/bacula/mtx-changer /dev/sg0 unload
mt -f /dev/st0 offline
/etc/bacula/mtx-changer /dev/sg0 load 3
mt -f /dev/st0 rewind
mt -f /dev/st0 weof

Obviously, if you need the offline command, you should move it into the mtx-changer script ensuring that you save the status of the mtx command or always force an exit 0 from the script, because Bacula checks the return status of the script.

As noted earlier, there are several scripts in <bacula-source>/examples/devices that implement the above features, so they may be a help to you in getting your script to work.

If Bacula complains "Rewind error on /dev/nst0. ERR=Input/output error." you most likely need more sleep time in your mtx-changer before returning to Bacula after a load command has been completed.

Using the Autochanger

Let's assume that you have properly defined the necessary Storage daemon Device records, and you have added the Autochanger = yes record to the Storage resource in your Director's configuration file.

Now you fill your autochanger with say six blank tapes.

What do you do to make Bacula access those tapes?

One strategy is to prelabel each of the tapes. Do so by starting Bacula, then with the Console program, enter the label command:

./console
Connecting to Director rufus:8101
1000 OK: rufus-dir Version: 1.26 (4 October 2002)
*label

it will then print something like:

Using default Catalog name=BackupDB DB=bacula
The defined Storage resources are:
     1: Autochanger
     2: File
Select Storage resource (1-2): 1

I select the autochanger (1), and it prints:

Enter new Volume name: TestVolume1
Enter slot (0 for none): 1

where I entered TestVolume1 for the tape name, and slot 1 for the slot. It then asks:

Defined Pools:
     1: Default
     2: File
Select the Pool (1-2): 1

I select the Default pool. This will be automatically done if you only have a single pool, then Bacula will proceed to unload any loaded volume, load the volume in slot 1 and label it. In this example, nothing was in the drive, so it printed:

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.
*

You may then proceed to label the other volumes. The messages will change slightly because Bacula will unload the volume (just labeled TestVolume1) before loading the next volume to be labeled.

Once all your Volumes are labeled, Bacula will automatically load them as they are needed.

To "see" how you have labeled your Volumes, simply enter the list volumes command from the Console program, which should print something like the following:

*{\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 Support

Bacula provides barcode support with two Console commands, label barcodes and update slots.

The label barcodes will cause Bacula to read the barcodes of all the cassettes that are currently installed in the magazine (cassette holder) using the mtx-changer list command. Each cassette is mounted in turn and labeled with the same Volume name as the barcode.

The update slots command will first obtain the list of cassettes and their barcodes from mtx-changer. Then it will find each volume in turn in the catalog database corresponding to the barcodes and set its Slot to correspond to the value just read. If the Volume is not in the catalog, then nothing will be done. This command is useful for synchronizing Bacula with the current magazine in case you have changed magazines or in case you have moved cassettes from one slot to another.

The Cleaning Prefix statement can be used in the Pool resource to define a Volume name prefix, which if it matches that of the Volume (barcode) will cause that Volume to be marked with a VolStatus of Cleaning. This will prevent Bacula from attempting to write on the Volume.

Bacula Autochanger Interface

Bacula calls the autochanger script that you specify on the Changer Device statement. Normally this script will be the mtx-changer script that we can provide, but it can in fact be any program. The only requirements are that the "commands" that Bacula uses are loaded, load, unload, list, and slots. In addition, each of those commands must return the information in the precise format as specified below:

- Currently the changer commands used are:
    loaded -- returns number of the slot that is loaded, base 1,
              in the drive or 0 if the drive is empty.
    load   -- loads a specified slot (note, some autochangers
              require a 30 second pause after this command) into
              the drive.
    unload -- unloads the device (returns cassette to its slot).
    list   -- returns one line for each cassette in the autochanger
              in the format <slot>:<barcode>. Where
              the {\bf slot} is the non-zero integer representing
              the slot number, and {\bf barcode} is the barcode
              associated with the cassette if it exists and if you
              autoloader supports barcodes. Otherwise the barcode
              field is blank.
    slots  -- returns total number of slots in the autochanger.

Bacula checks the exit status of the program called, and if it is zero, the data is accepted. If the exit status is non-zero, Bacula ignores any information returned and treats the drive as if it is not an autochanger.


Librairies supportées


Modèles de librairies supportés

J'hésite à qualifier ces librairies de "supportées", car les seules en ma possession et que je peux tester sont une HP SureStore DAT40X6 et une Overland PowerLoader LTO-2. Toutes les autres librairies citées ici ont été raportées comme fonctionnant avec Bacula par des utilisateurs. Notez que dans la colonne Capacité/Slot, je précise la capacité compressée par cartouche (ou slot).

OS Fabr. Media Modèle 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 Dell DLT VI,LTO-2 PowerVault 122T/132T/136T - 100GB
Linux Dell LTO-2 PowerVault 124T - 200GB
- DFSMS ?? VM RMM - ??
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
z/VM IBM ?? IBM Tape Manager - ??
z/VM IBM ?? native tape - ??
Linux IBM LTO IBM 3581 Ultrium Tape Loader 7 200/400GB
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


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


Examples

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.


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 examples of how I (Kern) configure my system, 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 NSF 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)
*{\bf 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): {\bf 5}
The defined Client resources are:
     1: Minimatou
     2: Rufus
     3: Timmy
Select Client (File daemon) resource (1-3): {\bf 2}
The defined FileSet resources are:
     1: Kerns 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: /
$ {\bf done}
84 files selected to restore.
Run Restore job
JobName:    kernsrestore
Bootstrap:  /home/kern/bacula/working/restore.bsr
Where:      /tmp/bacula-restores
FileSet:    Kerns Files
Client:     Rufus
Storage:    File
JobId:      *None*
OK to run? (yes/mod/no): {\bf no}
{\bf quit}
(in a shell window)
{\bf 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 cound 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:

{\bf update}
Update choice:
     1: Volume parameters
     2: Pool from resource
     3: Slots from autochanger
Choose catalog item to update (1-3): {\bf 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: {\bf 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): {\bf 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: {\bf 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): {\bf 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): {\bf 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): {\bf 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:

{\bf 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.


How to Excude File 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). It could be usefull 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 scrips 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 "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 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:

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 it's 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 effectivly 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 are not set to do so. Using the Maximum Concurrent Jobs directive, you have a lot of control over how many jobs can run at the same time, and which jobs can run simultaneously. The downside is that it can be a bit tricky to set it up for the first time as you need to set the concurrency in at least five different places.

The Director, the File daemon, and the Storage daemon each have a Maximum Concurrent Jobs directive that determines overall number of concurrent jobs the daemon will run. The default is one for the Director and ten for both the File daemon and the Storage daemon, so assuming you will not be running more than ten concurrent jobs, the only changes that are needed are in the Director's conf file (bacula-dir.conf).

Within the Director's configuration file, Maximum Concurrent Jobs can be set in the Direct, Job, Client, and Storage resources. Each one must be set properly, according to your needs, otherwise your jobs may be run one at a time.

For example, if you want two different jobs to run simultaneously backing up the same Client to the same Storage device, they will run concurrentl 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 carefully test your multiple concurrent backup including doing thorough 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 has been 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.

Summary of Steps to Take to 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. 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
    

  2. 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).
  3. 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.

  4. 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 appopriate mtx command, or press the autochanger buttons to change the tape when requested to do so.
  5. FreeBSD users, run the tapetest program, and make sure your system is patched if necessary. See below for more details.
  6. Run Bacula, and backup a reasonably small directory, say 60 Megabytes. Do three successive backups of this directory.
  7. Stop Bacula, then restart it. Do another full backup of the same directory. Then stop and restart Bacula.
  8. 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.

  9. 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.

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 2 minutes (default) 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 and 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 phsical names, the utility program will compare the name you entered to the Device names (rather than the Archive device names). 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. Please see below for help on resolving that.

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:

cat /proc/scsi/scsi

For example, I get the following:

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.

  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 during btape Testing

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.

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 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.

Checking and Setting 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.

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.

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
}

Determining What Tape Drives and Autochangers You Have 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 Compresson 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 to Tape 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 Filemarks with count = 8388607 is used. In the other case, SCSI SPACE End-of-data 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 MTOED.

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.

Considering Hardware End of Medium = no and Fast Forward Space File = no When I set the two to no, file positioning was very slow on my LTO-3:

  HEOM = no, FFSF = no:  ~ 10 - 100 minutes
\end{verbatime}

while even with {\bf Hardware End of Medium = no} but
{\bf Fast Forward Space File = yes}, the time is 10 to
100 times faster.
\begin{verbatim}
  HEOM = no, FFSF = yes: ~ 1 minute

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*.


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

General

At the current time only the File daemon or Client program has been tested on Windows. As a consequence, when we speak of the Windows version of Bacula below, we are referring to the File daemon only.

The Windows version of the Bacula File daemon has been tested on Win98, WinMe, WinNT, and Win2000 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 Cygwin of Bacula (1.32 or lower) installed, you should stop the service, uninstall it, and remove the Bacula installation directory possibly saving your bacula-fd.conf file for use with the new version you will install. The new native version of Bacula has far fewer files than the old Cygwin version, so it is better to start with a clean directory.

Finally, proceed with the installation.

That should complete the installation process. When the Bacula File Server is ready to serve files, an icon representing a cassette (or tape) will appear in the system tray ; right click on it and a menu will appear.

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 , and if there is an error, the holes in the cassette icon will change to red .

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 c:\bacula\bin\bacula-fd.conf to ensure that it corresponds to your configuration.

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

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 c:\bacula\bin\bacula-fd.conf 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.

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.
   cd c:\bacula\bin
   bacula-fd -t >out
   type out

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:

   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.

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.

Windows Compatibility Considerations

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.

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 (a major disaster for backup programs on Windows), 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. This restriction is mentioned for completeness, but in practice should not create any problems.

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)

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.

Important Note!! Under the current implementation, you may only run a single job at a time in any Win32 File daemon that has VSS active. Running multiple simultanous jobs in the File daemon will most likely cause jobs to fail. This restriction does not apply to the Director, Storage daemons, or any File daemons not running VSS.

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.

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]

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.

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:

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.

    You should see something like this:

  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).

  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.

  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.

Windows 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 wx-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 are not supported. This may be possible in a future version.

Command Line Options Specific to the Bacula Windows File Daemon (Client)

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:

/servicehelper
Run the service helper application (don't use this it is deprecated.).

/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, no luck. Apparently an "emergency boot" disk allowing access to the full system API without interference does not exist.

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 CDROM

The remainder of this section concerns recovering a Linux computer, and parts of it relate to the Red Hat version of Linux. 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.

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. One place you can find the rescue files is in the Source Forge Bacula CVS 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 build of the rescue disk 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/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

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.

You should probably make a new rescue CDROM each time you make any major updates to your kernel, and every time you upgrade a major version of Bacula.

The whole process with the exception of burning the CDROM is done with the following commands:

(Build a working version of Bacula in the
 bacula-source directory)
cd <bacula-source>
./configure (your options)
make
cd <bacula-rescue-source>
./configure --with-bacula=<path-to-bacula-source>
cd linux/cdrom
su (become root)
make all

The above instructions were for building the rescue CDROM from a bacula-rescue release. You will note that you need to do a separate ./configure in the rescue source directory and that you need to provide it the path to the Bacula source so that it can build a statically linked File daemon.

For users of the bacula-rescue rpm the static bacula-fd has already been built and placed in /etc/bacula/rescue/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/cdrom
su (become root)
make all

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 all" 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/cdromdirectory for instructions on changing the contents of the CDROM.

At the current time, the size of the CDROM is about 50MB (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, ...

You may also use:

make copy-static-bacula

which is similar to a "make all" except that instead of trying to build the static File daemon from the Bacula source, it will assume that you have already installed a static copy of the FD in the sbindir location (usually /usr/local/sbin), and will copy it from there.

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 Two or More 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 (your options)
make
cd <bacula-rescue-source>
./configure --with-bacula=<path-to-bacula-source>
cd linux/cdrom
su (become root)
make all
exit

Again, for rpm package users the above command set would be:

ssh client2
cd /etc/bacula/rescue/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 roottree
cp -a $c/roottree/bacula-client2 cdtree
make all
make burn
exit

And with the rpm package:

cd /etc/bacula/rescue/cdrom
su
(enter root password)
c=/mnt/client2/etc/bacula/rescue/cdrom
cp -a $c/roottree/bacula-client2 roottree
cp -a $c/roottree/bacula-client2 cdtree
make all
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 roottree so it is available in memory after booting, and we also copied it into the 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 1.1.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:

Welcome to the Bacula Rescue CDROM
2.4.21-15.0.4.EL #1 Wed Aug 4 03:08:03 EDT 2004
Please login using root and your root password ...
RescueCD login:

Note, you must enter the root password for the system on which you loaded the kernel or on which you did the build of the CDROM. Once you are logged in, you will be in the home directory for root, 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.

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.

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. 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.

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.

  2. Move your server to 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:

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.

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 particions 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.

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.

Resetting Directory and File 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.


Disaster Recovery Using a Bacula Rescue Floppy

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, no luck. Apparently an ``emergency boot'' disk allowing access to the full system API without interference does not exist.

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 Floppy Recovery on Linux with a Bacula Floppy Rescue Disk

Since floppies are being used less and less, the Bacula Floppy rescue disk is deprecated, which means that it is no longer really supported. For those of you who have or need floppy rescue, we include the recovery instructions here for your reference.

The remainder of this section concerns recovering a Linux computer using a floppy, and parts of it relate to the Red Hat version of Linux.

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.

Bare Metal Recovery assumes that you have the following four items for your system:

Restrictions

In addition, to the above assumptions, the following conditions or restrictions apply:

Directories

If you are building a self-contained Bacula Rescue CDROM, you will find the necessary scripts in rescule/linux/cdrom subdirectory of the Bacula source code.

If you wish to build the Bacula Rescue floppy disk, the scripts discussed below can be found in the rescue/linux/floppy subdirectory of the Bacula source code.

Preparation for a Bare Metal Recovery

There are two things you should do immediately on all (Linux) systems for which you wish to do a bare metal recovery:

  1. Create a system emergency boot disk or alternatively a system installation boot floppy. This step can be skipped if you have an Installation CDROM and your machine will boot from CDROM (most modern computers will).
  2. Create a Bacula Rescue floppy, which captures the current working state of your computer and creates scripts to restore it. In addition, it creates a statically linked version of the Bacula File daemon (Client) program, which is key to successfully restoring from scratch.

Creating an Emergency Boot Disk

Here you have several choices:

tomsrtbt:

If you have created a Bacula Rescue CDROM, you can skip this section.

If you *must* use a boot floppy, my preference is to create and use a tomsrtbt emergency boot disk because it gives you a very clean Linux environment (with a 2.2 kernel) and the most utilities. See http://www.toms.net/rb/ for more details on this. It is very easy to do and well worth the effort. However, I recommend that you create both especially if you have non-standard hardware. You may find that tomsrtbt will not work with your network driver (he surely has one, but you must explicitly put it on the disk), whereas the Linux rescue is more likely to work.

Emergency Boot Disk:

If you have created a Bacula Rescue CDROM, you can skip this section.

To create a standard Linux emergency boot disk you must first know the name of the kernel, which you can find with:

  ls -l /boot

and looking on the vmlinux-... line or alternative do an

 uname -a

then become root and with a blank floppy in the drive, enter the following command:

  mkbootdisk --device /dev/fd0 2.4.18-18

where you replace ``2.4.18-18'' by your system name.

This disk can then be booted and you will be in an environment with a number of important tools available. Some disadvantages of this environment as opposed to tomsrtbt are that you must enter linux rescue at the boot prompt or the boot will fail without a hard disk; it requires a disk boot image or a CDROM to be mounted, if the CDROM is released, you will loose a large number of the tools.

Red Hat Installation Disk:

If you have created a Bacula Rescue CDROM, you can skip this section.

Specific to Red Hat Linux, is to create an Installation floppy, which can also be used as an emergency boot disk. The advantage of this method is that it works in conjunction with the installation CDROM and hence during the first part of restoring the system, you have a much larger number of tools available (on the CDROM). This can be extremely useful if you are not sure what really happened and you need to examine your system in detail.

To make a Red Hat Linux installation disk, do the following:

mount the Installation CDROM (/mnt/cdrom)
cd /mnt/cdrom/images
dd if=boot.img of=/dev/fd0 bs=1440k

Now that you have either an emergency boot disk or an installation floppy, you will be able to reboot your system in the absence of your hard disk or with a damaged hard disk. This method has the same disadvantages compared to tomsrtbt disk as mentioned above for the Emergency Boot Disk.

Creating a Bacula Rescue Disk

If you have created a Bacula Rescue CDROM, this step will be automatically done for you.

Simply having a boot disk is not sufficient to re-create things as they were. To solve this problem, we will create a Bacula Rescue disk. Everything that will be written to this disk will first be placed into the <bacula-src>/rescue/linux directory.

The first step is while your system is up and running normally, you use a Bacula script called getdiskinfo to capture certain important information about your hard disk configuration (partitioning, formatting, mount points, ...). getdiskinfo will also create a number of scripts using the information found that can be used in an emergency to repartition your disks, reformat them, and restore a statically linked version of the Bacula file daemon so that your disk can be restored from within a minimal boot environment.

The first step is to run getdiskinfo as follows:

   su
   cd <bacula-src>/rescue/linux
   ./getdiskinfo

getdiskinfo works for either IDE or SCSI drives and recognizes both ext2 and ext3 file systems. If you wish to restore other file systems, you will need to modify the code. This script can be run multiple times, but really only needs to be run once unless you change your hard disk configuration.

Assuming you have a single hard disk on device /dev/hda, getdiskinfo will create the following files:

partition.hda
This file contains the shell commands to repartition your hard disk drive /dev/hda to the current state. If you have additional drives (e.g. /dev/hdc), you will find one of these files for each drive. DO NOT EXECUTE THIS SCRIPT UNLESS YOU WANT YOUR HARD DISK REPARTITIONED

format.hda
This file contains the shell commands that will format each of the partitions on your hard drive. It knows about ext2, ext3, and swap partitions. All other partitions, you must manually format. It is recommended that any Microsoft partitions be partitioned with Microsoft's format command rather than using Unix tools. DO NOT EXECUTE THIS SCRIPT UNLESS YOU WANT YOUR HARD DISK REFORMATTED

mount_drives
This script will mount all ext2 and ext3 drives that were previously mounted. They will be mounted on

/mnt/drive/. This is used just before running the statically linked Bacula so that it can access your drives for the restore.

restore_bacula
This script will restore the File daemon from the Bacula Rescue disk. Building the Bacula Rescue disk will be described later. This will provide your emergency boot environment with a Bacula file daemon. Note, this is a special statically linked version of the file daemon (i.e. it does not need or use shared libraries).

start_network
This script will start your network using the simplest possible commands. You will need to verify that the IP address used in this script is correct. In addition, if you have several ethernet cards, you may need to make other modifications to this script.

sfdisk
This is the program that will repartition your hard disk, and it is normally found in /sbin/sfdisk. It is placed in this directory so that it will be included on the rescue disk as it is not normally available with all emergency boot environments.

sfdisk.gz
This is the version of sfdisk that works with tomsrtbt. The standard sfdisk described above will not run under tomsrtbt.

The getdiskinfo program (actually a shell script) will also create a subdirectory named diskinfo, which contains the following files:

df.bsi
disks.bsi
fstab.bsi
ifconfig.bsi
mount.bsi
mount.ext2.bsi
mount.ext3.bsi
mtab.bsi
route.bsi
sfdisk.disks.bsi
sfdisk.hda.bsi
sfdisk.make.hda.bsi

Each of these files contains some important piece of information (sometimes redundant) about your hard disk setup or your network. Normally, you will not need this information, but it will be written to the Bacula Rescue disk just in case. Since it is normally not used, we will leave it to you to examine those files at your leisure.

Building a Static File Daemon:

If you have created a Bacula Rescue CDROM, this step will be automatically done for you.

The second of the three steps in creating your Bacula Rescue disk is to build a static version of the File daemon. Do so by either configuring Bacula as follows or by allowing the make_rescue_disk script described below make it for you:

cd <bacula-src>
./configure <normal-options>
make
cd src/filed
make static-bacula-fd
strip static-bacula-fd
cp static-bacula-fd ../../rescue/linux/bacula-fd
cp bacula-fd.conf ../../rescue/linux

Note, above, we built static-bacula-fd and changed its name to bacula-fd when copying it to the rescue/linux directory.

Finally, in <bacula-src>/rescue/linux, ensure that the WorkingDirectory and PIDDirectory both point to reasonable locations on a stripped down system. If you are using tomsrtbt you will also want to replace machine names with IP addresses since there is no resolver running. With the Linux Rescue disk, network address mapping seems to work. Don't forget that at the time this version of the Bacula File daemon runs, your file system will not be restored. In my bacula-fd.conf, I use /var/working.

Writing the Bacula Rescue Floppy:

When you have everything you need (output of getdiskinfo, Bacula File daemon, ...), you create your rescue floppy by putting a blank tape into your floppy disk drive and entering:

su
./make_rescue_disk

This script will reformat the floppy and write everything in the current directory and all files in the diskinfo directory to the floppy. If you supply the appropriate command line options, it will also build a static version of the Bacula file daemon and copy it along with the configuration file to the disk. Also using a command line option, you can make it write a compressed tar file containing all the files whose names are in backup.etc.list to the floppy. The list as provided contains names of files in /etc that you might need in a disaster situation. It is not needed, but in some cases such as a complex network setup, you may find it useful.

Options for make_rescue_disk:

The following command line options are available for the make_rescue_disk script:

Usage: make_rescue_disk
  -h, --help             print this message
  --make-static-bacula   make static File daemon and add to diskette
  --copy-static-bacula   copy static File daemon to diskette
  --copy-etc-files       copy files in etc list to diskette

Briefly the options are:

--make-static-bacula
If this option is specified, the script will assume that you have already configured and built Bacula. It will then proceed to build a statically linked version and copy it along with bacula-fd.conf to the current directory, then write it to the rescue disk.

--copy-static-bacula,/dt>
If this option is given, the script will assume that you already have a copy of the statically linked Bacula in the current directory named bacula-fd as well as the configuration script. They will then be written to the rescue disk.

--copy-etc-files
If this option is specified, the script will tar the files in backup.etc.list and write them to the rescue disk.

Please examine the contents of the rescue floppy to ensure that it has everything you want and need. If not modify the scripts as necessary and re-run it until it is correct.

Now that you have both a system boot floppy and a Bacula Rescue floppy, assuming you have a full backup of your system made by Bacula, you are ready to handle nearly any kind of emergency restoration situation.

Restoring Your Linux Client with a Floppy

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. An emergency boot floppy (preferably tomsrtbt)
  3. A Bacula Rescue Floppy Disk
  4. 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 Emergency Floppy
  2. Mount your Bacula Rescue floppy
  3. Start the Network (local network)
  4. Re-partition your hard disk(s) as it was before
  5. Re-format your partitions
  6. Restore the Bacula File daemon (static version)
  7. Perform a Bacula restore of all your files
  8. Re-install your boot loader
  9. Reboot

Now for the details ...

Boot with your Emergency Floppy

First you will boot with your emergency floppy. If you use the Installation floppy described above, when you get to the boot prompt:

boot:

you enter linux rescue.

If you are booting from tomsrtbt simply enter the default responses.

When your machine finishes booting, you should be at the command prompt possibly with your hard disk mounted on /mount/sysimage (Linux emergency only). To see what is actually mounted, use:

df

Mount your Bacula Rescue Floppy:

Make sure that the mount point /mnt/floppy exists. If not, enter:

mkdir -p /mnt/floppy

the mount your Bacula Rescue disk and cd to it with:

mount /dev/fd0 /mnt/floppy
cd /mnt/floppy

To simplify running the scripts make sure the current directory is on your path by:

PATH=$PATH:.

Start the Network:

At this point, you should bring up your network. Normally, this is quite simple and requires just a few commands. If you have booted from your Bacula Rescue CDROM, 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:

./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.

Unmount Your Hard Disk (if mounted):

When you are sure you want to repartition your disk, normally, if your disk was damaged or if you are using tomsrtbt your hard disk will not be mounted. However, if it is you must first unmount it so that it is not in use. Do so by entering df and then enter the correct commands to unmount the disks. For example:

umount /mnt/sysimage/boot
umount /mnt/sysimage/usr
umount /mnt/sysimage/proc
umount /mnt/sysimage/

where you explicitly unmount (umount) each sysimage partition and finally, the last one being the root. Do another df command to be sure you successfully unmount all the sysimage partitions.

This is necessary because sfdisk will refuse to partition a disk that is currently mounted. As mentioned, this should never be necessary with tomsrtbt.

Partition Your Hard Disk(s):

If you are using tomsrtbt, you will need to do the following steps to get the correct sfdisk:

rm -f sfdisk
bzip2 -d sfdisk.bz2

Do not do the above steps if you are using a standard Linux boot disk or the Bacula Rescue CDROM.

Then proceed with partitioning your hard disk by:

./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):

After partitioning your disk, you must format it appropriately. The formatting script will put back swap partitions, normal Unix partitions (ext2) and journaled partitions (ext3). 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 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.

Unmount the CDROM:

Next, if you are using the Red Hat installation disk, unmount the CDROM drive by doing:

umount /mnt/cdrom

This is not necessary if you are running tomsrtbt. In doing this, I find it is always busy, and I haven't figured out how to unmount it (Linux boot only).

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 with be in the /bacula-hostname/bin directory. Please skip the following paragraph and continue with editing the Bacula configuration file.

If you have not used a Bacula Rescue CDROM, now change (cd) to some directory where you want to put the image of the Bacula File daemon. I use the tmp directory my hard disk (mounted as /mnt/disk/tmp) because it is easy. Then install into the current directory Bacula by running the restore_bacula script from the floppy drive. For example:

cd /mnt/disk
mkdir -p /mnt/disk/tmp
mkdir -p /mnt/disk/tmp/working
/mnt/floppy/restore_bacula
ls -l

Make sure bacula-fd and bacula-fd.conf are both there.

Edit the Bacula configuration file, create the working/pid/subsys directory if you haven't already done so above, and start Bacula by entering:

chroot /mnt/disk /tmp/bacula-fd -c /tmp/bacula-fd.conf

The above command starts the Bacula File daemon with your 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.

Restoring using the RedHat Installation Disk:

Suppose your system was damaged for one reason or another, so that the hard disk and the partitioning and much of the filesystems are intact, but you want to do a full restore. If you have booted into your system with the RedHat Installation Disk by specifying linux rescue at the boot: prompt, you will find yourself in a shell command with your disks already mounted (if it was possible) in /mnt/sysimage. In this case, you can do much like you did above to restore your system:

cd /mnt/sysimage/tmp
mkdir -p /mnt/sysimage/tmp/working
/mnt/floppy/restore_bacula
ls -l

Make sure that bacula-fd and bacula-fd.conf are both in the current directory and that the directory names in the bacula-fd.conf correctly point to the appropriate directories. Then start Bacula with:

chroot /mnt/sysimage /tmp/bacula-fd -c /tmp/bacula-fd.conf

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. 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.

Reboot:

Reboot your machine by entering exit until you get to the main prompt then enter ctl-d.

If everything went well, you should now be back up and running. If not, re-insert the emergency boot floppy, boot, and figure out what is wrong.

At this point, you will probably want to remove the temporary copy of Bacula that you installed. Do so with:

rm -f /bacula-fd /bacula-fd.conf
rm -rf /working

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.

Bugs

When performing the bare metal recovery using the Red Hat emergency boot disk (actually the installation boot disk), I was never able to release the cdrom, and when the system came up /mnt/cdrom was soft linked to /mnt/disk/dev/hdd, which is not correct. I fixed this in each case by deleting and simply remaking it with mkdir -p /mnt/cdrom.

tomsrtbt

This is a single floppy (1.722Meg) that really has A LOT of software. For example, by default (version 2.0.103) you get:

AHA152X AHA1542 AIC7XXX BUSLOGIC DAC960 DEC_ELCP(TULIP) EATA EEXPRESS/PRO/PRO100 EL2 EL3 EXT2 EXT3 FAT FD IDE-CD/DISK/TAPE IMM INITRD ISO9660 JOLIET LOOP MATH_EMULATION MINIX MSDOS NCR53C8XX NE2000 NFS NTFS PARPORT PCINE2K PCNET32 PLIP PPA RTL8139 SD SERIAL/_CONSOLE SLIP SMC_ULTRA SR ST VFAT VID_SELECT VORTEX WD80x3 .exrc 3c589_cs agetty ash badblocks basename boot.b buildit.s busybox bz2bzImage bzip2 cardmgr cardmgr.pid cat chain.b chattr chgrp chmod chown chroot clear clone.s cmp common config cp cpio cs cut date dd dd-lfs debugfs ddate df dhcpcd-- dirname dmesg domainname ds du dumpe2fs e2fsck echo egrep elvis ex false fdflush fdformat fdisk filesize find findsuper fmt fstab grep group gunzip gzip halt head hexdump hexedit host.conf hostname hosts httpd i82365 ifconfig ile init inittab insmod install.s issue kernel key.lst kill killall killall5 ld ld-linux length less libc libcom_err libe2p libext2fs libtermcap libuuid lilo lilo.conf ln loadkmap login ls lsattr lsmod lua luasocket man map md5sum miterm mkdir mkdosfs mke2fs mkfifo mkfs.minix mknod mkswap more more.help mount mt mtab mv nc necho network networks nmclan_cs nslookup passwd pax pcmcia_core pcnet_cs pidof ping poweroff printf profile protocols ps pwd rc.0 rc.S rc.custom rc.custom.gz rc.pcmcia reboot rescuept reset resolv.conf rm rmdir rmmod route rsh rshd script sed serial serial_cs services setserial settings.s sh shared slattach sleep sln sort split stab strings swapoff swapon sync tail tar tcic tee telnet telnetd termcap test tomshexd tomsrtbt.FAQ touch traceroute true tune2fs umount undeb-- unpack.s unrpm-- update utmp vi vi.help view watch wc wget which xargs xirc2ps_cs yecho yes zcat

In addition, at Tom's Web Site, you can find a lot of additional kernel drivers and other software (such as sdisk, which is used by Bacula.

Building his floppy is a piece of cake. Simply download his .tar.gz file then:

- detar the .tar.gz archive
- become root
- cd to the tomsrtbt-<version> directory
- load a blank floppy with no bad sectors
- ./install.s


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.


Considérations sur la sécurité de Bacula

Compatibilité ascendante

L'un des principaux objectifs de Bacula est de garantir que vous pouvez restaurer depuis des cartouches (ou depuis des volumes disque) écrites des années auparavant. Ceci implique que chaque nouvelle version de Bacula devrait être capable de relire les anciens formats de cartouches. Le premier problème est de s'assurer que le matériel fonctionne encore malgré les années, et que les supports sont encore valides. Ensuite, votre système d'exploitation doit être capable de s'interfacer avec le périphérique et finalement, Bacula doit être capable de reconnaître les anciens formats. De tous ces problèmes, nous ne pouvons prendre en charge que le dernier, pour les autres, vous devez vous préparer consciencieusement.

Depuis les tous premiers stades de Bacula (janvier 2000) jusqu'à aujourd'hui (Décembre 2005), Bacula a connu deux formats majeurs d'écriture sur les cartouches. Le second format a été introduit dans la version 1.27 en novembre 2002, et n'a pas changé depuis. En principe, Bacula devrait encore pouvoir lire le format d'origine, mais j'avoue ne pas avoir essayé depuis longtemps...

Bien que le format des cartouches soit fixé, les types de données qui peuvent être écrites sur les cartouches sont extensibles, ce qui nous a permis d'ajouter de nouvelles fonctionnalités telles que les ACLs, les données Win32, les données chiffrées... Naturellement, une ancienne version de Bacula ne saurait lire des nouveaux flux de données, mais chaque nouvelle version de Bacula est en principe capable de lire les anciens flux.

Si vous voulez être absolument certain de pouvoir lire vos vieilles cartouches, vous devriez :

1. Essayer de lire les vieilles cartouches de temps en temps, une fois par an par exemple.

2. Conserver une copie statiquement liée de chaque version de Bacula que vous avez utilisée en production. Ainsi, si pour quelque raison nous venions à abandonner la compatibilité avec les anciens formats de cartouches, vous pourriez toujours remettre en service une vieille copie de Bacula...

Le second point est probablement excessif, en toute rigueur, il pourrait vous sauver un jour.

Configurer et tester TCP Wrappers

Les TCP Wrappers sont implémentés si vous les activez lors de la configuration (./configure :--:with-tcp-wrappers). Avec ce code activé, vous pourrez contrôler qui peut accéder à vos daemons. Ce contrôle est obtenu par la modification du fichier /etc/hosts.allow. Le nom de programme qu'utilise Bacula pour appliquer ces restrictions est celui que vous avez spécifié dans le fichier de configuration du daemon. Vous ne devez pas utiliser l'option twist dans votre /etc/hosts.allow car elle stopperait les daemons Bacula lorsqu'une connection est refusée.

Dan Languille a fourni les informations suivantes concernant la configuration et les tests de TCP Wrappers avec Bacula.

Si vous lisez hosts_options(5), vous verrez une option nommée twist. Cette option remplace le processus courant par une instance de la commande shell spécifiée. Voici un exemple typique de son utilisation :

ALL : ALL \
 : severity auth.info \
 : twist /bin/echo "Vous n'\^etes pas autoris\'e \`a utiliser %d depuis %h."

Le code libwrap tente d'éviter twist s'il est exécuté dans un processus résident. Il en résulte que le processus (e.g. bacula-fd, bacula-sd, bacula-dir) sera stoppé si la première connection à son port provoque l'invocation de l'option twist. Le risque est qu'une attaque provoque l'arrêt des daemons. Cette situation est évitée si votre fichier /etc/hosts.allow contient un jeu de règles approprié. L'exemple suivant est suffisant :

undef-fd : localhost : allow
undef-sd : localhost : allow
undef-dir : localhost : allow
undef-fd : ALL : deny
undef-sd : ALL : deny
undef-dir : ALL : deny

Vous devez accorder les noms des daemons à ceux de leurs fichiers de configuration respectifs. Dans ces exemples, le Director est undef-dir, le Storage Daemon est undef-sd, et le File Daemon est undef-fd. Ajustez pour coller à votre configuration. L'exemple de règles ci-dessus suppose que SD, FD et DIR sont tous sur la même machine. Si vous avez un client FD distant, il vous suffira de placer le jeu de règles suivant sur ce client :

undef-fd : director.example.org : allow
undef-fd : ALL : deny

Où director.example.org est l'hôte qui contactera le client (i.e. la machine sur laquelle le Bacula Director tourne). L'usage de "ALL : deny" assure que l'option twist (si présente) n'est pas invoquée. Pour tester correctement votre configuration, démarrez le(s) daemon(s), puis essayez de vous y connecter depuis une adresse IP qui devrait être capable de le faire. Vous devriez voir quelque chose comme :

$ telnet undef 9103
Trying 192.168.0.56...
Connected to undef.example.org.
Escape character is '^]'.
Connection closed by foreign host.
$

C'est la réponse correcte. Si vous voyez ceci :

$ 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.
$

Alors, twist a été invoquée, et votre configuration est incorrecte. vous devez ajouter la directive "deny". Il est important de noter que vos tests doivent inclure le redémarrage des daemons après chaque tentative de connexion. Vous pouvez aussi tcpdchk(8) et tcpdmatch(8) pour valider jeu de règles /etc/hosts.allow. Voici un test simple avec 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

Si vous exécutez Bacula en tant que standalone daemon, les avertissements ci-dessus peuvent être ignorés sans scrupules. Voici un exemple qui révèle que "deny" fait defaut à vos règles, et que l'option twist a été invoquée.

$ 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

Executer Bacula sans être root

Voici quelques recommandations de Dan Languille :

C'est une bonne idée d'exécuter vos daemons avec des privilèges aussi faibles que possible. En d'autres termes, si vous pouvez, n'exécutez pas d'applications en tant que root si elle n'ont pas besoin d'être exécutées en tant que root. Le Storage Daemon et le Director Daemon n'ont pas besoin d'être exécutés en tant que root. Le File Daemon en a besoin pour accéder à l'ensemble des fichiers du système. Pour vous passer des privilèges root, il vous faut créer un utilisateur et un groupe. Choisir bacula pour l'un et l'autre me semble une bonne idée.

Le port FreeBSD crée cet utilisateur et ce groupe pour vous. (En fait, au moment ou j'écris ces lignes, ce n'est pas encore le cas, mais ça le sera bientôt). Voici à quoi ressemblent ces entrées sur mon portable FreeBSD :

bacula:*:1002:1002::0:0:Bacul Daemon:/var/db/bacula:/sbin/nologin

J'ai utilisé vipw pour créer ces entrées. J'ai utilisé un User ID et un Group ID disponibles sur mon système : 1002.

J'ai aussi créé un groupe dans /etc/group:

bacula:*:1002:

L'utilisateur bacula, contrairement au daemon Bacula, aura un répertoire dédié (home directory) : /var/db/bacula qui est le répertoire standard pour le catalogue de Bacula.

A présent, vous avez un utilisateur et un groupe bacula, et vous pouvez sécuriser le répertoire dédié de bacula en utilisant cette commande :

chown -R bacula:bacula /var/db/bacula/

Celle-ci assure que seul l'utilisateur bacula peut accéder à ce répertoire. Elle signifie aussi que si nous exécutons le Director et le Storage Daemon en tant que bacula, ces daemons auront aussi des accès restreints. Ce ne serait pas le cas s'ils étaient exécutés en tant que root.

Il est important de noter que le Storage Daemon a vraiment besoin d'appartenir au groupe operator pour un accès normal aux lecteurs de bandes. (au moins sur FreeBSD, c'est ainsi que les choses sont configurées par défaut). De tels périphériques sont en principe attribués à root:operator. Il est plus facile et moins dangereux de faire de bacula un membre de ce groupe que de jouer avec les permissions du système.

Démarrer les daemons bacula

Pour démarrer les daemons bacula sur FreeBSD, utilisez la commande :

/usr/local/etc/rc.d/bacula.sh start

Pour vous assurer que tous fonctionnent :

$ 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 RedHat 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 RedHat 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 = verify=pins1 signature=SHA1 {
     /boot
     /bin
     /sbin
     /usr/bin
     /lib
     /root/.ssh
     /home/kern/.ssh
     /var/named
     /etc/sysconfig
     /etc/ssh
     /etc/security
     /etc/exports
     /etc/rc.d/init.d
     /etc/sendmail.cf
     /etc/sysctl.conf
     /etc/services
     /etc/xinetd.d
     /etc/hosts.allow
     /etc/hosts.deny
     /etc/hosts
     /etc/modules.conf
     /etc/named.conf
     /etc/pam.d
     /etc/resolv.conf
  }
  Exclude = { }
}
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 dependancy for something called /usr/afsws/bin/pagsh.

Answers

  1. How do I build Bacula for platform xxx? The bacula spec file contains defines to build for several platforms: RedHat 7.x (rh7), RedHat 8.0 (rh8), RedHat 9 (rh9), Fedora Core (fc1), Whitebox Enterprise Linux (RHEL) 3.0 (wb3), Mandrake 10.x (mdk) and SuSE 9.x (su9). 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. 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 RedHat 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
            

    to

            %define mysql 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
    

  3. What other defines are used? Two other building defines of note are the depkgs_version and tomsrtbt 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.
  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/). To accomplish this, execute the following command as root:

            chmod -R 777 /usr/src/redhat
    

    If you are working on a shared system where you can not use the method above then you need to recreate the /usr/src/redhat 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
            

  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.

Support for RHEL4, CentOS 4 and x86_64 The examples below explicit build support for RHEL4 (I think) 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.36.2-4.src.rpm

rpmbuild --rebuild \
        --define "build_rhel4 1" \
        --define "build_postgresql 1" \
        bacula-1.36.2-4.src.rpm

rpmbuild --rebuild \
        --define "build_rhel4 1" \
        --define "build_mysql 1" \
        --define "build_mysql4 1" \
        bacula-1.36.2-4.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:
# RedHat builds
--define "build_rh8 1"
--define "build_rh9 1"

# Fedora Core build
--define "build_fc1 1"
--define "build_fc3 1"

# Whitebox Enterprise build
--define "build_wb3 1"

# RedHat Enterprise builds
--define "build_rhel3 1"
--define "build_rhel4 1"

# CentOS build
--define "build_centos4 1"

# SuSE build
--define "build_su9 1"

# Mandrake build
--define "build_mdk 1"

MySQL support:

--define "build_mysql 1"
# if using mysql 4.x define this and mysql above
# currently: Mandrake 10.x, SuSE 9.x, RHEL4
--define "build_mysql4 1"

PostgreSQL support:
--define "build_postgresql 1"

Sqlite support:
--define "build_sqlite 1"


The Bootstrap File

The information in this chapter is provided so that you may either create your own bootstrap files, or so that you can edit a bootstrap file produced by Bacula. However, normally the bootstrap file will be automatically created for you during the restore command in the Console program, or by using a Write Bootstrap record in your Backup Jobs, and thus you will never need to know the details of this file.

The bootstrap file contains ASCII information that permits precise specification of what files should be restored. It is a relatively compact form of specifying the information, is human readable, and can be edited with any text editor.

File Format

The general format of a bootstrap file is:

<keyword>= <value>

Where each keyword and the value specify which files to restore. More precisely the keyword and their values serve to limit which files will be restored and thus act as a filter. The absence of a keyword means that all records will be accepted.

Blank lines and lines beginning with a pound sign (#) in the bootstrap file are ignored.

There are keywords which permit filtering by Volume, Client, Job, FileIndex, Session Id, Session Time, ...

The more keywords that are specified, the more selective the specification of which files to restore will be. In fact, each keyword is ANDed with other keywords that may be present.

For example,

Volume = Test-001
VolSessionId = 1
VolSessionTime = 108927638

directs the Storage daemon (or the bextract program) to restore only those files on Volume Test-001 AND having VolumeSessionId equal to one AND having VolumeSession time equal to 108927638.

The full set of permitted keywords presented in the order in which they are matched against the Volume records are:

Volume
The value field specifies what Volume the following commands apply to. Each Volume specification becomes the current Volume, to which all the following commands apply until a new current Volume (if any) is specified. If the Volume name contains spaces, it should be enclosed in quotes.

Count
The value is the total number of files that will be restored for this Volume. This allows the Storage daemon to know when to stop reading the Volume.

VolFile
The value is a file number, a list of file numbers, or a range of file numbers to match on the current Volume. The file number represents the physical file on the Volume where the data is stored. For a tape volume, this record is used to position to the correct starting file, and once the tape is past the last specified file, reading will stop.

VolBlock
The value is a block number, a list of block numbers, or a range of block numbers to match on the current Volume. The block number represents the physical block on the Volume where the data is stored. This record is currently not used.

VolSessionTime
The value specifies a Volume Session Time to be matched from the current volume.

VolSessionId
The value specifies a VolSessionId, a list of volume session ids, or a range of volume session ids to be matched from the current Volume. Each VolSessionId and VolSessionTime pair corresponds to a unique Job that is backed up on the Volume.

JobId
The value specifies a JobId, list of JobIds, or range of JobIds to be selected from the current Volume. Note, the JobId may not be unique if you have multiple Directors, or if you have reinitialized your database. The JobId filter works only if you do not run multiple simultaneous jobs.

Job
The value specifies a Job name or list of Job names to be matched on the current Volume. The Job corresponds to a unique VolSessionId and VolSessionTime pair. However, the Job is perhaps a bit more readable by humans. Standard regular expressions (wildcards) may be used to match Job names. The Job filter works only if you do not run multiple simultaneous jobs.

Client
The value specifies a Client name or list of Clients to will be matched on the current Volume. Standard regular expressions (wildcards) may be used to match Client names. The Client filter works only if you do not run multiple simultaneous jobs.

FileIndex
The value specifies a FileIndex, list of FileIndexes, or range of FileIndexes to be selected from the current Volume. Each file (data) stored on a Volume within a Session has a unique FileIndex. For each Session, the first file written is assigned FileIndex equal to one and incremented for each file backed up.

This for a given Volume, the triple VolSessionId, VolSessionTime, and FileIndex uniquely identifies a file stored on the Volume. Multiple copies of the same file may be stored on the same Volume, but for each file, the triple VolSessionId, VolSessionTime, and FileIndex will be unique. This triple is stored in the Catalog database for each file.

Slot
The value specifies the autochanger slot. There may be only a single Slot specification for each Volume.

Stream
The value specifies a Stream, a list of Streams, or a range of Streams to be selected from the current Volume. Unless you really know what you are doing (the internals of Bacula, you should avoid this specification.

*JobType
Not yet implemented.

*JobLevel
Not yet implemented.

The Volume record is a bit special in that it must be the first record. The other keyword records may appear in any order and any number following a Volume record.

Multiple Volume records may be specified in the same bootstrap file, but each one starts a new set of filter criteria for the Volume.

In processing the bootstrap file within the current Volume, each filter specified by a keyword is ANDed with the next. Thus,

Volume = Test-01
Client = "My machine"
FileIndex = 1

will match records on Volume Test-01 AND Client records for My machine AND FileIndex equal to one.

Multiple occurrences of the same record are ORed together. Thus,

Volume = Test-01
Client = "My machine"
Client = "Backup machine"
FileIndex = 1

will match records on Volume Test-01 AND (Client records for My machine OR Backup machine) AND FileIndex equal to one.

For integer values, you may supply a range or a list, and for all other values except Volumes, you may specify a list. A list is equivalent to multiple records of the same keyword. For example,

Volume = Test-01
Client = "My machine", "Backup machine"
FileIndex = 1-20, 35

will match records on Volume Test-01 AND (Client records for My machine OR Backup machine) AND (FileIndex 1 OR 2 OR 3 ... OR 20 OR 35).

As previously mentioned above, there may be multiple Volume records in the same bootstrap file. Each new Volume definition begins a new set of filter conditions that apply to that Volume and will be ORed with any other Volume definitions.

As an example, suppose we query for the current set of tapes to restore all files on Client Rufus using the query command in the console program:

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 |
+-------+------------------+------------+-----------+----------+------------+

The output shows us that there are four Jobs that must be restored. The first one is a Full backup, and the following three are all Incremental backups.

The following bootstrap file will restore those files:

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

As a final example, assume that the initial Full save spanned two Volumes. The output from query might look like:

+-------+------------------+------------+-----------+----------+------------+
| 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 |
+-------+------------------+------------+-----------+----------+------------+

and the following bootstrap file would restore those files:

Volume=File0003
VolSessionId=1
VolSessionTime=1025016612
Volume=File0004
VolSessionId=1
VolSessionTime=1025016612
Volume=File0005
VolSessionId=2
VolSessionTime=1025016612
Volume=File0006
VolSessionId=2
VolSessionTime=1025025494

Automatic Generation of Bootstrap Files

One thing that is probably worth knowing: the bootstrap files that are generated automatically at the end of the job are not as optimized as those generated by the restore command. This is because the ones created at the end of the file, contain all files written to the Volume for that job. As a consequence, all the files saved to an Incremental or Differential job will be restored first by the Full save, then by any Incremental or Differential saves.

When the bootstrap file is generated for the restore command, only one copy (the most recent) of each file is restored.

So if you have spare cycles on your machine, you could optimize the bootstrap files by doing the following:

   ./console
   restore client=xxx select all
   no
   quit
   Backup bootstrap file.

The above will not work if you have multiple FileSets because that will be an extra prompt. However, the restore client=xxx select all builds the in-memory tree, selecting everything and creates the bootstrap file.

The no answers the Do you want to run this (yes/mod/no) question.

A Final Example

If you want to extract or copy a single Job, you can do it by selecting by JobId (code not tested) or better yet, if you know the VolSessionTime and the VolSessionId (printed on Job report and in Catalog), specifying this is by far the best. Using the VolSessionTime and VolSessionId is the way Bacula does restores. A bsr file might look like the following:

Volume="Vol001"
VolSessionId=10
VolSessionTime=1080847820

If you know how many files are backed up (on the job report), you can enormously speed up the selection by adding (let's assume there are 157 files):

FileIndex=1-157
Count=157

Finally, if you know the File number where the Job starts, you can also cause bcopy to forward space to the right file without reading every record:

VolFile=20

There is nothing magic or complicated about a BSR file. Parsing it and properly applying it within Bacula *is* magic, but you don't need to worry about that.

If you want to see a *real* bsr file, simply fire up the restore command in the console program, select something, then answer no when it prompts to run the job. Then look at the file restore.bsr in your working directory.


Catalog Services

General

This chapter is intended to be a technical discussion of the Catalog services and as such is not targeted at end users but rather at developers and system administrators that want or need to know more of the working details of Bacula.

The Bacula Catalog services consist of the programs that provide the SQL database engine for storage and retrieval of all information concerning files that were backed up and their locations on the storage media.

We have investigated the possibility of using the following SQL engines for Bacula: Beagle, mSQL, GNU SQL, PostgreSQL, SQLite, Oracle, and MySQL. Each presents certain problems with either licensing or maturity. At present, we have chosen for development purposes to use MySQL, PostgreSQL and SQLite. MySQL was chosen because it is fast, proven to be reliable, widely used, and actively being developed. MySQL is released under the GNU GPL license. PostgreSQL was chosen because it is a full-featured, very mature database, and because Dan Langille did the Bacula driver for it. PostgreSQL is distributed under the BSD license. SQLite was chosen because it is small, efficient, and can be directly embedded in Bacula thus requiring much less effort from the system administrator or person building Bacula. In our testing SQLite has performed very well, and for the functions that we use, it has never encountered any errors except that it does not appear to handle databases larger than 2GBytes.

The Bacula SQL code has been written in a manner that will allow it to be easily modified to support any of the current SQL database systems on the market (for example: mSQL, iODBC, unixODBC, Solid, OpenLink ODBC, EasySoft ODBC, InterBase, Oracle8, Oracle7, and DB2).

If you do not specify either --with-mysql or --with-postgresql or --with-sqlite on the ./configure line, Bacula will use its minimalist internal database. This database is kept for build reasons but is no longer supported. Bacula requires one of the three databases (MySQL, PostgreSQL, or SQLite) to run.

Filenames and Maximum Filename Length

In general, either MySQL, PostgreSQL or SQLite permit storing arbitrary long path names and file names in the catalog database. In practice, there still may be one or two places in the Catalog interface code that restrict the maximum path length to 512 characters and the maximum file name length to 512 characters. These restrictions are believed to have been removed. Please note, these restrictions apply only to the Catalog database and thus to your ability to list online the files saved during any job. All information received and stored by the Storage daemon (normally on tape) allows and handles arbitrarily long path and filenames.

Installing and Configuring MySQL

For the details of installing and configuring MySQL, please see the Installing and Configuring MySQL chapter of this manual.

Installing and Configuring PostgreSQL

For the details of installing and configuring PostgreSQL, please see the Installing and Configuring PostgreSQL chapter of this manual.

Installing and Configuring SQLite

For the details of installing and configuring SQLite, please see the Installing and Configuring SQLite chapter of this manual.

Internal Bacula Catalog

Please see the Internal Bacula Database chapter of this manual for more details.

Database Table Design

All discussions that follow pertain to the MySQL database. The details for the PostgreSQL and SQLite databases are essentially identical except for that all fields in the SQLite database are stored as ASCII text and some of the database creation statements are a bit different. The details of the internal Bacula catalog are not discussed here.

Because the Catalog database may contain very large amounts of data for large sites, we have made a modest attempt to normalize the data tables to reduce redundant information. While reducing the size of the database significantly, it does, unfortunately, add some complications to the structures.

In simple terms, the Catalog database must contain a record of all Jobs run by Bacula, and for each Job, it must maintain a list of all files saved, with their File Attributes (permissions, create date, ...), and the location and Media on which the file is stored. This is seemingly a simple task, but it represents a huge amount interlinked data. Note: the list of files and their attributes is not maintained when using the internal Bacula database. The data stored in the File records, which allows the user or administrator to obtain a list of all files backed up during a job, is by far the largest volume of information put into the Catalog database.

Although the Catalog database has been designed to handle backup data for multiple clients, some users may want to maintain multiple databases, one for each machine to be backed up. This reduces the risk of confusion of accidental restoring a file to the wrong machine as well as reducing the amount of data in a single database, thus increasing efficiency and reducing the impact of a lost or damaged database.

Sequence of Creation of Records for a Save Job

Start with StartDate, ClientName, Filename, Path, Attributes, MediaName, MediaCoordinates. (PartNumber, NumParts). In the steps below, ``Create new'' means to create a new record whether or not it is unique. ``Create unique'' means each record in the database should be unique. Thus, one must first search to see if the record exists, and only if not should a new one be created, otherwise the existing RecordId should be used.

  1. Create new Job record with StartDate; save JobId
  2. Create unique Media record; save MediaId
  3. Create unique Client record; save ClientId
  4. Create unique Filename record; save FilenameId
  5. Create unique Path record; save PathId
  6. Create unique Attribute record; save AttributeId store ClientId, FilenameId, PathId, and Attributes
  7. Create new File record store JobId, AttributeId, MediaCoordinates, etc
  8. Repeat steps 4 through 8 for each file
  9. Create a JobMedia record; save MediaId
  10. Update Job record filling in EndDate and other Job statistics

Database Tables

Filename
Column Name Data Type Remark
FilenameId integer Primary Key
Name Blob Filename

The Filename table shown above contains the name of each file backed up with the path removed. If different directories or machines contain the same filename, only one copy will be saved in this table.

Path
Column Name Data Type Remark
PathId integer Primary Key
Path Blob Full Path

The Path table contains shown above the path or directory names of all directories on the system or systems. The filename and any MSDOS disk name are stripped off. As with the filename, only one copy of each directory name is kept regardless of how many machines or drives have the same directory. These path names should be stored in Unix path name format.

Some simple testing on a Linux file system indicates that separating the filename and the path may be more complication than is warranted by the space savings. For example, this system has a total of 89,097 files, 60,467 of which have unique filenames, and there are 4,374 unique paths.

Finding all those files and doing two stats() per file takes an average wall clock time of 1 min 35 seconds on a 400MHz machine running RedHat 6.1 Linux.

Finding all those files and putting them directly into a MySQL database with the path and filename defined as TEXT, which is variable length up to 65,535 characters takes 19 mins 31 seconds and creates a 27.6 MByte database.

Doing the same thing, but inserting them into Blob fields with the filename indexed on the first 30 characters and the path name indexed on the 255 (max) characters takes 5 mins 18 seconds and creates a 5.24 MB database. Rerunning the job (with the database already created) takes about 2 mins 50 seconds.

Running the same as the last one (Path and Filename Blob), but Filename indexed on the first 30 characters and the Path on the first 50 characters (linear search done there after) takes 5 mins on the average and creates a 3.4 MB database. Rerunning with the data already in the DB takes 3 mins 35 seconds.

Finally, saving only the full path name rather than splitting the path and the file, and indexing it on the first 50 characters takes 6 mins 43 seconds and creates a 7.35 MB database.

File
Column Name Data Type Remark
FileId integer Primary Key
FileIndex integer The sequential file number in the Job
JobId integer Link to Job Record
PathId integer Link to Path Record
FilenameId integer Link to Filename Record
MarkId integer Used to mark files during Verify Jobs
LStat tinyblob File attributes in base64 encoding
MD5 tinyblob MD5 signature in base64 encoding

The File table shown above contains one entry for each file backed up by Bacula. Thus a file that is backed up multiple times (as is normal) will have multiple entries in the File table. This will probably be the table with the most number of records. Consequently, it is essential to keep the size of this record to an absolute minimum. At the same time, this table must contain all the information (or pointers to the information) about the file and where it is backed up. Since a file may be backed up many times without having changed, the path and filename are stored in separate tables.

This table contains by far the largest amount of information in the Catalog database, both from the stand point of number of records, and the stand point of total database size. As a consequence, the user must take care to periodically reduce the number of File records using the retention command in the Console program.

Job
Column Name Data Type Remark
JobId integer Primary Key
Job tinyblob Unique Job Name
Name tinyblob Job Name
PurgedFiles tinyint Used by Bacula for purging/retention periods
Type binary(1) Job Type: Backup, Copy, Clone, Archive, Migration
Level binary(1) Job Level
ClientId integer Client index
JobStatus binary(1) Job Termination Status
SchedTime datetime Time/date when Job scheduled
StartTime datetime Time/date when Job started
EndTime datetime Time/date when Job ended
JobTDate bigint Start day in Unix format but 64 bits; used for Retention period.
VolSessionId integer Unique Volume Session ID
VolSessionTime integer Unique Volume Session Time
JobFiles integer Number of files saved in Job
JobBytes bigint Number of bytes saved in Job
JobErrors integer Number of errors during Job
JobMissingFiles integer Number of files not saved (not yet used)
PoolId integer Link to Pool Record
FileSetId integer Link to FileSet Record
PurgedFiles tiny integer Set when all File records purged
HasBase tiny integer Set when Base Job run

The Job table contains one record for each Job run by Bacula. Thus normally, there will be one per day per machine added to the database. Note, the JobId is used to index Job records in the database, and it often is shown to the user in the Console program. However, care must be taken with its use as it is not unique from database to database. For example, the user may have a database for Client data saved on machine Rufus and another database for Client data saved on machine Roxie. In this case, the two database will each have JobIds that match those in another database. For a unique reference to a Job, see Job below.

The Name field of the Job record corresponds to the Name resource record given in the Director's configuration file. Thus it is a generic name, and it will be normal to find many Jobs (or even all Jobs) with the same Name.

The Job field contains a combination of the Name and the schedule time of the Job by the Director. Thus for a given Director, even with multiple Catalog databases, the Job will contain a unique name that represents the Job.

For a given Storage daemon, the VolSessionId and VolSessionTime form a unique identification of the Job. This will be the case even if multiple Directors are using the same Storage daemon.

The Job Type (or simply Type) can have one of the following values:

Value Meaning
B Backup Job
V Verify Job
R Restore Job
C Console program (not in database)
D Admin Job
A Archive Job (not implemented)

The JobStatus field specifies how the job terminated, and can be one of the following:

Value Meaning
C Created but not yet running
R Running
B Blocked
T Terminated normally
E Terminated in Error
e Non-fatal error
f Fatal error
D Verify Differences
A Canceled by the user
F Waiting on the File daemon
S Waiting on the Storage daemon
m Waiting for a new Volume to be mounted
M Waiting for a Mount
s Waiting for Storage resource
j Waiting for Job resource
c Waiting for Client resource
d Wating for Maximum jobs
t Waiting for Start Time
p Waiting for higher priority job to finish

FileSet
Column Name Data Type Remark
FileSetId integer Primary Key
FileSet tinyblob FileSet name
MD5 tinyblob MD5 checksum of FileSet
CreateTime datetime Time and date Fileset created

The FileSet table contains one entry for each FileSet that is used. The MD5 signature is kept to ensure that if the user changes anything inside the FileSet, it will be detected and the new FileSet will be used. This is particularly important when doing an incremental update. If the user deletes a file or adds a file, we need to ensure that a Full backup is done prior to the next incremental.

JobMedia
Column Name Data Type Remark
JobMediaId integer Primary Key
JobId integer Link to Job Record
MediaId integer Link to Media Record
FirstIndex integer The index (sequence number) of the first file written for this Job to the Media
LastIndex integer The index of the last file written for this Job to the Media
StartFile integer The physical media (tape) file number of the first block written for this Job
EndFile integer The physical media (tape) file number of the last block written for this Job
StartBlock integer The number of the first block written for this Job
EndBlock integer The number of the last block written for this Job
VolIndex integer The Volume use sequence number within the Job

The JobMedia table contains one entry for each volume written for the current Job. If the Job spans 3 tapes, there will be three JobMedia records, each containing the information to find all the files for the given JobId on the tape.

Media
Column Name Data Type Remark
MediaId integer Primary Key
VolumeName tinyblob Volume name
Slot integer Autochanger Slot number or zero
PoolId integer Link to Pool Record
MediaType tinyblob The MediaType supplied by the user
FirstWritten datetime Time/date when first written
LastWritten datetime Time/date when last written
LabelDate datetime Time/date when tape labeled
VolJobs integer Number of jobs written to this media
VolFiles integer Number of files written to this media
VolBlocks integer Number of blocks written to this media
VolMounts integer Number of time media mounted
VolBytes bigint Number of bytes saved in Job
VolErrors integer Number of errors during Job
VolWrites integer Number of writes to media
MaxVolBytes bigint Maximum bytes to put on this media
VolCapacityBytes bigint Capacity estimate for this volume
VolStatus enum Status of media: Full, Archive, Append, Recycle, Read-Only, Disabled, Error, Busy
Recycle tinyint Whether or not Bacula can recycle the Volumes: Yes, No
VolRetention bigint 64 bit seconds until expiration
VolUseDuration bigint 64 bit seconds volume can be used
MaxVolJobs integer maximum jobs to put on Volume
MaxVolFiles integer maximume EOF marks to put on Volume

The Volume table (internally referred to as the Media table) contains one entry for each volume, that is each tape, cassette (8mm, DLT, DAT, ...), or file on which information is or was backed up. There is one Volume record created for each of the NumVols specified in the Pool resource record.

Pool
Column Name Data Type Remark
PoolId integer Primary Key
Name Tinyblob Pool Name
NumVols Integer Number of Volumes in the Pool
MaxVols Integer Maximum Volumes in the Pool
UseOnce tinyint Use volume once
UseCatalog tinyint Set to use catalog
AcceptAnyVolume tinyint Accept any volume from Pool
VolRetention bigint 64 bit seconds to retain volume
VolUseDuration bigint 64 bit seconds volume can be used
MaxVolJobs integer max jobs on volume
MaxVolFiles integer max EOF marks to put on Volume
MaxVolBytes bigint max bytes to write on Volume
AutoPrune tinyint yes|no for autopruning
Recycle tinyint yes|no for allowing auto recycling of Volume
PoolType enum Backup, Copy, Cloned, Archive, Migration
LabelFormat Tinyblob Label format

The Pool table contains one entry for each media pool controlled by Bacula in this database. One media record exists for each of the NumVols contained in the Pool. The PoolType is a Bacula defined keyword. The MediaType is defined by the administrator, and corresponds to the MediaType specified in the Director's Storage definition record. The CurrentVol is the sequence number of the Media record for the current volume.

Client
Column Name Data Type Remark
ClientId integer Primary Key
Name TinyBlob File Services Name
UName TinyBlob uname -a from Client (not yet used)
AutoPrune tinyint yes|no for autopruning
FileRetention bigint 64 bit seconds to retain Files
JobRetention bigint 64 bit seconds to retain Job

The Client table contains one entry for each machine backed up by Bacula in this database. Normally the Name is a fully qualified domain name.

UnsavedFiles
Column Name Data Type Remark
UnsavedId integer Primary Key
JobId integer JobId corresponding to this record
PathId integer Id of path
FilenameId integer Id of filename

The UnsavedFiles table contains one entry for each file that was not saved. Note! This record is not yet implemented.

Counter
Column Name Data Type Remark
Counter tinyblob Counter name
MinValue integer Start/Min value for counter
MaxValue integer Max value for counter
CurrentValue integer Current counter value
WrapCounter tinyblob Name of another counter

The Counter table contains one entry for each permanent counter defined by the user.

Version
Column Name Data Type Remark
VersionId integer Primary Key

The Version table defines the Bacula database version number. Bacula checks this number before reading the database to ensure that it is compatible with the Bacula binary file.

BaseFiles
Column Name Data Type Remark
BaseId integer Primary Key
BaseJobId integer JobId of Base Job
JobId integer Reference to Job
FileId integer Reference to File
FileIndex integer File Index number

The BaseFiles table contains all the File references for a particular JobId that point to a Base file -- i.e. they were previously saved and hence were not saved in the current JobId but in BaseJobId under FileId. FileIndex is the index of the file, and is used for optimization of Restore jobs to prevent the need to read the FileId record when creating the in memory tree. This record is not yet implemented.

MySQL Table Definition

The commands used to create the MySQL tables are as follows:

USE bacula;
CREATE TABLE Filename (
  FilenameId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  Name BLOB NOT NULL,
  PRIMARY KEY(FilenameId),
  INDEX (Name(30))
  );
CREATE TABLE Path (
   PathId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   Path BLOB NOT NULL,
   PRIMARY KEY(PathId),
   INDEX (Path(50))
   );
CREATE TABLE File (
   FileId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   FileIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,
   JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
   PathId INTEGER UNSIGNED NOT NULL REFERENCES Path,
   FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename,
   MarkId INTEGER UNSIGNED NOT NULL DEFAULT 0,
   LStat TINYBLOB NOT NULL,
   MD5 TINYBLOB NOT NULL,
   PRIMARY KEY(FileId),
   INDEX (JobId),
   INDEX (PathId),
   INDEX (FilenameId)
   );
CREATE TABLE Job (
   JobId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   Job TINYBLOB NOT NULL,
   Name TINYBLOB NOT NULL,
   Type BINARY(1) NOT NULL,
   Level BINARY(1) NOT NULL,
   ClientId INTEGER NOT NULL REFERENCES Client,
   JobStatus BINARY(1) NOT NULL,
   SchedTime DATETIME NOT NULL,
   StartTime DATETIME NOT NULL,
   EndTime DATETIME NOT NULL,
   JobTDate BIGINT UNSIGNED NOT NULL,
   VolSessionId INTEGER UNSIGNED NOT NULL DEFAULT 0,
   VolSessionTime INTEGER UNSIGNED NOT NULL DEFAULT 0,
   JobFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
   JobBytes BIGINT UNSIGNED NOT NULL,
   JobErrors INTEGER UNSIGNED NOT NULL DEFAULT 0,
   JobMissingFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
   PoolId INTEGER UNSIGNED NOT NULL REFERENCES Pool,
   FileSetId INTEGER UNSIGNED NOT NULL REFERENCES FileSet,
   PurgedFiles TINYINT NOT NULL DEFAULT 0,
   HasBase TINYINT NOT NULL DEFAULT 0,
   PRIMARY KEY(JobId),
   INDEX (Name(128))
   );
CREATE TABLE FileSet (
   FileSetId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   FileSet TINYBLOB NOT NULL,
   MD5 TINYBLOB NOT NULL,
   CreateTime DATETIME NOT NULL,
   PRIMARY KEY(FileSetId)
   );
CREATE TABLE JobMedia (
   JobMediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
   MediaId INTEGER UNSIGNED NOT NULL REFERENCES Media,
   FirstIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,
   LastIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,
   StartFile INTEGER UNSIGNED NOT NULL DEFAULT 0,
   EndFile INTEGER UNSIGNED NOT NULL DEFAULT 0,
   StartBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,
   EndBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,
   VolIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,
   PRIMARY KEY(JobMediaId),
   INDEX (JobId, MediaId)
   );
CREATE TABLE Media (
   MediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   VolumeName TINYBLOB NOT NULL,
   Slot INTEGER NOT NULL DEFAULT 0,
   PoolId INTEGER UNSIGNED NOT NULL REFERENCES Pool,
   MediaType TINYBLOB NOT NULL,
   FirstWritten DATETIME NOT NULL,
   LastWritten DATETIME NOT NULL,
   LabelDate DATETIME NOT NULL,
   VolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,
   VolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
   VolBlocks INTEGER UNSIGNED NOT NULL DEFAULT 0,
   VolMounts INTEGER UNSIGNED NOT NULL DEFAULT 0,
   VolBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,
   VolErrors INTEGER UNSIGNED NOT NULL DEFAULT 0,
   VolWrites INTEGER UNSIGNED NOT NULL DEFAULT 0,
   VolCapacityBytes BIGINT UNSIGNED NOT NULL,
   VolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',
    'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,
   Recycle TINYINT NOT NULL DEFAULT 0,
   VolRetention BIGINT UNSIGNED NOT NULL DEFAULT 0,
   VolUseDuration BIGINT UNSIGNED NOT NULL DEFAULT 0,
   MaxVolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,
   MaxVolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
   MaxVolBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,
   InChanger TINYINT NOT NULL DEFAULT 0,
   MediaAddressing TINYINT NOT NULL DEFAULT 0,
   VolReadTime BIGINT UNSIGNED NOT NULL DEFAULT 0,
   VolWriteTime BIGINT UNSIGNED NOT NULL DEFAULT 0,
   PRIMARY KEY(MediaId),
   INDEX (PoolId)
   );
CREATE TABLE Pool (
   PoolId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   Name TINYBLOB NOT NULL,
   NumVols INTEGER UNSIGNED NOT NULL DEFAULT 0,
   MaxVols INTEGER UNSIGNED NOT NULL DEFAULT 0,
   UseOnce TINYINT NOT NULL,
   UseCatalog TINYINT NOT NULL,
   AcceptAnyVolume TINYINT DEFAULT 0,
   VolRetention BIGINT UNSIGNED NOT NULL,
   VolUseDuration BIGINT UNSIGNED NOT NULL,
   MaxVolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,
   MaxVolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
   MaxVolBytes BIGINT UNSIGNED NOT NULL,
   AutoPrune TINYINT DEFAULT 0,
   Recycle TINYINT DEFAULT 0,
   PoolType ENUM('Backup', 'Copy', 'Cloned', 'Archive', 'Migration', 'Scratch') NOT NULL,
   LabelFormat TINYBLOB,
   Enabled TINYINT DEFAULT 1,
   ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
   RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
   UNIQUE (Name(128)),
   PRIMARY KEY (PoolId)
   );
CREATE TABLE Client (
   ClientId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   Name TINYBLOB NOT NULL,
   Uname TINYBLOB NOT NULL,       /* full uname -a of client */
   AutoPrune TINYINT DEFAULT 0,
   FileRetention BIGINT UNSIGNED NOT NULL,
   JobRetention  BIGINT UNSIGNED NOT NULL,
   UNIQUE (Name(128)),
   PRIMARY KEY(ClientId)
   );
CREATE TABLE BaseFiles (
   BaseId INTEGER UNSIGNED AUTO_INCREMENT,
   BaseJobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
   JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
   FileId INTEGER UNSIGNED NOT NULL REFERENCES File,
   FileIndex INTEGER UNSIGNED,
   PRIMARY KEY(BaseId)
   );
CREATE TABLE UnsavedFiles (
   UnsavedId INTEGER UNSIGNED AUTO_INCREMENT,
   JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
   PathId INTEGER UNSIGNED NOT NULL REFERENCES Path,
   FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename,
   PRIMARY KEY (UnsavedId)
   );
CREATE TABLE Version (
   VersionId INTEGER UNSIGNED NOT NULL
   );
-- Initialize Version
INSERT INTO Version (VersionId) VALUES (7);
CREATE TABLE Counters (
   Counter TINYBLOB NOT NULL,
   MinValue INTEGER,
   MaxValue INTEGER,
   CurrentValue INTEGER,
   WrapCounter TINYBLOB NOT NULL,
   PRIMARY KEY (Counter(128))
   );


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.


Installer et configurer PostgreSQL

Installer et configurer PostgreSQL -- Phase I

Si vous avez utilisé l'option ./configure --with-postgresql=PostgreSQL-Directory pour configurer Bacula, vous avez besoin d'installer la version 7.3 ou supérieure de PostgreSQL. ATTENTION! Les versions préalables à la 7.3 ne fonctionnent pas avec Bacula. Si PostgreSQL est installé dans ses répertoires sandards, seule l'option --with-postgresql est nécessaire, le programme de configuration scrutant tous les répertoires standards. Si PostgreSQL est installé dans votre répertoire de travail ou dans un répertoire atypique, il faut préciser l'option --with-postgresql suivie du répertoire ad hoc.

Installer et configurer PostgreSQL n'est pas compliqué mais peut être déroutant la première fois. Si vous préférez, vous pouvez utiliser le paquet de votre distribution. Les paquets binaires sont disponibles sur la plupart des mirroirs de PostgreSQL.

Si vous préférez installer PostgreSQL à partir des sources, nous vous recommandons de suivre les instructions de la documentation PostgreSQL.

Si vous utilisez PostgreSQL pour FreeBSD, cet article vous sera peut être utile. Même si vous n'utilisez pas FreeBSD, l'article contient des informations utiles à la configuration et au paramétrage de PostgreSQL.

Après l'installation de PostgreSQL, terminez l'installation de Bacula. Ensuite, quand Bacula sera installé, reprenez ce chapitre pour terminer l'installation. Notez que les fichiers d'installation utilisés dans cette seconde phase de l'installation de PostgreSQL sont créés durant l'installation de Bacula.

Installer et configurer PostgreSQL -- Phase II

Si vous en êtes là, vous avez construit et installé PostgreSQL, ou vous aviez déjà un serveur PostgreSQL existant et vous avez configuré et installé Bacula. Dans le cas contraire, nous vous invitons à le faire avant de poursuivre.

Notez bien que la commande ./configure utilisée pour construire Bacula nécessite d'ajouter l'option --with-postgresql=repertoire_de_PostgreSQL, où repertoire_de_PostgreSQL spécifie le chemin de PostgreSQL indiqué à la commande ./configure. (si vous n'avez pas spécifié de répertoire ou si PostgreSQL est installé dans son répertoire par défaut, cette option n'est pas nécessaire). Cette option est nécessaire pour que Bacula puisse trouver les fichiers d'en-tête et les librairies d'interface à PostgreSQL.

Bacula installe les scripts pour la gestion de la base de données (créer, détruire, créer les tables, etc.) dans le répertoire principal de l'installation. Ces fichiers sont de la forme *_bacula_* (par exemple create_bacula_database). Ces fichiers sont également disponibles dans le répertoire <bacula-src>/src/cats après que la commande ./configure ait été lancée. Si vous consultez le fichier create_bacula_database, vous verrez qu'il fait appel à create_postgresql_database. Les fichiers *_bacula_* sont fournis pour faciliter les choses. Peu importe la base de données choisie, create_bacula_database créera la base de données.

Maintenant vous allez créer la base de données PostgreSQL et les tables utilisées par Bacula. On présume dans la suite que votre serveur PostgreSQL fonctionne. Vous devez exécuter les différentes étapes ci-dessous en tant qu'utilisateur autorisé à créer des bases. Ceci peut être fait avec l'utilisateur PostgreSQL (sur la plupart des systèmes il s'agit de pgsql. NDT: sur debian il s'agit de postgres)

  1. cd <répertoire_d_installation>

    Ce répertoire contient le catalogue des routines d'interfaces.

  2. ./create_bacula_database

    Ce script créé le catalogue bacula PostgreSQL. S'il échoue, c'est probablement que vous n'avez pas les droits requis sur la base de données. Sur la plupart des systèmes, le propriétaire de la base de données est pgsql, et sur d'autres tels que RedHat ou Fedora, c'est postgres. Vous pouvez déterminer lequel en examinant le fichier /etc/passwd. Pour créer un nouvel utilisateur avec votre nom ou le nom bacula, vous pouvez faire ce qui suit :

       su
       (entrez le mot de passe root)
       password pgsql (ou postgres)
       (entrez un mot de passe pour cet utilisateur)
       exit
       su pgsql (ou postgres)
       (entrez le nouveau mot de passe)
       createuser kern (or peut-\^etre 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) (choisissez ce que vous voulez)
       exit
    

    A ce stade, vous devriez pouvoir exécuter la commande ./create_bacula_database

  3. ./make_bacula_tables

    Créée les tables utilisées par Bacula.

  4. ./grant_bacula_privileges

    Créée l'utilisateur de la base de données bacula avec des droits d'accès restreints. Vous pouvez modifier ce script pour cadrer avec votre propre configuration. Attention, cette base n'est pas protégée par un mot de passe.

Chacun de ces scripts (create_bacula_database, make_bacula_tables et grant_bacula_privileges) permet l'ajout d'arguments en ligne de commande. Ceci peut être utile pour spécifier le nom de l'utilisateur. Par exemple, vous pouvez avoir besoin d'ajouter -h nom_d_hote à la ligne de commande pour spécifier le serveur de base de données distant.

Pour avoir un bon aperçu des droits d'accès que vous avez spécifié vous pouvez utiliser la commande

repertoire_de_PostgreSQL/bin/psql --command \\dp bacula

J'ai rencontré un problème de permissions avec le mot de passe. J'ai finalement du modifier mon fichier pg_hba.conf (situé dans /var/lib/pgsql/data sur ma machine) :

de
  local   all    all        ident  sameuser
vers
  local   all    all        trust  sameuser

Ceci a résolu le problème pour moi, mais ce n'est pas pas forcément une bonne chose du point de vue de la sécurité, mais j'ai ainsi pu exécuter mes scripts de régression sans mot de passe.

Un moyen plus sécurisé pour l'authentification auprès de la base de données consiste à utiliser le hachage MD5 des mots de passe. Pour cela, éditez les fichier pg_hba.conf, et ajoutez ajoutez ce qui suit juste avant les lignes "local" et "host" existantes :

  local bacula bacula md5

Puis redémarrez le daemon Postgres (la plupart du temps, avec "/etc/init.d/postgresql restart") pour activer cette nouvelle règle d'authentification.

Ensuite, en tant qu'administrateur Postgres (connectez-vous en tant qu'utilisateur postgres ou en utilisant su pour devenir root, puis su postgres), ajoutez un mot de passe à la base de données bacula pour l'utilisateur bacula avec les commandes suivantes :

  \$ psql bacula
  bacula=# alter user bacula with password 'secret';
  ALTER USER
  bacula=# \\q

Enfin, il vous faudra ajouter ce mot de passe en deux endroits du fichier bacula-dir.conf : au niveau de la ressource Catalog et au niveau de la directive RunBeforeJob de la ressource Job BackupCatalog. Avec les mots de passe en place, ces deux lignes devraient ressembler à ceci :

  dbname = bacula; user = bacula; password = "secret"
    ... and ...
  RunBeforeJob = "/etc/make_catalog_backup bacula bacula secret"

Naturellement, vous devriez choisir un meilleur mot de passe, et vous assurer que le fichier bacula-dir.conf qui contient ce mot de passe n'est lisible que par root.

Même avec ces restrictions, il reste un problème de sécurité avec cette approche : sur certaines plateformes, la variable d'environnement utilisée pour soumettre le mot de passe à Postgres est inévitablement disponible pour tout utilisateur local du système. Pour supprimer ce problème, l'équipe Postgres a décrété obsolète ce mécanisme de passage de mot de passe par variable d'environnement et recommande d'utiliser un fichier .pgpass. Pour utiliser ce mécanisme, créez un fichier nommé .pgpass vcontenant une simple ligne :

  localhost:5432:bacula:bacula:secret

Ce fichier devrait être copié dans les répertoires personnels (NDT : home directories) de tous les comptes susceptibles d'avoir besoin d'accéder à la base de données : typiquement, il s'agit de root, bacula et tout utilisateur de la console Bacula. Les fichiers doivent appartenir aux utilisateur et groupe correspondant : root:root pour la copie dans root, etc. Les permissions doivent être positionnées à 600 pour limiter l'accès au propriétaire du fichier.

Réinitialiser la base des catalogues (de sauvegardes)

Après avoir fait un certain nombre de tests avec Bacula, vous aurez très certainement envie de nettoyer le catalogue des sauvegardes et faire disparaître tous les travaux de tests que vous avez lancés. Pour ce faire, vous pouvez exécuter les commandes suivantes:

  cd <r\'epertoire_d_installation>
  ./drop_bacula_tables
  ./make_bacula_tables
  ./grant_bacula_privileges

Attention! Toutes les informations contenues dans cette base seront perdues et vous repartirez de zéro. Si vous avez écrit sur certains volumes (média de sauvegarde), vous devrez écrire une marque de fin de fichier (EOF) sur chacun d'eux afin que Bacula puisse les réutiliser. Pour ce faire:

   (arr\^eter Baula ou demonter les volumes)
   mt -f /dev/nst0 rewind
   mt -f /dev/nst0 weof

où vous devrez remplacer /dev/nst0 par le chemin approprié de votre lecteur de sauvegarde.

Installer PostgreSQL avec les RPMs

Si vous installez PostgreSQL avec les RPMs, il vous faut installer les binaires PostgreSQL ainsi que les librairies clientes. Ces dernières font généralement partie de paquetages de développement, aussi vous devez installer :

  postgresql
  postgresql-devel

Il en va de même avec la plupart des gestionnaires de paquetages.

Migrer de MySQL à PostgreSQL

La procédure de migration présentée ici à fonctionné pour Norm Dressler <ndressler at dinmar dot com>

Ce process a été testé en utilisant les versions suivantes des différents logiciels:

ATTENTION! Par précaution, réalisez une sauvegarde complète de vos systèmes avant de procéder à cette migration.

  1. Arrêtez bacula (cd /etc/bacula;./bacula stop)
  2. Lancez la commande pour extraire les données de votre base MySQL:

           mysqldump -f -t -n >bacula-backup.dmp
    

  3. Faites une sauvegarde de votre répertoire /etc/bacula (mais laisser l'original en place ).
  4. Allez dans le répertoire source de Bacula et reconstruisez le en incluant le support PostgreSQL au lieu de celui de MySQL . Vérifiez que le fichier config.log de votre configuration originale et remplacez enable-mysql par enable-postgresql.
  5. Recompilez Bacula avec la commande make et si tout se passe correctement lancez un "make install".
  6. Arrêtez MySQL.
  7. Lancez PostgreSQL sur votre système.
  8. Créez un utilisateur Bacula dans Postgres avec la commande "createuser". En fonction de votre installation, vous serez peut être amené à faire un "su" vers l'utilisateur adéquat (NDT: su postgres).
  9. Verifiez que le fichier pg_hba.conf (NdT sur Debian: /etc/postgres/pg_hba.conf) contient les permissions adéquates pour permettre à Bacula d'accéder au serveur. Le mien contient les informations suivantes, et il est situé sur un réseau sécurisé,

    local all all trust
                    
    host all all 127.0.0.1 255.255.255.255 trust
                    
    ATTENTION: vous devez red\'emmarer PostgreSQL si vous faites des changements dans ce fichier.
    

  10. Allez dans le répertoire /etc/bacula et préparez la base de données avec les commandes suivantes:

    ./create_postgresql_database
                                    
    ./make_postgresql_tables
                                    
    ./grant_postgresql_privileges
    

  11. Verifiez que vous avez accès à la base de données:

      
    psql -Ubacula bacula
    

    Vous ne devriez avoir aucune erreur.

  12. Chargez la base PostgreSQL avec l'extraction MySQL grâce à la commande:

    psql -Ubacula bacula <bacula-backup.dmp>
    

  13. Réindexez vos tables avec les commandes suivantes:

    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. Parvenu ici, lancez Bacula, vérifiez votre librairie et faites un test pour valider que tout s'est bien déroulé.

Mettre à jour PostgreSQL

Si vous mettez PosgreSQL à jour, vous devez reconfigurer, recompiler et réinstaller Bacula, faute de quoi vous constaterez probalement des erreurs étranges. Pour cela, il vous faut installer le RPM source, modifier le fichier bacula.spec pour l'accorder à votre version de PostgreSQL, reconstruire le RPM et l'installer.

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

Tous mes remerciements à Dan Languille pour l'écriture du driver PostgreSQL qui deviendra très certainement la base de données la plus réputée utilisable avec Bacula


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.

GPL

The vast bulk of the code is released under a modified version of the GNU General Public License version 2. The modifications (actually additions) are described in the source file LICENSE, and their purpose is not to alter the essential qualities of the GPL but to permit more freedom in linking certain third party software supposedly non-GPL compatible, provide termination for Patent (and IP) actions, clarify contributors IP and Copyright claims and non-infringment intentions. The details and governing text are in the file LICENSE in the main source directory.

Most of this code is copyrighted: Copyright ©2000-2004 Kern Sibbald and John Walker or Copyright ©2000-2005 Kern Sibbald.

Portions may be copyrighted by other people (ATT, the Free Software Foundation, ...). Generally these portions are released under a non-modified GPL 2 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 and John Walker.

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.

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 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

colorlinks, citecolor=black, filecolor=black, linkcolor=black, urlcolor=black, pdftex

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 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 Phil Stracchino for writing the gnome-console ConsoleFont configuration command, all the suggestions he has made, and his continuing suppport of Bacula users.

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 Nicolas Boichat for writing wx-console and the bacula-tray-monitor. These are very nice GUI additions to Bacula.

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 Nic Bellamy for providing the bacula-dir.conf file that he uses to implement daily tape rotation using multiple Pools.

Thanks also to Jo Simoens for finding and correcting so many typos and other problems with the manual.

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.

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.

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

Well fortunately there are not too many bugs, but thanks to Dan Langille, we have a bugs database where bugs are reported. Generally, when a bug is fixed, a patch for the currently release version will be attached to the bug report.

A ``raw'' list of the current task list and known issues can be found in kernstodo in the main Bacula source directory.


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


Index du Director

*WrapCounter
La ressource Counter
--sysbindir
Options de la commande configure
--sysconfdir
Options de la commande configure
--enable-smartalloc
Options de la commande configure
--enable-gnome
Options de la commande configure
--enable-static-dir
Options de la commande configure
--enable-static-cons
Options de la commande configure
--with-working-dir
Options de la commande configure
--with-base-port
Options de la commande configure
--with-dump-email
Options de la commande configure
--with-pid-dir
Options de la commande configure
--with-subsys-dir
Options de la commande configure
--with-dir-password
Options de la commande configure
--with-dir-user
Options de la commande configure
--with-dir-group
Options de la commande configure
--copy-static-bacula,/dt>
Options for make_rescue_disk:
a name
Types de données primitives reconnus | Types de données primitives reconnus
aclsupport
La ressource FileSet
Address
La ressource Client | La ressource Storage | The Director Resource
Admin
La ressource Job
always
La ressource Job
append
The Messages Resource
Autochanger
La ressource Storage
AutoPrune
La ressource Client | La ressource Pool
AutoPrune
Setting Retention Periods
Backup
La ressource Job
Bootstrap
La ressource Job
Catalog
La ressource Job | La ressource Client | La ressource Catalog | La ressource Counter
Catalog Files
La ressource Pool
CatalogACL
La ressource Console
Cleaning Prefix
La ressource Pool
Client
La ressource Job
Client (ou FileDaemon)
La ressource Client
Client Run After Job
La ressource Job
Client Run Before Job
La ressource Job
ClientACL
La ressource Console
Cloner un Job
La ressource Job
CommandACL
La ressource Console
compression
La ressource FileSet
count
File Selection Commands
Counter
La ressource Counter
Counters
Bacula Variables
D
La ressource Job
days
Types de données primitives reconnus
DB Address
La ressource Catalog
DB Name
La ressource Catalog
DB Port
La ressource Catalog
DB Socket
La ressource Catalog
Description
La ressource Director
destination
The Messages Resource | The Messages Resource
Device
La ressource Storage
Differential
La ressource Job
Differential Backup Pool
La ressource Job
Differential Max Wait Time
La ressource Job
DifferentialPool
La ressource Schedule
dir
File Selection Commands
DirAddress
La ressource Director
DirAddresses
La ressource Director
Directive, *WrapCounter
La ressource Counter
Directive, Address
La ressource Client | La ressource Storage
Directive, Autochanger
La ressource Storage
Directive, AutoPrune
La ressource Client | La ressource Pool
Directive, Bootstrap
La ressource Job
Directive, Catalog
La ressource Client | La ressource Catalog | La ressource Counter
Directive, Catalog Files
La ressource Pool
Directive, CatalogACL
La ressource Console
Directive, Cleaning Prefix
La ressource Pool
Directive, Client
La ressource Job
Directive, Client (or FileDaemon)
La ressource Client
Directive, Client Run After Job
La ressource Job
Directive, Client Run Before Job
La ressource Job
Directive, ClientACL
La ressource Console
Directive, CommandACL
La ressource Console
Directive, Counter
La ressource Counter
Directive, DB Address
La ressource Catalog
Directive, DB Name
La ressource Catalog
Directive, DB Port
La ressource Catalog
Directive, DB Socket
La ressource Catalog
Directive, Description
La ressource Director
Directive, Device
La ressource Storage
Directive, Differential Backup Pool
La ressource Job | La ressource Job
Directive, Differential Max Wait Time
La ressource Job | La ressource Job
Directive, DifferentialPool
La ressource Schedule
Directive, DirAddress
La ressource Director
Directive, DirAddresses
La ressource Director
Directive, DIRport
La ressource Director
Directive, FD Connect Timeout
La ressource Director
Directive, FD Port
La ressource Client
Directive, FileSetACL
La ressource Console
Directive, Full Backup Pool
La ressource Job
Directive, FullPool
La ressource Schedule
Directive, Incremental Max Wait Time
La ressource Job
Directive, IncrementalPool
La ressource Schedule
Directive, Job
La ressource Job
Directive, Job Retention
La ressource Client
Directive, JobACL
La ressource Console
Directive, JobDefs
La ressource Job
Directive, Label Format
La ressource Pool
Directive, Level
La ressource Job | La ressource Schedule | La ressource Schedule
Directive, Max Run Time
La ressource Job
Directive, Max Start Delay
La ressource Job
Directive, Max Wait Time
La ressource Job
Directive, Maximum
La ressource Counter
Directive, Maximum Concurrent Jobs
La ressource Director | La ressource Job | La ressource Client | La ressource Storage
Directive, Maximum Volume Bytes
La ressource Pool
Directive, Maximum Volume Files
La ressource Pool
Directive, Maximum Volume Jobs
La ressource Pool
Directive, Maximum Volumes
La ressource Pool
Directive, Media Type
La ressource Storage
Directive, Messages
La ressource Director | La ressource Job | La ressource Schedule
Directive, Minimum
La ressource Counter
Directive, Name
La ressource Director | La ressource Job | La ressource Schedule | La ressource Client | La ressource Storage | La ressource Pool | La ressource Catalog | La ressource Console | La ressource Counter
Directive, Password
La ressource Director | La ressource Client | La ressource Client | La ressource Storage | La ressource Catalog | La ressource Console
Directive, Pid Directory
La ressource Director
Directive, Pool
La ressource Job | La ressource Schedule | La ressource Pool
Directive, Pool Type
La ressource Pool
Directive, PoolACL
La ressource Console
Directive, Prefix Links
La ressource Job
Directive, Priority
La ressource Job | La ressource Client
Directive, Prune Jobs
La ressource Job | La ressource Job | La ressource Job
Directive, Purge Oldest Volume
La ressource Pool
Directive, QueryFile
La ressource Director
Directive, Recycle
La ressource Pool
Directive, Recycle Current Volume
La ressource Pool
Directive, Recycle Oldest Volume
La ressource Pool
Directive, Replace
La ressource Job
Directive, Rerun Failed Levels
La ressource Job
Directive, Reschedule Interval
La ressource Job
Directive, Reschedule On Error
La ressource Job
Directive, Reschedule Times
La ressource Job
Directive, Run
La ressource Job | La ressource Schedule
Directive, Run After Job
La ressource Job | La ressource Job
Directive, Run Before Job
La ressource Job
Directive, Schedule
La ressource Job | La ressource Schedule
Directive, ScheduleACL
La ressource Console
Directive, Scripts Directory
La ressource Director
Directive, SD Connect Timeout
La ressource Director
Directive, SD Port
La ressource Storage
Directive, Spool Attributes
La ressource Job
Directive, Spool Data
La ressource Job
Directive, SpoolData
La ressource Schedule
Directive, Storage
La ressource Job | La ressource Schedule | La ressource Storage
Directive, StorageACL
La ressource Console
Directive, Type
La ressource Job
Directive, Use Volume Once
La ressource Pool
Directive, user
La ressource Catalog
Directive, Verify Job
La ressource Job
Directive, Volume Retention
La ressource Pool
Directive, Volume Use Duration
La ressource Pool
Directive, Where
La ressource Job
Directive, Working Directory
La ressource Director
Directive, Write Bootstrap
La ressource Job
Directive, Write Part After Job
La ressource Job
Directive, WritePartAfterJob
La ressource Schedule
Director
La ressource Director
director
The Messages Resource
directory
Types de données primitives reconnus
DIRport
La ressource Director | The Director Resource
DiskToCatalog
La ressource Job
done
File Selection Commands
Enable
La ressource Job
Enable VSS
Volume Shadow Copy Service
Environment Variables
Bacula Variables
estimate
File Selection Commands
exclude
La ressource FileSet
Exclude { <file-list> }
La ressource FileSet
Exit Status
La ressource Job
FD Connect Timeout
La ressource Director
FD Port
La ressource Client
file
The Messages Resource
File Retention
La ressource Client | Setting Retention Periods
FileSet
La ressource Job | La ressource Job
FileSet
La ressource FileSet
FileSetACL
La ressource Console
find
File Selection Commands
Full
La ressource Job
Full Backup Pool
La ressource Job
FullPool
La ressource Schedule
hours
Types de données primitives reconnus
ifnewer
La ressource Job
ifolder
La ressource Job
Ignore FileSet Changes
La ressource FileSet
Include { [ Options {<file-options>} ...] <file-list> }
La ressource FileSet
Incremental
La ressource Job
Incremental Backup Pool
La ressource Job
Incremental Max Wait Time
La ressource Job
IncrementalPool
La ressource Schedule
InitCatalog
La ressource Job
integer
Types de données primitives reconnus
Internal Variables
Bacula Variables
Job
La ressource Job
Job Retention
La ressource Client
Job Retention
Setting Retention Periods
JobACL
La ressource Console
JobDefs
La ressource Job
keepatime
La ressource FileSet
Label Format
La ressource Pool
Level
La ressource Job | La ressource Schedule | La ressource Schedule
long integer
Types de données primitives reconnus
MailCommand
The Messages Resource
mark
File Selection Commands
Maximum
La ressource Counter
Maximum Concurrent Jobs
La ressource Director | La ressource Job | La ressource Client | La ressource Storage
Maximum Volume Bytes
La ressource Pool
Maximum Volume Files
La ressource Pool
Maximum Volume Jobs
La ressource Pool
Maximum Volumes
La ressource Pool
Media Type
La ressource Storage
Messages
La ressource Director | La ressource Job
Messages
La ressource Schedule | The Messages Resource
Minimum
La ressource Counter
minutes
Types de données primitives reconnus
months
Types de données primitives reconnus
mount
The Messages Resource
mtimeonly
La ressource FileSet
Name
La ressource Director | La ressource Job | La ressource Schedule | La ressource Client | La ressource Storage | La ressource Pool | La ressource Catalog | La ressource Console | La ressource Counter
Name
La ressource FileSet | The Messages Resource
never
La ressource Job
Number of Volumes
La ressource Pool
onefs
La ressource FileSet
Options { <file-options> }
La ressource FileSet
Password
La ressource Director | La ressource Client | La ressource Storage | La ressource Catalog | La ressource Console | The Director Resource
password
Types de données primitives reconnus
Pid Directory
La ressource Director
Pool
La ressource Job | La ressource Schedule | La ressource Pool
Pool Type
La ressource Pool
PoolACL
La ressource Console
portable
La ressource FileSet
positive integer
Types de données primitives reconnus
Prefer Mounted Volumes
La ressource Job
Prefix Links
La ressource Job
Priority
La ressource Job | La ressource Client
Prune Files
La ressource Job
Prune Jobs
La ressource Job
Prune Volumes
La ressource Job
Purge Oldest Volume
La ressource Pool
pwd
File Selection Commands
quarters
Types de données primitives reconnus
QueryFile
La ressource Director
readfifo
La ressource FileSet
recurse
La ressource FileSet
Recycle
La ressource Pool
Recycle Current Volume
La ressource Pool
Recycle Oldest Volume
La ressource Pool
regex
La ressource FileSet
Replace
La ressource Job
Rerun Failed Levels
La ressource Job
Reschedule Interval
La ressource Job
Reschedule On Error
La ressource Job
Reschedule Times
La ressource Job
Restore
La ressource Job
restored
The Messages Resource
Run
La ressource Job | La ressource Schedule
Run After Job
La ressource Job | La ressource Job
Run Before Job
La ressource Job
Schedule
La ressource Job | La ressource Schedule
ScheduleACL
La ressource Console
Scripts Directory
La ressource Director
SD Connect Timeout
La ressource Director
SD Port
La ressource Storage
seconds
Types de données primitives reconnus
setdebug
Alphabetic List of Console Commands
sfdisk.gz
Creating a Bacula Rescue Disk
signature
La ressource FileSet | La ressource FileSet
sparse
La ressource FileSet
Spool Attributes
La ressource Job
Spool Data
La ressource Job
SpoolData
La ressource Schedule
sqlquery
Alphabetic List of Console Commands
status
Alphabetic List of Console Commands
Storage
La ressource Job | La ressource Storage
Storage
La ressource Schedule
StorageACL
La ressource Console
Type
La ressource Job
unmark
File Selection Commands
Use Volume Once
La ressource Pool
user
La ressource Catalog
Verify
La ressource Job
verify
La ressource FileSet
Verify Job
La ressource Job
Volume Retention
La ressource Pool
Volume Use Duration
La ressource Pool
VolumeToCatalog
La ressource Job
weeks
Types de données primitives reconnus
Where
La ressource Job
wild
La ressource FileSet
Working Directory
La ressource Director
Write Bootstrap
La ressource Job
WritePartAfterJob
La ressource Schedule
years
Types de données primitives reconnus
yes or no
Types de données primitives reconnus

Index du File Daemon

<destination>
The Messages Resource
*JobLevel
File Format
*JobType
File Format
*security
The Messages Resource
-r <job>
Options en ligne de commande des Daemons
/about
Command Line Options Specific to the Bacula Windows File Daemon
/events
Command Line Options Specific to the Bacula Windows File Daemon
/help
Command Line Options Specific to the Bacula Windows File Daemon
/install
Command Line Options Specific to the Bacula Windows File Daemon
/kill
Command Line Options Specific to the Bacula Windows File Daemon
/remove
Command Line Options Specific to the Bacula Windows File Daemon
/run
Command Line Options Specific to the Bacula Windows File Daemon
/service
Command Line Options Specific to the Bacula Windows File Daemon
/servicehelper
Command Line Options Specific to the Bacula Windows File Daemon
/status
Command Line Options Specific to the Bacula Windows File Daemon
--enable-static-fd
Options de la commande configure
--with-fd-password
Options de la commande configure
--with-fd-user
Options de la commande configure
--with-fd-group
Options de la commande configure
--make-static-bacula
Options for make_rescue_disk:
--copy-etc-files
Options for make_rescue_disk:
Address
The Director Resource | The Client Resource | The Storage Resource
all
The Messages Resource
Client
File Format
Client (or FileDaemon)
The Client Resource
Client (ou FileDaemon)
La ressource Client
Count
File Format
Debug
The Messages Resource
Directive, Client (or FileDaemon)
La ressource Client
Directive, Director
La ressource Director
Directive, FDAddress
La ressource Client
Directive, FDAddresses
La ressource Client
Directive, FDPort
La ressource Client
Directive, Heartbeat Interval
La ressource Client
Directive, Maximum Concurrent Jobs
La ressource Client
Directive, Maximum Network Buffer Size
La ressource Client
Directive, Monitor
La ressource Director
Directive, Name
La ressource Client | La ressource Director
Directive, Password
La ressource Director
Directive, Pid Directory
La ressource Client
Directive, SDConnectTimeout
La ressource Client
Directive, Working Directory
La ressource Client
Director
La ressource Director
Director
The Director Resource
DIRPort
The Director Resource
error
The Messages Resource
exit
File Selection Commands
fatal
The Messages Resource
FD Port
The Client Resource
FDAddress
La ressource Client
FDAddresses
La ressource Client
FDPort
La ressource Client
FileIndex
File Format
format.hda
Creating a Bacula Rescue Disk
Heartbeat Interval
La ressource Client
help
File Selection Commands
info
The Messages Resource
Job
File Format
JobId
File Format
lsmark
File Selection Commands
mail
The Messages Resource
mail on error
The Messages Resource
Maximum Concurrent Jobs
La ressource Client
Maximum Network Buffer Size
La ressource Client
Monitor
La ressource Director
Monitor
The Monitor Resource
mount_drives
Creating a Bacula Rescue Disk
Name
La ressource Client | La ressource Director
Name
The Monitor Resource | The Director Resource | The Client Resource | The Storage Resource
notsaved
The Messages Resource
operator
The Messages Resource
OperatorCommand
The Messages Resource
partition.hda
Creating a Bacula Rescue Disk
Password
La ressource Director
Password
The Monitor Resource | The Client Resource
Pid Directory
La ressource Client
quit
File Selection Commands
Recycle
Prunning Directives
Refresh Interval
The Monitor Resource
restore_bacula
Creating a Bacula Rescue Disk
saved
The Messages Resource
SD Port
The Storage Resource
SDConnectTimeout
La ressource Client
sfdisk
Creating a Bacula Rescue Disk
skipped
The Messages Resource
Slot
File Format
start_network
Creating a Bacula Rescue Disk
stderr
The Messages Resource
stdout
The Messages Resource
Storage
The Storage Resource
Stream
File Format
syslog
The Messages Resource
terminate
The Messages Resource
VolBlock
File Format
VolFile
File Format
VolSessionId
File Format
VolSessionTime
File Format
Volume
File Format
warning
The Messages Resource
Working Directory
La ressource Client

Index du Storage Daemon

*Archive
Terminologie
*Update
Terminologie
-c <file>
Options en ligne de commande des Daemons
-d nn
Options en ligne de commande des Daemons
/etc/bacula/mtx-changer /dev/sg0 list 0 /dev/nst0 0
Testing the Autochanger and Adapting Your mtx-changer Script
/etc/bacula/mtx-changer /dev/sg0 load 3 /dev/nst0 0
Testing the Autochanger and Adapting Your mtx-changer Script
/etc/bacula/mtx-changer /dev/sg0 loaded 0 /dev/nst0 0
Testing the Autochanger and Adapting Your mtx-changer Script
/etc/bacula/mtx-changer /dev/sg0 slots 0 /dev/nst0 0
Testing the Autochanger and Adapting Your mtx-changer Script
/etc/bacula/mtx-changer /dev/sg0 unload
Testing the Autochanger and Adapting Your mtx-changer Script
/etc/bacula/mtx-changer /dev/sg0 unload
Testing the Autochanger and Adapting Your mtx-changer Script
--enable-static-sd
Options de la commande configure
--with-sd-password
Options de la commande configure
--with-sd-user
Options de la commande configure
--with-sd-group
Options de la commande configure
a name
Terminologie | Terminologie
Administrateur
Terminologie
Adresses de stockage
Terminologie
Alert Command
La Ressource Device
Always Open
La Ressource Device
Archive Device
La Ressource Device
Attributs de fichiers
Terminologie
Autochanger
La Ressource Device
Autochanger
Device Configuration Records
Automatic mount
Capabilities
Autoselect
La Ressource Device
Backward Space File
La Ressource Device
Backward Space Record
La Ressource Device
Block Positioning
La Ressource Device
BSF at EOM
La Ressource Device
Catalogue
Terminologie
Changer Command
La Ressource Device
Changer Command
Device Configuration Records
Changer Device
La Ressource Device
Changer Device
Device Configuration Records
Client
Terminologie
Close on Poll
La Ressource Device
Console
Terminologie
Daemon
Terminologie
Device Type
La Ressource Device
Differentielle (Differential)
Terminologie
Directive
Terminologie
Directive, Always Open
La Ressource Device
Directive, Archive Device
La Ressource Device
Directive, Autochanger
La Ressource Device
Directive, Automatic mount
Capabilities
Directive, Autoselect
La Ressource Device
Directive, Backward Space File
La Ressource Device
Directive, Backward Space Record
La Ressource Device
Directive, Block Positioning
La Ressource Device
Directive, BSF at EOM
La Ressource Device
Directive, Changer Command
La Ressource Device | La Ressource Device
Directive, Changer Device
La Ressource Device
Directive, Close on Poll
La Ressource Device
Directive, Device Type
La Ressource Device
Directive, Drive Index
La Ressource Device
Directive, Fast Forward Space File
La Ressource Device | La Ressource Device
Directive, Forward Space File
La Ressource Device
Directive, Forward Space Record
La Ressource Device
Directive, Free Space Command
Devices that require a mount (DVD)
Directive, Hardware End of Medium
La Ressource Device
Directive, Heartbeat Interval
Ressource Storage
Directive, Label media
Capabilities
Directive, Maximum block size
La Ressource Device
Directive, Maximum Changer Wait
La Ressource Device
Directive, Maximum Concurrent Jobs
Ressource Storage
Directive, Maximum File Size
La Ressource Device
Directive, Maximum Job Spool Size
La Ressource Device
Directive, Maximum Network Buffer Size
La Ressource Device
Directive, Maximum Open Wait
La Ressource Device | La Ressource Device
Directive, Maximum Part Size
La Ressource Device
Directive, Maximum Rewind Wait
La Ressource Device
Directive, Maximum Spool Size
La Ressource Device
Directive, Maximum Volume Size
La Ressource Device
Directive, Media Type
La Ressource Device
Directive, Minimum block size
La Ressource Device
Directive, Monitor
La ressource Director
Directive, Mount Command
Devices that require a mount (DVD)
Directive, Mount Point
Devices that require a mount (DVD)
Directive, Name
Ressource Storage | La ressource Director | La Ressource Device
Directive, Offline On Unmount
La Ressource Device
Directive, Password
La ressource Director
Directive, Pid Directory
Ressource Storage
Directive, Random access
La Ressource Device
Directive, Removable media
La Ressource Device
Directive, Requires Mount
Devices that require a mount (DVD)
Directive, SDAddress
Ressource Storage
Directive, SDAddresses
Ressource Storage
Directive, SDPort
Ressource Storage
Directive, Spool Directory
La Ressource Device
Directive, TWO EOF
La Ressource Device
Directive, Unmount Command
Devices that require a mount (DVD)
Directive, Volume Poll Interval
La Ressource Device
Directive, Working Directory
Ressource Storage
Directive, Write Part Command
Devices that require a mount (DVD)
Director
Terminologie
Drive Index
La Ressource Device
Drive Index
Device Configuration Records
Fast Forward Space File
La Ressource Device | La Ressource Device
Fichier Bootstrap (Bootstrap File)
Terminologie
File Daemon
Terminologie
Forward Space File
La Ressource Device
Forward Space Record
La Ressource Device
Free Space Command
Devices that require a mount (DVD)
Hardware End of Medium
La Ressource Device
Heartbeat Interval
Ressource Storage
Incrementale
Terminologie
Label media
Capabilities
Make sure Bacula is not running.
Testing the Autochanger and Adapting Your mtx-changer Script
Max Run Time
La ressource Job
Max Start Delay
La ressource Job
Max Wait Time
La ressource Job
Maximum block size
La Ressource Device
Maximum Changer Wait
La Ressource Device
Maximum Changer Wait
Device Configuration Records
Maximum Concurrent Jobs
Ressource Storage
Maximum File Size
La Ressource Device
Maximum Job Spool Size
La Ressource Device
Maximum Network Buffer Size
La Ressource Device
Maximum Open Wait
La Ressource Device | La Ressource Device
Maximum Part Size
La Ressource Device
Maximum Rewind Wait
La Ressource Device
Maximum Spool Size
La Ressource Device
Maximum Volume Size
La Ressource Device
Media Type
La Ressource Device
Minimum block size
La Ressource Device
Monitor
La ressource Director
Monitor
Terminologie
Mount Command
Devices that require a mount (DVD)
Mount Point
Devices that require a mount (DVD)
mount storage
D'autres commandes utiles de la console Bacula
Name
Ressource Storage | La ressource Director | La Ressource Device
Offline On Unmount
La Ressource Device
Période de rétention
Terminologie
Password
La ressource Director
Password
The Storage Resource
Pid Directory
Ressource Storage
quit
D'autres commandes utiles de la console Bacula
Random access
La Ressource Device
Removable media
La Ressource Device
Requires Mount
Devices that require a mount (DVD)
Resource
Terminologie
Restore
Terminologie
Sauvegarde
Terminologie
Scan
Terminologie
Schedule
Terminologie
SDAddress
Ressource Storage
SDAddresses
Ressource Storage
SDPort
Ressource Storage
Service
Terminologie
Session
Terminologie
Spool Directory
La Ressource Device
Storage Daemon
Terminologie
TWO EOF
La Ressource Device
Unmount Command
Devices that require a mount (DVD)
Verify
Terminologie
Volume
Terminologie
Volume Poll Interval
La Ressource Device
Working Directory
Ressource Storage
Write Part After Job
La ressource Job
Write Part Command
Devices that require a mount (DVD)

Index du Console

exit
Special At (@) Commands | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands | Special At (@) Commands
<destination>
The Messages Resource
--enable-wx-console
Options de la commande configure
--enable-tray-monitor
Options de la commande configure
--enable-static-tools
Options de la commande configure
--enable-client-only
Options de la commande configure
--enable-largefile
Options de la commande configure
--with-sqlite
Options de la commande configure
--with-sqlite3
Options de la commande configure
--with-mysql
Options de la commande configure
--with-postgresql
Options de la commande configure
--enable-conio
Options de la commande configure
--with-readline
Options de la commande configure
--enable-readline
Options de la commande configure
--with-tcp-wrappers
Options de la commande configure
add
Alphabetic List of Console Commands
Alphabetic List of Console Commands
Alphabetic List of Console Commands
anything
Special At (@) Commands
autodisplay on/off
Alphabetic List of Console Commands
automount on/off
Alphabetic List of Console Commands
AutoPrune
Prunning Directives
Bacula Console
Bacula Console
cancel jobid
Alphabetic List of Console Commands
Commands, Alphabetic List of Console
Alphabetic List of Console Commands
Configuration, Console
Console Configuration
console
The Messages Resource
Console Configuration
Console Configuration
Console, Bacula
Bacula Console
ConsoleFont
The ConsoleFont Resource
create pool
Alphabetic List of Console Commands
delete
Alphabetic List of Console Commands
Director
The Director Resource
estimate
Alphabetic List of Console Commands
exit
Alphabetic List of Console Commands
Font
The ConsoleFont Resource
help
Alphabetic List of Console Commands
label
Alphabetic List of Console Commands
list
Alphabetic List of Console Commands
list files jobid
D'autres commandes utiles de la console Bacula
list jobid
D'autres commandes utiles de la console Bacula
list jobmedia
D'autres commandes utiles de la console Bacula
list jobs
D'autres commandes utiles de la console Bacula
list jobtotals
D'autres commandes utiles de la console Bacula
list media
D'autres commandes utiles de la console Bacula
list pools
D'autres commandes utiles de la console Bacula
llist
Alphabetic List of Console Commands
messages
Alphabetic List of Console Commands
messages
D'autres commandes utiles de la console Bacula
mount
Alphabetic List of Console Commands
Name
The Director Resource | The ConsoleFont Resource
name
Types de données primitives reconnus
name-string
Types de données primitives reconnus
Program, Running the Console
Running the Console Program
Program, Stopping the Console
Stopping the Console Program
prune
Alphabetic List of Console Commands
purge
Alphabetic List of Console Commands
python
Alphabetic List of Console Commands
query
Alphabetic List of Console Commands
quit
Alphabetic List of Console Commands
relabel
Alphabetic List of Console Commands | Alphabetic List of Console Commands
release
Alphabetic List of Console Commands
reload
Alphabetic List of Console Commands
restore
Alphabetic List of Console Commands
run
Alphabetic List of Console Commands
Running the Console Program
Running the Console Program
show
Alphabetic List of Console Commands
status
D'autres commandes utiles de la console Bacula
status dir
D'autres commandes utiles de la console Bacula
status jobid
D'autres commandes utiles de la console Bacula
Stopping the Console Program
Stopping the Console Program
string
Types de données primitives reconnus
unmount
Alphabetic List of Console Commands
unmount storage
D'autres commandes utiles de la console Bacula
update
Alphabetic List of Console Commands
use
Alphabetic List of Console Commands
var name
Alphabetic List of Console Commands
version
Alphabetic List of Console Commands
Volume Retention
Prunning Directives
wait
Alphabetic List of Console Commands

Index Générale

MAJOR WARNING
!!! MAJOR WARNING !!!
--mandir
Options de la commande configure
--datadir
Options de la commande configure
--disable-nls
Options de la commande configure
--with-python
Options de la commande configure
--with-libintl-prefix
Options de la commande configure
Above, Bacula Configuration Files for the
The Bacula Configuration Files for the Above
Actual Conf Files
The Actual Conf Files
Actuelle, Restrictions de l'implémentation
Restrictions de l'implémentation actuelle
Adapter les fichiers de configuration
Adapter les fichiers de configuration
Adding Volumes to a Pool
Adding Volumes to a Pool
Additional Resources
Additional Resources
Advantages
Advantages | Advantages
After bscan
After bscan
Ajouter un client
Ajouter un client
Algorithm, Recycling
Recycling Algorithm
Alphabetic List of Console Commands
Alphabetic List of Console Commands
Alternate Disaster Recovery Suggestion for Win32 Systems
Alternate Disaster Recovery Suggestion for Win32 Systems
Answers
Answers
Arguments, Command Line
Command Line Arguments
Attributes, Restoring Directory
Restoring Directory Attributes
Authorization Errors
I'm Getting Authorization Errors. What is Going On?
Autochanger Errors
Autochanger Errors
Autochanger Support
Autochanger Support
Autochanger, Automatic Labeling Using Your
Automatic Labeling Using Your Autochanger
Autochanger, Simulating Barcodes in your
Simulating Barcodes in your Autochanger
Autochanger, Using the
Using the Autochanger
Autochangers -- General
Autochangers -- General
Autochangeurs supportés
Autochangeurs supportés
Automated Disk Backup
Automated Disk Backup
Automatic Generation of Bootstrap Files
Automatic Generation of Bootstrap Files
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
Autorisations, Noms mots de passe et
Noms, mots de passe et autorisations
autres commandes utiles de la console Bacula
D'autres commandes utiles de la console Bacula
Autres gestionnaires de fenêtres
Autres gestionnaires de fenêtres
Autres notes concernant la compilation
Autres notes concernant la compilation
Avant d'exécuter Bacula
Avant d'exécuter Bacula
Avantages de Bacula sur d'autres programmes de sauvegarde
Avantages de Bacula sur d'autres programmes de sauvegarde
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 the WinNT/XP/2K System State
Backing Up the WinNT/XP/2K System State
Backing Up Third Party Databases
Backing Up Third Party Databases
Backing up to Multiple Disks
Backing up to Multiple Disks
Backing Up Your Bacula Database
Backing Up Your Bacula Database
Backup Strategies
Backup Strategies
Backup, Simple One Tape
Simple One Tape Backup
Bacula Autochanger Interface
Bacula Autochanger Interface
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 Restore Command
The Bacula Console Restore Command
Bacula Copyright, Trademark, and Licenses
Bacula Copyright, Trademark, and Licenses
Bacula Frequently Asked Questions
Bacula Frequently Asked Questions
Bacula internal database is no longer supported, please do not use it.
The Bacula internal database is no longer supported, please do
Bacula Projects
Bacula Projects
Bacula Saves But Cannot Restore Files
Bacula Saves But Cannot Restore Files
Bacula Trademark
Why have You Trademarked the Name Bacula®?
Bacula Variables
Bacula Variables
Bacula, Avant d'exécuter
Avant d'exécuter Bacula
Bacula, Caractéristiques système générales indispensables à
Caractéristiques système générales indispensables à Bacula | Caractéristiques système générales indispensables à Bacula
Bacula, Composants ou Services de
Composants ou Services de Bacula
Bacula, Configuration de
Configuration de Bacula
Bacula, Configurer et tester TCP Wrappers
Configurer et tester TCP Wrappers
Bacula, Considérations sur la sécurité de
Considérations sur la sécurité de Bacula
Bacula, Démarrer avec
Démarrer avec Bacula
Bacula, Disaster Recovery Using
Disaster Recovery Using Bacula
Bacula, Exécuter
Exécuter Bacula
Bacula, Installer
Installer Bacula | Installer Bacula
Bacula, Interactions entre les services
Interactions entre les services Bacula
Bacula, L'état actuel de
L'état actuel de Bacula
Bacula, Modifier les fichiers de configuration de
Modifier les fichiers de configuration de Bacula
Bacula, Paramétrage des fichiers de configuration de
Paramétrage des fichiers de configuration de Bacula
Bacula, Qu'est-ce que
Qu'est-ce que Bacula ?
Bacula, Qui a besoin de
Qui a besoin de Bacula ?
Bacula® - RPM Packaging FAQ
Bacula® - RPM Packaging FAQ
Bandes, Tester la compatibilité de Bacula avec votre lecteur de
Tester la compatibilité de Bacula avec votre lecteur de bandes
Barcode Support
Barcode Support
Bare Metal Floppy Recovery on Linux with a Bacula Floppy Rescue Disk
Bare Metal Floppy Recovery on Linux with a Bacula Floppy
Bare Metal Recovery on Linux with a Bacula Rescue CDROM
Bare Metal Recovery on Linux with a Bacula Rescue CDROM
base de données, Démarrer la
Démarrer la base de données
Basic Volume Management
Basic Volume Management
Bcopy
bcopy
Bcopy Command Options
bcopy Command Options
Bextract
bextract
bls
bls
bls, Listing Blocks
Listing Blocks
bls, Listing Jobs
Listing Jobs
Boot with your Bacula Rescue CDROM
Boot with your Bacula Rescue CDROM
Boot with your Emergency Floppy
Boot with your Emergency Floppy
Bootstrap File
The Bootstrap File
Broken pipe
La ressource Client | Ressource Storage
bscan
bscan
Bscan, After
After bscan
Bsmtp
bsmtp
Btape
btape
Btape
btape
Btape Commands
btape Commands
Bugs
Bugs
Bugs and Other Considerations
Bugs and Other Considerations
Bugs, Bacula
Bacula Bugs
Bugs, Linux Problems or
Linux Problems or Bugs | Linux Problems or Bugs
Build Options
Build Options
Can Bacula Backup My System To Files instead of Tape?
Can Bacula Backup My System To Files instead of Tape?
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
Caractéristiques système générales indispensables à Bacula
Caractéristiques système générales indispensables à Bacula | Caractéristiques système générales indispensables à Bacula
Cartouches Spécifications
Spécifications des cartouches
Cartouches, Soyez patient lorsque vous démarrez les daemons ou montez
Soyez patient lorsque vous démarrez les daemons ou montez des
Case, How to Excude File on Windows Regardless of
How to Excude File on Windows Regardless of Case
Casse et espaces
Casse et espaces
Catalog Maintenance
Catalog Maintenance
Catalog Services
Catalog Services
Catalog, Internal Bacula
Internal Bacula Catalog
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 CDROM
CDROM, Boot with your Bacula Rescue
Boot with your Bacula Rescue CDROM
CDROM, Creating a Bacula Rescue
Creating a Bacula Rescue CDROM
Ce que Bacula n'est pas
Ce que Bacula n'est pas
Ce qui est implémenté
Ce qui est implémenté
Certificate, Creating a Self-signed
Creating a Self-signed Certificate
Certificate, Getting a CA Signed
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
Checking and Setting Tape Hardware Compression and Blocking Size
Checking and Setting Tape Hardware Compression and Blocking Size
Client Resource
The Client Resource
Client Ressource
La ressource Client
Client, Ajouter
Ajouter un client
Client, Command Line Options Specific to the Bacula Windows File Daemon
Command Line Options Specific to the Bacula Windows File Daemon
Client, Compiler un File Daemon ou
Compiler un File Daemon (ou Client)
Client, Using stunnel to Encrypt to a Second
Using stunnel to Encrypt to a Second Client
Client/File daemon Configuration
Configuration du Client/File Daemon
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 Line Options Specific to the Bacula Windows File Daemon (Client)
Command Line Options Specific to the Bacula Windows File Daemon
Command, Bacula Console Restore
The Bacula Console Restore Command
Command, Full Form of the Update Slots
The Full Form of the Update Slots Command
Command, Restore
The Restore Command
Commands, Alphabetic List of Console
Alphabetic List of Console Commands
Commands, autres commandes utiles de la console Bacula
D'autres commandes utiles de la console Bacula
Commands, btape
btape Commands
Commands, Console
Console Commands
Commands, File Selection
File Selection Commands
Special At (@) Commands
Commands, Special dot
Special dot Commands
Commentaires
Commentaires
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
Compacting Your MySQL Database
Compacting Your MySQL Database
Compacting Your PostgreSQL Database
Compacting Your PostgreSQL Database
Compacting Your SQLite Database
Compacting Your SQLite Database
Compatibilité ascendante
Compatibilité ascendante
Compilation, Autres notes concernant la
Autres notes concernant la compilation
Compiler un File Daemon (ou Client)
Compiler un File Daemon (ou Client)
Completion, Getting Notified of Job
Getting Notified of Job Completion
Composants ou Services de Bacula
Composants ou Services de Bacula
Comprendre les Pools, Volumes et Labels
Comprendre les Pools, Volumes et Labels
Compression
Why aren't my files compressed?
Conception, Limitations ou Restrictions inhérentes à la
Limitations ou Restrictions inhérentes à la conception
Concrete Example
A Concrete Example
Concurrent Disk Jobs
Concurrent Disk Jobs
Concurrent Jobs
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 de Bacula
Configuration de Bacula
Configuration du Storage Daemon
Configuration du Storage Daemon
Configuration, Adapter les fichiers de
Adapter les fichiers de configuration
Configuration, Client/File daemon
Configuration du Client/File Daemon
Configuration, Console
Console Configuration | Console Configuration
Configuration, Inclure d'autres fichiers de
Inclure d'autres fichiers de configuration
Configuration, Monitor
Monitor Configuration
Configuration, Storage Daemon
Configuration du Storage Daemon
Configuration, Tester vos Fichiers de
Tester vos Fichiers de Configuration
Configure, Options de la commande
Options de la commande configure
Configurer et tester TCP Wrappers
Configurer et tester TCP Wrappers
Configurer le Director
Configurer le Director
Configurer le Director
Configurer le Director
Configurer le File Daemon
Configurer le File Daemon
Configurer le programme Console
Configurer le programme Console
Configurer le programme Monitor
Configurer le programme Monitor
Configurer le Storage Daemon
Configurer le Storage Daemon
Considérations sur la sécurité de Bacula
Considérations sur la sécurité de Bacula
Considerations sur le nommage Windows NTFS
Considerations sur le nommage Windows NTFS
Considerations, Bugs and Other
Bugs and Other Considerations
Considerations, Important
Important Considerations | Important Considerations
Considerations, Security
Security Considerations
Considerations, Windows Compatibility
Windows Compatibility Considerations
Considerations, Windows NTFS Naming
Considerations sur le nommage Windows NTFS
Console Commands
Console Commands
Console Configuration
Console Configuration | Console Configuration
Console Resource
The Console Resource
Console Resource
La ressource Console
Console, Bacula
Bacula Console
Console, Configurer le programme
Configurer le programme Console
Console, Etiquetage des volumes dans la
Etiquetage des volumes dans la console
ConsoleFont Resource
The ConsoleFont Resource
Construire Bacula à partir des sources
Construire Bacula à partir des sources
Contents, Table of
Table of Contents | Table of Contents
Conventions utilisées dans ce document
Conventions utilisées dans ce document
Copyrights and Trademarks
Copyrights and Trademarks
Count, Using bscan to Correct the Volume File
Using bscan to Correct the Volume File Count
Créer un Pool
Créer un Pool
Crash, Rejected Volumes After a
Rejected Volumes After a Crash
Creating a Bacula Rescue CDROM
Creating a Bacula Rescue CDROM
Creating a Bacula Rescue Disk
Creating a Bacula Rescue Disk
Creating a Self-signed Certificate
Creating a Self-signed Certificate
Creating an Emergency Boot Disk
Creating an Emergency Boot Disk
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
Débarrassez-vous du répertoire /lib/tls
Débarrassez-vous du répertoire /lib/tls
Débugger sortie daemons
Débugger la sortie des daemons
Démarrage automatique des Daemons
Démarrage automatique des Daemons
Démarrage rapide
Démarrage rapide | Démarrage rapide
Démarrer avec Bacula
Démarrer avec Bacula
Démarrer la base de données
Démarrer la base de données
Démarrer les daemons
Démarrer les daemons
Daemon, Configurer le File
Configurer le File Daemon
Daemon, Configurer le Storage
Configurer le Storage Daemon
Daemon, Informations détaillées sur chaque
Informations détaillées sur chaque daemon
Daemons, Démarrage automatique des
Démarrage automatique des Daemons
Daemons, Démarrer les
Démarrer les daemons
Daily Tape Rotation
Daily Tape Rotation
Daily, Weekly, Monthly Tape Usage Example
A Daily, Weekly, Monthly Tape Usage Example
Data Spooling
Data Spooling
Data Spooling Directives
Data Spooling Directives
Database Performance Issues
Performance Issues
Database Size
Database Size
Database Table Design
Database Table Design
Database Tables
Database Tables
Database, Backing Up Your Bacula
Backing Up Your Bacula Database
Database, Compacting Your MySQL
Compacting Your MySQL Database
Database, Compacting Your PostgreSQL
Compacting Your PostgreSQL Database
Database, Compacting Your SQLite
Compacting Your SQLite Database
Database, Internal Bacula
Internal Bacula Database
Database, Re-initializing the Catalog
Re-initializing the Catalog Database | Re-initializing the Catalog Database
Database, Repairing Your MySQL
Repairing Your MySQL Database
Database, Repairing Your PostgreSQL
Repairing Your PostgreSQL Database
Databases, Backing Up Third Party
Backing Up Third Party Databases
Dbcheck
dbcheck
Dealing with Firewalls
Dealing with Firewalls
Dealing with Multiple Magazines
Dealing with Multiple Magazines
Dealing with Win32 Problems
Dealing with Win32 Problems
Debugger, Manually Running Bacula Under The
Manually Running Bacula Under The Debugger
Definition, MySQL Table
MySQL Table Definition
Design, Database Table
Database Table Design
Design, Overall
Overall Design
Details
The Details
Details of Tape Modes
Details of Tape Modes
Details, Practical
Practical Details | Practical Details
Details, Technical
Technical Details
Determining What Tape Drives and Autochangers You Have on FreeBSD
Determining What Tape Drives and Autochangers You Have on FreeBSD
Device Configuration Records
Device Configuration Records
Device, Bacula Cannot Open the
Bacula Cannot Open the Device
Devices that require a mount (DVD)
Devices that require a mount (DVD)
Devices, Multiple
Multiple Devices
devices, SCSI
Knowing What SCSI Devices You Have
DHCP, Backing Up Portables Using
Backing Up Portables Using DHCP
Differential Pool
Differential Pool
Directives, Data Spooling
Data Spooling Directives
Directives, Format des
Format des directives
Directives, Prunning
Prunning Directives
Director Resource
The Director Resource
Director Resource
The Director Resource
Director, Configurer le
Configurer le Director
Director, Configurer le
Configurer le Director
Director, La ressource
La ressource Director
Director, Les types de ressources du
Les types de ressources du Director
Directories
Directories | Directories
Directories, Excluding Files and
Exclusion de fichiers et répertoires
Disadvantages
Disadvantages | Disadvantages
Disaster Recovery of Win32 Systems
Disaster Recovery of Win32 Systems
Disaster Recovery Using a Bacula Rescue Floppy
Disaster Recovery Using a Bacula Rescue Floppy
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, Bare Metal Floppy Recovery on Linux with a Bacula Floppy Rescue
Bare Metal Floppy Recovery on Linux with a Bacula Floppy
Disk, Creating a Bacula Rescue
Creating a Bacula Rescue Disk
Disk, Creating an Emergency Boot
Creating an Emergency Boot Disk
Disk, Putting Two or More Systems on Your Rescue
Putting Two or More Systems on Your Rescue Disk
Disks, Backing up to Multiple
Backing up to Multiple Disks
distrribution fichiers
Distribution des fichiers source
Document, Conventions utilisées dans ce
Conventions utilisées dans ce document
Documentation, brève
Une brève documentation
Does Bacula support Windows?
Does Bacula support Windows?
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, Devices that require a mount
Devices that require a mount (DVD)
Enable VSS
Volume Shadow Copy Service
Encrypting the Control Channel
Encrypting the Control Channel
Encryption
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
Espaces, Casse et
Casse et espaces
Etiquetage des volumes dans la console
Etiquetage des volumes dans la console
Etiqueter vos Volumes
Etiqueter vos Volumes
Exécuter Bacula
Exécuter Bacula
exécuter un job
exécuter un job
Example
An Example
Example Configuration File
An Example Configuration File
Example Restore Job Resource
Example Restore Job Resource
Example Scripts
Example Scripts
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, Final
A Final Example
Example, Verify Configuration
A Verify Configuration Example
Examples
Examples | Examples
EXB-8900, Hardware Compression
Hardware Compresson on EXB-8900
Excluding Files and Directories
Exclusion de fichiers et répertoires
Executer Bacula sans être root
Executer Bacula sans être root
Executing Scripts on a Remote Machine
Executing Scripts on a Remote Machine
Exemple Complet Fichier Configuration Director
Voici un exemple complet de fichier de configuration du Director.
Exemple fichier configuration Client
Un exemple de fichier de configuration de Client
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
Fichier, Exemple configuration Client
Un exemple de fichier de configuration de Client
fichiers source
Distribution des fichiers source
Fichiers, Restaurer vos
Restaurer vos fichiers
File Format
File Format
File Selection Commands
File Selection Commands
File, Bootstrap
The Bootstrap File
File, Example Configuration
An Example Configuration File
File, Exemple Complet Director Configuration
Voici un exemple complet de fichier de configuration du Director.
File, Extracting With a Bootstrap
Extracting With a Bootstrap File
File, Maintaining a Valid Bootstrap
Maintaining a Valid Bootstrap File
File, Sample Console Configuration
Sample Console Configuration 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
Filename, Selecting Files by
Selecting Files by Filename
Filenames and Maximum Filename Length
Filenames and Maximum Filename Length
Files, Actual Conf
The Actual Conf Files
Files, Automatic Generation of Bootstrap
Automatic Generation of Bootstrap Files
Files, Bacula Saves But Cannot Restore
Bacula Saves But Cannot Restore Files
Files, Problems Restoring
Problems Restoring Files
FileSet Resource
La ressource FileSet
FileSet, Testing Your
Tester vos FileSets
FileSet, Windows Example
Un exemple de FileSet Windows
FileSets, Windows Considerations for
Considérations sur les FileSets Windows
Filesystems, Backing up ACLs on ext3 or XFS
Backing up ACLs on ext3 or XFS filesystems
Final Example
A Final Example
Firewall Problems
Firewall Problems
Firewalls, Dealing with
Dealing with Firewalls
Firewalls, Windows
Windows Firewalls
Floppy, Boot with your Emergency
Boot with your Emergency Floppy
Floppy, Disaster Recovery Using a Bacula Rescue
Disaster Recovery Using a Bacula Rescue Floppy
Floppy, Restoring Your Linux Client with a
Restoring Your Linux Client with a Floppy
Format des directives
Format des directives
Format, File
File 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 Issues
FreeBSD Issues
FreeBSD, Determining What Tape Drives and Autochangers You Have
Determining What Tape Drives and Autochangers You Have on FreeBSD
FreeBSD, l'attention des utilisateurs de
A l'attention des utilisateurs de FreeBSD !!!
FreeBSD, Tape Modes on
Tape Modes on FreeBSD
Full Form of the Update Slots Command
The Full Form of the Update Slots Command
Full Pool
Full Pool
Full Syntax
Full Syntax
Functionality, General
General Functionality
General
General | General | General
General
General | General | General | General | General | General | General | General
General Functionality
General Functionality
General, Autochangers --
Autochangers -- General
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
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
GNU ree Documentation License
GNU Free Documentation License
Going on Vacation
Going on Vacation
GPL
GPL
Handling, Total Automation of Bacula Tape
Total Automation of Bacula Tape Handling
Hardware Compression on EXB-8900
Hardware Compresson on EXB-8900
Have, Knowing What SCSI Devices You
Knowing What SCSI Devices You Have
Heartbeat Interval
La ressource Client | Ressource Storage
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
How to Excude File on Windows Regardless of Case
How to Excude File on Windows Regardless of Case
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?
Important Considerations
Important Considerations | Important 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
Inclure d'autres fichiers de configuration
Inclure d'autres fichiers de configuration
Incorrect File Number
Incorrect File Number
Incorrect Number of Blocks or Positioning Errors during btape Testing
Incorrect Number of Blocks or Positioning Errors during btape Testing
Incremental backups
Incremental backups are not working
Incremental Pool
Incremental Pool
Informations détaillées sur chaque daemon
Informations détaillées sur chaque daemon
Installation
Win32 Installation
Installer Bacula
Installer Bacula | Installer Bacula
Installer et configurer PostgreSQL
Installer et configurer PostgreSQL
Installer et configurer PostgreSQL -- Phase I
Installer et configurer PostgreSQL -- Phase I
Installer et configurer PostgreSQL -- Phase II
Installer et configurer PostgreSQL -- Phase II
Installer PostgreSQL avec les RPMs
Installer PostgreSQL avec les RPMs
Installer Tray Monitor
Installer Tray Monitor
Installing and Configuring MySQL
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
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
Interactions entre les services Bacula
Interactions entre les services Bacula
Interagir avec le Director pour interroger l'état de Bacula ou lancer des jobs
Interagir avec le Director pour l'interroger sur l'état de Bacula
Interface, Bacula Autochanger
Bacula Autochanger Interface
Internal Bacula Catalog
Internal Bacula Catalog
Internal Bacula Database
Internal Bacula Database
Is Bacula Stable?
Is Bacula Stable?
Issues, FreeBSD
FreeBSD Issues
Items, Critical
Critical Items
Items, Recommended
Recommended Items
Job Resource
La ressource Job
Job, exécuter un
exécuter un job
Job, Sequence of Creation of Records for a Save
Sequence of Creation of Records for a Save Job
JobDefs Resource
La ressource JobDefs
Jobs Concurrents
La ressource Director
Jobs Simultanés
La ressource Director
Jobs, Comprendre
Comprendre les Jobs et Schedules
Jobs, Interagir avec le Director pour interroger l'état de Bacula ou lancer des
Interagir avec le Director pour l'interroger sur l'état de Bacula
Jobs, Running Concurrent
Running Concurrent Jobs
Jour, Mettre Bacula à
Mettre Bacula à jour
Kaboom, What To Do When Bacula Crashes
What To Do When Bacula Crashes (Kaboom)
KDE
KDE
Kern, Le script Configure de
Le script Configure de Kern
Key Concepts and Resource Records
Key Concepts and Resource Records
Knowing What SCSI Devices You Have
Knowing What SCSI Devices You Have
L'état actuel de Bacula
L'état actuel de Bacula
L'ancienne ressource FileSet
L'ancienne ressource FileSet
L'attention des utilisateurs de FreeBSD
A l'attention des utilisateurs de FreeBSD !!!
La ressource Client
La ressource Client
La ressource Director
La ressource Director | La ressource Director
La ressource Message
La ressource Message
label
Alphabetic List of Console Commands
Labeling, Automatic Volume
Automatic Volume Labeling
Labeling, Specifying Slots When
Specifying Slots When Labeling
Labels, Comprendre les Pools Volumes et
Comprendre les Pools, Volumes et Labels
Large file support
Can Bacula Backup and Restore Files Greater than 2 Gigabytes?
Le script Configure de Kern
Le script Configure de Kern
Lecteurs de bande non supportés
Lecteurs de bande non supportés
Lecteurs de bandes supportés
Lecteurs de bandes supportés
Lecteurs, bandes supportées
Lecteurs de bandes supportés
Length, Filenames and Maximum Filename
Filenames and Maximum Filename Length
Les types de ressources du Director
Les types de ressources du Director
LGPL
LGPL
Librairies, Supportées
Modèles de librairies supportés
Libraries, How to Apply These Terms to Your New
How to Apply These Terms to Your New Libraries
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
License, GNU ree Documentation
GNU Free Documentation License
Licenses, Bacula Copyright Trademark and
Bacula Copyright, Trademark, and Licenses
Limitations ou Restrictions inhérentes à la conception
Limitations ou Restrictions inhérentes à la conception
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 Problems or Bugs
Linux SCSI Tricks
Linux SCSI Tricks
Listing Blocks with bls
Listing Blocks
Listing Jobs with bls
Listing Jobs
Lists, Extracting with Include or Exclude
Extracting with Include or Exclude Lists
Log Watch
Log Watch
Logs, Rotation des
Rotation des logs
Lorsque la cartouche est pleine
Lorsque la cartouche est pleine
Machine, Executing Scripts on a Remote
Executing Scripts on a Remote Machine
Magazines, Dealing with Multiple
Dealing with Multiple Magazines
Maintaining a Valid Bootstrap File
Maintaining a Valid Bootstrap File
Maintenance, Catalog
Catalog Maintenance
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
Messages Resource
Messages Resource
Messages Resource
Messages Resource | The Messages Resource
Messages Ressource
La ressource Catalog
Mettre à jour PostgreSQL
Mettre à jour PostgreSQL
Mettre à jour, PostgreSQL
Mettre à jour PostgreSQL
Mettre Bacula à jour
Mettre Bacula à jour
Migrating from SQLite to MySQL
Migrating from SQLite to MySQL
Migrer de MySQL à PostgreSQL
Migrer de MySQL à PostgreSQL
Modèles de librairies supportées
Modèles de librairies supportés
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
Modifier les fichiers de configuration de Bacula
Modifier les fichiers de configuration de Bacula
Monitor Configuration
Monitor Configuration
Monitor Resource
The Monitor Resource
Monitor, Configurer le programme
Configurer le programme Monitor
Monitor, Installer Tray
Installer Tray Monitor
Mots de passe
Noms, mots de passe et autorisations
Multi-drive Example Configuration File
A Multi-drive Example Configuration File
Multiple Clients
Considerations for Multiple Clients
Multiple Devices
Multiple Devices
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 Table Definition
MySQL Table Definition
MySQL, Installing and Configuring
Installing and Configuring MySQL | Installing and Configuring MySQL
MySQL, Installing from RPMs
Installing MySQL from RPMs
MySQL, Linking Bacula with
Linking Bacula with MySQL
MySQL, Migrating from SQLite to
Migrating from SQLite to MySQL
Noms, mots de passe et autorisations
Noms, mots de passe et autorisations
Note, Important
Important Note
Number, Incorrect File
Incorrect File Number
On what machines does Bacula run?
On what machines does Bacula run?
Only, Ensuring that the Tape Modes Are Properly Set -- Linux
Ensuring that the Tape Modes Are Properly Set -- Linux
Options de la commande configure
Options de la commande configure
Options en ligne de commande des Daemons
Options en ligne de commande des Daemons
Options recommandées pour la plupart des systèmes
Options recommandées pour la plupart des systèmes
Options, bcopy Command
bcopy Command Options
Options, en ligne de commande des Daemons
Options en ligne de commande des Daemons
Other Points
Other Points
Other Programs
Other Programs
Output, Débugger daemons
Débugger la sortie des daemons
Overall Design
Overall Design
Paquetage de Dépendences
Paquetage de Dépendences
Paquetage, Dépendences
Paquetage de Dépendences
Paramétrage des fichiers de configuration de Bacula
Paramétrage des fichiers de configuration de Bacula
Pas, Ce que Bacula n'est
Ce que Bacula n'est pas
Performance, Database
Performance Issues
Periods, Setting Retention
Setting Retention Periods
Permissions, Manually resetting the
Manually resetting the Permissions
Phase I, Installer et configurer PostgreSQL --
Installer et configurer PostgreSQL -- Phase I
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, Installer et configurer PostgreSQL --
Installer et configurer PostgreSQL -- Phase II
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
pleine, Lorsque la cartouche
Lorsque la cartouche est pleine
Points, Other
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
La ressource Pool
Pool, Adding Volumes to a
Adding Volumes to a Pool
Pool, Créer un
Créer un Pool
Pool, Differential
Differential Pool
Pool, Full
Full Pool
Pool, Incremental
Incremental Pool
Post Win32 Installation
Post Win32 Installation
PostgreSQL, Installer avec les RPMs
Installer PostgreSQL avec les RPMs
PostgreSQL, Installer et configurer
Installer et configurer PostgreSQL
PostgreSQL, Installing and Configuring
Installing and Configuring PostgreSQL
PostgreSQL, Migrer de MySQL à
Migrer de MySQL à PostgreSQL
Prérequis
Prérequis
Practical Details
Practical Details | Practical Details
Preamble
Preamble | Preamble
Preparation for a Bare Metal Recovery
Preparation for a Bare Metal Recovery | Preparation for a Bare Metal Recovery
Preparing Solaris Before a Disaster
Preparing Solaris Before a Disaster
Problèmes de connection du FD vers le SD
Problèmes de connection du FD vers le SD
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, 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, Running the Console
Running the Console Program
Program, Stopping the Console
Stopping the Console Program
Programme, Quitter Console
Quitter le programme Console
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
Pruning, Automatic
Automatic Pruning
Prunning Directives
Prunning Directives
Public Domain
Public Domain
Putting Two or More Systems on Your Rescue Disk
Putting Two or More Systems on Your Rescue Disk
Qu'est-ce que Bacula ?
Qu'est-ce que Bacula ?
Quelle base de données utiliser ?
Quelle base de données utiliser ?
Questions, Bacula Frequently Asked
Bacula Frequently Asked Questions
Qui a besoin de Bacula ?
Qui a besoin de Bacula ?
Quitter le programme Console
Quitter le programme Console
Réinitialiser la base des catalogues (de sauvegardes)
Réinitialiser la base des catalogues (de sauvegardes)
Rapide, Démarrage
Démarrage rapide | Démarrage rapide
Re-initializing the Catalog Database
Re-initializing the Catalog Database | Re-initializing the Catalog Database
Recommended Items
Recommended Items
Reconnus, Types de données primitives
Types de données primitives reconnus
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, Device Configuration
Device Configuration Records
Records, Key Concepts and Resource
Key Concepts and Resource Records
Recovering Files Written to Tape With Fixed Block Sizes
Recovering Files Written to Tape With Fixed Block Sizes
Recovery, FreeBSD Bare Metal
FreeBSD Bare Metal Recovery
Recovery, Preparation for a Bare Metal
Preparation for a Bare Metal Recovery | Preparation for a Bare Metal Recovery
Recovery, Reprise d'activité après un désastre disaster
Reprise d'activité après un désastre (disaster 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
Alphabetic List of Console Commands | Alphabetic List of Console Commands
Repairing Your MySQL Database
Repairing Your MySQL Database
Repairing Your PostgreSQL Database
Repairing Your PostgreSQL Database
Reprise d'activité après un désastre (disaster recovery)
Reprise d'activité après un désastre (disaster recovery)
Requirements
Requirements
Resetting Directory and File Ownership and Permissions on Win32 Systems
Resetting Directory and File Ownership and Permissions on Win32 Systems
Resource, Catalog
La ressource Catalog
Resource, Client
La ressource Client | The Client Resource
Resource, Console
The Console Resource
Resource, Console
La ressource Console
Resource, ConsoleFont
The ConsoleFont Resource
Resource, Device
La Ressource Device
Resource, Director
La ressource Director | The Director Resource
Resource, Director
La ressource Director | The Director Resource
Resource, Example Restore Job
Example Restore Job Resource
Resource, FileSet
La ressource FileSet
Resource, Job
La ressource Job
Resource, JobDefs
La ressource JobDefs
Resource, Messages
Messages Resource
Resource, Messages
La ressource Catalog | Messages Resource | The Messages Resource
Resource, Monitor
The Monitor Resource
Resource, Old FileSet
L'ancienne ressource FileSet
Resource, Pool
La ressource Pool
Resource, Schedule
La ressource Schedule
Resource, Storage
La ressource Storage | The Storage Resource
Resources, Additional
Additional Resources
Ressource Catalog
La ressource Catalog
Ressource Counter
La ressource Counter
Ressource Device
La Ressource Device
Ressource Director
La ressource Director
Ressource Sorage
Ressource Storage
Ressource, Client
La ressource Client
Ressource, Counter
La ressource Counter
Ressource, Message
La ressource Message
Ressource, Storage
Ressource Storage
Ressources, Types de
Types de Ressources
Restaurer vos fichiers
Restaurer vos fichiers
Restore Command
The Restore Command
Restore Directories
The Restore Command
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 Linux Client with a Floppy
Restoring Your Linux Client with a Floppy
Restricting the Number of Volumes and Recycling
Restricting the Number of Volumes and Recycling
Restrictions
Restrictions
Restrictions de l'implémentation actuelle
Restrictions de l'implémentation actuelle
Retention Periods
My retention periods don't work
Root, Executer Bacula sans être
Executer Bacula sans être root
Rotation des logs
Rotation des logs
Rotation, Daily Tape
Daily Tape Rotation
Running Concurrent Jobs
Running Concurrent Jobs
Running the Console Program
Running the Console Program
Running the Console Program from a Shell Script
Running the Console Program from a Shell Script
Running the Verify
Running the Verify
Running, Getting Notified that Bacula is
Getting Notified that Bacula is Running
Sample Console Configuration File
Sample Console Configuration File
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
Sauvegarde, Avantages de Bacula sur d'autres programmes de
Avantages de Bacula sur d'autres programmes de sauvegarde
Sauvegardes, Réinitialiser la base des catalogues de
Réinitialiser la base des catalogues (de sauvegardes)
Schedule problems
All my Jobs are scheduled for the same time. Will
Schedule Resource
La ressource Schedule
Schedules, Comprendre
Comprendre les Jobs et Schedules
Schedules, Creating Holiday
Creating Holiday Schedules
Schedules, Technical Notes on
Notes techniques sur les Schedules
Scratch Pool
Le Scratch Pool
Script, Running the Console Program from a Shell
Running the Console Program from a Shell Script
Script, Testing the Autochanger and Adapting Your mtx-changer
Testing the Autochanger and Adapting Your mtx-changer Script
Scripts, Example
Example Scripts
SCSI devices
Knowing What SCSI Devices You Have
SD, Problèmes de connection du FD vers le
Problèmes de connection du FD vers le 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
Sequence of Creation of Records for a Save Job
Sequence of Creation of Records for a Save Job
Server, Restoring a
Restoring a Server
Services, Catalog
Catalog Services
Setting Retention Periods
Setting Retention Periods
Shutting down Windows Systems
Shutting down Windows Systems
Simple One Tape Backup
Simple One Tape Backup
Simulating Barcodes in your Autochanger
Simulating Barcodes in your Autochanger
Size, Checking and Setting Tape Hardware Compression and Blocking
Checking and Setting Tape Hardware Compression and Blocking Size
Size, Database
Database Size
Sizes, Recovering Files Written to Tape With Fixed Block
Recovering Files Written to Tape With Fixed Block Sizes
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
Sources, Construire Bacula à partir des
Construire Bacula à partir des sources
Soyez patient lorsque vous démarrez les daemons ou montez des cartouches vierges
Soyez patient lorsque vous démarrez les daemons ou montez des
Spécifications, Cartouches
Spécifications des cartouches
) Commands
Special At (@) Commands
Special dot Commands
Special dot Commands
Specifications, Windows Considerations for Filename
Windows Considerations for Filename Specifications
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 Slots When Labeling
Specifying Slots When Labeling
Specifying the Configuration File
Specifying the Configuration File
Specifying the Configuration File
Specifying the Configuration File
Specifying Volumes
Specifying Volumes
Spooling, Data
Data Spooling
SQLite, Installing and Configuring
Installing and Configuring SQLite | Installing and Configuring SQLite
SQLite, Linking Bacula with
Linking Bacula with SQLite
SQLite, Testing
Testing SQLite
Starting and Testing the Control Channel
Starting and Testing the Control Channel
Starting and Testing the Data Encryption
Starting and Testing the Data Encryption
State, Backing Up the WinNT/XP/2K System
Backing Up the WinNT/XP/2K System State
Status, Recycle
Recycle Status
Steps to Take Before Disaster Strikes
Steps to Take Before Disaster Strikes | Steps to Take Before Disaster Strikes
Stopping the Console Program
Stopping the Console Program
Storage Resource
La ressource Storage | The Storage Resource
Strategies, Backup
Backup Strategies
Strikes, Steps to Take Before Disaster
Steps to Take Before Disaster Strikes | Steps to Take Before Disaster Strikes
Suggestions, Tips and
Tips and Suggestions
Summary of Steps to Take to Get Your Tape Drive Working
Summary of Steps to Take to Get Your Tape Drive
Support, Autochanger
Autochanger Support
Support, Barcode
Barcode Support
Syntax, Full
Full Syntax
Systèmes d'exploitation supportés
Systèmes d'exploitation supportés
Systèmes Supportés
Systèmes Supportés
Systèmes Windows avec CYGWIN installé
Systèmes Windows avec CYGWIN installé
System, Restoring a Client
Restoring a Client System
System, Restoring to a Running
Restoring to a Running System
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
Resetting Directory and File 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
Table of Contents
Table of Contents | Table of Contents
Tables, Database
Database Tables
Tape Blocking Modes
Tape Blocking Modes
Tape capacity
Why aren't my files compressed?
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 a
Using btape to Simulate Filling a Tape
Tapes, Manually Changing
Manually Changing Tapes
Technical Details
Technical Details
Technical Notes on Schedules
Notes techniques sur les Schedules
Terminologie
Terminologie
TERMS AND CONDITIONS
TERMS AND CONDITIONS | TERMS AND CONDITIONS
Tester la compatibilité de Bacula avec votre lecteur de bandes
Tester la compatibilité de Bacula avec votre lecteur de bandes
Tester vos Fichiers de Configuration
Tester vos Fichiers de Configuration
Tester vos FileSets
Tester vos FileSets
Testfind
testfind
Testing SQLite
Testing SQLite
Testing the Autochanger and Adapting Your mtx-changer Script
Testing the Autochanger and Adapting Your mtx-changer Script
Testing The Traceback
Testing The Traceback
Testing Your Tape Drive With Bacula
Testing Your Tape Drive With Bacula
Testing, Incorrect Number of Blocks or Positioning Errors during btape
Incorrect Number of Blocks or Positioning Errors during btape Testing
Thanks
Thanks
Tips and Suggestions
Tips and Suggestions
Tips for Resolving Problems
Tips for Resolving Problems
Tomsrtbt
tomsrtbt
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
Tricks, Linux SCSI
Linux SCSI Tricks
Types de données primitives reconnus
Types de données primitives reconnus
Types de Ressources
Types de Ressources
Un exemple de FileSet Windows
Un exemple de FileSet Windows
Une brève documentation
Une brève documentation
Unicode
Windows Considerations for Filename Specifications
Uninstalling Bacula on Win32
Uninstalling Bacula on Win32
Upgrading Bacula Versions
Upgrading Bacula Versions
Upgrading MySQL
Upgrading MySQL
Upgrading, MySQL
Upgrading MySQL
Usage, Pool Options to Limit the Volume
Pool Options to Limit the Volume Usage
Usage, Windows Port
Windows Port Usage
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 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 Autochanger
Using the Autochanger
Using the OnStream driver on Linux Systems
Using the OnStream driver on Linux Systems
Utiliser, Quelle base de données
Quelle base de données utiliser ?
Vacation, Going on
Going on Vacation
Variable Expansion
Variable Expansion
Variables, Bacula
Bacula Variables
Verify Configuration Example
A Verify Configuration Example
Verify, Running the
Running the Verify
Versions, Upgrading Bacula
Upgrading Bacula Versions
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, Etiqueter vos
Etiqueter vos Volumes
Volumes, Extracting From Multiple
Extracting From Multiple 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
VSS
Volume Shadow Copy Service
WARNING, MAJOR
!!! MAJOR WARNING !!!
Watch, Log
Log Watch
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
Why Does Bacula Ignore the MaxVolumeSize Set in my Pool?
MaxVolumeSize is ignored
Win32
Win32
Win32 path length restriction
Windows Considerations for Filename Specifications
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 Compatibility Considerations
Windows Compatibility Considerations
Windows Considerations for Filename Specifications
Windows Considerations for Filename Specifications
Windows Considerations for FileSets
Considérations sur les FileSets Windows
Windows Disaster Recovery
Windows Disaster Recovery
Windows Firewalls
Windows Firewalls
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, Restoring on
Restoring on Windows
Work, Getting Email Notification to
Getting Email Notification to Work
Work, How Does It
How Does It Work?
Working, Summary of Steps to Take to Get Your Tape Drive
Summary of Steps to Take to Get Your Tape Drive

About this document ...

\includegraphics{./bacula-logo.eps}


Il surgit de la nuit et absorbe l'essence vitale de vos ordinateurs.

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-01-03


next_inactive up previous
2008-01-03