]> git.sur5r.net Git - bacula/docs/blob - docs/manual-fr/progs.tex
- Litle fix
[bacula/docs] / docs / manual-fr / progs.tex
1 %%
2 %%
3
4 \section*{Volume Utility Tools}
5 \label{_ChapterStart9}
6 \index[general]{Volume Utility Tools }
7 \index[general]{Tools!Volume Utility }
8 \addcontentsline{toc}{section}{Volume Utility Tools}
9
10 This document describes the utility programs written to aid Bacula users and
11 developers in dealing with Volumes external to Bacula. 
12
13 \subsection*{Specifying the Configuration File}
14 \index[general]{File!Specifying the Configuration }
15 \index[general]{Specifying the Configuration File }
16 \addcontentsline{toc}{subsection}{Specifying the Configuration File}
17
18 Starting with version 1.27, each of the following programs requires a valid
19 Storage daemon configuration file (actually, the only part of the
20 configuration file that these programs need is the {\bf Device} resource
21 definitions). This permits the programs to find the configuration parameters
22 for your archive device (generally a tape drive). By default, they read {\bf
23 bacula-sd.conf} in the current directory, but you may specify a different
24 configuration file using the {\bf -c} option. 
25
26 \subsection*{Specifying a Device Name For a Tape}
27 \index[general]{Tape!Specifying a Device Name For a }
28 \index[general]{Specifying a Device Name For a Tape }
29 \addcontentsline{toc}{subsection}{Specifying a Device Name For a Tape}
30
31 Each of these programs require a {\bf device-name} where the Volume can be
32 found. In the case of a tape, this is the physical device name such as {\bf
33 /dev/nst0} or {\bf /dev/rmt/0ubn} depending on your system. For the program to
34 work, it must find the identical name in the Device resource of the
35 configuration file. See below for specifying Volume names. 
36
37 \subsection*{Specifying a Device Name For a File}
38 \index[general]{File!Specifying a Device Name For a }
39 \index[general]{Specifying a Device Name For a File }
40 \addcontentsline{toc}{subsection}{Specifying a Device Name For a File}
41
42 If you are attempting to read or write an archive file rather than a tape, the
43 {\bf device-name} should be the full path to the archive location including
44 the filename. The filename (last part of the specification) will be stripped
45 and used as the Volume name, and the path (first part before the filename)
46 must have the same entry in the configuration file. So, the path is equivalent
47 to the archive device name, and the filename is equivalent to the volume name.
48
49
50 \subsection*{Specifying Volumes}
51 \index[general]{Volumes!Specifying }
52 \index[general]{Specifying Volumes }
53 \addcontentsline{toc}{subsection}{Specifying Volumes}
54
55 In general, you must specify the Volume name to each of the programs below
56 (with the exception of {\bf btape}). The best method to do so is to specify a
57 {\bf bootstrap} file on the command line with the {\bf -b} option. As part of
58 the bootstrap file, you will then specify the Volume name or Volume names if
59 more than one volume is needed. For example, suppose you want to read tapes
60 {\bf tape1} and {\bf tape2}. First construct a {\bf bootstrap} file named say,
61 {\bf list.bsr} which contains: 
62
63 \footnotesize
64 \begin{verbatim}
65 Volume=test1|test2
66 \end{verbatim}
67 \normalsize
68
69 where each Volume is separated by a vertical bar. Then simply use: 
70
71 \footnotesize
72 \begin{verbatim}
73 ./bls -b list.bsr /dev/nst0
74 \end{verbatim}
75 \normalsize
76
77 In the case of Bacula Volumes that are on files, you may simply append volumes
78 as follows: 
79
80 \footnotesize
81 \begin{verbatim}
82 ./bls /tmp/test1\|test2
83 \end{verbatim}
84 \normalsize
85
86 where the backslash (\textbackslash{}) was necessary as a shell escape to
87 permit entering the vertical bar (|). 
88
89 And finally, if you feel that specifying a Volume name is a bit complicated
90 with a bootstrap file, you can use the {\bf -V} option (on all programs except
91 {\bf bcopy}) to specify one or more Volume names separated by the vertical bar
92 (|). For example, 
93
94 \footnotesize
95 \begin{verbatim}
96 ./bls -V Vol001 /dev/nst0
97 \end{verbatim}
98 \normalsize
99
100 You may also specify an asterisk (*) to indicate that the program should
101 accept any volume. For example: 
102
103 \footnotesize
104 \begin{verbatim}
105 ./bls -V* /dev/nst0
106 \end{verbatim}
107 \normalsize
108
109 \subsection*{bls}
110 \label{bls}
111 \index[general]{Bls }
112 \addcontentsline{toc}{subsection}{bls}
113
114 {\bf bls} can be used to do an {\bf ls} type listing of a {\bf Bacula} tape or
115 file. It is called: 
116
117 \footnotesize
118 \begin{verbatim}
119 Usage: bls [-d debug_level] <device-name>
120        -b <file>       specify a bootstrap file
121        -c <file>       specify a configuration file
122        -d <level>       specify a debug level
123        -e <file>       exclude list
124        -i <file>       include list
125        -j              list jobs
126        -k              list blocks
127        -L              list tape label
128     (none of above)    list saved files
129        -p              proceed inspite of I/O errors
130        -t              use default tape device
131        -v              be verbose
132        -V              specify Volume names (separated by |)
133        -?              print this message
134 \end{verbatim}
135 \normalsize
136
137 For example, to list the contents of a tape: 
138
139 \footnotesize
140 \begin{verbatim}
141 ./bls -V Volume-name /dev/nst0
142 \end{verbatim}
143 \normalsize
144
145 Or to list the contents of a file: 
146
147 \footnotesize
148 \begin{verbatim}
149 ./bls /tmp/Volume-name
150 or
151 ./bls -V Volume-name /tmp
152 \end{verbatim}
153 \normalsize
154
155 Note that, in the case of a file, the Volume name becomes the filename, so in
156 the above example, you will replace the {\bf xxx} with the name of the volume
157 (file) you wrote. 
158
159 Normally if no options are specified, {\bf bls} will produce the equivalent
160 output to the {\bf ls -l} command for each file on the tape. Using other
161 options listed above, it is possible to display only the Job records, only the
162 tape blocks, etc. For example: 
163
164 \footnotesize
165 \begin{verbatim}
166  
167 ./bls /tmp/File002
168 bls: butil.c:148 Using device: /tmp
169 drwxrwxr-x   3 k  k  4096 02-10-19 21:08  /home/kern/bacula/k/src/dird/
170 drwxrwxr-x   2 k  k  4096 02-10-10 18:59  /home/kern/bacula/k/src/dird/CVS/
171 -rw-rw-r--   1 k  k    54 02-07-06 18:02  /home/kern/bacula/k/src/dird/CVS/Root
172 -rw-rw-r--   1 k  k    16 02-07-06 18:02  /home/kern/bacula/k/src/dird/CVS/Repository
173 -rw-rw-r--   1 k  k  1783 02-10-10 18:59  /home/kern/bacula/k/src/dird/CVS/Entries
174 -rw-rw-r--   1 k  k 97506 02-10-18 21:07  /home/kern/bacula/k/src/dird/Makefile
175 -rw-r--r--   1 k  k  3513 02-10-18 21:02  /home/kern/bacula/k/src/dird/Makefile.in
176 -rw-rw-r--   1 k  k  4669 02-07-06 18:02  /home/kern/bacula/k/src/dird/README-config
177 -rw-r--r--   1 k  k  4391 02-09-14 16:51  /home/kern/bacula/k/src/dird/authenticate.c
178 -rw-r--r--   1 k  k  3609 02-07-07 16:41  /home/kern/bacula/k/src/dird/autoprune.c
179 -rw-rw-r--   1 k  k  4418 02-10-18 21:03  /home/kern/bacula/k/src/dird/bacula-dir.conf
180 ...
181 -rw-rw-r--   1 k  k    83 02-08-31 19:19  /home/kern/bacula/k/src/dird/.cvsignore
182 bls: Got EOF on device /tmp
183 84 files found.
184 \end{verbatim}
185 \normalsize
186
187 \subsubsection*{Listing Bacula Jobs}
188 \index[general]{Listing Bacula Jobs }
189 \index[general]{Jobs!Listing Bacula }
190 \addcontentsline{toc}{subsubsection}{Listing Bacula Jobs}
191
192 If you are listing a Volume to determine what Jobs to restore, normally the
193 {\bf -j} option provides you with most of what you will need as long as you
194 don't have multiple clients. For example, 
195
196 \footnotesize
197 \begin{verbatim}
198 ./bls -j /tmp/test1
199 Volume Record: SessId=2 SessTime=1033762386 JobId=0 DataLen=144
200 Begin Session Record: SessId=2 SessTime=1033762386 JobId=1 Level=F Type=B
201 End Session Record: SessId=2 SessTime=1033762386 JobId=1 Level=F Type=B
202 Begin Session Record: SessId=3 SessTime=1033762386 JobId=2 Level=I Type=B
203 End Session Record: SessId=3 SessTime=1033762386 JobId=2 Level=I Type=B
204 Begin Session Record: SessId=4 SessTime=1033762386 JobId=3 Level=I Type=B
205 End Session Record: SessId=4 SessTime=1033762386 JobId=3 Level=I Type=B
206 bls: Got EOF on device /tmp
207 \end{verbatim}
208 \normalsize
209
210 shows a full save followed by two incremental saves. 
211
212 Adding the {\bf -v} option will display virtually all information that is
213 available for each record: 
214
215 \subsubsection*{Listing Bacula Blocks}
216 \index[general]{Listing Bacula Blocks }
217 \index[general]{Blocks!Listing Bacula }
218 \addcontentsline{toc}{subsubsection}{Listing Bacula Blocks}
219
220 Normally, except for debugging purposes, you will not need to list Bacula
221 blocks (the ``primitive'' unit of Bacula data on the Volume). However, you can
222 do so with: 
223
224 \footnotesize
225 \begin{verbatim}
226 ./bls -k /tmp/File002
227 bls: butil.c:148 Using device: /tmp
228 Block: 1 size=64512
229 Block: 2 size=64512
230 ...
231 Block: 65 size=64512
232 Block: 66 size=19195
233 bls: Got EOF on device /tmp
234 End of File on device
235 \end{verbatim}
236 \normalsize
237
238 By adding the {\bf -v} option, you can get more information, which can be
239 useful in knowing what sessions were written to the volume: 
240
241 \footnotesize
242 \begin{verbatim}
243 ./bls -k -v /tmp/File002
244 Volume Label:
245 Id                : Bacula 0.9 mortal
246 VerNo             : 10
247 VolName           : File002
248 PrevVolName       :
249 VolFile           : 0
250 LabelType         : VOL_LABEL
251 LabelSize         : 147
252 PoolName          : Default
253 MediaType         : File
254 PoolType          : Backup
255 HostName          :
256 Date label written: 2002-10-19 at 21:16
257 Block: 1 blen=64512 First rec FI=VOL_LABEL SessId=1 SessTim=1035062102 Strm=0 rlen=147
258 Block: 2 blen=64512 First rec FI=6 SessId=1 SessTim=1035062102 Strm=DATA rlen=4087
259 Block: 3 blen=64512 First rec FI=12 SessId=1 SessTim=1035062102 Strm=DATA rlen=5902
260 Block: 4 blen=64512 First rec FI=19 SessId=1 SessTim=1035062102 Strm=DATA rlen=28382
261 ...
262 Block: 65 blen=64512 First rec FI=83 SessId=1 SessTim=1035062102 Strm=DATA rlen=1873
263 Block: 66 blen=19195 First rec FI=83 SessId=1 SessTim=1035062102 Strm=DATA rlen=2973
264 bls: Got EOF on device /tmp
265 End of File on device
266 \end{verbatim}
267 \normalsize
268
269 Armed with the SessionId and the SessionTime, you can extract just about
270 anything. 
271
272 If you want to know even more, add a second {\bf -v} to the command line to
273 get a dump of every record in every block. 
274
275 \footnotesize
276 \begin{verbatim}
277 ./bls -k -v -v /tmp/File002
278 bls: block.c:79 Dump block  80f8ad0: size=64512 BlkNum=1
279                Hdrcksum=b1bdfd6d cksum=b1bdfd6d
280 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=VOL_LABEL Strm=0 len=147 p=80f8b40
281 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=SOS_LABEL Strm=-7 len=122 p=80f8be7
282 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=1 Strm=UATTR len=86 p=80f8c75
283 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=2 Strm=UATTR len=90 p=80f8cdf
284 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=3 Strm=UATTR len=92 p=80f8d4d
285 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=3 Strm=DATA len=54 p=80f8dbd
286 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=3 Strm=MD5 len=16 p=80f8e07
287 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=4 Strm=UATTR len=98 p=80f8e2b
288 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=4 Strm=DATA len=16 p=80f8ea1
289 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=4 Strm=MD5 len=16 p=80f8ec5
290 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=5 Strm=UATTR len=96 p=80f8ee9
291 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=5 Strm=DATA len=1783 p=80f8f5d
292 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=5 Strm=MD5 len=16 p=80f9668
293 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=UATTR len=95 p=80f968c
294 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=DATA len=32768 p=80f96ff
295 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=DATA len=32768 p=8101713
296 bls: block.c:79 Dump block  80f8ad0: size=64512 BlkNum=2
297                Hdrcksum=9acc1e7f cksum=9acc1e7f
298 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=contDATA len=4087 p=80f8b40
299 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=DATA len=31970 p=80f9b4b
300 bls: block.c:92    Rec: VId=1 VT=1035062102 FI=6 Strm=MD5 len=16 p=8101841
301 ...
302 \end{verbatim}
303 \normalsize
304
305 \subsection*{bextract}
306 \label{bextract}
307 \index[general]{Bextract }
308 \addcontentsline{toc}{subsection}{bextract}
309
310 Normally, you will restore files by running a {\bf Restore} Job from the {\bf
311 Console} program. However, {\bf bextract} can be used to extract a single file
312 or a list of files from a Bacula tape or file. In fact, {\bf bextract} can be
313 a useful tool to restore files to an empty system assuming you are able to
314 boot, you have statically linked {\bf bextract} and you have an appropriate
315 {\bf bootstrap} file. 
316
317 It is called: 
318
319 \footnotesize
320 \begin{verbatim}
321  
322 Usage: bextract [-d debug_level] <device-name> <directory-to-store-files>
323        -b <file>       specify a bootstrap file
324        -dnn            set debug level to nn
325        -e <file>       exclude list
326        -i <file>       include list
327        -p              proceed inspite of I/O errors
328        -V              specify Volume names (separated by |)
329        -?              print this message
330 \end{verbatim}
331 \normalsize
332
333 where {\bf device-name} is the Archive Device (raw device name or full
334 filename) of the device to be read, and {\bf directory-to-store-files} is a
335 path prefix to prepend to all the files restored. 
336
337 NOTE: On Windows systems, if you specify a prefix of say d:/tmp, any file that
338 would have been restored to {\bf c:/My Documents} will be restored to {\bf
339 d:/tmp/My Documents}. That is, the original drive specification will be
340 stripped. If no prefix is specified, the file will be restored to the original
341 drive. 
342
343 \subsubsection*{Extracting with Include or Exclude Lists}
344 \index[general]{Lists!Extracting with Include or Exclude }
345 \index[general]{Extracting with Include or Exclude Lists }
346 \addcontentsline{toc}{subsubsection}{Extracting with Include or Exclude Lists}
347
348 Using the {\bf -e} option, you can specify a file containing a list of files
349 to be excluded. Wildcards can be used in the exclusion list. This option will
350 normally be used in conjunction with the {\bf -i} option (see below). Both the
351 {\bf -e} and the {\bf -i} options may be specified at the same time as the
352 {\bf -b} option. The bootstrap filters will be applied first, then the include
353 list, then the exclude list. 
354
355 Likewise, and probably more importantly, with the {\bf -i} option, you can
356 specify a file that contains a list (one file per line) of files and
357 directories to include to be restored. The list must contain the full filename
358 with the path. If you specify a path name only, all files and subdirectories
359 of that path will be restored. If you specify a line containing only the
360 filename (e.g. {\bf my-file.txt}) it probably will not be extracted because
361 you have not specified the full path. 
362
363 For example, if the file {\bf include-list} contains: 
364
365 \footnotesize
366 \begin{verbatim}
367 /home/kern/bacula
368 /usr/local/bin
369 \end{verbatim}
370 \normalsize
371
372 Then the command: 
373
374 \footnotesize
375 \begin{verbatim}
376 ./bextract -i include-list -V Volume /dev/nst0 /tmp
377 \end{verbatim}
378 \normalsize
379
380 will restore from the Bacula archive {\bf /dev/nst0} all files and directories
381 in the backup from {\bf /home/kern/bacula} and from {\bf /usr/local/bin}. The
382 restored files will be placed in a file of the original name under the
383 directory {\bf /tmp} (i.e. /tmp/home/kern/bacula/... and
384 /tmp/usr/local/bin/...). 
385
386 \subsubsection*{Extracting With a Bootstrap File}
387 \index[general]{File!Extracting With a Bootstrap }
388 \index[general]{Extracting With a Bootstrap File }
389 \addcontentsline{toc}{subsubsection}{Extracting With a Bootstrap File}
390
391 The {\bf -b} option is used to specify a {\bf bootstrap} file containing the
392 information needed to restore precisely the files you want. Specifying a {\bf
393 bootstrap} file is optional but recommended because it gives you the most
394 control over which files will be restored. For more details on the {\bf
395 bootstrap} file, please see 
396 \ilink{Restoring Files with the Bootstrap File}{_ChapterStart43}
397 chapter of this document. Note, you may also use a bootstrap file produced by
398 the {\bf restore} command. For example: 
399
400 \footnotesize
401 \begin{verbatim}
402 ./bextract -b bootstrap-file /dev/nst0 /tmp
403 \end{verbatim}
404 \normalsize
405
406 The bootstrap file allows detailed specification of what files you want
407 restored (extracted). You may specify a bootstrap file and include and/or
408 exclude files at the same time. The bootstrap conditions will first be
409 applied, and then each file record seen will be compared to the include and
410 exclude lists. 
411
412 \subsubsection*{Extracting From Multiple Volumes}
413 \index[general]{Volumes!Extracting From Multiple }
414 \index[general]{Extracting From Multiple Volumes }
415 \addcontentsline{toc}{subsubsection}{Extracting From Multiple Volumes}
416
417 If you wish to extract files that span several Volumes, you can specify the
418 Volume names in the bootstrap file or you may specify the Volume names on the
419 command line by separating them with a vertical bar. See the section above
420 under the {\bf bls} program entitled {\bf Listing Multiple Volumes} for more
421 information. The same techniques apply equally well to the {\bf bextract}
422 program. 
423
424 \subsection*{bscan}
425 \label{bscan}
426 \index[general]{Bscan }
427 \addcontentsline{toc}{subsection}{bscan}
428
429 The {\bf bscan} program can be used to re-create a database (catalog) from the
430 backup information written to one or more Volumes. This is normally needed
431 only if one or more Volumes have been pruned or purged from your catalog so
432 that the records on the Volume are no longer in the catalog. 
433
434 With some care, it can also be used to synchronize your existing catalog with
435 a Volume. Since {\bf bscan} modifies your catalog, we strongly recommend that
436 you do a simple ASCII backup of your database before running {\bf bscan} just
437 to be sure. See 
438 \ilink{Compacting Your Database}{CompactingMySQL}. 
439
440 {\bf bscan} can also be useful in a disaster recovery situation, after the
441 loss of a hard disk, if you do not have a valid {\bf bootstrap} file for
442 reloading your system, or if a Volume has been recycled but not overwritten,
443 you can use {\bf bscan} to re-create your database, which can then be used to
444 {\bf restore} your system or a file to its previous state. 
445
446 It is called: 
447
448 \footnotesize
449 \begin{verbatim}
450  
451 Usage: bscan [options] <bacula-archive>
452        -b bootstrap   specify a bootstrap file
453        -c <file>      specify configuration file
454        -d <nn>        set debug level to nn
455        -m             update media info in database
456        -n <name>      specify the database name (default bacula)
457        -u <user>      specify database user name (default bacula)
458        -P <password>  specify database password (default none)
459        -h <host>      specify database host (default NULL)
460        -p             proceed inspite of I/O errors
461        -r             list records
462        -s             synchronize or store in database
463        -v             verbose
464        -V <Volumes>   specify Volume names (separated by |)
465        -w <dir>       specify working directory (default from conf file)
466        -?             print this message
467 \end{verbatim}
468 \normalsize
469
470 If you are using MySQL or PostgreSQL, there is no need to supply a working
471 directory since in that case, bscan knows where the databases are. However, if
472 you have provided security on your database, you may need to supply either the
473 database name ({\bf -b} option), the user name ({\bf -u} option), and/or the
474 password ({\bf -p}) options. 
475
476 As an example, let's suppose that you did a backup to Volume ``Vol001'' and
477 that sometime later all record of that Volume was pruned or purged from the
478 database. By using {\bf bscan} you can recreate the catalog entries for that
479 Volume and then use the {\bf restore} command in the Console to restore
480 whatever you want. A command something like: 
481
482 \footnotesize
483 \begin{verbatim}
484 bscan -c bacula-sd.conf -v -V Vol001 /dev/nst0
485 \end{verbatim}
486 \normalsize
487
488 will give you a give you an idea of what is going to happen without changing
489 your catalog. Of course, you may need to change the path to the Storage
490 daemon's conf file, the Volume name, and your tape (or disk) device name. This
491 command must read the entire tape, so if it has a lot of data, it may take a
492 long time, and thus you might want to immediately use the command listed
493 below. Note, if you are writing to a disk file, replace the device name with
494 the path to the directory that contains the Volume. This must correspond to
495 the Archive Device in the conf file. 
496
497 Then to actually write or store the records in the catalog, add the {\bf -s}
498 option as follows: 
499
500 \footnotesize
501 \begin{verbatim}
502  bscan -s -m -c bacula-sd.conf -v -V Vol001 /dev/nst0
503 \end{verbatim}
504 \normalsize
505
506 When writing to the database, if bscan finds existing records, it will
507 generally either update them if something is wrong or leave them alone. Thus
508 if the Volume you are scanning is all or partially in the catalog already, no
509 harm will be done to that existing data. Any missing data will simply be
510 added. 
511
512 If you have multiple tapes, you can scan them with: 
513
514 \footnotesize
515 \begin{verbatim}
516  bscan -s -m -c bacula-sd.conf -v -V Vol001\|Vol002\|Vol003 /dev/nst0
517 \end{verbatim}
518 \normalsize
519
520 You should, where ever possible try to specify the tapes in the order they are
521 written. However, bscan can handle scanning tapes that are not sequential. Any
522 incomplete records at the end of the tape will simply be ignored in that case.
523
524
525 Note, the restoration process using bscan is not identical to the original
526 creation of the catalog data. This is because certain non-essential data such
527 as volume reads, volume mounts, etc is not stored on the Volume, and thus is
528 not restored by bscan. The results of bscanning are, however, perfectly valid,
529 and will permit restoration of any or all the files in the catalog using the
530 normal Bacula console commands. 
531
532 \subsubsection*{Using bscan to Compare a Volume to an existing Catalog}
533 \index[general]{Catalog!Using bscan to Compare a Volume to an existing }
534 \index[general]{Using bscan to Compare a Volume to an existing Catalog }
535 \addcontentsline{toc}{subsubsection}{Using bscan to Compare a Volume to an
536 existing Catalog}
537
538 If you wish to compare the contents of a Volume to an existing catalog without
539 changing the catalog, you can safely do so if and only if you do {\bf not}
540 specify either the {\bf -m} or the {\bf -s} options. However, at this time
541 (Bacula version 1.26), the comparison routines are not as good or as thorough
542 as they should be, so we don't particularly recommend this mode other than for
543 testing. 
544
545 \subsubsection*{Using bscan to Recreate a Catalog from a Volume}
546 \index[general]{Volume!Using bscan to Recreate a Catalog from a }
547 \index[general]{Using bscan to Recreate a Catalog from a Volume }
548 \addcontentsline{toc}{subsubsection}{Using bscan to Recreate a Catalog from a
549 Volume}
550
551 This is the mode for which {\bf bscan} is most useful. You can either {\bf
552 bscan} into a freshly created catalog, or directly into your existing catalog
553 (after having made an ASCII copy as described above). Normally, you should
554 start with a freshly created catalog that contains no data. 
555
556 Starting with a single Volume named {\bf TestVolume1}, you run a command such
557 as: 
558
559 \footnotesize
560 \begin{verbatim}
561 ./bscan -V TestVolume1 -v -s -m -c bacula-sd.conf /dev/nst0
562 \end{verbatim}
563 \normalsize
564
565 If there is more than one volume, simply append it to the first one separating
566 it with a vertical bar. You may need to precede the vertical bar with a
567 forward slash escape the shell -- e.g. {\bf
568 TestVolume1\textbackslash{}|TestVolume2 }. The {\bf -v} option was added for
569 verbose output (this can be omitted if desired). The {\bf -s} option that
570 tells {\bf bscan} to store information in the database. The physical device
571 name {\bf /dev/nst0} is specified after all the options. 
572
573 {\bf } For example, after having done a full backup of a directory, then two
574 incrementals, I reinitialized the SQLite database as described above, and
575 using the bootstrap.bsr file noted above, I entered the following command: 
576
577 \footnotesize
578 \begin{verbatim}
579 ./bscan -b bootstrap.bsr -v -s -c bacula-sd.conf /dev/nst0
580 \end{verbatim}
581 \normalsize
582
583 which produced the following output: 
584
585 \footnotesize
586 \begin{verbatim}
587 bscan: bscan.c:182 Using Database: bacula, User: bacula
588 bscan: bscan.c:673 Created Pool record for Pool: Default
589 bscan: bscan.c:271 Pool type "Backup" is OK.
590 bscan: bscan.c:632 Created Media record for Volume: TestVolume1
591 bscan: bscan.c:298 Media type "DDS-4" is OK.
592 bscan: bscan.c:307 VOL_LABEL: OK for Volume: TestVolume1
593 bscan: bscan.c:693 Created Client record for Client: Rufus
594 bscan: bscan.c:769 Created new JobId=1 record for original JobId=2
595 bscan: bscan.c:717 Created FileSet record "Kerns Files"
596 bscan: bscan.c:819 Updated Job termination record for new JobId=1
597 bscan: bscan.c:905 Created JobMedia record JobId 1, MediaId 1
598 bscan: Got EOF on device /dev/nst0
599 bscan: bscan.c:693 Created Client record for Client: Rufus
600 bscan: bscan.c:769 Created new JobId=2 record for original JobId=3
601 bscan: bscan.c:708 Fileset "Kerns Files" already exists.
602 bscan: bscan.c:819 Updated Job termination record for new JobId=2
603 bscan: bscan.c:905 Created JobMedia record JobId 2, MediaId 1
604 bscan: Got EOF on device /dev/nst0
605 bscan: bscan.c:693 Created Client record for Client: Rufus
606 bscan: bscan.c:769 Created new JobId=3 record for original JobId=4
607 bscan: bscan.c:708 Fileset "Kerns Files" already exists.
608 bscan: bscan.c:819 Updated Job termination record for new JobId=3
609 bscan: bscan.c:905 Created JobMedia record JobId 3, MediaId 1
610 bscan: Got EOF on device /dev/nst0
611 bscan: bscan.c:652 Updated Media record at end of Volume: TestVolume1
612 bscan: bscan.c:428 End of Volume. VolFiles=3 VolBlocks=57 VolBytes=10,027,437
613 \end{verbatim}
614 \normalsize
615
616 The key points to note are that {\bf bscan} prints a line when each major
617 record is created. Due to the volume of output, it does not print a line for
618 each file record unless you supply the {\bf -v} option twice or more on the
619 command line. 
620
621 In the case of a Job record, the new JobId will not normally be the same as
622 the original Jobid. For example, for the first JobId above, the new JobId is
623 1, but the original JobId is 2. This is nothing to be concerned about as it is
624 the normal nature of databases. {\bf bscan} will keep everything straight. 
625
626 Although {\bf bscan} claims that it created a Client record for Client: Rufus
627 three times, it was actually only created the first time. This is normal. 
628
629 You will also notice that it read an end of file after each Job (Got EOF on
630 device ...). Finally the last line gives the total statistics for the bscan. 
631
632 If you had added a second {\bf -v} option to the command line, Bacula would
633 have been even more verbose, dumping virtually all the details of each Job
634 record it encountered. 
635
636 Now if you start Bacula and enter a {\bf list jobs} command to the console
637 program, you will get: 
638
639 \footnotesize
640 \begin{verbatim}
641 +-------+----------+------------------+------+-----+----------+----------+---------+
642 | JobId | Name     | StartTime        | Type | Lvl | JobFiles | JobBytes | JobStat |
643 +-------+----------+------------------+------+-----+----------+----------+---------+
644 | 1     | kernsave | 2002-10-07 14:59 | B    | F   | 84       | 4180207  | T       |
645 | 2     | kernsave | 2002-10-07 15:00 | B    | I   | 15       | 2170314  | T       |
646 | 3     | kernsave | 2002-10-07 15:01 | B    | I   | 33       | 3662184  | T       |
647 +-------+----------+------------------+------+-----+----------+----------+---------+
648 \end{verbatim}
649 \normalsize
650
651 which corresponds virtually identically with what the database contained
652 before it was re-initialized and restored with bscan. All the Jobs and Files
653 found on the tape are restored including most of the Media record. The Volume
654 (Media) records restored will be marked as {\bf Full} so that they cannot be
655 rewritten without operator intervention. 
656
657 It should be noted that {\bf bscan} cannot restore a database to the exact
658 condition it was in previously because a lot of the less important information
659 contained in the database is not saved to the tape. Nevertheless, the
660 reconstruction is sufficiently complete, that you can run {\bf restore}
661 against it and get valid results. 
662
663 \subsubsection*{Using bscan to Correct the Volume File Count}
664 \index[general]{Using bscan to Correct the Volume File Count }
665 \index[general]{Count!Using bscan to Correct the Volume File }
666 \addcontentsline{toc}{subsubsection}{Using bscan to Correct the Volume File
667 Count}
668
669 If the Storage daemon crashes during a backup Job, the catalog will no be
670 properly updated for the Volume being used at the time of the crash. This
671 means that the Storage daemon will have written say 20 files on the tape, but
672 the catalog record for the Volume indicates only 19 files. 
673
674 Bacula refuses to write on a tape that contains a different number of files
675 from what is in the catalog. To correct this situation, you may run a {\bf
676 bscan} with the {\bf -m} option (but {\bf without} the {\bf -s} option) to
677 update only the final Media record for the Volumes read. 
678
679 \subsubsection*{After bscan}
680 \index[general]{After bscan }
681 \index[general]{Bscan!After }
682 \addcontentsline{toc}{subsubsection}{After bscan}
683
684 If you use {\bf bscan} to enter the contents of the Volume into an existing
685 catalog, you should be aware that the records you entered may be immediately
686 pruned during the next job particularly if the Volume is very old or had been
687 previously purged. To avoid this, after running {\bf bscan}, you can manually
688 set the volume status (VolStatus) to {\bf Read-Only} by using the {\bf update}
689 command in the catalog. This will allow you to restore from the volume without
690 having it immediately purged. When you have restored and backed up the data,
691 you can reset the VolStatus to {\bf Used} and the Volume will be purged from
692 the catalog. 
693
694 \subsection*{bcopy}
695 \label{bcopy}
696 \index[general]{Bcopy }
697 \addcontentsline{toc}{subsection}{bcopy}
698
699 The {\bf bcopy} program can be used to copy one {\bf Bacula} archive file to
700 another. For example, you may copy a tape to a file, a file to a tape, a file
701 to a file, or a tape to a tape. For tape to tape, you will need two tape
702 drives. (a later version is planned that will buffer it to disk). In the
703 process of making the copy, no record of the information written to the new
704 Volume is stored in the catalog. This means that the new Volume, though it
705 contains valid backup data, cannot be accessed directly from existing catalog
706 entries. If you wish to be able to use the Volume with the Console restore
707 command, for example, you must first bscan the new Volume into the catalog. 
708
709 \subsubsection*{bcopy Command Options}
710 \index[general]{Options!bcopy Command }
711 \index[general]{Bcopy Command Options }
712 \addcontentsline{toc}{subsubsection}{bcopy Command Options}
713
714 \footnotesize
715 \begin{verbatim}
716 Usage: bcopy [-d debug_level] <input-archive> <output-archive>
717        -b bootstrap      specify a bootstrap file
718        -c <file>         specify configuration file
719        -dnn              set debug level to nn
720        -i                specify input Volume names (separated by |)
721        -o                specify output Volume names (separated by |)
722        -p                proceed inspite of I/O errors
723        -v                verbose
724        -w dir            specify working directory (default /tmp)
725        -?                print this message
726 \end{verbatim}
727 \normalsize
728
729 By using a {\bf bootstrap} file, you can copy parts of a Bacula archive file
730 to another archive. 
731
732 One of the objectives of this program is to be able to recover as much data as
733 possible from a damaged tape. However, the current version does not yet have
734 this feature. 
735
736 As this is a new program, any feedback on its use would be appreciated. In
737 addition, I only have a single tape drive, so I have never been able to test
738 this program with two tape drives. 
739
740 \subsection*{btape}
741 \label{btape}
742 \index[general]{Btape }
743 \addcontentsline{toc}{subsection}{btape}
744
745 This program permits a number of elementary tape operations via a tty command
746 interface. The {\bf test} command, described below, can be very useful for
747 testing older tape drive compatibility problems. Aside from initial testing of
748 tape drive compatibility with {\bf Bacula}, {\bf btape} will be mostly used by
749 developers writing new tape drivers. 
750
751 {\bf btape} can be dangerous to use with existing {\bf Bacula} tapes because
752 it will relabel a tape or write on the tape if so requested regardless that
753 the tape may contain valuable data, so please be careful and use it only on
754 blank tapes. 
755
756 To work properly, {\bf btape} needs to read the Storage daemon's configuration
757 file. As a default, it will look for {\bf bacula-sd.conf} in the current
758 directory. If your configuration file is elsewhere, please use the {\bf -c}
759 option to specify where. 
760
761 The physical device name must be specified on the command line, and that this
762 same device name must be present in the Storage daemon's configuration file
763 read by {\bf btape} 
764
765 \footnotesize
766 \begin{verbatim}
767 Usage: btape [-c config_file] [-d debug_level] [device_name]
768        -c <file>   set configuration file to file
769        -dnn        set debug level to nn
770        -s          turn off signals
771        -t          open the default tape device
772        -?          print this message.
773 \end{verbatim}
774 \normalsize
775
776 \subsubsection*{Using btape to Verify your Tape Drive}
777 \index[general]{Using btape to Verify your Tape Drive }
778 \index[general]{Drive!Using btape to Verify your Tape }
779 \addcontentsline{toc}{subsubsection}{Using btape to Verify your Tape Drive}
780
781 An important reason for this program is to ensure that a Storage daemon
782 configuration file is defined so that Bacula will correctly read and write
783 tapes. 
784
785 It is highly recommended that you run the {\bf test} command before running
786 your first Bacula job to ensure that the parameters you have defined for your
787 storage device (tape drive) will permit {\bf Bacula} to function properly. You
788 only need to mount a blank tape, enter the command, and the output should be
789 reasonably self explanatory. Please see the 
790 \ilink{Tape Testing}{_ChapterStart27} Chapter of this manual for
791 the details. 
792
793 \subsubsection*{btape Commands}
794 \index[general]{Btape Commands }
795 \index[general]{Commands!btape }
796 \addcontentsline{toc}{subsubsection}{btape Commands}
797
798 The full list of commands are: 
799
800 \footnotesize
801 \begin{verbatim}
802   Command    Description
803   =======    ===========
804   bsf        backspace file
805   bsr        backspace record
806   cap        list device capabilities
807   clear      clear tape errors
808   eod        go to end of Bacula data for append
809   test       General test Bacula tape functions
810   eom        go to the physical end of medium
811   fill       fill tape, write onto second volume
812   unfill     read filled tape
813   fsf        forward space a file
814   fsr        forward space a record
815   help       print this command
816   label      write a Bacula label to the tape
817   load       load a tape
818   quit       quit btape
819   rd         read tape
820   readlabel  read and print the Bacula tape label
821   rectest    test record handling functions
822   rewind     rewind the tape
823   scan       read tape block by block to EOT and report
824   status     print tape status
825   test       test a tape for compatibility with Bacula
826   weof       write an EOF on the tape
827   wr         write a single record of 2048 bytes
828 \end{verbatim}
829 \normalsize
830
831 The most useful commands are: 
832
833 \begin{itemize}
834 \item test -- test writing records and EOF marks and  reading them back.  
835 \item fill -- completely fill a volume with records, then  write a few records
836    on a second volume, and finally,  both volumes will be read back. Please be
837    aware that  the data written will be quite similar every record, so  you might
838 want to turn compression off. One user found  that the fill command wrote
839 750Gb to a tape that can  hold 35Gb -- so you can see that the hardware
840 compression  really worked well! 
841 \item readlabel -- read and dump the label on a Bacula tape.  
842 \item cap -- list the device capabilities as defined in the  configuration
843    file and as perceived by the Storage daemon. 
844    \end{itemize}
845
846 The {\bf readlabel} command can be used to display the details of a Bacula
847 tape label. This can be useful if the physical tape label was lost or damaged.
848
849
850 In the event that you want to relabel a {\bf Bacula}, you can simply use the
851 {\bf label} command which will write over any existing label. However, please
852 note for labeling tapes, we recommend that you use the {\bf label} command in
853 the {\bf Console} program since it will never overwrite a valid Bacula tape. 
854
855 \subsection*{Other Programs}
856 \index[general]{Programs!Other }
857 \index[general]{Other Programs }
858 \addcontentsline{toc}{subsection}{Other Programs}
859
860 The following programs are general utility programs and in general do not need
861 a configuration file nor a device name. 
862
863 \subsection*{bsmtp}
864 \label{bsmtp}
865 \index[general]{Bsmtp }
866 \addcontentsline{toc}{subsection}{bsmtp}
867
868 {\bf bsmtp} is a simple mail transport program that permits more flexibility
869 than the standard mail programs typically found on Unix systems. It can even
870 be used on Windows machines. 
871
872 It is called: 
873
874 \footnotesize
875 \begin{verbatim}
876 Usage: bsmtp [-f from] [-h mailhost] [-s subject] [-c copy] [recipient ...]
877        -c          set the Cc: field
878        -dnn        set debug level to nn
879        -f          set the From: field
880        -h          use mailhost:port as the bsmtp server
881        -s          set the Subject: field
882        -?          print this message.
883 \end{verbatim}
884 \normalsize
885
886 If the {\bf -f} option is not specified, {\bf bsmtp} will use your userid. If
887 the option is not specified {\bf bsmtp} will use the value in the environment
888 variable {\bf bsmtpSERVER} or if there is none {\bf localhost}. By default
889 port 25 is used. 
890
891 {\bf recipients} is a space separated list of email recipients. 
892
893 The body of the email message is read from standard input. 
894
895 An example of the use of {\bf bsmtp} would be to put the following statement
896 in the {\bf Messages} resource of your {\bf bacula-dir.conf} file. Note, these
897 commands should appear on a single line each. 
898
899 \footnotesize
900 \begin{verbatim}
901   mailcommand = "/home/bacula/bin/bsmtp -h mail.domain.com -f \"\(Bacula\) %r\"
902                  -s \"Bacula: %t %e of %c %l\" %r"
903   operatorcommand = "/home/bacula/bin/bsmtp -h mail.domain.com -f \"\(Bacula\) %r\"
904                     -s \"Bacula: Intervention needed for %j\" %r"
905 \end{verbatim}
906 \normalsize
907
908 Where you replace {\bf /home/bacula/bin} with the path to your {\bf Bacula}
909 binary directory, and you replace {\bf mail.domain.com} with the fully
910 qualified name of your bsmtp (email) server, which normally listens on port
911 25. For more details on the substitution characters (e.g. \%r) used in the
912 above line, please see the documentation of the 
913 \ilink{ MailCommand in the Messages Resource}{mailcommand}
914 chapter of this manual. 
915
916 It is HIGHLY recommended that you test one or two cases by hand to make sure
917 that the {\bf mailhost} that you specified is correct and that it will accept
918 your email requests. Since {\bf bsmtp} always uses a TCP connection rather
919 than writing in the spool file, you may find that your {\bf from} address is
920 being rejected because it does not contain a valid domain, or because your
921 message is caught in your spam filtering rules. Generally, you should specify
922 a fully qualified domain name in the {\bf from} field, and depending on
923 whether your bsmtp gateway is Exim or Sendmail, you may need to modify the
924 syntax of the from part of the message. Please test. 
925
926 When running {\bf bsmtp} by hand, you will need to terminate the message by
927 entering a ctl-d in column 1 of the last line. 
928
929 \subsection*{dbcheck}
930 \label{dbcheck}
931 \index[general]{Dbcheck }
932 \addcontentsline{toc}{subsection}{dbcheck}
933
934 {\bf dbcheck} is a simple program that will search for inconsistencies in your
935 database, and optionally fix them. The {\bf dbcheck} program can be found in
936 the {\bf \lt{}bacula-source\gt{}/src/tools} directory of the source
937 distribution. Though it is built with the make process, it is not normally
938 ``installed''. 
939
940 It is called: 
941
942 \footnotesize
943 \begin{verbatim}
944 Usage: dbcheck [-c config] [-C catalog name] [-d debug_level]     []
945        -b              batch mode
946        -C              catalog name in the director conf file
947        -c              director conf filename
948        -dnn            set debug level to nn
949        -f              fix inconsistencies
950        -v              verbose
951        -?              print this message
952 \end{verbatim}
953 \normalsize
954
955 If the {\bf -c} option is given with the Director's conf file, there is no
956 need to enter any of the command line arguments, in particular the working
957 directory as dbcheck will read them from the file. 
958
959 If the {\bf -f} option is specified, {\bf dbcheck} will repair ({\bf fix}) the
960 inconsistencies it finds. Otherwise, it will report only. 
961
962 If the {\bf -b} option is specified, {\bf dbcheck} will run in batch mode, and
963 it will proceed to examine and fix (if -f is set) all programmed inconsistency
964 checks. If the {\bf -b} option is not specified, {\bf dbcheck} will enter
965 interactive mode and prompt with the following: 
966
967 \footnotesize
968 \begin{verbatim}
969 Hello, this is the database check/correct program.
970 Please select the function you want to perform.
971      1) Toggle modify database flag
972      2) Toggle verbose flag
973      3) Repair bad Filename records
974      4) Repair bad Path records
975      5) Eliminate duplicate Filename records
976      6) Eliminate duplicate Path records
977      7) Eliminate orphaned Jobmedia records
978      8) Eliminate orphaned File records
979      9) Eliminate orphaned Path records
980     10) Eliminate orphaned Filename records
981     11) Eliminate orphaned FileSet records
982     12) Eliminate orphaned Client records
983     13) Eliminate orphaned Job records
984     14) Eliminate all Admin records
985     15) Eliminate all Restore records
986     16) All (3-15)
987     17) Quit
988 Select function number:
989 \end{verbatim}
990 \normalsize
991
992 By entering 1 or 2, you can toggle the modify database flag (-f option) and
993 the verbose flag (-v). It can be helpful and reassuring to turn off the modify
994 database flag, then select one or more of the consistency checks (items 3
995 through 9) to see what will be done, then toggle the modify flag on and re-run
996 the check. 
997
998 The inconsistencies examined are the following: 
999
1000 \begin{itemize}
1001 \item Duplicate filename records. This can happen if you accidentally run  two
1002    copies of Bacula at the same time, and they are both adding  filenames
1003    simultaneously. It is a rare occurrence, but will create  an inconsistent
1004 database. If this is the case, you will receive  error messages during Jobs
1005 warning of duplicate database records.  If you are not getting these error
1006 messages, there is no reason  to run this check. 
1007 \item Repair bad Filename records. This checkes and corrects filenames  that
1008    have a trailing slash. They should not.  
1009 \item Repair bad Path records. This checks and corrects path names  that do
1010    not have a trailing slash. They should.  
1011 \item Duplicate path records. This can happen if you accidentally run  two
1012    copies of Bacula at the same time, and they are both adding  filenames
1013    simultaneously. It is a rare occurrence, but will create  an inconsistent
1014 database. See the item above for why this occurs and  how you know it is
1015 happening. 
1016 \item Orphaned JobMedia records. This happens when a Job record is deleted 
1017    (perhaps by a user issued SQL statement), but the corresponding  JobMedia
1018    record (one for each Volume used in the Job) was not deleted.  Normally, this
1019 should not happen, and even if it does, these records  generally do not take
1020 much space in your database. However, by running  this check, you can
1021 eliminate any such orphans.  
1022 \item Orphaned File records. This happens when a Job record is deleted 
1023    (perhaps by a user issued SQL statement), but the corresponding  File record
1024    (one for each Volume used in the Job) was not deleted.  Note, searching for
1025 these records can be {\bf very} time consuming (i.e.  it may take hours) for a
1026 large database. Normally this should not  happen as Bacula takes care to
1027 prevent it. Just the same, this  check can remove any orphaned File records.
1028 It is recommended that  you run this once a year since orphaned File records
1029 can take a  large amount of space in your database. 
1030 \item Orphaned Path records. This condition happens any time a directory is 
1031    deleted from your system and all associated Job records have been purged. 
1032    During standard purging (or pruning) of Job records, Bacula does  not check
1033 for orphaned Path records. As a consequence, over a period  of time, old
1034 unused Path records will tend to accumulate and use  space in your database.
1035 This check will eliminate them. It is strongly  recommended that you run this
1036 check at least once a year. 
1037 \item Orphaned Filename records. This condition happens any time a file is 
1038    deleted from your system and all associated Job records have been purged. 
1039    This can happen quite frequently as there are quite a large number  of files
1040 that are created and then deleted. In addition, if you  do a system update or
1041 delete an entire directory, there can be  a very large number of Filename
1042 records that remain in the catalog  but are no longer used.  
1043
1044 During standard purging (or pruning) of Job records, Bacula does  not check
1045 for orphaned Filename records. As a consequence, over a period  of time, old
1046 unused Filename records will accumulate and use  space in your database. This
1047 check will eliminate them. It is strongly  recommended that you run this check
1048 at least once a year, and for  large database (more than 200 Megabytes), it is
1049 probably better to  run this once every 6 months.  
1050 \item Orphaned Client records. These records can remain in the database  long
1051    after you have removed a client. 
1052 \item Orphaned Job records. If no client is defined for a job or you  do not
1053    run a job for a long time, you can accumulate old job  records. This option
1054    allow you to remove jobs that are not  attached to any client (and thus
1055 useless).  
1056 \item All Admin records. This command will remove all Admin records, 
1057    regardless of their age.  
1058 \item All Restore records. This command will remove all Restore records, 
1059    regardless of their age. 
1060    \end{itemize}
1061
1062 \subsection*{testfind}
1063 \label{testfind}
1064 \index[general]{Testfind }
1065 \addcontentsline{toc}{subsection}{testfind}
1066
1067 {\bf testfind} permits listing of files using the same search engine that is
1068 used for the {\bf Include} resource in Job resources. Note, much of the
1069 functionality of this program (listing of files to be included) is present in
1070 the 
1071 \ilink{estimate command}{estimate} in the Console program. 
1072
1073 The original use of testfind was to ensure that Bacula's file search engine
1074 was correct and to print some statistics on file name and path length.
1075 However, you may find it useful to see what bacula would do with a given {\bf
1076 Include} resource. The {\bf testfind} program can be found in the {\bf
1077 \lt{}bacula-source\gt{}/src/tools} directory of the source distribution.
1078 Though it is built with the make process, it is not normally ``installed''. 
1079
1080 It is called: 
1081
1082 \footnotesize
1083 \begin{verbatim}
1084 Usage: testfind [-d debug_level] [-] [pattern1 ...]
1085        -a          print extended attributes (Win32 debug)
1086        -dnn        set debug level to nn
1087        -           read pattern(s) from stdin
1088        -?          print this message.
1089 Patterns are used for file inclusion -- normally directories.
1090 Debug level>= 1 prints each file found.
1091 Debug level>= 10 prints path/file for catalog.
1092 Errors are always printed.
1093 Files/paths truncated is a number with len> 255.
1094 Truncation is only in the catalog.
1095 \end{verbatim}
1096 \normalsize
1097
1098 Where a pattern is any filename specification that is valid within an {\bf
1099 Include} resource definition. If none is specified, {\bf /} (the root
1100 directory) is assumed. For example: 
1101
1102 \footnotesize
1103 \begin{verbatim}
1104 ./testfind /bin
1105 \end{verbatim}
1106 \normalsize
1107
1108 Would print the following: 
1109
1110 \footnotesize
1111 \begin{verbatim}
1112 Dir: /bin
1113 Reg: /bin/bash
1114 Lnk: /bin/bash2 -> bash
1115 Lnk: /bin/sh -> bash
1116 Reg: /bin/cpio
1117 Reg: /bin/ed
1118 Lnk: /bin/red -> ed
1119 Reg: /bin/chgrp
1120 ...
1121 Reg: /bin/ipcalc
1122 Reg: /bin/usleep
1123 Reg: /bin/aumix-minimal
1124 Reg: /bin/mt
1125 Lnka: /bin/gawk-3.1.0 -> /bin/gawk
1126 Reg: /bin/pgawk
1127 Total files    : 85
1128 Max file length: 13
1129 Max path length: 5
1130 Files truncated: 0
1131 Paths truncated: 0
1132 \end{verbatim}
1133 \normalsize
1134
1135 Even though {\bf testfind} uses the same search engine as {\bf Bacula}, each
1136 directory to be listed, must be entered as a separate command line entry or
1137 entered one line at a time to standard input if the {\bf -} option was
1138 specified. 
1139
1140 Specifying a debug level of one (i.e. {\bf -d1}) on the command line will
1141 cause {\bf testfind} to print the raw filenames without showing the Bacula
1142 internal file type, or the link (if any). Debug levels of 10 or greater cause
1143 the filename and the path to be separated using the same algorithm that is
1144 used when putting filenames into the Catalog database. 
1145
1146 \subsection*{bimagemgr}
1147 \label{bimagemgr}
1148 \index[general]{Bimagemgr }
1149 \addcontentsline{toc}{subsection}{bimagemgr}
1150
1151 {\bf bimagemgr} is a utility for those who backup to disk volumes in order to
1152 commit them to CDR disk, rather than tapes. It is a web based interface
1153 written in perl, used to monitor when a volume file needs to be burned to
1154 disk. It requires: 
1155
1156 \begin{itemize}
1157 \item A web server running on the bacula server 
1158 \item A CD recorder installed and configured on the bacula server 
1159 \item The cdrtools package installed on the bacula server. 
1160 \item perl, perl-DBI module, and either DBD-MySQL or DBD-PostgreSQL modules 
1161    \end{itemize}
1162
1163 SQLite databases and DVD burning are not supported by {\bf bimagemgr} at this
1164 time, but both planned for future releases. 
1165
1166 \subsubsection*{Installation}
1167 \index[general]{Installation }
1168 \addcontentsline{toc}{subsubsection}{Installation}
1169
1170 Please see the README file in the bimagemgr directory of the distribution for
1171 instructions. 
1172
1173 \subsubsection*{Usage}
1174 \index[general]{Usage }
1175 \addcontentsline{toc}{subsubsection}{Usage}
1176
1177 Calling the program in your web browser, e.g. {\tt
1178 http://localhost/cgi-bin/bimagemgr.pl} will produce a display as shown below
1179 in Figure 1. The program will query the bacula database and display all volume
1180 files with the date last written and the date last burned to disk. If a volume
1181 needs to be burned (last written is newer than last burn date) a ``Burn''
1182 button will be displayed in the right most column. 
1183
1184 \addcontentsline{lof}{figure}{Bacula CD Image Manager}
1185 \includegraphics{./bimagemgr1.eps} Figure 1 
1186
1187 Place a blank CDR disk in your recorder and click a ``Burn'' button. This will
1188 cause a pop up window as shown in Figure 2 to display the burn progress. 
1189
1190 \addcontentsline{lof}{figure}{Bacula CD Image Burn Progress Window}
1191 \includegraphics{./bimagemgr2.eps} Figure 2 
1192
1193 When the burn finishes the pop up window will display the results of cdrecord
1194 as shown in Figure 3. Close the pop up window and refresh the main window. The
1195 last burn date will be updated and the ``Burn'' button for that volume will
1196 disappear. Should you have a failed burn you can reset the last burn date of
1197 that volume by clicking it's ``Reset'' link. 
1198
1199 \addcontentsline{lof}{figure}{Bacula CD Image Burn Results}
1200 \includegraphics{./bimagemgr3.eps} Figure 3 
1201
1202 In the bottom row of the main display window are two more buttons labeled
1203 ``Burn Catalog'' and ``Blank CDRW''. ``Burn Catalog'' will place a copy of
1204 your bacula catalog on a disk. If you use CDRW disks rather than CDR then
1205 ``Blank CDRW'' allows you to erase the disk before re-burning it. Regularly
1206 committing your backup volume files and your catalog to disk with {\bf
1207 bimagemgr} insures that you can rebuild easily in the event of some disaster
1208 on the bacula server itself.