X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=docs%2Fmanual%2Frestore.tex;h=4085e7748516a7c34545b1bd521a20bd9ca8fbb2;hb=36cd64837bfe3cc628c0806fce655c4df2d3c230;hp=2c2ef406b8838a78c6bbdaab6ee21d504357c095;hpb=ffb90de90c70a8bc89328b4ed889fbba49e53b42;p=bacula%2Fdocs diff --git a/docs/manual/restore.tex b/docs/manual/restore.tex index 2c2ef406..4085e774 100644 --- a/docs/manual/restore.tex +++ b/docs/manual/restore.tex @@ -11,7 +11,7 @@ \index[general]{General } \addcontentsline{toc}{subsection}{General} -Below, we will discuss restoring files with the Console {\bf Restore} command, +Below, we will discuss restoring files with the Console {\bf restore} command, which is the recommended way of doing it. However, there is a standalone program named {\bf bextract}, which also permits restoring files. For more information on this program, please see the @@ -27,8 +27,9 @@ job. That is a job with {\bf Type = Restore}. As a consequence, you will need a predefined {\bf restore} job in your {\bf bacula-dir.conf} (Director's config) file. The exact parameters (Client, FileSet, ...) that you define are not important as you can either modify them manually before running the job or -if you use the {\bf restore} command, explained below, they will be -automatically set for you. +if you use the {\bf restore} command, explained below, Bacula will +automatically set them for you. In fact, you can no longer simply run a restore +job. You must use the restore command. Since Bacula is a network backup program, you must be aware that when you restore files, it is up to you to ensure that you or Bacula have selected the @@ -37,8 +38,13 @@ correct Client and the correct hard disk location for restoring those files. the files to a different directory on client B. Normally, you will want to avoid this, but assuming the operating systems are not too different in their file structures, this should work perfectly well, if so desired. -\label{Example1} +By default, Bacula will restore data to the same Client that was backed +up, and those data will be restored not to the original places but to +{\bf /tmp/bacula-restores}. You may modify any of these defaults when the +restore command prompts you to run the job by selecting the {\bf mod} +option. +\label{Example1} \subsection*{The Restore Command} \index[general]{Command!Restore } \index[general]{Restore Command } @@ -57,6 +63,9 @@ interactively walk up and down the file tree selecting individual files to be restored. This mode is somewhat similar to the standard Unix {\bf restore} program's interactive file selection mode. +If your Files have been pruned, the {\bf restore} command will be unable +to find any files to restore. See below for more details on this. + Within the Console program, after entering the {\bf restore} command, you are presented with the following selection prompt: @@ -69,48 +78,101 @@ select which files from those JobIds are to be restored. To select the JobIds, you have the following choices: 1: List last 20 Jobs run 2: List Jobs where a given File is saved - 3: Enter list of JobIds to select + 3: Enter list of comma separated JobIds to select 4: Enter SQL list command 5: Select the most recent backup for a client 6: Select backup for a client before a specified time 7: Enter a list of files to restore 8: Enter a list of files to restore before a specified time - 9: Cancel -Select item: (1-9): - + 9: Find the JobIds of the most recent backup for a client + 10: Find the JobIds for a backup for a client before a specified time + 11: Enter a list of directories to restore for found JobIds + 12: Cancel +Select item: (1-12): \end{verbatim} \normalsize \begin{itemize} -\item Item 1 will list the last 20 jobs run. If you find the Job you want, - you can then select item 3 and enter its JobId(s). +\item Item 1 will list the last 20 jobs run. If you find the Job you want, + you can then select item 3 and enter its JobId(s). + \item Item 2 will list all the Jobs where a specified file is saved. If you - find the Job you want, you can then select item 3 and enter the JobId. + find the Job you want, you can then select item 3 and enter the JobId. + \item Item 3 allows you the enter a list of comma separated JobIds whose - files will be put into the directory tree. + files will be put into the directory tree. You may then select which + files from those JobIds to restore. + \item Item 4 allows you to enter any arbitrary SQL command. This is probably the most primitive way of finding the desired JobIds, but at the same time, the most flexible. Once you have found the JobId(s), you can select item 3 -and enter them. + and enter them. + \item Item 5 will automatically select the most recent Full backup and all - subsequent incremental and differential backups for a specified Client. These - are the Jobs and Files which, if reloaded, will restore your system to the most -current saved state. It automatically enters the JobIds found into the -directory tree. This is probably the most convenient of all the above options -to use if you wish to restore a selected Client to its most recent state. + subsequent incremental and differential backups for a specified Client. + These are the Jobs and Files which, if reloaded, will restore your + system to the most current saved state. It automatically enters the + JobIds found into the directory tree. This is probably the most + convenient of all the above options to use if you wish to restore a + selected Client to its most recent state. + + There are two important things to note. First, this automatic selection + will never select a job that failed (terminated with an error status). + If you have such a job and want to recover one or more files from it, + you will need to explicitly enter the JobId in item 3, then choose the + files to restore. + + If some of the Jobs that are needed to do the restore have had their + File records pruned, the restore will be incomplete. Bacula currently + does not correctly detect this condition. You can however, check for + this by looking carefully at the list of Jobs that Bacula selects and + prints. If you find Jobs with the JobFiles column set to zero, when + files should have been backed up, then you should expect problems. + + If all the File records have been pruned, Bacula will realize that there + are no file records in any of the JobIds chosen and will inform you. It + will then propose doing a full restore (non-selective) of those JobIds. + This is possible because Bacula still knows where the beginning of the + Job data is on the Volumes, even if it does not know where particular + files are located. + \item Item 6 allows you to specify a date and time, after which Bacula will automatically select the most recent Full backup and all subsequent incremental and differential backups that started before the specified date -and time. + and time. + \item Item 7 allows you to specify one or more filenames (complete path required) to be restored. Each filename is entered one at a time or if you prefix a filename with the less-than symbol (\lt{}) Bacula will read that -file and assume it is a list of filenames to be restored. The filename entry -mode is terminated by entering a blank line. + file and assume it is a list of filenames to be restored. The filename entry + mode is terminated by entering a blank line. + \item Item 8 allows you to specify a date and time before entering the - filenames. See Item 7 above for more details. -\item Item 9 allows you to cancel the restore command. - \end{itemize} + filenames. See Item 7 above for more details. + +\item Item 9 allows you find the JobIds of the most recent backup for + a client. This is much like option 5 (it uses the same code), but + those JobIds are retained internally as if you had entered them + manually. You may then select item 11 (see below) to restore one + or more directories. + +\item Item 10 is the same as item 9, except that it allows you to enter + a before date (as with item 6). These JobIds will then be retained + internally. + +\index[general]{Restore Directories} +\item Item 11 allows you to enter a list of JobIds from which you can + select directories to be restored. The list of JobIds can have been + previously created by using either item 9 or 10 on the menu. You + may then enter a full path to a directory name or a filename preceded + by a less than sign (\lt{}). The filename should contain a list + of directories to be restored. All files in those directories will + be restored, but if the directory contains subdirectories, nothing + will be restored in the subdirectory unless you explicitly enter its + name. + +\item Item 12 allows you to cancel the restore command. +\end{itemize} As an example, suppose that we select item 5 (restore to most recent state). It will then ask for the desired Client, which on my system, will print all @@ -159,14 +221,22 @@ the columns are truncated here for presentation: \footnotesize \begin{verbatim} -+-------+------+----------+-------------+-------------+------+-------+------------+ -| JobId | Levl | JobFiles | StartTime | VolumeName | File | SesId | VolSesTime | -+-------+------+----------+-------------+-------------+------+-------+------------+ -| 1,792 | F | 128,374 | 08-03 01:58 | DLT-19Jul02 | 67 | 18 | 1028042998 | -| 1,792 | F | 128,374 | 08-03 01:58 | DLT-04Aug02 | 0 | 18 | 1028042998 | -| 1,797 | I | 254 | 08-04 13:53 | DLT-04Aug02 | 5 | 23 | 1028042998 | -| 1,798 | I | 15 | 08-05 01:05 | DLT-04Aug02 | 6 | 24 | 1028042998 | -+-------+------+----------+-------------+-------------+------+-------+------------+ ++-------+------+----------+-------------+-------------+------+-------+---------- +--+ +| JobId | Levl | JobFiles | StartTime | VolumeName | File | SesId | +VolSesTime | ++-------+------+----------+-------------+-------------+------+-------+---------- +--+ +| 1,792 | F | 128,374 | 08-03 01:58 | DLT-19Jul02 | 67 | 18 | +1028042998 | +| 1,792 | F | 128,374 | 08-03 01:58 | DLT-04Aug02 | 0 | 18 | +1028042998 | +| 1,797 | I | 254 | 08-04 13:53 | DLT-04Aug02 | 5 | 23 | +1028042998 | +| 1,798 | I | 15 | 08-05 01:05 | DLT-04Aug02 | 6 | 24 | +1028042998 | ++-------+------+----------+-------------+-------------+------+-------+---------- +--+ You have selected the following JobId: 1792,1792,1797 Building directory tree for JobId 1792 ... Building directory tree for JobId 1797 ... @@ -177,7 +247,10 @@ $ \normalsize Depending on the number of {\bf JobFiles} for each JobId, the {\bf Building -directory tree ...``} can take a bit of time. +directory tree ..."} can take a bit of time. If you notice ath all the +JobFiles are zero, your Files have probably been pruned and you will not be +able to select any individual files -- it will be restore everything or +nothing. In our example, Bacula found four Jobs that comprise the most recent backup of the specified Client and FileSet. Two of the Jobs have the same JobId because @@ -191,11 +264,14 @@ to be restored as a default, tells you how many files are in the tree, and tells you that the current working directory ({\bf cwd}) is /. Finally, Bacula prompts with the dollar sign (\$) to indicate that you may enter commands to move around the directory tree and to select files. + +If you want all the files to automatically be marked when the directory +tree is built, enter the command {\bf restore all}. Instead of choosing item 5 on the first menu (Select the most recent backup for a client), if we had chosen item 3 (Enter list of JobIds to select) and we had entered the JobIds {\bf 1792,1797,1798} we would have arrived at the same -point. +point. One point to note, if you are manually entering JobIds, is that you must enter them in the order they were run (generally in increasing JobId order). If you @@ -203,35 +279,38 @@ enter them out of order and the same file was saved in two or more of the Jobs, you may end up with an old version of that file (i.e. not the most recent). +Directly entering the JobIds can also permit you to recover data from +a Job that wrote files to tape but that terminated with an error status. + While in file selection mode, you can enter {\bf help} or a question mark (?) to produce a summary of the available commands: \footnotesize \begin{verbatim} - Command Description + Command Description ======= =========== cd change current directory count count marked files in and below the cd - dir list current directory + dir long list current directory, wildcards allowed done leave file selection mode estimate estimate restore size - exit exit = done - find find files -- wildcards allowed + exit same as done command + find find files, wildcards allowed help print help - ls list current directory -- wildcards allowed + ls list current directory, wildcards allowed lsmark list the marked files in and below the cd - mark mark file to be restored - markdir mark directory entry to be restored -- nonrecursive + mark mark dir/file to be restored recursively in dirs + markdir mark directory name to be restored (no files) pwd print current working directory - unmark unmark file to be restored - unmarkdir unmark directory -- no recursion - quit quit + unmark unmark dir/file to be restored recursively in dir + unmarkdir unmark directory name only no recursion + quit quit and do not do restore ? print help - \end{verbatim} \normalsize -As a default no files have been selected for restore. If you want to restore +As a default no files have been selected for restore (unless you +added {\bf all} to the command line. If you want to restore everything, at this point, you should enter {\bf mark *}, and then {\bf done} and {\bf Bacula} will write the bootstrap records to a file and request your approval to start a restore job. @@ -282,11 +361,13 @@ OK to run? (yes/mod/no): \normalsize Please examine each of the items very carefully to make sure that they are -correct. In particular, look at {\bf Where}, which tells you where in the -directory structure the files will be restored, and {\bf Client}, which tells -you which client will receive the files. These items will not always be -completed with the correct values depending on which of the restore options -you chose. +correct. In particular, look at {\bf Where}, which tells you where in the +directory structure the files will be restored, and {\bf Client}, which +tells you which client will receive the files. Note that by default the +Client which will receive the files is the Client that was backed up. +These items will not always be completed with the correct values depending +on which of the restore options you chose. You can change any of these +default items by entering {\bf mod} and responding to the prompts. The above assumes that you have defined a {\bf Restore} Job resource in your Director's configuration file. Normally, you will only need one Restore Job @@ -336,14 +417,17 @@ prompt list: To select the JobIds, you have the following choices: 1: List last 20 Jobs run 2: List Jobs where a given File is saved - 3: Enter list of JobIds to select + 3: Enter list of comma separated JobIds to select 4: Enter SQL list command 5: Select the most recent backup for a client 6: Select backup for a client before a specified time 7: Enter a list of files to restore 8: Enter a list of files to restore before a specified time - 9: Cancel -Select item: (1-9): 7 + 9: Find the JobIds of the most recent backup for a client + 10: Find the JobIds for a backup for a client before a specified time + 11: Enter a list of directories to restore for found JobIds + 12: Cancel +Select item: (1-12): \end{verbatim} \normalsize @@ -427,7 +511,7 @@ restore client=Rufus file=