]> git.sur5r.net Git - bacula/docs/blob - docs/manual-fr/tutorial.tex
Debut de tutorial.tex
[bacula/docs] / docs / manual-fr / tutorial.tex
1 %%
2 %%
3
4 \section*{Une br\`eve documentation}
5 \label{_ChapterStart1}
6 \index[general]{Une br\`eve documentation}
7 \index[general]{Documentation!br\`eve }
8 \addcontentsline{toc}{section}{Une br\`eve documentation}
9
10 Ce chapitre vous guidera \`a travers les \'etapes n\'ecessaires pour ex\'ecuter Bacula. 
11 Pour cela, nous supposons que vous avez install\'e Bacula, peut \^etre dans un simple 
12 r\'epertoire comme le d\'ecrit le chapitre pr\'ec\'edent, auquel cas vous pouvez ex\'ecuter 
13 Bacula sans \^etre root pour ces tests. Nous supposons d'autre part que vous n'avez 
14 pas modifi\'e les fichiers de configuration. Dans le cas contraire, nous vous 
15 recommandons de d\'esinstaller Bacula et de le r\'einstaller sans rien modifier. Les 
16 exemples de ce chapitre utilisent les fichiers de configuration par d\'efaut, et 
17 cr\'eent les volumes dans le r\'epertoire {\bf /tmp} de votre disque. De plus, les 
18 donn\'ees sauvegard\'ees seront celle du r\'epertoire des sources de Bacula o\`u vous 
19 l'avez compil\'e. Par cons\'equent, tous les {\it daemons} peuvent \^etre ex\'ecut\'es 
20 sans les droits root pour ces tests. Notez bien qu'en production, vos File 
21 Daemons devront \^etre ex\'ecut\'es en tant que root. Voyez le chapitre sur la 
22 s\'ecurit\'e pour plus d'informations sur ce sujet.
23
24 Voici les \'etapes que nous suivrons :
25
26 \begin{enumerate}
27 \item cd \lt{}install-directory\gt{}  
28 \item D\'emarrer la base de donn\'ees (si vous utilisez MySQL ou PostgreSQL)  
29 \item D\'emarrer les {\it daemons} avec {\bf ./bacula start}  
30 \item Lancer le programme Console pour interagir avec le Director 
31 \item Lancer un job
32 \item Lorsqu'un volume est plein, le d\'emonter, s'il s'agit d'une cartouche, en 
33    \'etiqueter une nouvelle et poursuivre. Dans ce chapitre, nous n'\'ecrirons que sur 
34    des volumes fichier, aussi vous n'avez pas \`a vous inqui\'eter au sujet des 
35    cartouches pour le moment.
36 \item Tester la restauration de quelques fichiers depuis le volume fraichement \'ecrit 
37    pour s'assurer de la validit\'e de la sauvegarde et qu'il est possible de restaurer. 
38    Mieux vaut essayer avant qu'un d\'esastre ne survienne...   
39 \item Ajouter un second client.
40    \end{enumerate}
41
42 Chacune de ces \'etapes est d\'ecrite en d\'etail ci-dessous.
43
44 \subsection*{Avant d'ex\'ecuter Bacula}
45 \index[general]{Bacula!Avant d'ex\'ecuter}
46 \index[general]{Avant d'ex\'ecuter Bacula}
47 \addcontentsline{toc}{subsection}{Avant d'ex\'ecuter Bacula}
48
49 Avant d'utiliser Bacula pour la premi\`ere fois en production, nous vous recommandons 
50 d'ex\'ecuter la commande {\test} du programme {\btape} ainsi qu'il est d\'ecrit 
51 dans le chapitre \ilink{Programmes utilitaires}{btape} de ce manuel. 
52 Ce programme vous aidera \`a vous assurer que votre lecteur de bandes fonctionne 
53 correctement avec Bacula. Si vous avez un lecteur moderne de marque HP, Sony, ou 
54 Quantum DDS ou DLT qui fonctionne sous Linux ou Solaris, vous pouvez probablement 
55 vous dispenser de faire ce test car Bacula est bien test\'e avec ces lecteurs et ces 
56 syst\`emes. Dans tous les autres cas, vous \^etes {\bf fortement} encourag\'e \`a 
57 ex\'ecuter les tests avant de poursuivre. {\bf btape} dispose aussi d'une commande 
58 {\bf fill} qui tente de reproduire le comportement de Bacula lorsqu'il remplit 
59 une cartouche et qu'il poursuit son \'ecriture sur la suivante. Vous devriez 
60 songer \`a faire ce test, sachez cependant qu'il peut \^etre long (environ 
61 4 heures sur mon lecteur) de remplir une cartouche de haute capacit\'e. 
62
63 \subsection*{D\'emarrer la base de donn\'ees}
64 \label{StartDB}
65 \index[general]{D\'emarrer la base de donn\'ees}
66 \index[general]{base de donn\'ees!D\'emarrer la }
67 \addcontentsline{toc}{subsection}{D\'emarrer la base de donn\'ees}
68
69 Si vous utilisez MySQL ou PostgreSQL pour votre catalogue Bacula, vous devez 
70 d\'emarrer la base de donn\'ees avant d'essayer de lancer un job pour \'eviter 
71 d'obtenir des messages d'erreur au d\'emarrage de Bacula. J'utilise les scripts 
72 {\bf startmysql} et {\bf stopmysql} pour d\'emarrer mon MySQL local. Notez que si 
73 vous utilisez SQLite, vous n'aurez pas \`a utiliser  {\bf startmysql} ou {\bf stopmysql}. 
74 Si vous utilisez ceci en production, vous souhaiterez probablement trouver 
75 un moyen pour d\'emarrer automatiquement MySQL ou PostgreSQL apr\`es chaque 
76 red\'emarrage du syst\`eme.
77
78 Si vous utilisez SQLite (c'est \`a dire, si vous avez sp\'ecifi\'e l'option 
79 {\bf \verb:--:with-sqlite=xxx} de la commande {\bf ./configure}, vous n'avez rien \`a faire. 
80 SQLite est d\'emarr\'ee automatiquement par {\bf Bacula}.
81
82 \subsection*{D\'emarrer les daemons}
83 \label{StartDaemon}
84 \index[general]{D\'emarrer les daemons}
85 \index[general]{Daemons!D\'emarrer les}
86 \addcontentsline{toc}{subsection}{D\'emarrer les daemons}
87
88 Que vous ayez compil\'e Bacula depuis les sources ou que vous ayez install\'e les rpms, 
89 tapez simplement :
90
91 ./bacula start
92
93 dans votre r\'epertoire d'installation pour d\'emarrer les trois {\it daemons}.
94
95 Le script {\bf bacula} lance le Storage Daemon, le File Daemon et le Director Daemon, qui 
96 tournent tous trois en tant que {\it daemons} en t\^ache de fond. Si vous utilisez 
97 la fonction de d\'emarrage automatique de Bacula, vous pouvez, au choix, lancer les 
98 trois {\it daemons} lors du d\'emarrage, ou au contraire les lancer individuellement 
99 avec les scripts  {\bf bacula-dir}, {\bf bacula-fd}, et {\bf bacula-sd} usuellement 
100 situ\'es dans {\bf /etc/init.d}, bien que leur localisation effective soit d\'ependante du syst\`eme 
101 d'exploitation.
102
103 Notez que seul le File Daemon a \'et\'e port\'e sur les syst\`emes Windows, et qu'il doit \^etre 
104 d\'emarr\'e diff\'eramment. Veuillez consulter le chapitre  
105 \ilink{La version Windows de Bacula}{_ChapterStart7} de ce manuel.
106
107 Les paquetages rpm configurent les {\it daemons} pour qu'ils s'ex\'ecutent en tant 
108 qu'utilisateur root et en tant que groupe bacula. Le processus d'installation rpm 
109 se charge de cr\'eer le groupe bacula s'il n'existe pas sur le syst\`eme. Tout utilisateur 
110 ajout\'e au groupe bacula h\'erite de l'acc\`es aux fichiers cr\'e\'es par les {\it daemons}. Pour 
111 modifier ce comportement, \'editez les scripts de d\'emarrage des {\it daemons} :
112
113 \begin{itemize}
114   \item /etc/bacula/bacula 
115   \item /etc/init.d/bacula-dir 
116   \item /etc/init.d/bacula-sd 
117   \item /etc/init.d/bacula-fd 
118 \end{itemize}
119
120 puis red\'emarrez-les.
121
122 Le chapitre 
123 \ilink{installation}{_ChapterStart17} de ce manuel indique comment installer 
124 les scripts de d\'emarrage automatique des {\it daemons}.
125
126 \subsection*{Interagir avec le Director pour l'interroger sur l'\'etat de Bacula ou lancer des jobs}
127 \index[general]{Jobs!Interagir avec le Director pour interroger l'\'etat de Bacula ou lancer des}
128 \index[general]{Interagir avec le Director pour interroger l'\'etat de Bacula ou lancer des jobs}
129 \addcontentsline{toc}{subsection}{Interagir avec le Director pour interroger l'\'etat de Bacula ou lancer des jobs}
130
131 Pour communiquer avec le Director et pour s'enqu\'erir de l'\'etat de Bacula ou de jobs en 
132 cours d'ex\'ecution, tapez simplement :
133
134 ./bconsole
135
136 dans le r\'epertoire de plus haut niveau.
137
138 Si vous avez install\'e la console GNOME et utilis\'e l'option {\bf \verb:--:enable-gnome} 
139 de la commande configure, vous pouvez aussi utiliser la console GNOME en tapant : 
140
141 ./gnome-console
142
143 Vous pouvez aussi utiliser le programme wxWidgets {\bf wx-console}.
144
145 Pour simplifier, nous ne d\'ecrirons ici que le programme {\bf ./bconsole}. La plus 
146 grande partie de ce qui est d\'ecrit ici s'applique aussi aux programmes {\bf ./gnome-console} 
147 et {\bf wx-console}.
148
149 La commande {\bf ./bconsole} lance le programme Console, qui se connecte au Director. 
150 Bacula \'etant un programme r\'eseau, vous pouvez utiliser la Console depuis n'importe quelle 
151 machine de votre r\'eseau. Cependant, la plupart du temps le Console est ex\'ecut\'ee sur la 
152 m\^eme machine que le Director. En principe, la Console devrait produire un affichage 
153 similaire \`a :  
154
155 \footnotesize
156 \begin{verbatim}
157 [kern@polymatou bin]$ ./bconsole
158 Connecting to Director lpmatou:9101
159 1000 OK: HeadMan Version: 1.30 (28 April 2003)
160 *
161 \end{verbatim}
162 \normalsize
163
164 L'ast\'erisque est l'invite de commande de la console.
165
166 Tapez {\bf help} pour obtenir la liste des commandes disponibles :
167
168 \footnotesize
169 \begin{verbatim}
170 *help
171   Command    Description
172   =======    ===========
173   add        add media to a pool
174   autodisplay autodisplay [on/off] -- console messages
175   automount  automount [on/off] -- after label
176   cancel     cancel job=nnn -- cancel a job
177   create     create DB Pool from resource
178   delete     delete [pool=<pool-name> | media volume=<volume-name>]
179   estimate   performs FileSet estimate debug=1 give full listing
180   exit       exit = quit
181   help       print this command
182   label      label a tape
183   list       list [pools | jobs | jobtotals | media <pool> |
184              files jobid=<nn>]; from catalog
185   llist      full or long list like list command
186   messages   messages
187   mount      mount <storage-name>
188   prune      prune expired records from catalog
189   purge      purge records from catalog
190   query      query catalog
191   quit       quit
192   relabel    relabel a tape
193   release    release <storage-name>
194   restore    restore files
195   run        run <job-name>
196   setdebug   sets debug level
197   show       show (resource records) [jobs | pools | ... | all]
198   sqlquery   use SQL to query catalog
199   status     status [storage | client]=<name>
200   time       print current time
201   unmount    unmount <storage-name>
202   update     update Volume or Pool
203   use        use catalog xxx
204   var        does variable expansion
205   version    print Director version
206   wait       wait until no jobs are running
207 *
208 \end{verbatim}
209 \normalsize
210
211 Pour plus de d\'etails sur les commandes de la console, consultez le chapitre 
212 \ilink{Console}{_ConsoleChapter} de ce manuel. 
213
214 \subsection*{ex\'ecuter un job}
215 \label{Running}
216 \index[general]{Job!ex\'ecuter un}
217 \index[general]{ex\'ecuter un job}
218 \addcontentsline{toc}{subsection}{Ex\'ecuter un job}
219
220 A ce stade, nous supposons que vous avez :
221
222 \begin{itemize}
223 \item Configur\'e Bacula avec la commande {\bf ./configure \verb:--:your-options} 
224 \item Compil\'e Bacula avec la commande {\bf make} 
225 \item Install\'e Bacula avec la commande {\bf make install} 
226 \item Cr\'e\'e votre catalogue avec, par exemple, la commande {\bf
227    ./create\_sqlite\_database} 
228 \item Cr\'e\'e les tables du catalogue avec la commande {\bf
229    ./make\_bacula\_tables} 
230 \item Eventuellement \'edit\'e votre fichier  {\bf bacula-dir.conf} pour le personnaliser 
231    quelque peu. ATTENTION ! Si vous modifiez le nom du Director ou son mot de passe, 
232    vous devez faire les modifications correspondantes dans les autres fichiers de 
233    configuration. Il est sans dout pr\'ef\'erable, pour l'instant, de ne rien changer.
234 \item D\'emarr\'e Bacula avec la commande {\bf ./bacula start}
235 \item Invoqu\'e le programme Console avec la commande {\bf ./bconsole}.
236 \end{itemize}
237
238 En outre, nous supposons pour le moment que vous utilisez les fichiers de configuration 
239 par d\'efaut.
240
241 Maintenant, entrez les commandes suivantes :
242
243 \footnotesize
244 \begin{verbatim}
245 show filesets
246 \end{verbatim}
247 \normalsize
248
249 Vous devriez obtenir quelque chose comme :
250
251 \footnotesize
252 \begin{verbatim}
253 FileSet: name=Full Set
254       O M
255       N
256       I /home/kern/bacula/regress/build
257       N
258       E /proc
259       E /tmp
260       E /.journal
261       E /.fsck
262       N
263 FileSet: name=Catalog
264       O M
265       N
266       I /home/kern/bacula/regress/working/bacula.sql
267       N
268 \end{verbatim}
269 \normalsize
270
271 Il s'agit d'un {\bf FileSet} pr\'ed\'efini qui sauvegardera le r\'epertoire des 
272 sources de Bacula. Les noms de r\'epertoires qui seront r\'eellement affich\'es 
273 devraient correspondre \`a votre configuration. Dans une perspective de tests, 
274 nous avons choisi un r\'epertoire de taille et de complexit\'e mod\'er\'ee (environ 
275 40 Mo). Le FileSet {\bf Catalog} est utilis\'e pour sauvegarder le catalogue 
276 Bacula et nous ne nous y attarderons pas pour le moment. Les entr\'ees {\bf I} 
277 sont les fichiers ou r\'epertoires qui seront inclus dans la sauvegarde, tandis 
278 que les entr\'ees  {\bf E} sont ceux qui en seront exclus, quand aux entr\'ees {\bf O}, 
279 ce sont les options sp\'ecifi\'ees pour ce FileSet. Vous pouvez changer ce qui est 
280 sauvegard\'e en modifiant la ligne {\bf File =} de la ressource {\bf FileSet}.
281
282
283 Il est maintenant temps de lancer votre premi\`ere sauvegarde. Nous allons 
284 sauvegarder votre r\'epertoire sources de Bacula vers un volume File dans votre 
285 r\'epertoire {\bf /tmp} afin de vous montrer combien c'est facile. Saisissez :  
286
287 \footnotesize
288 \begin{verbatim}
289 status dir
290 \end{verbatim}
291 \normalsize
292
293 Vous devriez obtenir :
294
295 \footnotesize
296 \begin{verbatim}
297 rufus-dir Version: 1.30 (28 April 2003)
298 Daemon started 28-Apr-2003 14:03, 0 Jobs run.
299 Console connected at 28-Apr-2003 14:03
300 No jobs are running.
301 Level          Type     Scheduled          Name
302 =================================================================
303 Incremental    Backup   29-Apr-2003 01:05  Client1
304 Full           Backup   29-Apr-2003 01:10  BackupCatalog
305 ====
306 \end{verbatim}
307 \normalsize
308
309 O\`u les dates et le nom du Director seront diff\'erents et en accord avec votre 
310 installation. Ceci montre qu'une sauvegarde incr\'ementale est planifi\'ee pour 
311 le job {\bf Client1} \`a 1h05, et qu'une sauvegarde full est planifi\'ee pour 
312 le job {\bf BackupCatalog} \`a 1h10. Vous devriez remplacer le nom {\bf Client1} 
313 par celui de votre machine, sinon vous risquez la confusion lorsque vous 
314 ajouterez de nouveaux clients. Pour ma machine r\'eelle, j'utilise {\bf Rufus} 
315 plut\^ot que {\bf Client1}.
316
317 A pr\'esent, tapez :
318
319 \footnotesize
320 \begin{verbatim}
321 status client
322 \end{verbatim}
323 \normalsize
324
325 Vous devriez obtenir :
326
327 \footnotesize
328 \begin{verbatim}
329 The defined Client resources are:
330      1: rufus-fd
331 Item 1 selected automatically.
332 Connecting to Client rufus-fd at rufus:8102
333 rufus-fd Version: 1.30 (28 April 2003)
334 Daemon started 28-Apr-2003 14:03, 0 Jobs run.
335 Director connected at: 28-Apr-2003 14:14
336 No jobs running.
337 ====
338 \end{verbatim}
339 \normalsize
340
341 Dans ce cas, le client se nomme {\bf rufus-fd}, votre nom sera diff\'erent, mais la 
342 ligne qui d\'ebute par {\bf rufus-fd Version...} est produite par votre File Daemon, 
343 nous sommes donc maintenant surs qu'il fonctionne.
344
345 Finalement, faites de m\^eme pour votre Storage Daemon :
346
347 \footnotesize
348 \begin{verbatim}
349 status storage
350 \end{verbatim}
351 \normalsize
352
353 Vous devriez obtenir :
354
355 \footnotesize
356 \begin{verbatim}
357 The defined Storage resources are:
358      1: File
359 Item 1 selected automatically.
360 Connecting to Storage daemon File at rufus:8103
361 rufus-sd Version: 1.30 (28 April 2003)
362 Daemon started 28-Apr-2003 14:03, 0 Jobs run.
363 Device /tmp is not open.
364 No jobs running.
365 ====
366 \end{verbatim}
367 \normalsize
368
369 Vous noterez que le p\'eriph\'erique du Storage Daemon par d\'efaut est nomm\'e {\bf File} 
370 et qu'il utilise le p\'eriph\'erique {\bf /tmp}, qui n'est actuellement pas ouvert. 
371
372 Maintenant, lancez un job :
373
374 \footnotesize
375 \begin{verbatim}
376 run
377 \end{verbatim}
378 \normalsize
379  
380 Vous devriez obtenir :
381
382 \footnotesize
383 \begin{verbatim}
384 Using default Catalog name=MyCatalog DB=bacula
385 A job name must be specified.
386 The defined Job resources are:
387      1: Client1
388      2: BackupCatalog
389      3: RestoreFiles
390 Select Job resource (1-3):
391 \end{verbatim}
392 \normalsize
393
394 Ici, Bacula affiche la liste des trois diff\'erents jobs que vous pouvez ex\'ecuter. 
395 Choisissez le num\'ero {\bf 1} et validez (entr\'ee).
396
397 Vous devriez obtenir :
398
399 \footnotesize
400 \begin{verbatim}
401 Run Backup job
402 JobName:  Client1
403 FileSet:  Full Set
404 Level:    Incremental
405 Client:   rufus-fd
406 Storage:  File
407 Pool:     Default
408 When:     2003-04-28 14:18:57
409 OK to run? (yes/mod/no):
410 \end{verbatim}
411 \normalsize
412
413 Prenez un peu de temps pour examiner cet affichage et le comprendre. Il vous 
414 est demand\'e de valider, modifier ou annuler l'ex\'ecution d'un job nomm\'e 
415 {\bf Client1} avec le FileSet {\bf Full Set} que nous avons affich\'e plus haut 
416 en incr\'emental sur votre client rufus, utilisant le p\'eriph\'erique de stockage 
417 {\bf File} et le pool {\bf Default} \`a la date indiqu\'ee sur la ligne "When".
418
419 Nous avons le choix de valider ({\bf yes}), modifier un ou plusieurs des 
420 param\`etres ci-dessus ({\bf mod}), ou de ne pas ex\'ecuter le job ({\bf no}). 
421
422 Validez l'ex\'ecution du job ({\bf yes}), vous devriez imm\'ediatement obtenir 
423 l'invite de commande de la console (un ast\'erisque). Apr\`es quelques minutes, 
424 la commande {\bf messages} devrait produire un r\'esultat tel que :
425
426 \footnotesize
427 \begin{verbatim}
428 28-Apr-2003 14:22 rufus-dir: Last FULL backup time not found. Doing
429                   FULL backup.
430 28-Apr-2003 14:22 rufus-dir: Start Backup JobId 1,
431                   Job=Client1.2003-04-28_14.22.33
432 28-Apr-2003 14:22 rufus-sd: Job Client1.2003-04-28_14.22.33 waiting.
433                   Cannot find any appendable volumes.
434 Please use the "label"  command to create a new Volume for:
435     Storage:      FileStorage
436     Media type:   File
437     Pool:         Default
438 \end{verbatim}
439 \normalsize
440
441 Le premier message signale qu'aucune sauvegarde full n'a jamais \'et\'e faite, et 
442 que par cons\'equent Bacula \'el\`eve votre incr\'ementale en une Full (ce comportement 
443 est normal). Le second message indique que le job a d\'emarr\'e avec le JobId 1 et le 
444 troisi\`eme message vous informe que Bacula ne peut trouver aucun volume dans le 
445 pool Default sur lequel \'ecrire les donn\'ees du job. Ceci est normal, car nous 
446 n'avons encore cr\'e\'e (ou \'etiquet\'e) aucun volume. Bacula vous fournit tous les d\'etails 
447 concernant le volume dont il a besoin. 
448
449 A ce point, le job est bloqu\'e en attente d'un volume. Vous pouvez le v\'erifier 
450 en utilisant la commande {\bf status dir}. Pour continuer, vous devez cr\'eer un 
451 volume sur lequel Bacula pourra \'ecrire. Voici la manipulation :
452
453 \footnotesize
454 \begin{verbatim}
455 label
456 \end{verbatim}
457 \normalsize
458
459 Bacula devrait afficher :
460
461 \footnotesize
462 \begin{verbatim}
463 The defined Storage resources are:
464      1: File
465 Item 1 selected automatically.
466 Enter new Volume name:
467 \end{verbatim}
468 \normalsize
469
470 Entrez un nom commençant par une lettre et ne contenant que des chiffres et des lettres 
471 (p\'eriodes, tirets et soulign\'e "_" sont aussi autoris\'es). Par exemple entrez {\bf TestVolume001}, 
472 vous devriez obtenir : 
473
474 \footnotesize
475 \begin{verbatim}
476 Defined Pools:
477      1: Default
478 Item 1 selected automatically.
479 Connecting to Storage daemon File at rufus:8103 ...
480 Sending label command for Volume "TestVolume001" Slot 0 ...
481 3000 OK label. Volume=TestVolume001 Device=/tmp
482 Catalog record for Volume "TestVolume002", Slot 0  successfully created.
483 Requesting mount FileStorage ...
484 3001 OK mount. Device=/tmp
485 \end{verbatim}
486 \normalsize
487
488 Finalement, tapez la commande {\bf messages}, vous devriez obtenir quelque chose comme :
489
490 \footnotesize
491 \begin{verbatim}
492 28-Apr-2003 14:30 rufus-sd: Wrote label to prelabeled Volume
493    "TestVolume001" on device /tmp
494 28-Apr-2003 14:30 rufus-dir: Bacula 1.30 (28Apr03): 28-Apr-2003 14:30
495 JobId:                  1
496 Job:                    Client1.2003-04-28_14.22.33
497 FileSet:                Full Set
498 Backup Level:           Full
499 Client:                 rufus-fd
500 Start time:             28-Apr-2003 14:22
501 End time:               28-Apr-2003 14:30
502 Files Written:          1,444
503 Bytes Written:          38,988,877
504 Rate:                   81.2 KB/s
505 Software Compression:   None
506 Volume names(s):        TestVolume001
507 Volume Session Id:      1
508 Volume Session Time:    1051531381
509 Last Volume Bytes:      39,072,359
510 FD termination status:  OK
511 SD termination status:  OK
512 Termination:            Backup OK
513 28-Apr-2003 14:30 rufus-dir: Begin pruning Jobs.
514 28-Apr-2003 14:30 rufus-dir: No Jobs found to prune.
515 28-Apr-2003 14:30 rufus-dir: Begin pruning Files.
516 28-Apr-2003 14:30 rufus-dir: No Files found to prune.
517 28-Apr-2003 14:30 rufus-dir: End auto prune.
518 \end{verbatim}
519 \normalsize
520
521 Si rien ne se passe dans l'imm\'ediat, vous pouvez continuer de rentrer la 
522 commande {\bf messages} jusqu'\`a ce que le job se termine, ou utiliser la 
523 commande {\bf autodisplay on} afin que les messages soient affich\'es d\`es-qu'ils 
524 sont disponibles.
525
526 si vous faites {\bf ls -l} dans votre r\'epertoire {\bf /tmp}, vous verrez 
527 l'\'el\'ement suivant : 
528
529 \footnotesize
530 \begin{verbatim}
531 -rw-r-----    1 kern     kern     39072153 Apr 28 14:30 TestVolume001
532 \end{verbatim}
533 \normalsize
534
535 Il s'agit du volume File que vous venez juste d'\'ecrire, et qui contient toutes 
536 les donn\'ees du job que vous venez d'ex\'ecuter. Si vous ex\'ecutez d'autres jobs, 
537 il seront ajout\'es \`a la suite de ce volume, \`a moins que vous n'ayez sp\'ecifi\'e 
538 un autre comportement.
539
540 Vous vous demandez peut-\^etre s'il va vous falloir \'etiqueter vous même chaque 
541 volume que Bacula sera amen\'e \`a utiliser. La r\'eponse, en ce qui concerne les 
542 volumes disque tels que celui que nous avons utilis\'e, est non. Il est possible 
543 de param\'etrer Bacula pour qu'il cr\'e\'ee lui même les volumes. En revanche, 
544 pour les volumes de type cartouche, il vous faudra tr\`es probablement 
545 \'etiqueter chaque volume que vous voulez utiliser.
546
547 Si vous souhaitez en rester l\`a, saisissez simplement {\bf quit} dans la 
548 console, puis stoppez Bacula avec {\bf ./bacula stop}. Pour nettoyer 
549 votre installation des r\'esultats de vos tests, supprimez le fichier 
550  {\bf /tmp/TestVolume001}, et r\'einitialiser votre catalogue en utilisant :
551
552 \footnotesize
553 \begin{verbatim}
554 ./drop_bacula_tables
555 ./make_bacula_tables
556 \end{verbatim}
557 \normalsize
558
559 Notez bien que ceci supprimera toutes les informations concernant les jobs pr\'ec\'edemment 
560 ex\'ecut\'es et que, si c'est sans doute ce que vous souhaitez faire en fin de phase de 
561 test, ce n'est g\'en\'eralement pas une op\'eration souhaitable en utilisation normale.
562
563 Si vous souhaitez essayer de restaurer les fichiers que vous venez de sauvegarder, 
564 lisez la section suivante.
565
566 \label{restoring}
567
568 \subsection*{Restoring Your Files}
569 \index[general]{Files!Restoring Your }
570 \index[general]{Restoring Your Files }
571 \addcontentsline{toc}{subsection}{Restoring Your Files}
572
573 If you have run the default configuration and the save of the Bacula source
574 code as demonstrated above, you can restore the backed up files in the Console
575 program by entering: 
576
577 \footnotesize
578 \begin{verbatim}
579 restore all
580 \end{verbatim}
581 \normalsize
582
583 where you will get: 
584
585 \footnotesize
586 \begin{verbatim}
587 First you select one or more JobIds that contain files
588 to be restored. You will be presented several methods
589 of specifying the JobIds. Then you will be allowed to
590 select which files from those JobIds are to be restored.
591
592 To select the JobIds, you have the following choices:
593      1: List last 20 Jobs run
594      2: List Jobs where a given File is saved
595      3: Enter list of comma separated JobIds to select
596      4: Enter SQL list command
597      5: Select the most recent backup for a client
598      6: Select backup for a client before a specified time
599      7: Enter a list of files to restore
600      8: Enter a list of files to restore before a specified time
601      9: Find the JobIds of the most recent backup for a client
602     10: Find the JobIds for a backup for a client before a specified time
603     11: Enter a list of directories to restore for found JobIds
604     12: Cancel
605 Select item:  (1-12): 
606 \end{verbatim}
607 \normalsize
608
609 As you can see, there are a number of options, but for the current
610 demonstration, please enter {\bf 5} to do a restore of the last backup you
611 did, and you will get the following output: 
612
613 \footnotesize
614 \begin{verbatim}
615 Defined Clients:
616      1: rufus-fd
617 Item 1 selected automatically.
618 The defined FileSet resources are:
619      1: 1  Full Set  2003-04-28 14:22:33
620 Item 1 selected automatically.
621 +-------+-------+----------+---------------------+---------------+
622 | JobId | Level | JobFiles | StartTime           | VolumeName    |
623 +-------+-------+----------+---------------------+---------------+
624 | 1     | F     | 1444     | 2003-04-28 14:22:33 | TestVolume002 |
625 +-------+-------+----------+---------------------+---------------+
626 You have selected the following JobId: 1
627 Building directory tree for JobId 1 ...
628 1 Job inserted into the tree and marked for extraction.
629 The defined Storage resources are:
630      1: File
631 Item 1 selected automatically.
632 You are now entering file selection mode where you add and
633 remove files to be restored. All files are initially added.
634 Enter "done" to leave this mode.
635 cwd is: /
636 $
637 \end{verbatim}
638 \normalsize
639
640 where I have truncated the listing on the right side to make it more readable.
641 As you can see by starting at the top of the listing, Bacula knows what client
642 you have, and since there was only one, it selected it automatically, likewise
643 for the FileSet. Then Bacula produced a listing containing all the jobs that
644 form the current backup, in this case, there is only one, and the Storage
645 daemon was also automatically chosen. Bacula then took all the files that were
646 in Job number 1 and entered them into a {\bf directory tree} (a sort of in
647 memory representation of your filesystem). At this point, you can use the {\bf
648 cd} and {\bf ls} ro {\bf dir} commands to walk up and down the directory tree
649 and view what files will be restored. For example, if I enter {\bf cd
650 /home/kern/bacula/bacula-1.30} and then enter {\bf dir} I will get a listing
651 of all the files in the Bacula source directory. On your system, the path will
652 be somewhat different. For more information on this, please refer to the 
653 \ilink{Restore Command Chapter}{_ChapterStart13} of this manual for
654 more details. 
655
656 To exit this mode, simply enter: 
657
658 \footnotesize
659 \begin{verbatim}
660 done
661 \end{verbatim}
662 \normalsize
663
664 and you will get the following output: 
665
666 \footnotesize
667 \begin{verbatim}
668 Bootstrap records written to
669    /home/kern/bacula/testbin/working/restore.bsr
670 The restore job will require the following Volumes:
671    
672    TestVolume001
673 1444 files selected to restore.
674 Run Restore job
675 JobName:    RestoreFiles
676 Bootstrap:  /home/kern/bacula/testbin/working/restore.bsr
677 Where:      /tmp/bacula-restores
678 Replace:    always
679 FileSet:    Full Set
680 Client:     rufus-fd
681 Storage:    File
682 JobId:      *None*
683 When:       2005-04-28 14:53:54
684 OK to run? (yes/mod/no):
685 \end{verbatim}
686 \normalsize
687
688 If you answer {\bf yes} your files will be restored to {\bf
689 /tmp/bacula-restores}. If you want to restore the files to their original
690 locations, you must use the {\bf mod} option and explicitly set {\bf Where:}
691 to nothing (or to /). We recommend you go ahead and answer {\bf yes} and after
692 a brief moment, enter {\bf messages}, at which point you should get a listing
693 of all the files that were restored as well as a summary of the job that looks
694 similar to this: 
695
696 \footnotesize
697 \begin{verbatim}
698 28-Apr-2005 14:56 rufus-dir: Bacula 1.30 (28Apr03): 28-Apr-2003 14:56
699 JobId:                  2
700 Job:                    RestoreFiles.2005-04-28_14.56.06
701 Client:                 rufus-fd
702 Start time:             28-Apr-2005 14:56
703 End time:               28-Apr-2005 14:56
704 Files Restored:         1,444
705 Bytes Restored:         38,816,381
706 Rate:                   9704.1 KB/s
707 FD termination status:  OK
708 Termination:            Restore OK
709 28-Apr-2005 14:56 rufus-dir: Begin pruning Jobs.
710 28-Apr-2005 14:56 rufus-dir: No Jobs found to prune.
711 28-Apr-2005 14:56 rufus-dir: Begin pruning Files.
712 28-Apr-2005 14:56 rufus-dir: No Files found to prune.
713 28-Apr-2005 14:56 rufus-dir: End auto prune.
714 \end{verbatim}
715 \normalsize
716
717 After exiting the Console program, you can examine the files in {\bf
718 /tmp/bacula-restores}, which will contain a small directory tree with all the
719 files. Be sure to clean up at the end with: 
720
721 \footnotesize
722 \begin{verbatim}
723 rm -rf /tmp/bacula-restore
724 \end{verbatim}
725 \normalsize
726
727 \subsection*{Quitting the Console Program}
728 \index[general]{Program!Quitting the Console }
729 \index[general]{Quitting the Console Program }
730 \addcontentsline{toc}{subsection}{Quitting the Console Program}
731
732 Simply enter the command {\bf quit}. 
733 \label{SecondClient}
734
735 \subsection*{Adding a Second Client}
736 \index[general]{Client!Adding a Second }
737 \index[general]{Adding a Second Client }
738 \addcontentsline{toc}{subsection}{Adding a Second Client}
739
740 If you have gotten the example shown above to work on your system, you may be
741 ready to add a second Client (File daemon). That is you have a second machine
742 that you would like backed up. The only part you need installed on the other
743 machine is the binary {\bf bacula-fd} (or {\bf bacula-fd.exe} for Windows) and
744 its configuration file {\bf bacula-fd.conf}. You can start with the same {\bf
745 bacula-fd.conf} file that you are currently using and make one minor
746 modification to it to create the conf file for your second client. Change the
747 File daemon name from whatever was configured, {\bf rufus-fd} in the example
748 above, but your system will have a different name. The best is to change it to
749 the name of your second machine. For example: 
750
751 \footnotesize
752 \begin{verbatim}
753 ...
754 #
755 # "Global" File daemon configuration specifications
756 #
757 FileDaemon {                          # this is me
758   Name = rufus-fd
759   FDport = 9102                  # where we listen for the director
760   WorkingDirectory = /home/kern/bacula/working
761   Pid Directory = /var/run
762 }
763 ...
764 \end{verbatim}
765 \normalsize
766
767 would become: 
768
769 \footnotesize
770 \begin{verbatim}
771 ...
772 #
773 # "Global" File daemon configuration specifications
774 #
775 FileDaemon {                          # this is me
776   Name = matou-fd
777   FDport = 9102                  # where we listen for the director
778   WorkingDirectory = /home/kern/bacula/working
779   Pid Directory = /var/run
780 }
781 ...
782 \end{verbatim}
783 \normalsize
784
785 where I show just a portion of the file and have changed {\bf rufus-fd} to
786 {\bf matou-fd}. The names you use are your choice. For the moment, I recommend
787 you change nothing else. Later, you will want to change the password. 
788
789 Now you should install that change on your second machine. Then you need to
790 make some additions to your Director's configuration file to define the new
791 File daemon or Client. Starting from our original example which should be
792 installed on your system, you should add the following lines (essentially
793 copies of the existing data but with the names changed) to your Director's
794 configuration file {\bf bacula-dir.conf}. 
795
796 \footnotesize
797 \begin{verbatim}
798 #
799 # Define the main nightly save backup job
800 #   By default, this job will back up to disk in /tmp
801 Job {
802   Name = "Matou"
803   Type = Backup
804   Client = matou-fd
805   FileSet = "Full Set"
806   Schedule = "WeeklyCycle"
807   Storage = File
808   Messages = Standard
809   Pool = Default
810   Write Bootstrap = "/home/kern/bacula/working/matou.bsr"
811 }
812 # Client (File Services) to backup
813 Client {
814   Name = matou-fd
815   Address = matou
816   FDPort = 9102
817   Catalog = MyCatalog
818   Password = "xxxxx"                  # password for
819   File Retention = 30d                # 30 days
820   Job Retention = 180d                # six months
821   AutoPrune = yes                     # Prune expired Jobs/Files
822 }
823 \end{verbatim}
824 \normalsize
825
826 Then make sure that the Address parameter in the Storage resource is set to
827 the fully qualified domain name and not to something like "localhost". The
828 address specified is sent to the File daemon (client) and it must be a fully
829 qualified domain name. If you pass something like "localhost" it will not
830 resolve correctly and will result in a time out when the File daemon fails to
831 connect to the Storage daemon. 
832
833 That is all that is necessary. I copied the existing resource to create a
834 second Job (Matou) to backup the second client (matou-fd). It has the name
835 {\bf Matou}, the Client is named {\bf matou-fd}, and the bootstrap file name
836 is changed, but everything else is the same. This means that Matou will be
837 backed up on the same schedule using the same set of tapes. You may want to
838 change that later, but for now, let's keep it simple. 
839
840 The second change was to add a new Client resource that defines {\bf matou-fd}
841 and has the correct address {\bf matou}, but in real life, you may need a
842 fully qualified domain name or an IP address. I also kept the password the
843 same (shown as xxxxx for the example). 
844
845 At this point, if you stop Bacula and restart it, and start the Client on the
846 other machine, everything will be ready, and the prompts that you saw above
847 will now include the second machine. 
848
849 To make this a real production installation, you will possibly want to use
850 different Pool, or a different schedule. It is up to you to customize. In any
851 case, you should change the password in both the Director's file and the
852 Client's file for additional security. 
853
854 For some important tips on changing names and passwords, and a diagram of what
855 names and passwords must match, please see 
856 \ilink{Authorization Errors}{AuthorizationErrors} in the FAQ chapter
857 of this manual. 
858
859 \subsection*{When The Tape Fills}
860 \label{FullTape}
861 \index[general]{Fills!When The Tape }
862 \index[general]{When The Tape Fills }
863 \addcontentsline{toc}{subsection}{When The Tape Fills}
864
865 If you have scheduled your job, typically nightly, there will come a time when
866 the tape fills up and {\bf Bacula} cannot continue. In this case, Bacula will
867 send you a message similar to the following: 
868
869 \footnotesize
870 \begin{verbatim}
871 rufus-sd: block.c:337 === Write error errno=28: ERR=No space left
872           on device
873 \end{verbatim}
874 \normalsize
875
876 This indicates that Bacula got a write error because the tape is full. Bacula
877 will then search the Pool specified for your Job looking for an appendable
878 volume. In the best of all cases, you will have properly set your Retention
879 Periods and you will have all your tapes marked to be Recycled, and {\bf
880 Bacula} will automatically recycle the tapes in your pool requesting and
881 overwriting old Volumes. For more information on recycling, please see the 
882 \ilink{Recycling chapter}{_ChapterStart22} of this manual. If you
883 find that your Volumes were not properly recycled (usually because of a
884 configuration error), please see the 
885 \ilink{Manually Recycling Volumes}{manualrecycling} section of
886 the Recycling chapter. 
887
888 If like me, you have a very large set of Volumes and you label them with the
889 date the Volume was first writing, or you have not set up your Retention
890 periods, Bacula will not find a tape in the pool, and it will send you a
891 message similar to the following: 
892
893 \footnotesize
894 \begin{verbatim}
895 rufus-sd: Job kernsave.2002-09-19.10:50:48 waiting. Cannot find any
896           appendable volumes.
897 Please use the "label"  command to create a new Volume for:
898     Storage:      SDT-10000
899     Media type:   DDS-4
900     Pool:         Default
901 \end{verbatim}
902 \normalsize
903
904 Until you create a new Volume, this message will be repeated an hour later,
905 then two hours later, and so on doubling the interval each time up to a
906 maximum interval of 1 day. 
907
908 The obvious question at this point is: What do I do now? 
909
910 The answer is simple: first, using the Console program, close the tape drive
911 using the {\bf unmount} command. If you only have a single drive, it will be
912 automatically selected, otherwise, make sure you release the one specified on
913 the message (in this case {\bf STD-10000}). 
914
915 Next, you remove the tape from the drive and insert a new blank tape. Note, on
916 some older tape drives, you may need to write an end of file mark ({\bf mt \
917 -f \ /dev/nst0 \ weof}) to prevent the drive from running away when Bacula
918 attempts to read the label. 
919
920 Finally, you use the {\bf label} command in the Console to write a label to
921 the new Volume. The {\bf label} command will contact the Storage daemon to
922 write the software label, if it is successful, it will add the new Volume to
923 the Pool, then issue a {\bf mount} command to the Storage daemon. See the
924 previous sections of this chapter for more details on labeling tapes. 
925
926 The result is that Bacula will continue the previous Job writing the backup to
927 the new Volume. 
928
929 If you have a Pool of volumes and Bacula is cycling through them, instead of
930 the above message "Cannot find any appendable volumes.", Bacula may ask you
931 to mount a specific volume. In that case, you should attempt to do just that.
932 If you do not have the volume any more (for any of a number of reasons), you
933 can simply mount another volume from the same Pool, providing it is
934 appendable, and Bacula will use it. You can use the {\bf list volumes} command
935 in the console program to determine which volumes are appendable and which are
936 not. 
937
938 If like me, you have your Volume retention periods set correctly, but you have
939 no more free Volumes, you can relabel and reuse a Volume as follows: 
940
941 \begin{itemize}
942 \item Do a {\bf list volumes} in the Console and select the oldest  Volume for
943    relabeling.  
944 \item If you have setup your Retention periods correctly, the  Volume should
945    have VolStatus {\bf Purged}.  
946 \item If the VolStatus is not set to Purged, you will need to purge  the
947    database of Jobs that are written on that Volume. Do so  by using the command
948    {\bf purge jobs volume} in the Console.  If you have multiple Pools, you will
949 be prompted for the  Pool then enter the VolumeName (or MediaId) when
950 requested.  
951 \item Then simply use the {\bf relabel} command to relabel the  Volume. 
952    \end{itemize}
953
954 To manually relabel the Volume use the following additional steps: 
955
956 \begin{itemize}
957 \item To delete the Volume from the catalog use the {\bf delete volume} 
958    command in the Console and select the VolumeName (or MediaId) to be  deleted. 
959
960 \item Use the {\bf unmount} command in the Console to unmount the  old tape.  
961 \item Physically relabel the old Volume that you deleted so that it  can be
962    reused.  
963 \item Insert the old Volume in the tape drive.  
964 \item From a command line do: {\bf mt \ -f \ /dev/st0 \ rewind} and  {\bf mt \
965    -f \ /dev/st0 \ weof}, where you need to use the proper  tape drive name for
966    your system in place of {\bf /dev/st0}.  
967 \item Use the {\bf label} command in the Console to write a new  Bacula label
968    on your tape.  
969 \item Use the {\bf mount} command in the Console if it is not automatically 
970    done, so that Bacula starts using your newly labeled tape. 
971    \end{itemize}
972
973 \subsection*{Other Useful Console Commands}
974 \index[general]{Commands!Other Useful Console }
975 \index[general]{Other Useful Console Commands }
976 \addcontentsline{toc}{subsection}{Other Useful Console Commands}
977
978 \begin{description}
979
980 \item [status dir]
981    \index[console]{status dir }
982    Print a status of all running jobs and jobs  scheduled in the next 24 hours.  
983
984 \item [status]
985    \index[console]{status }
986    The console program will prompt you to select  a daemon type, then will
987 request the daemon's status.  
988
989 \item [status jobid=nn]
990    \index[console]{status jobid }
991    Print a status of JobId nn if it is running.  The Storage daemon is contacted
992 and requested to print a current  status of the job as well.  
993
994 \item [list pools]
995    \index[console]{list pools }
996    List the pools defined in the Catalog (normally  only Default is used).  
997
998 \item [list media]
999    \index[console]{list media }
1000    Lists all the media defined in the Catalog.  
1001
1002 \item [list jobs]
1003    \index[console]{list jobs }
1004    Lists all jobs in the Catalog that have run.  
1005
1006 \item [list jobid=nn]
1007    \index[console]{list jobid }
1008    Lists JobId nn from the Catalog.  
1009
1010 \item [list jobtotals]
1011    \index[console]{list jobtotals }
1012    Lists totals for all jobs in the Catalog.  
1013
1014 \item [list files jobid=nn]
1015    \index[console]{list files jobid }
1016    List the files that were saved for JobId nn.  
1017
1018 \item [list jobmedia]
1019    \index[console]{list jobmedia }
1020    List the media information for each Job run.  
1021
1022 \item [messages]
1023    \index[console]{messages }
1024    Prints any messages that have been directed to the console.  
1025
1026 \item [unmount storage=storage-name]
1027    \index[console]{unmount storage }
1028    Unmounts the drive associated with the storage  device with the name {\bf
1029 storage-name} if the drive is not currently being  used. This command is used
1030 if you wish Bacula to free the drive so  that you can use it to label a tape. 
1031
1032
1033 \item [mount storage=storage-name]
1034    \index[sd]{mount storage }
1035    Causes the drive associated with the  storage device to be mounted again. When
1036 Bacula reaches the end of a volume and requests you to mount a  new volume,
1037 you must issue this command after you have placed the  new volume in the
1038 drive. In effect, it is the signal needed by  Bacula to know to start reading
1039 or writing the new volume.  
1040
1041 \item [quit]
1042    \index[sd]{quit }
1043    Exit or quit the console program. 
1044 \end{description}
1045
1046 Most of the commands given above, with the exception of {\bf list}, will
1047 prompt you for the necessary arguments if you simply enter the command name. 
1048
1049 \subsection*{Debug Daemon Output}
1050 \index[general]{Debug Daemon Output }
1051 \index[general]{Output!Debug Daemon }
1052 \addcontentsline{toc}{subsection}{Debug Daemon Output}
1053
1054 If you want debug output from the daemons as they are running, start the
1055 daemons from the install directory as follows: 
1056
1057 \footnotesize
1058 \begin{verbatim}
1059 ./bacula start -d100
1060 \end{verbatim}
1061 \normalsize
1062
1063 This can be particularly helpful if your daemons do not start correctly,
1064 because direct daemon output to the console is normally directed to the
1065 NULL device, but with the debug level greater than zero, the output
1066 will be sent to the starting terminal.
1067
1068 To stop the three daemons, enter the following from the install directory: 
1069
1070 \footnotesize
1071 \begin{verbatim}
1072 ./bacula stop
1073 \end{verbatim}
1074 \normalsize
1075
1076 The execution of {\bf bacula stop} may complain about pids not found. This is
1077 OK, especially if one of the daemons has died, which is very rare. 
1078
1079 To do a full system save, each File daemon must be running as root so that it
1080 will have permission to access all the files. None of the other daemons
1081 require root privileges. However, the Storage daemon must be able to open the
1082 tape drives. On many systems, only root can access the tape drives. Either run
1083 the Storage daemon as root, or change the permissions on the tape devices to
1084 permit non-root access. MySQL and PostgreSQL can be installed and run with any
1085 userid; root privilege is not necessary. 
1086
1087 \subsection*{Have Patience When Starting the Daemons or Mounting Blank Tapes}
1088 \index[general]{Have Patience When Starting the Daemons or Mounting Blank
1089 Tapes }
1090 \index[general]{Tapes!Have Patience When Starting the Daemons or Mounting
1091 Blank }
1092 \addcontentsline{toc}{subsection}{Have Patience When Starting the Daemons or
1093 Mounting Blank Tapes}
1094
1095 When you start the Bacula daemons, the Storage daemon attempts to open all
1096 defined storage devices and verify the currently mounted Volume (if
1097 configured). Until all the storage devices are verified, the Storage daemon
1098 will not accept connections from the Console program. If a tape was previously
1099 used, it will be rewound, and on some devices this can take several minutes.
1100 As a consequence, you may need to have a bit of patience when first contacting
1101 the Storage daemon after starting the daemons. If you can see your tape drive,
1102 once the lights stop flashing, the drive will be ready to be used. 
1103
1104 The same considerations apply if you have just mounted a blank tape in a drive
1105 such as an HP DLT. It can take a minute or two before the drive properly
1106 recognizes that the tape is blank. If you attempt to {\bf mount} the tape with
1107 the Console program during this recognition period, it is quite possible that
1108 you will hang your SCSI driver (at least on my RedHat Linux system). As a
1109 consequence, you are again urged to have patience when inserting blank tapes.
1110 Let the device settle down before attempting to access it. 
1111
1112 \subsection*{Difficulties Connecting from the FD to the SD}
1113 \index[general]{Difficulties Connecting from the FD to the SD }
1114 \index[general]{SD!Difficulties Connecting from the FD to the }
1115 \addcontentsline{toc}{subsection}{Difficulties Connecting from the FD to the
1116 SD}
1117
1118 If you are having difficulties getting one or more of your File daemons to
1119 connect to the Storage daemon, it is most likely because you have not used a
1120 fully qualified domain name on the {\bf Address} directive in the
1121 Director's Storage resource. That is the resolver on the File daemon's machine
1122 (not on the Director's) must be able to resolve the name you supply into an IP
1123 address. An example of an address that is guaranteed not to work: {\bf
1124 localhost}. An example that may work: {\bf megalon}. An example that is more
1125 likely to work: {\bf magalon.mydomain.com}. On Win32 if you don't have a good
1126 resolver (often true on older Win98 systems), you might try using an IP
1127 address in place of a name. 
1128
1129 If your address is correct, then make sure that no other program is using the
1130 port 9103 on the Storage daemon's machine. The Bacula port number are
1131 authorized by IANA, and should not be used by other programs, but apparently
1132 some HP printers do use these port numbers. A {\bf netstat -a} on the Storage
1133 daemon's machine can determine who is using the 9103 port (used for FD to SD
1134 communications in Bacula). 
1135
1136 \subsection*{Daemon Command Line Options}
1137 \index[general]{Daemon Command Line Options }
1138 \index[general]{Options!Daemon Command Line }
1139 \addcontentsline{toc}{subsection}{Daemon Command Line Options}
1140
1141 Each of the three daemons (Director, File, Storage) accepts a small set of
1142 options on the command line. In general, each of the daemons as well as the
1143 Console program accepts the following options: 
1144
1145 \begin{description}
1146
1147 \item [-c \lt{}file\gt{}]
1148    \index[sd]{-c \lt{}file\gt{} }
1149    Define the file to use as a  configuration file. The default is the daemon
1150 name followed  by {\bf .conf} i.e. {\bf bacula-dir.conf} for the Director, 
1151 {\bf bacula-fd.conf} for the File daemon, and {\bf bacula-sd}  for the Storage
1152 daemon.  
1153
1154 \item [-d nn]
1155    \index[sd]{-d nn }
1156    Set the debug level to {\bf nn}. Higher levels  of debug cause more
1157 information to be displayed on STDOUT concerning  what the daemon is doing.  
1158
1159 \item [-f]
1160    Run the daemon in the foreground. This option is  needed to run the daemon
1161    under the debugger.  
1162
1163 \item [-s]
1164    Do not trap signals. This option is needed to run  the daemon under the
1165    debugger.  
1166
1167 \item [-t]
1168    Read the configuration file and print any error messages,  then immediately
1169    exit. Useful for syntax testing of  new configuration files.  
1170
1171 \item [-v]
1172    Be more verbose or more complete in printing error  and informational
1173    messages. Recommended.  
1174
1175 \item [-?]
1176    Print the version and list of options. 
1177    \end{description}
1178
1179 The Director has the following additional Director specific option: 
1180
1181 \begin{description}
1182
1183 \item [-r \lt{}job\gt{}]
1184    \index[fd]{-r \lt{}job\gt{} }
1185    Run the named job immediately. This is  for debugging and should not be used. 
1186 \end{description}
1187
1188 The File daemon has the following File daemon specific option: 
1189
1190 \begin{description}
1191
1192 \item [-i]
1193    Assume that the daemon is called from {\bf inetd}  or {\bf xinetd}. In this
1194    case, the daemon assumes that a connection  has already been made and that it
1195 is passed as STDIN. After the  connection terminates the daemon will exit. 
1196 \end{description}
1197
1198 The Storage daemon has no Storage daemon specific options. 
1199
1200 The Console program has no console specific options. 
1201
1202 \subsection*{Creating a Pool}
1203 \label{Pool}
1204 \index[general]{Pool!Creating a }
1205 \index[general]{Creating a Pool }
1206 \addcontentsline{toc}{subsection}{Creating a Pool}
1207
1208 Creating the Pool is automatically done when {\bf Bacula} starts, so if you
1209 understand Pools, you can skip to the next section. 
1210
1211 When you run a job, one of the things that Bacula must know is what Volumes to
1212 use to backup the FileSet. Instead of specifying a Volume (tape) directly, you
1213 specify which Pool of Volumes you want Bacula to consult when it wants a tape
1214 for writing backups. Bacula will select the first available Volume from the
1215 Pool that is appropriate for the Storage device you have specified for the Job
1216 being run. When a volume has filled up with data, {\bf Bacula} will change its
1217 VolStatus from {\bf Append} to {\bf Full}, and then {\bf Bacula} will use the
1218 next volume and so on. If no appendable Volume exists in the Pool, the
1219 Director will attempt to recycle an old Volume, if there are still no
1220 appendable Volumes available, {\bf Bacula} will send a message requesting the
1221 operator to create an appropriate Volume. 
1222
1223 {\bf Bacula} keeps track of the Pool name, the volumes contained in the Pool,
1224 and a number of attributes of each of those Volumes. 
1225
1226 When Bacula starts, it ensures that all Pool resource definitions have been
1227 recorded in the catalog. You can verify this by entering: 
1228
1229 \footnotesize
1230 \begin{verbatim}
1231 list pools
1232 \end{verbatim}
1233 \normalsize
1234
1235 to the console program, which should print something like the following: 
1236
1237 \footnotesize
1238 \begin{verbatim}
1239 *list pools
1240 Using default Catalog name=MySQL DB=bacula
1241 +--------+---------+---------+---------+----------+-------------+
1242 | PoolId | Name    | NumVols | MaxVols | PoolType | LabelFormat |
1243 +--------+---------+---------+---------+----------+-------------+
1244 | 1      | Default | 3       | 0       | Backup   | *           |
1245 | 2      | File    | 12      | 12      | Backup   | File        |
1246 +--------+---------+---------+---------+----------+-------------+
1247 *
1248 \end{verbatim}
1249 \normalsize
1250
1251 If you attempt to create the same Pool name a second time, {\bf Bacula} will
1252 print: 
1253
1254 \footnotesize
1255 \begin{verbatim}
1256 Error: Pool Default already exists.
1257 Once created, you may use the {\bf update} command to
1258 modify many of the values in the Pool record.
1259 \end{verbatim}
1260 \normalsize
1261
1262 \label{Labeling}
1263
1264 \subsection*{Labeling Your Volumes}
1265 \index[general]{Volumes!Labeling Your }
1266 \index[general]{Labeling Your Volumes }
1267 \addcontentsline{toc}{subsection}{Labeling Your Volumes}
1268
1269 Bacula requires that each Volume contains a software label. There are several
1270 strategies for labeling volumes. The one I use is to label them as they are
1271 needed by {\bf Bacula} using the console program. That is when Bacula needs a
1272 new Volume, and it does not find one in the catalog, it will send me an email
1273 message requesting that I add Volumes to the Pool. I then use the {\bf label}
1274 command in the Console program to label a new Volume and to define it in the
1275 Pool database, after which Bacula will begin writing on the new Volume.
1276 Alternatively, I can use the Console {\bf relabel} command to relabel a Volume
1277 that is no longer used providing it has VolStatus {\bf Purged}. 
1278
1279 Another strategy is to label a set of volumes at the start, then use them as
1280 {\bf Bacula} requests them. This is most often done if you are cycling through
1281 a set of tapes, for example using an autochanger. For more details on
1282 recycling, please see the 
1283 \ilink{Automatic Volume Recycling}{_ChapterStart22} chapter of
1284 this manual. 
1285
1286 If you run a Bacula job, and you have no labeled tapes in the Pool, Bacula
1287 will inform you, and you can create them "on-the-fly" so to speak. In my
1288 case, I label my tapes with the date, for example: {\bf DLT-18April02}. See
1289 below for the details of using the {\bf label} command. 
1290
1291 \subsection*{Labeling Volumes with the Console Program}
1292 \index[general]{Labeling Volumes with the Console Program }
1293 \index[general]{Program!Labeling Volumes with the Console }
1294 \addcontentsline{toc}{subsection}{Labeling Volumes with the Console Program}
1295
1296 Labeling volumes is normally done by using the console program. 
1297
1298 \begin{enumerate}
1299 \item ./bconsole  
1300 \item label 
1301    \end{enumerate}
1302
1303 If Bacula complains that you cannot label the tape because it is already
1304 labeled, simply {\bf unmount} the tape using the {\bf unmount} command in the
1305 console, then physically mount a blank tape and re-issue the {\bf label}
1306 command. 
1307
1308 Since the physical storage media is different for each device, the {\bf label}
1309 command will provide you with a list of the defined Storage resources such as
1310 the following: 
1311
1312 \footnotesize
1313 \begin{verbatim}
1314 The defined Storage resources are:
1315      1: File
1316      2: 8mmDrive
1317      3: DLTDrive
1318      4: SDT-10000
1319 Select Storage resource (1-4):
1320 \end{verbatim}
1321 \normalsize
1322
1323 At this point, you should have a blank tape in the drive corresponding to the
1324 Storage resource that you select. 
1325
1326 It will then ask you for the Volume name. 
1327
1328 \footnotesize
1329 \begin{verbatim}
1330 Enter new Volume name:
1331 \end{verbatim}
1332 \normalsize
1333
1334 If Bacula complains: 
1335
1336 \footnotesize
1337 \begin{verbatim}
1338 Media record for Volume xxxx already exists.
1339 \end{verbatim}
1340 \normalsize
1341
1342 It means that the volume name {\bf xxxx} that you entered already exists in
1343 the Media database. You can list all the defined Media (Volumes) with the {\bf
1344 list media} command. Note, the LastWritten column has been truncated for
1345 proper printing. 
1346
1347 \footnotesize
1348 \begin{verbatim}
1349 +---------------+---------+--------+----------------+-----/~/-+------------+-----+
1350 | VolumeName    | MediaTyp| VolStat| VolBytes       | LastWri | VolReten   | Recy|
1351 +---------------+---------+--------+----------------+---------+------------+-----+
1352 | DLTVol0002    | DLT8000 | Purged | 56,128,042,217 | 2001-10 | 31,536,000 |   0 |
1353 | DLT-07Oct2001 | DLT8000 | Full   | 56,172,030,586 | 2001-11 | 31,536,000 |   0 |
1354 | DLT-08Nov2001 | DLT8000 | Full   | 55,691,684,216 | 2001-12 | 31,536,000 |   0 |
1355 | DLT-01Dec2001 | DLT8000 | Full   | 55,162,215,866 | 2001-12 | 31,536,000 |   0 |
1356 | DLT-28Dec2001 | DLT8000 | Full   | 57,888,007,042 | 2002-01 | 31,536,000 |   0 |
1357 | DLT-20Jan2002 | DLT8000 | Full   | 57,003,507,308 | 2002-02 | 31,536,000 |   0 |
1358 | DLT-16Feb2002 | DLT8000 | Full   | 55,772,630,824 | 2002-03 | 31,536,000 |   0 |
1359 | DLT-12Mar2002 | DLT8000 | Full   | 50,666,320,453 | 1970-01 | 31,536,000 |   0 |
1360 | DLT-27Mar2002 | DLT8000 | Full   | 57,592,952,309 | 2002-04 | 31,536,000 |   0 |
1361 | DLT-15Apr2002 | DLT8000 | Full   | 57,190,864,185 | 2002-05 | 31,536,000 |   0 |
1362 | DLT-04May2002 | DLT8000 | Full   | 60,486,677,724 | 2002-05 | 31,536,000 |   0 |
1363 | DLT-26May02   | DLT8000 | Append |  1,336,699,620 | 2002-05 | 31,536,000 |   1 |
1364 +---------------+---------+--------+----------------+-----/~/-+------------+-----+
1365 \end{verbatim}
1366 \normalsize
1367
1368 Once Bacula has verified that the volume does not already exist, it will
1369 prompt you for the name of the Pool in which the Volume (tape) is to be
1370 created.  If there is only one Pool (Default), it will be automatically
1371 selected.
1372
1373 If the tape is successfully labeled, a Volume record will also be created in
1374 the Pool. That is the Volume name and all its other attributes will appear
1375 when you list the Pool. In addition, that Volume will be available for backup
1376 if the MediaType matches what is requested by the Storage daemon. 
1377
1378 When you labeled the tape, you answered very few questions about it --
1379 principally the Volume name, and perhaps the Slot. However, a Volume record in
1380 the catalog database (internally known as a Media record) contains quite a few
1381 attributes. Most of these attributes will be filled in from the default values
1382 that were defined in the Pool (i.e. the Pool holds most of the default
1383 attributes used when creating a Volume). 
1384
1385 It is also possible to add media to the pool without physically labeling the
1386 Volumes. This can be done with the {\bf add} command. For more information,
1387 please see the 
1388 \ilink{Console Chapter}{_ConsoleChapter} of this manual.