]> git.sur5r.net Git - bacula/docs/blob - docs/manual/restore.tex
Update
[bacula/docs] / docs / manual / restore.tex
1 %%
2 %%
3
4 \section*{The Bacula Console Restore Command}
5 \label{_ChapterStart13}
6 \index[general]{Command!Bacula Console Restore }
7 \index[general]{Bacula Console Restore Command }
8 \addcontentsline{toc}{section}{Bacula Console Restore Command}
9
10 \subsection*{General}
11 \index[general]{General }
12 \addcontentsline{toc}{subsection}{General}
13
14 Below, we will discuss restoring files with the Console {\bf restore} command,
15 which is the recommended way of doing it. However, there is a standalone
16 program named {\bf bextract}, which also permits restoring files. For more
17 information on this program, please see the 
18 \ilink{Bacula Utility Programs}{bextract} chapter of this manual.
19 You will also want to look at the {\bf bls} program in the same chapter, which
20 allows you to list the contents of your Volumes. Finally, if you have an old
21 Volume that is no longer in the catalog, you can restore the catalog entries
22 using the program named {\bf bscan}, documented in the same 
23 \ilink{Bacula Utility Programs}{bextract} chapter. 
24
25 In general, to restore a file or a set of files, you must run a {\bf restore}
26 job. That is a job with {\bf Type = Restore}. As a consequence, you will need
27 a predefined {\bf restore} job in your {\bf bacula-dir.conf} (Director's
28 config) file. The exact parameters (Client, FileSet, ...) that you define are
29 not important as you can either modify them manually before running the job or
30 if you use the {\bf restore} command, explained below, Bacula will  
31 automatically set them for you. In fact, you can no longer simply run a restore
32 job.  You must use the restore command.                                  
33
34 Since Bacula is a network backup program, you must be aware that when you
35 restore files, it is up to you to ensure that you or Bacula have selected the
36 correct Client and the correct hard disk location for restoring those files.
37 {\bf Bacula} will quite willingly backup client A, and restore it by sending
38 the files to a different directory on client B. Normally, you will want to
39 avoid this, but assuming the operating systems are not too different in their
40 file structures, this should work perfectly well, if so desired. 
41 By default, Bacula will restore data to the same Client that was backed
42 up, and those data will be restored not to the original places but to
43 {\bf /tmp/bacula-restores}.  You may modify any of these defaults when the
44 restore command prompts you to run the job by selecting the {\bf mod}
45 option.
46
47 \label{Example1}
48 \subsection*{The Restore Command}
49 \index[general]{Command!Restore }
50 \index[general]{Restore Command }
51 \addcontentsline{toc}{subsection}{Restore Command}
52
53 Since Bacula maintains a catalog of your files and on which Volumes (disk or
54 tape), they are stored, it can do most of the bookkeeping work, allowing you
55 simply to specify what kind of restore you want (current, before a particular
56 date), and what files to restore. Bacula will then do the rest. 
57
58 This is accomplished using the {\bf restore} command in the Console. First you
59 select the kind of restore you want, then the JobIds are selected,
60 the File records for those Jobs are placed in an internal Bacula directory
61 tree, and the restore enters a file selection mode that allows you to
62 interactively walk up and down the file tree selecting individual files to be
63 restored. This mode is somewhat similar to the standard Unix {\bf restore}
64 program's interactive file selection mode. 
65
66 If your Files have been pruned, the {\bf restore} command will be unable
67 to find any files to restore. See below for more details on this. 
68
69 Within the Console program, after entering the {\bf restore} command, you are
70 presented with the following selection prompt:  
71
72 \footnotesize
73 \begin{verbatim}
74 First you select one or more JobIds that contain files
75 to be restored. You will be presented several methods
76 of specifying the JobIds. Then you will be allowed to
77 select which files from those JobIds are to be restored.
78 To select the JobIds, you have the following choices:
79      1: List last 20 Jobs run
80      2: List Jobs where a given File is saved
81      3: Enter list of comma separated JobIds to select
82      4: Enter SQL list command
83      5: Select the most recent backup for a client
84      6: Select backup for a client before a specified time
85      7: Enter a list of files to restore
86      8: Enter a list of files to restore before a specified time
87      9: Find the JobIds of the most recent backup for a client
88     10: Find the JobIds for a backup for a client before a specified time
89     11: Enter a list of directories to restore for found JobIds
90     12: Cancel
91 Select item:  (1-12):
92 \end{verbatim}
93 \normalsize
94
95 \begin{itemize}
96 \item Item 1 will list the last 20 jobs run. If you find the Job you want,
97    you can then select item 3 and enter its JobId(s).
98
99 \item Item 2 will list all the Jobs where a specified file is saved.  If you
100    find the Job you want, you can then select item 3 and enter the JobId.
101
102 \item Item 3 allows you the enter a list of comma separated JobIds whose 
103    files will be put into the directory tree. You may then select which
104    files from those JobIds to restore.
105
106 \item Item 4 allows you to enter any arbitrary SQL command. This is  probably
107    the most primitive way of finding the desired JobIds,  but at the same time,
108    the most flexible.  Once you have found the JobId(s), you can select item 3
109    and enter  them.
110
111 \item Item 5 will automatically select the most recent Full backup and all 
112    subsequent incremental and differential backups for a specified Client.
113    These are the Jobs and Files which, if reloaded, will restore your
114    system to the most current saved state.  It automatically enters the
115    JobIds found into the directory tree.  This is probably the most
116    convenient of all the above options to use if you wish to restore a
117    selected Client to its most recent state.
118
119    There are two important things to note. First, this automatic selection
120    will never select a job that failed (terminated with an error status).
121    If you have such a job and want to recover one or more files from it,
122    you will need to explicitly enter the JobId in item 3, then choose the
123    files to restore.
124
125    If some of the Jobs that are needed to do the restore have had their 
126    File records pruned, the restore will be incomplete. Bacula currently
127    does not correctly detect this condition.  You can however, check for
128    this by looking carefully at the list of Jobs that Bacula selects and
129    prints. If you find Jobs with the JobFiles column set to zero, when
130    files should have been backed up, then you should expect problems.
131
132    If all the File records have been pruned, Bacula will realize that there
133    are no file records in any of the JobIds chosen and will inform you. It
134    will then propose doing a full restore (non-selective) of those JobIds.
135    This is possible because Bacula still knows where the beginning of the
136    Job data is on the Volumes, even if it does not know where particular
137    files are located.
138
139 \item Item 6 allows you to specify a date and time, after which Bacula  will
140    automatically select the most recent Full backup and all  subsequent
141    incremental and differential backups that started  before the specified date
142   and time.  
143
144 \item Item 7 allows you to specify one or more filenames  (complete path
145    required) to be restored. Each filename  is entered one at a time or if you
146    prefix a filename  with the less-than symbol (\lt{}) Bacula will read that 
147    file and assume it is a list of filenames to be restored.  The filename entry
148    mode is terminated by entering a  blank line.
149
150 \item Item 8 allows you to specify a date and time before  entering the
151    filenames. See Item 7 above for more  details.
152
153 \item Item 9 allows you find the JobIds of the most recent backup for
154    a client. This is much like option 5 (it uses the same code), but
155    those JobIds are retained internally as if you had entered them
156    manually.  You may then select item 11 (see below) to restore one
157    or more directories.
158
159 \item Item 10 is the same as item 9, except that it allows you to enter
160    a before date (as with item 6). These JobIds will then be retained
161    internally.
162
163 \index[general]{Restore Directories}
164 \item Item 11 allows you to enter a list of JobIds from which you can
165    select directories to be restored. The list of JobIds can have been
166    previously created by using either item 9 or 10 on the menu.  You
167    may then enter a full path to a directory name or a filename preceded
168    by a less than sign (\lt{}). The filename should contain a list
169    of directories to be restored.  All files in those directories will
170    be restored, but if the directory contains subdirectories, nothing
171    will be restored in the subdirectory unless you explicitly enter its
172    name.
173
174 \item Item 12 allows you to cancel the restore command.  
175 \end{itemize}
176
177 As an example, suppose that we select item 5 (restore to most recent state).
178 It will then ask for the desired Client, which on my system, will print all
179 the Clients found in the database as follows:  
180
181 \footnotesize
182 \begin{verbatim}
183 Defined clients:
184      1: Rufus
185      2: Matou
186      3: Polymatou
187      4: Minimatou
188      5: Minou
189      6: MatouVerify
190      7: PmatouVerify
191      8: RufusVerify
192      9: Watchdog
193 Select Client (File daemon) resource (1-9):
194      
195 \end{verbatim}
196 \normalsize
197
198 You will probably have far fewer Clients than this example, and  if you have
199 only one Client, it will be automatically selected. In this case, I enter
200 {\bf Rufus} to select the Client. Then  Bacula needs to know what FileSet is
201 to be restored, so it  prompts with:  
202
203 \footnotesize
204 \begin{verbatim}
205 The defined FileSet resources are:
206      1: Full Set
207      2: Kerns Files
208 Select FileSet resource (1-2):
209      
210 \end{verbatim}
211 \normalsize
212
213 I choose item 1, which is my full backup. Normally, you will only have a
214 single FileSet for each Job, and if your machines are similar (all Linux) you
215 may only have one FileSet for all your Clients. 
216
217 At this point, {\bf Bacula} has all the information it needs to find the most
218 recent set of backups. It will then query the database, which may take a bit
219 of time, and it will come up with something like the following. Note, some of
220 the columns are truncated here for presentation: 
221
222 \footnotesize
223 \begin{verbatim}
224 +-------+------+----------+-------------+-------------+------+-------+----------
225 --+
226 | JobId | Levl | JobFiles | StartTime   | VolumeName  | File | SesId |
227 VolSesTime |
228 +-------+------+----------+-------------+-------------+------+-------+----------
229 --+
230 | 1,792 | F    |  128,374 | 08-03 01:58 | DLT-19Jul02 |   67 |    18 |
231 1028042998 |
232 | 1,792 | F    |  128,374 | 08-03 01:58 | DLT-04Aug02 |    0 |    18 |
233 1028042998 |
234 | 1,797 | I    |      254 | 08-04 13:53 | DLT-04Aug02 |    5 |    23 |
235 1028042998 |
236 | 1,798 | I    |       15 | 08-05 01:05 | DLT-04Aug02 |    6 |    24 |
237 1028042998 |
238 +-------+------+----------+-------------+-------------+------+-------+----------
239 --+
240 You have selected the following JobId: 1792,1792,1797
241 Building directory tree for JobId 1792 ...
242 Building directory tree for JobId 1797 ...
243 Building directory tree for JobId 1798 ...
244 cwd is: /
245 $
246 \end{verbatim}
247 \normalsize
248
249 Depending on the number of {\bf JobFiles} for each JobId, the {\bf Building
250 directory tree ..."} can take a bit of time. If you notice ath all the
251 JobFiles are zero, your Files have probably been pruned and you will not be
252 able to select any individual files -- it will be restore everything or
253 nothing.
254
255 In our example, Bacula found four Jobs that comprise the most recent backup of
256 the specified Client and FileSet. Two of the Jobs have the same JobId because
257 that Job wrote on two different Volumes. The third Job was an incremental
258 backup to the previous Full backup, and it only saved 254 Files compared to
259 128,374 for the Full backup. The fourth Job was also an incremental backup
260 that saved 15 files. 
261
262 Next Bacula entered those Jobs into the directory tree, with no files marked
263 to be restored as a default, tells you how many files are in the tree, and
264 tells you that the current working directory ({\bf cwd}) is /. Finally, Bacula
265 prompts with the dollar sign (\$) to indicate that you may enter commands to
266 move around the directory tree and to select files. 
267              
268 If you want all the files to automatically be marked when the directory
269 tree is built, enter the command {\bf restore all}.
270
271 Instead of choosing item 5 on the first menu (Select the most recent backup
272 for a client), if we had chosen item 3 (Enter list of JobIds to select) and we
273 had entered the JobIds {\bf 1792,1797,1798} we would have arrived at the same
274 point.                 
275
276 One point to note, if you are manually entering JobIds, is that you must enter
277 them in the order they were run (generally in increasing JobId order). If you
278 enter them out of order and the same file was saved in two or more of the
279 Jobs, you may end up with an old version of that file (i.e. not the most
280 recent). 
281
282 Directly entering the JobIds can also permit you to recover data from
283 a Job that wrote files to tape but that terminated with an error status.
284
285 While in file selection mode, you can enter {\bf help} or a question mark (?)
286 to produce a summary of the available commands:  
287
288 \footnotesize
289 \begin{verbatim}
290  Command    Description
291   =======    ===========
292   cd         change current directory
293   count      count marked files in and below the cd
294   dir        long list current directory, wildcards allowed
295   done       leave file selection mode
296   estimate   estimate restore size
297   exit       same as done command
298   find       find files, wildcards allowed
299   help       print help
300   ls         list current directory, wildcards allowed
301   lsmark     list the marked files in and below the cd
302   mark       mark dir/file to be restored recursively in dirs
303   markdir    mark directory name to be restored (no files)
304   pwd        print current working directory
305   unmark     unmark dir/file to be restored recursively in dir
306   unmarkdir  unmark directory name only no recursion
307   quit       quit and do not do restore
308   ?          print help
309 \end{verbatim}
310 \normalsize
311
312 As a default no files have been selected for restore (unless you
313 added {\bf all} to the command line. If you want to restore
314 everything, at this point, you should enter {\bf mark *}, and then {\bf done}
315 and {\bf Bacula} will write the bootstrap records to a file and request your
316 approval to start a restore job. 
317
318 If you do not enter the above mentioned {\bf mark *} command, you will start
319 with an empty slate. Now you can simply start looking at the tree and {\bf
320 mark} particular files or directories you want restored. It is easy to make
321 a mistake in specifying a file to mark or unmark, and Bacula's error handling
322 is not perfect, so please check your work by using the {\bf ls} or {\bf dir}
323 commands to see what files are actually selected. Any selected file has its
324 name preceded by an asterisk. 
325
326 To check what is marked or not marked, enter the {\bf count} command, which
327 displays:  
328
329 \footnotesize
330 \begin{verbatim}
331 128401 total files. 128401 marked to be restored.
332      
333 \end{verbatim}
334 \normalsize
335
336 Each of the above commands will be described in more detail in the next
337 section. We continue with the above example, having accepted to restore all
338 files as Bacula set by default. On entering the {\bf done} command, Bacula
339 prints:  
340
341 \footnotesize
342 \begin{verbatim}
343 Bootstrap records written to /home/kern/bacula/working/restore.bsr
344 The restore job will require the following Volumes:
345    
346    DLT-19Jul02
347    DLT-04Aug02
348 128401 files selected to restore.
349 Run Restore job
350 JobName:    kernsrestore
351 Bootstrap:  /home/kern/bacula/working/restore.bsr
352 Where:      /tmp/bacula-restores
353 Replace:    always
354 FileSet:    Kerns Files
355 Client:     Rufus
356 Storage:    SDT-10000
357 JobId:      *None*
358 OK to run? (yes/mod/no):
359     
360 \end{verbatim}
361 \normalsize
362
363 Please examine each of the items very carefully to make sure that they are
364 correct.  In particular, look at {\bf Where}, which tells you where in the
365 directory structure the files will be restored, and {\bf Client}, which
366 tells you which client will receive the files.  Note that by default the
367 Client which will receive the files is the Client that was backed up.
368 These items will not always be completed with the correct values depending
369 on which of the restore options you chose.  You can change any of these
370 default items by entering {\bf mod} and responding to the prompts.
371
372 The above assumes that you have defined a {\bf Restore} Job resource in your
373 Director's configuration file. Normally, you will only need one Restore Job
374 resource definition because by its nature, restoring is a manual operation,
375 and using the Console interface, you will be able to modify the Restore Job to
376 do what you want. 
377
378 An example Restore Job resource definition is given below. 
379
380 Returning to the above example, you should verify that the Client name is
381 correct before running the Job. However, you may want to modify some of the
382 parameters of the restore job. For example, in addition to checking the Client
383 it is wise to check that the Storage device chosen by Bacula is indeed
384 correct. Although the {\bf FileSet} is shown, it will be ignored in restore.
385 The restore will choose the files to be restored either by reading the {\bf
386 Bootstrap} file, or if not specified, it will restore all files associated
387 with the specified backup {\bf JobId} (i.e. the JobId of the Job that
388 originally backed up the files). 
389
390 Finally before running the job, please note that the default location for
391 restoring files is {\bf not} their original locations, but rather the directory
392 {\bf /tmp/bacula-restores}. You can change this default by modifying your {\bf
393 bacula-dir.conf} file, or you can modify it using the {\bf mod} option. If you
394 want to restore the files to their original location, you must have {\bf
395 Where} set to nothing or to the root, i.e. {\bf /}. 
396
397 If you now enter {\bf yes}, Bacula will run the restore Job. The Storage
398 daemon will first request Volume {\bf DLT-19Jul02} and after the appropriate
399 files have been restored from that volume, it will request Volume {\bf
400 DLT-04Aug02}. 
401
402 \subsection*{Selecting Files by Filename}
403 \index[general]{Selecting Files by Filename }
404 \index[general]{Filename!Selecting Files by }
405 \addcontentsline{toc}{subsection}{Selecting Files by Filename}
406
407 If you have a small number of files to restore, and you know the filenames,
408 you can either put the list of filenames in a file to be read by Bacula, or
409 you can enter the names one at a time. The filenames must include the full
410 path and filename. No wild cards are used. 
411
412 To enter the files, after the {\bf restore}, you select item number 7 from the
413 prompt list: 
414
415 \footnotesize
416 \begin{verbatim}
417 To select the JobIds, you have the following choices:
418      1: List last 20 Jobs run
419      2: List Jobs where a given File is saved
420      3: Enter list of comma separated JobIds to select
421      4: Enter SQL list command
422      5: Select the most recent backup for a client
423      6: Select backup for a client before a specified time
424      7: Enter a list of files to restore
425      8: Enter a list of files to restore before a specified time
426      9: Find the JobIds of the most recent backup for a client
427     10: Find the JobIds for a backup for a client before a specified time
428     11: Enter a list of directories to restore for found JobIds
429     12: Cancel
430 Select item:  (1-12):
431 \end{verbatim}
432 \normalsize
433
434 which then prompts you for the client name: 
435
436 \footnotesize
437 \begin{verbatim}
438 Defined Clients:
439      1: Timmy
440      2: Tibs
441      3: Rufus
442 Select the Client (1-3): 3
443 \end{verbatim}
444 \normalsize
445
446 Of course, your client list will be different, and if you have only one
447 client, it will be automatically selected. And finally, Bacula requests you to
448 enter a filename: 
449
450 \footnotesize
451 \begin{verbatim}
452 Enter filename:
453 \end{verbatim}
454 \normalsize
455
456 At this point, you can enter the full path and filename 
457
458 \footnotesize
459 \begin{verbatim}
460 Enter filename: /home/kern/bacula/k/Makefile.in
461 Enter filename:
462 \end{verbatim}
463 \normalsize
464
465 as you can see, it took the filename. If Bacula cannot find a copy of the
466 file, it prints the following: 
467
468 \footnotesize
469 \begin{verbatim}
470 Enter filename: junk filename
471 No database record found for: junk filename
472 Enter filename:
473 \end{verbatim}
474 \normalsize
475
476 If you want Bacula to read the filenames from a file, you simply precede the
477 filename with a less-than symbol (\lt{}). When you have entered all the
478 filenames, you enter a blank line, and Bacula will write the bootstrap file,
479 tells you what tapes will be used, and proposes a Restore job to be run: 
480
481 \footnotesize
482 \begin{verbatim}
483 Enter filename:
484 Automatically selected Storage: DDS-4
485 Bootstrap records written to /home/kern/bacula/working/restore.bsr
486 The restore job will require the following Volumes:
487    
488    test1
489 1 file selected to restore.
490 Run Restore job
491 JobName:    kernsrestore
492 Bootstrap:  /home/kern/bacula/working/restore.bsr
493 Where:      /tmp/bacula-restores
494 Replace:    always
495 FileSet:    Kerns Files
496 Client:     Rufus
497 Storage:    DDS-4
498 When:       2003-09-11 10:20:53
499 Priority:   10
500 OK to run? (yes/mod/no):
501 \end{verbatim}
502 \normalsize
503
504 It is possible to automate the selection by file by putting your list of files
505 in say {\bf /tmp/file-list}, then using the following command: 
506
507 \footnotesize
508 \begin{verbatim}
509 restore client=Rufus file=</tmp/file-list
510 \end{verbatim}
511 \normalsize
512
513 If in modifying the parameters for the Run Restore job, you find that Bacula
514 asks you to enter a Job number, this is because you have not yet specified
515 either a Job number or a Bootstrap file. Simply entering zero will allow you
516 to continue and to select another option to be modified. 
517 \label{CommandArguments}
518
519 \subsection*{Command Line Arguments}
520 \index[general]{Arguments!Command Line }
521 \index[general]{Command Line Arguments }
522 \addcontentsline{toc}{subsection}{Command Line Arguments}
523
524 If all the above sounds complicated, you will probably agree that it really
525 isn't after trying it a few times. It is possible to do everything that was
526 shown above, with the exception of selecting the FileSet, by using command
527 line arguments with a single command by entering: 
528
529 \footnotesize
530 \begin{verbatim}
531 restore client=Rufus select current all done yes
532 \end{verbatim}
533 \normalsize
534
535 The {\bf client=Rufus} specification will automatically select Rufus as the
536 client, the {\bf current} tells Bacula that you want to restore the system to
537 the most current state possible, and the {\bf yes} suppresses the final {\bf
538 yes/mod/no} prompt and simply runs the restore. 
539
540 The full list of possible command line arguments are: 
541
542 \begin{itemize}
543 \item {\bf all} -- select all Files to be restored.  
544 \item {\bf select} -- use the tree selection method.  
545 \item {\bf done} -- do not prompt the user in tree mode.  
546 \item {\bf current} -- automatically select the most current set of  backups
547    for the specified client.  
548 \item {\bf client=xxxx} -- select the specified client.  
549 \item {\bf jobid=nnn} -- specify a JobId or comma separated list of  JobIds to
550    be restored.  
551 \item {\bf before=YYYY-MM-DD HH:MM:SS} -- specify a date and time to  which
552    the system should be restored. Only Jobs started before  the specified
553    date/time will be selected, and as is the case  for {\bf current} Bacula will
554 automatically find the most  recent prior Full save and all Differential and
555 Incremental  saves run before the date you specify. Note, this command is  not
556 too user friendly in that you must specify the date/time  exactly as shown. 
557 \item {\bf file=filename} -- specify a filename to be restored. You  must
558    specify the full path and filename. Prefixing the entry  with a less-than
559 sign
560    (\lt{}) will cause Bacula to assume that the  filename is on your system and
561 contains a list of files to be  restored. Bacula will thus read the list from
562 that file. Multiple  file=xxx specifications may be specified on the command
563 line. 
564 \item {\bf jobid=nnn} -- specify a JobId to be restored. 
565 \item {\bf pool=pool-name} -- specify a Pool name to be used for selection  of
566    Volumes when specifying options 5 and 6 (restore current system,  and restore
567    current system before given date). This permits you to  have several Pools,
568 possibly one offsite, and to select the Pool to  be used for restoring.  
569 \item {\bf yes} -- automatically run the restore without prompting  for
570    modifications (most useful in batch scripts). 
571    \end{itemize}
572
573 \subsection*{Restoring Directory Attributes}
574 \index[general]{Attributes!Restoring Directory }
575 \index[general]{Restoring Directory Attributes }
576 \addcontentsline{toc}{subsection}{Restoring Directory Attributes}
577
578 Depending how you do the restore, you may or may not get the directory entries
579 back to their original state. Here are a few of the problems you can
580 encounter, and for same machine restores, how to avoid them. 
581
582 \begin{itemize}
583 \item You backed up on one machine and are restoring to another that is 
584    either a different OS or doesn't have the same users/groups defined.  Bacula
585    does the best it can in these situations. Note, Bacula has saved the
586    user/groups in numeric form, which means on a different machine, they
587    may map to different user/group names.
588 \item You are restoring into a directory that is already created and has
589    file creation restrictions.  Bacula tries to reset everything but
590    without walking up the full chain of directories and modifying them all
591    during the restore, which Bacula does and will not do, getting
592    permissions back correctly in this situation depends to a large extent
593    on your OS.
594 \item You are doing a recursive restore of a directory tree.  In this case
595    Bacula will restore a file before restoring the file's parent directory
596    entry.  In the process of restoring the file Bacula will create the
597    parent directory with open permissions and ownership of the file being
598    restored.  Then when Bacula tries to restore the parent directory Bacula
599    sees that it already exists (Similar to the previous situation).  If you
600    had set the Restore job's "Replace" property to "never" then Bacula will
601    not change the directory's permissions and ownerships to match what it
602    backed up, you should also notice that the actual number of files
603    restored is less then the expected number.  If you had set the Restore
604    job's "Replace" property to "always" then Bacula will change the
605    Directory's ownership and permissions to match what it backed up, also
606    the actual number of files restored should be equal to the expected
607    number.
608 \item You selected one or more files in a directory, but did not select the
609    directory entry to be restored.  In that case, if the directory is not
610    on disk Bacula simply creates the directory with some default attributes
611    which may not be the same as the original.  If you do not select a
612    directory and all its contents to be restored, you can still select
613    items within the directory to be restored by individually marking those
614    files, but in that case, you should individually use the "markdir"
615    command to select all higher level directory entries (one at a time) to
616    be restored if you want the directory entries properly restored.
617 \end{itemize}
618
619 \label{Windows}
620
621 \subsection*{Restoring on Windows}
622 \index[general]{Restoring on Windows }
623 \index[general]{Windows!Restoring on }
624 \addcontentsline{toc}{subsection}{Restoring on Windows}
625
626 If you are restoring on WinNT/2K/XP systems, Bacula will restore the files
627 with the original ownerships and permissions as would be expected.  This is
628 also true if you are restoring those files to an alternate directory (using
629 the Where option in restore).  However, if the alternate directory does not
630 already exist, the Bacula File daemon (Client) will try to create it.  In
631 some cases, it may not create the directories, and if it does since the
632 File daemon runs under the SYSTEM account, the directory will be created
633 with SYSTEM ownership and permissions.  In this case, you may have problems
634 accessing the newly restored files.
635
636 To avoid this problem, you should create any alternate directory before
637 doing the restore.  Bacula will not change the ownership and permissions of
638 the directory if it is already created as long as it is not one of the
639 directories being restored (i.e.  written to tape).
640
641 The default restore location is {\bf /tmp/bacula-restores/} and if you are
642 restoring from drive {\bf E:}, the default will be 
643 {\bf /tmp/bacula-restores/e/}, so you should ensure that this directory
644 exists before doing the restore, or use the {\bf mod} option to
645 select a different {\bf where} directory that does exist.
646
647 Some users have experienced problems restoring files that participate in
648 the Active Directory. They also report that changing the userid under which
649 Bacula (bacula-fd.exe) runs, from SYSTEM to a Domain Admin userid, resolves
650 the problem.
651
652
653 \subsection*{Restoring Files Can Be Slow}
654 \index[general]{Slow!Restoring Files Can Be }
655 \index[general]{Restoring Files Can Be Slow }
656 \addcontentsline{toc}{subsection}{Restoring Files Can Be Slow}
657
658 Restoring files is generally {\bf much} slower than backing them up for several
659 reasons. The first is that during a backup the tape is normally already
660 positioned and Bacula only needs to write. On the other hand, because restoring
661 files is done so rarely, Bacula keeps only the start file and block on the
662 tape for the whole job rather than on a file by file basis which would use
663 quite a lot of space in the catalog. 
664
665 Bacula will forward space to the correct file mark on the tape for the Job,
666 then forward space to the correct block, and finally sequentially read each
667 record until it gets to the correct one(s) for the file or files you want to
668 restore. Once the desired files are restored, Bacula will stop reading the
669 tape. 
670
671 Finally, instead of just reading a file for backup, during the restore, Bacula
672 must create the file, and the operating system must allocate disk space for
673 the file as Bacula is restoring it. 
674
675 For all the above reasons the restore process is generally much slower than
676 backing up (sometimes it takes three times as long).
677
678 \subsection*{Problems Restoring Files}
679 \index[general]{Files!Problems Restoring }
680 \index[general]{Problems Restoring Files }
681 \addcontentsline{toc}{subsection}{Problems Restoring Files}
682
683 The most frequent problems users have restoring files are error messages such
684 as: 
685
686 \footnotesize
687 \begin{verbatim}
688 04-Jan 00:33 z217-sd: RestoreFiles.2005-01-04_00.31.04 Error:
689 block.c:868 Volume data error at 20:0! Short block of 512 bytes on
690 device /dev/tape discarded.
691 \end{verbatim}
692 \normalsize
693
694 or 
695
696 \footnotesize
697 \begin{verbatim}
698 04-Jan 00:33 z217-sd: RestoreFiles.2005-01-04_00.31.04 Error:
699 block.c:264 Volume data error at 20:0! Wanted ID: "BB02", got ".".
700 Buffer discarded.
701 \end{verbatim}
702 \normalsize
703
704 Both these kinds of messages indicate that you were probably running your tape
705 drive in fixed block mode rather than variable block mode. Fixed block mode
706 will work with any program that reads tapes sequentially such as tar, but
707 Bacula repositions the tape on a block basis when restoring files because this
708 will speed up the restore by orders of magnitude when only a few files are being
709 restored. There are several ways that you can attempt to recover from this
710 unfortunate situation. 
711
712 Try the following things, each separately, and reset your Device resource to
713 what it is now after each individual test: 
714
715 \begin{enumerate}
716 \item Set "Block Positioning = no" in your Device resource  and try the
717    restore. This is a new directive and untested. 
718 \item Set "Minimum Block Size = 512" and "Maximum  Block Size = 512" and
719    try the restore.  If you are able to determine the block size your drive
720    was previously using, you should try that size if 512 does not work.
721 \item Try editing the restore.bsr file at the Run xxx yes/mod/no prompt 
722    before starting the restore job and remove all the VolBlock statements.
723    These are what causes Bacula to reposition the tape, and where problems
724    occur if you have a fixed block size set for your drive.  The VolFile
725    commands also cause repositioning, but this will work regardless of the
726    block size.
727 \item Use bextract to extract the files you want -- it reads the  Volume
728    sequentially if you use the include list feature, or if you use a .bsr
729    file, but remove all the VolBlock statements after the .bsr file is
730    created (at the Run yes/mod/no) prompt but before you start the restore.
731 \end{enumerate}
732
733 \subsection*{Restore Errors}
734 \index[general]{Errors!Restore}
735 \index[general]{Restore Errors}
736 \addcontentsline{toc}{subsection}{Restore Errors}
737
738 There are a number of reasons why there may be restore errors or
739 warning messages. Some of the more common ones are:
740
741 \begin{description}
742
743 \item [file count mismatch]
744   This can occur for the following reasons:
745   \begin{itemize}
746   \item You requested Bacula not to overwrite existing or newer
747      files.
748   \item A Bacula miscount of files/directories. This is an
749      on-going problem due to the complications of directories,
750      soft/hard link, and such.  Simply check that all the files you
751      wanted were actually restored.
752   \end{itemize}
753 \item [file size error]
754    When Bacula restores files, it checks that the size of the
755    restored file is the same as the file status data it saved 
756    when starting the backup of the file. If the sizes do not
757    agree, Bacula will print an error message. This size mismatch
758    most often occurs because the file was being written as Bacula
759    backed up the file. In this case, the size that Bacula
760    restored will be greater than the status size.  This often
761    happens with log files.
762
763    If the restored size is smaller, then you should be concerned
764    about a possible tape error and check the Bacula output as
765    well as your system logs.
766 \end{description}
767
768
769
770 \subsection*{Example Restore Job Resource}
771 \index[general]{Example Restore Job Resource }
772 \index[general]{Resource!Example Restore Job }
773 \addcontentsline{toc}{subsection}{Example Restore Job Resource}
774
775 \footnotesize
776 \begin{verbatim}
777 Job {
778   Name = "RestoreFiles"
779   Type = Restore
780   Client = Any-client
781   FileSet = "Any-FileSet"
782   Storage = Any-storage
783   Where = /tmp/bacula-restores
784   Messages = Standard
785   Pool = Default
786 }
787 \end{verbatim}
788 \normalsize
789
790 If {\bf Where} is not specified, the default location for restoring files will
791 be their original locations. 
792 \label{Selection}
793
794 \subsection*{File Selection Commands}
795 \index[general]{Commands!File Selection }
796 \index[general]{File Selection Commands }
797 \addcontentsline{toc}{subsection}{File Selection Commands}
798
799 After you have selected the Jobs to be restored and Bacula has created the
800 in-memory directory tree, you will enter file selection mode as indicated by
801 the dollar sign ({\bf \$}) prompt. While in this mode, you may use the
802 commands listed above. The basic idea is to move up and down the in memory
803 directory structure with the {\bf cd} command much as you normally do on the
804 system. Once you are in a directory, you may select the files that you want
805 restored. As a default no files are marked to be restored. If you wish to
806 start with all files, simply enter: {\bf cd /} and {\bf mark *}. Otherwise
807 proceed to select the files you wish to restore by marking them with the {\bf
808 mark} command. The available commands are: 
809
810 \begin{description}
811
812 \item [cd]
813    The {\bf cd} command changes the current directory to  the argument
814    specified.
815    It operates much like the Unix {\bf cd} command.  Wildcard specifications are
816    not permitted.  
817
818    Note, on Windows systems, the various drives (c:, d:, ...) are treated  like
819    a
820    directory within the file tree while in the file  selection mode. As a
821    consequence, you must do a {\bf cd c:} or  possibly in some cases a {\bf cd
822    C:} (note upper case)  to get down to the first directory.  
823
824 \item [dir]
825    \index[dir]{dir }
826    The {\bf dir} command is similar to the {\bf ls} command,  except that it
827    prints it in long format (all details). This command  can be a bit slower
828    than
829    the {\bf ls} command because it must access  the catalog database for the
830    detailed information for each file.  
831
832 \item [estimate]
833    \index[dir]{estimate }
834    The {\bf estimate} command prints a summary of  the total files in the tree,
835    how many are marked to be restored, and  an estimate of the number of bytes
836    to
837    be restored. This can be useful  if you are short on disk space on the
838    machine
839    where the files will be  restored.  
840
841 \item [find]
842    \index[dir]{find }
843    The {\bf find} command accepts one or more arguments  and displays all files
844    in the tree that match that argument. The argument  may have wildcards. It is
845    somewhat similar to the Unix command  {\bf find / -name arg}.  
846
847 \item [ls]
848    The {\bf ls} command produces a listing of all the files  contained in the
849    current directory much like the Unix {\bf ls} command.  You may specify an
850    argument containing wildcards, in which case only  those files will be
851 listed.
852    Any file that is marked to be restored will  have its name preceded by an
853    asterisk ({\bf *}). Directory names  will be terminated with a forward slash
854    ({\bf /}) to distinguish them  from filenames.  
855
856 \item [lsmark]
857    \index[fd]{lsmark }
858    The {\bf lsmark} command is the same as the  {\bf ls} except that it will
859    print only those files marked for  extraction. The other distinction is that
860    it will recursively  descend into any directory selected. 
861
862 \item [mark]
863    \index[dir]{mark }
864    The {\bf mark} command allows you to mark files to be restored. It takes a
865    single argument which is the filename  or directory name in the current
866    directory to be marked for extraction.  The argument may be a wildcard
867    specification, in which  case all files that match in the current directory
868    are marked to be  restored. If the argument matches a directory rather than a
869    file,  then the directory and all the files contained in that directory
870    (recursively)  are marked to be restored. Any marked file will have its name 
871    preceded with an asterisk ({\bf *}) in the output produced by the  {\bf ls}
872 or
873    {\bf dir} commands. Note, supplying a full path on  the mark command does not
874    work as expected to select a file or  directory in the current directory.
875    Also, the {\bf mark} command works  on the current and lower directories but
876    does not touch higher level  directories.  
877
878    After executing the {\bf mark} command, it will print a brief summary:  
879
880 \footnotesize
881 \begin{verbatim}
882     No files marked.
883     
884 \end{verbatim}
885 \normalsize
886
887    If no files were marked, or:  
888
889 \footnotesize
890 \begin{verbatim}
891     nn files marked.
892     
893 \end{verbatim}
894 \normalsize
895
896    if some files are marked.  
897
898 \item [unmark]
899    \index[dir]{unmark }
900    The {\bf unmark} is identical to the {\bf mark}  command, except that it
901    unmarks the specified file or files so that  they will not be restored. Note:
902    the {\bf unmark} command works from  the current directory, so it does not
903    unmark any files at a higher  level. First do a {\bf cd /} before the {\bf
904    unmark *} command if  you want to unmark everything.  
905
906 \item [pwd]
907    \index[dir]{pwd }
908    The {\bf pwd} command prints the current working  directory. It accepts no
909    arguments.  
910
911 \item [count]
912    \index[dir]{count }
913    The {\bf count} command prints the total files in the  directory tree and the
914    number of files marked to be restored.  
915
916 \item [done]
917    \index[dir]{done }
918    This command terminates file selection mode.  
919
920 \item [exit]
921    \index[fd]{exit }
922    This command terminates file selection mode (the same as  done).  
923
924 \item [quit]
925    \index[fd]{quit }
926    This command terminates the file selection and does  not run the restore
927 job. 
928
929
930 \item [help]
931    \index[fd]{help }
932    This command prints a summary of the commands available.  
933
934 \item [?]
935    This command is the same as the {\bf help} command.  
936 \end{description}
937
938 \label{database_restore}
939 \subsection*{Restoring When Things Go Wrong}
940 \index[general]{Restoring When Things Go Wrong }
941 \index[general]{Restoring Your Database}
942 \index[general]{Database!Restoring}
943 \addcontentsline{toc}{subsection}{Restoring When Things Go Wrong}
944
945 This and the following sections will try to present a few of the kinds of
946 problems that can come up making restoring more difficult. I'll try to
947 provide a few ideas how to get out of these problem situations.
948 In addition to what is presented here, there is more specific information
949 on restoring a \ilink{Client}{restore_client} and your
950 \ilink{Server}{restore_server} in the \ilink{Disaster Recovery Using
951 Bacula}{_ChapterRescue} chapter of this manual.
952
953 \begin{description}
954 \item[Problem]
955    My database is broken.
956 \item[Solution]
957    For SQLite, use the vacuum command to try to fix the database. For either
958    MySQL or PostgreSQL, see the vendor's documentation. They have specific tools
959    that check and repair databases, see the \ilink{database
960    repair}{DatabaseRepair} sections of this manual for links to vendor    
961    information.
962
963    Assuming the above does not resolve the problem, you will need to restore
964    or rebuild your catalog.  Note, if it is a matter of some
965    inconsistencies in the Bacula tables rather than a broken database, then
966    running \ilink{dbcheck}{dbcheck} might help, but you will need to ensure
967    that your database indexes are properly setup.  Please see
968    the \ilink{Database Performance Issues}{DatabasePerformance} sections
969    of this manual for more details.
970
971 \item[Problem]
972    How do I restore my catalog?
973 \item[Solution with a Catalog backup]
974    If you have backed up your database nightly (as you should) and you
975    have made a bootstrap file, you can immediately load back your
976    database (or the ASCII SQL output).  Make a copy of your current
977    database, then re-initialize it, by running the following scripts:
978 \begin{verbatim}
979    ./drop_bacula_tables
980    ./make_bacula_tables
981 \end{verbatim}
982    After re-initializing the database, you should be able to run 
983    Bacula. If you now try to use the restore command, it will not 
984    work because the database will be empty. However, you can manually
985    run a restore job and specify your bootstrap file. You do so
986    by entering the {bf run} command in the console and selecting the
987    restore job.  If you are using the default bacula-dir.conf, this
988    Job will be named {\bf RestoreFiles}. Most likely it will prompt
989    you with something such as:
990 \footnotesize
991 \begin{verbatim}
992 Run Restore job
993 JobName:    RestoreFiles
994 Bootstrap:  /home/kern/bacula/working/restore.bsr
995 Where:      /tmp/bacula-restores
996 Replace:    always
997 FileSet:    Full Set
998 Client:     rufus-fd
999 Storage:    File
1000 When:       2005-07-10 17:33:40
1001 Catalog:    MyCatalog
1002 Priority:   10
1003 OK to run? (yes/mod/no): 
1004 \end{verbatim}
1005 \normalsize
1006    A number of the items will be different in your case.  What you want to
1007    do is: to use the mod option to change the Bootstrap to point to your
1008    saved bootstrap file; and to make sure all the other items such as
1009    Client, Storage, Catalog, and Where are correct.  The FileSet is not
1010    used when you specify a bootstrap file.  Once you have set all the
1011    correct values, run the Job and it will restore the backup of your
1012    database, which is most likely an ASCII dump. 
1013
1014    You will then need to follow the instructions for your
1015    database type to recreate the database from the ASCII backup file.
1016    See the \ilink {Catalog Maintenance}{_ChapterStart12} chapter of
1017    this manual for examples of the command needed to restore a 
1018    database from an ASCII dump (they are shown in the Compacting Your
1019    XXX Database sections).
1020     
1021    Also, please note that after you restore your database from an ASCII
1022    backup, you do NOT want to do a {\bf make_bacula_tables}  command, or
1023    you will probably erase your newly restored database tables.
1024
1025       
1026 \item[Solution with a Job listing]
1027    If you did save your database but did not make a bootstrap file, then
1028    recovering the database is more difficult.  You will probably need to
1029    use bextract to extract the backup copy.  First you should locate the
1030    listing of the job report from the last catalog backup.  It has
1031    important information that will allow you to quickly find your database
1032    file.  For example, in the job report for the CatalogBackup shown below,
1033    the critical items are the Volume name(s), the Volume Session Id and the
1034    Volume Session Time.  If you know those, you can easily restore your
1035    Catalog.
1036 \footnotesize
1037 \begin{verbatim}
1038
1039 22-Apr 10:22 HeadMan: Start Backup JobId 7510,
1040 Job=CatalogBackup.2005-04-22_01.10.0
1041 22-Apr 10:23 HeadMan: Bacula 1.37.14 (21Apr05): 22-Apr-2005 10:23:06
1042   JobId:                  7510
1043   Job:                    CatalogBackup.2005-04-22_01.10.00
1044   Backup Level:           Full
1045   Client:                 Polymatou
1046   FileSet:                "CatalogFile" 2003-04-10 01:24:01
1047   Pool:                   "Default"
1048   Storage:                "DLTDrive"
1049   Start time:             22-Apr-2005 10:21:00
1050   End time:               22-Apr-2005 10:23:06
1051   FD Files Written:       1
1052   SD Files Written:       1
1053   FD Bytes Written:       210,739,395
1054   SD Bytes Written:       210,739,521
1055   Rate:                   1672.5 KB/s
1056   Software Compression:   None
1057   Volume name(s):         DLT-22Apr05
1058   Volume Session Id:      11
1059   Volume Session Time:    1114075126
1060   Last Volume Bytes:      1,428,240,465
1061   Non-fatal FD errors:    0
1062   SD Errors:              0
1063   FD termination status:  OK
1064   SD termination status:  OK
1065   Termination:            Backup OK
1066
1067 \end{verbatim}
1068 \normalsize
1069
1070   From the above information, you can manually create a bootstrap file,
1071   and then follow the instructions given above for restoring your database.
1072   A reconstructed bootstrap file for the above backup Job would look
1073   like the following:
1074
1075 \footnotesize
1076 \begin{verbatim}
1077 Volume="DLT-22Apr05"
1078 VolSessionId=11
1079 VolSessionTime=1114075126
1080 FileIndex=1-1
1081 \end{verbatim}
1082 \normalsize    
1083
1084   Where we have inserted the Volume name, Volume Session Id, and Volume
1085   Session Time that correspond to the values in the job report.  We've also
1086   used a FileIndex of one, which will always be the case providing that
1087   there was only one file backed up in the job.
1088   
1089   The disadvantage of this bootstrap file compared to what is created when
1090   you ask for one to be written, is that there is no File and Block
1091   specified, so the restore code must search all data in the Volume to find
1092   the requested file.  A fully specified bootstrap file would have the File
1093   and Blocks specified as follows:
1094
1095 \footnotesize
1096 \begin{verbatim}
1097 Volume="DLT-22Apr05"
1098 VolSessionId=11
1099 VolSessionTime=1114075126
1100 VolFile=118-118
1101 VolBlock=0-4053
1102 FileIndex=1-1
1103 \end{verbatim}
1104 \normalsize
1105
1106    Once you have restored the ASCII dump of the database,
1107    you will then to follow the instructions for your
1108    database type to recreate the database from the ASCII backup file.
1109    See the \ilink {Catalog Maintenance}{_ChapterStart12} chapter of
1110    this manual for examples of the command needed to restore a 
1111    database from an ASCII dump (they are shown in the Compacting Your
1112    XXX Database sections).
1113     
1114    Also, please note that after you restore your database from an ASCII
1115    backup, you do NOT want to do a {\bf make_bacula_tables}  command, or
1116    you will probably erase your newly restored database tables.
1117
1118 \item [Solution withou a Job Listing]
1119    If you do not have a job listing, then it is a bit more difficult.
1120    Either you use the \ilink{bscan}{bscan} program to scan the contents
1121    of your tape into a database, which can be very time consuming 
1122    depending on the size of the tape, or you can use the \ilink{bls}{bls}
1123    program to list everything on the tape, and reconstruct a bootstrap 
1124    file from the bls listing for the file or files you want following
1125    the instructions given above.
1126
1127    There is a specific example of how to use {\bf bls} below.
1128
1129 \item [Problem]
1130    I try to restore the last known good full backup by specifying
1131    item 3 on the restore menu then the JobId to restore.  Bacula 
1132    then reports:
1133
1134 \footnotesize
1135 \begin{verbatim}
1136    1 Job 0 Files
1137 \end{verbatim}
1138 \normalsize
1139    and restores nothing.
1140 \item[Solution]
1141    Most likely the File records were pruned from the database either due
1142    to the File Retention period expiring or by explicitly purging the
1143    Job. By using the "llist jobid=nn" command, you can obtain all the
1144    important information about the job:
1145 \footnotesize
1146 \begin{verbatim}
1147 llist jobid=120
1148            JobId: 120
1149              Job: save.2005-12-05_18.27.33
1150         Job.Name: save
1151      PurgedFiles: 0
1152             Type: B
1153            Level: F
1154     Job.ClientId: 1
1155      Client.Name: Rufus
1156        JobStatus: T
1157        SchedTime: 2005-12-05 18:27:32
1158        StartTime: 2005-12-05 18:27:35
1159          EndTime: 2005-12-05 18:27:37
1160         JobTDate: 1133803657
1161     VolSessionId: 1
1162   VolSessionTime: 1133803624
1163         JobFiles: 236
1164        JobErrors: 0
1165  JobMissingFiles: 0
1166       Job.PoolId: 4
1167        Pool.Name: Full
1168    Job.FileSetId: 1
1169  FileSet.FileSet: BackupSet
1170 \end{verbatim}
1171 \normalsize
1172
1173    Then you can find the Volume(s) used by doing:
1174 \footnotesize
1175 \begin{verbatim}
1176 sql
1177 select VolumeName from JobMedia,Media where JobId=1 and JobMedia.MediaId=Media.MediaId;
1178 \end{verbatim}
1179 \normalsize
1180    Finally, you can create a bootstrap file as described in the previous
1181    problem above using this information.
1182
1183    If you are using Bacula version 1.38.0 or greater, when you select
1184    item 3 from the menu and enter the JobId, it will ask you if
1185    you would like to restore all the files in the job, and it will
1186    collect the above information and write the bootstrap file for
1187    you.
1188
1189 \item [Problem]
1190   You don't have a bootstrap file, and you don't have the Job report for
1191   the backup of your database, but you did backup the database, and you
1192   know the Volume to which it was backed up.
1193   
1194 \item [Solution]
1195   Either bscan the tape, or use {\bf bls} to indicate where it is on the
1196   tape.  For example:
1197
1198 \footnotesize
1199 \begin{verbatim}
1200 ./bls -j -V DLT-22Apr05 /dev/nst0
1201 \end{verbatim}
1202 \normalsize
1203   Might produce the following output:
1204 \footnotesize
1205 \begin{verbatim}
1206 bls: butil.c:258 Using device: "/dev/nst0" for reading.
1207 21-Jul 18:34 bls: Ready to read from volume "DLT-22Apr05" on device "DLTDrive"
1208 (/dev/nst0).
1209 Volume Record: File:blk=0:0 SessId=11 SessTime=1114075126 JobId=0 DataLen=164
1210 ...
1211 Begin Job Session Record: File:blk=118:0 SessId=11 SessTime=1114075126
1212 JobId=7510
1213    Job=CatalogBackup.2005-04-22_01.10.0 Date=22-Apr-2005 10:21:00 Level=F Type=B
1214 End Job Session Record: File:blk=118:4053 SessId=11 SessTime=1114075126
1215 JobId=7510
1216    Date=22-Apr-2005 10:23:06 Level=F Type=B Files=1 Bytes=210,739,395 Errors=0
1217 Status=T
1218 ...
1219 21-Jul 18:34 bls: End of Volume at file 201 on device "DLTDrive" (/dev/nst0),
1220 Volume "DLT-22Apr05"
1221 21-Jul 18:34 bls: End of all volumes.
1222 \end{verbatim}
1223 \normalsize
1224   Of course, there will be many more records printed, but we have indicated
1225   the essential lines of output. From the information on the Begin Job and End 
1226   Job Session Records, you can reconstruct a bootstrap file such as the one
1227   shown above.
1228
1229 \item[Problem]
1230   How can I find where a file is stored.
1231 \item[Solution]
1232   Normally, it is not necessary, you just use the {\bf restore} command to
1233   restore the most recently saved version (menu option 5), or a version
1234   saved before a given date (menu option 8).  If you know the JobId of the
1235   job in which it was saved, you can use menu option 3 to enter that JobId.
1236
1237   If you would like to know the JobId where a file was saved, select
1238   restore menu option 2.
1239
1240   You can also use the {\bf query} command to find information such as: 
1241 \footnotesize
1242 \begin{verbatim}
1243 *query
1244 Available queries:
1245      1: List Job totals:
1246      2: List up to 20 places where a File is saved regardless of the directory:
1247      3: List where the most recent copies of a file are saved:
1248      4: List last 20 Full Backups for a Client:
1249      5: List all backups for a Client after a specified time
1250      6: List all backups for a Client
1251      7: List Volume Attributes for a selected Volume:
1252      8: List Volumes used by selected JobId:
1253      9: List Volumes to Restore All Files:
1254     10: List Pool Attributes for a selected Pool:
1255     11: List total files/bytes by Job:
1256     12: List total files/bytes by Volume:
1257     13: List Files for a selected JobId:
1258     14: List Jobs stored in a selected MediaId:
1259     15: List Jobs stored for a given Volume name:
1260 Choose a query (1-15):
1261 \end{verbatim}
1262 \normalsize
1263
1264
1265 \end{description}