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