]> git.sur5r.net Git - bacula/docs/blobdiff - docs/manual/restore.tex
Update
[bacula/docs] / docs / manual / restore.tex
index c0516323c519927a93dd2de76226586dbf5adf03..4085e7748516a7c34545b1bd521a20bd9ca8fbb2 100644 (file)
@@ -582,25 +582,38 @@ encounter, and for same machine restores, how to avoid them.
 \begin{itemize}
 \item You backed up on one machine and are restoring to another that is 
    either a different OS or doesn't have the same users/groups defined.  Bacula
-   does the best it can in these situations.  
-\item You are restoring into a directory that is already created and has  file
-   creation restrictions. Bacula tries to reset everything  but without walking
-   up the full chain of directories and modifying  them all during the restore,
-   which Bacula does and will not do,  getting permissions back correctly in
-this
-   situation depends to a  large extent on your OS.  
-\item You selected one or more files in a directory, but did not select  the
-   directory entry to be restored. In that case, if the directory  is not on
-disk
-   Bacula simply creates the directory with some default  attributes which may
-   not be the same as the original.  If you do not select a directory and all
-its
-   contents to be restored,  you can still select items within the directory to
-   be restored by  individually marking those files, but in that case, you
-should
-   individually use the "markdir" command to select all higher level 
-   directory entries (one at a time) to be restored if you want the  directory
-   entries properly restored. 
+   does the best it can in these situations. Note, Bacula has saved the
+   user/groups in numeric form, which means on a different machine, they
+   may map to different user/group names.
+\item You are restoring into a directory that is already created and has
+   file creation restrictions.  Bacula tries to reset everything but
+   without walking up the full chain of directories and modifying them all
+   during the restore, which Bacula does and will not do, getting
+   permissions back correctly in this situation depends to a large extent
+   on your OS.
+\item You are doing a recursive restore of a directory tree.  In this case
+   Bacula will restore a file before restoring the file's parent directory
+   entry.  In the process of restoring the file Bacula will create the
+   parent directory with open permissions and ownership of the file being
+   restored.  Then when Bacula tries to restore the parent directory Bacula
+   sees that it already exists (Similar to the previous situation).  If you
+   had set the Restore job's "Replace" property to "never" then Bacula will
+   not change the directory's permissions and ownerships to match what it
+   backed up, you should also notice that the actual number of files
+   restored is less then the expected number.  If you had set the Restore
+   job's "Replace" property to "always" then Bacula will change the
+   Directory's ownership and permissions to match what it backed up, also
+   the actual number of files restored should be equal to the expected
+   number.
+\item You selected one or more files in a directory, but did not select the
+   directory entry to be restored.  In that case, if the directory is not
+   on disk Bacula simply creates the directory with some default attributes
+   which may not be the same as the original.  If you do not select a
+   directory and all its contents to be restored, you can still select
+   items within the directory to be restored by individually marking those
+   files, but in that case, you should individually use the "markdir"
+   command to select all higher level directory entries (one at a time) to
+   be restored if you want the directory entries properly restored.
 \end{itemize}
 
 \label{Windows}
@@ -703,9 +716,8 @@ what it is now after each individual test:
 \item Set "Block Positioning = no" in your Device resource  and try the
    restore. This is a new directive and untested. 
 \item Set "Minimum Block Size = 512" and "Maximum  Block Size = 512" and
-   try the restore.  Again send me the full job report output.  If you are
-   able to determine the block size your drive was previously using, you
-   should try that size if 512 does not work.
+   try the restore.  If you are able to determine the block size your drive
+   was previously using, you should try that size if 512 does not work.
 \item Try editing the restore.bsr file at the Run xxx yes/mod/no prompt 
    before starting the restore job and remove all the VolBlock statements.
    These are what causes Bacula to reposition the tape, and where problems
@@ -718,6 +730,43 @@ what it is now after each individual test:
    created (at the Run yes/mod/no) prompt but before you start the restore.
 \end{enumerate}
 
+\subsection*{Restore Errors}
+\index[general]{Errors!Restore}
+\index[general]{Restore Errors}
+\addcontentsline{toc}{subsection}{Restore Errors}
+
+There are a number of reasons why there may be restore errors or
+warning messages. Some of the more common ones are:
+
+\begin{description}
+
+\item [file count mismatch]
+  This can occur for the following reasons:
+  \begin{itemize}
+  \item You requested Bacula not to overwrite existing or newer
+     files.
+  \item A Bacula miscount of files/directories. This is an
+     on-going problem due to the complications of directories,
+     soft/hard link, and such.  Simply check that all the files you
+     wanted were actually restored.
+  \end{itemize}
+\item [file size error]
+   When Bacula restores files, it checks that the size of the
+   restored file is the same as the file status data it saved 
+   when starting the backup of the file. If the sizes do not
+   agree, Bacula will print an error message. This size mismatch
+   most often occurs because the file was being written as Bacula
+   backed up the file. In this case, the size that Bacula
+   restored will be greater than the status size.  This often
+   happens with log files.
+
+   If the restored size is smaller, then you should be concerned
+   about a possible tape error and check the Bacula output as
+   well as your system logs.
+\end{description}
+
+
+
 \subsection*{Example Restore Job Resource}
 \index[general]{Example Restore Job Resource }
 \index[general]{Resource!Example Restore Job }
@@ -907,13 +956,21 @@ Bacula}{_ChapterRescue} chapter of this manual.
 \item[Solution]
    For SQLite, use the vacuum command to try to fix the database. For either
    MySQL or PostgreSQL, see the vendor's documentation. They have specific tools
-   that check and repair databases.
+   that check and repair databases, see the \ilink{database
+   repair}{DatabaseRepair} sections of this manual for links to vendor    
+   information.
 
    Assuming the above does not resolve the problem, you will need to restore
-   or rebuild your catalog.
+   or rebuild your catalog.  Note, if it is a matter of some
+   inconsistencies in the Bacula tables rather than a broken database, then
+   running \ilink{dbcheck}{dbcheck} might help, but you will need to ensure
+   that your database indexes are properly setup.  Please see
+   the \ilink{Database Performance Issues}{DatabasePerformance} sections
+   of this manual for more details.
+
 \item[Problem]
    How do I restore my catalog?
-\item[Solution]
+\item[Solution with a Catalog backup]
    If you have backed up your database nightly (as you should) and you
    have made a bootstrap file, you can immediately load back your
    database (or the ASCII SQL output).  Make a copy of your current
@@ -952,11 +1009,21 @@ OK to run? (yes/mod/no):
    Client, Storage, Catalog, and Where are correct.  The FileSet is not
    used when you specify a bootstrap file.  Once you have set all the
    correct values, run the Job and it will restore the backup of your
-   database.  You will then need to follow the instructions for your
+   database, which is most likely an ASCII dump. 
+
+   You will then need to follow the instructions for your
    database type to recreate the database from the ASCII backup file.
+   See the \ilink {Catalog Maintenance}{_ChapterStart12} chapter of
+   this manual for examples of the command needed to restore a 
+   database from an ASCII dump (they are shown in the Compacting Your
+   XXX Database sections).
+    
+   Also, please note that after you restore your database from an ASCII
+   backup, you do NOT want to do a {\bf make_bacula_tables}  command, or
+   you will probably erase your newly restored database tables.
 
       
-\item[Solution]
+\item[Solution with a Job listing]
    If you did save your database but did not make a bootstrap file, then
    recovering the database is more difficult.  You will probably need to
    use bextract to extract the backup copy.  First you should locate the
@@ -999,10 +1066,12 @@ Job=CatalogBackup.2005-04-22_01.10.0
 
 \end{verbatim}
 \normalsize
+
   From the above information, you can manually create a bootstrap file,
   and then follow the instructions given above for restoring your database.
   A reconstructed bootstrap file for the above backup Job would look
   like the following:
+
 \footnotesize
 \begin{verbatim}
 Volume="DLT-22Apr05"
@@ -1011,6 +1080,7 @@ VolSessionTime=1114075126
 FileIndex=1-1
 \end{verbatim}
 \normalsize    
+
   Where we have inserted the Volume name, Volume Session Id, and Volume
   Session Time that correspond to the values in the job report.  We've also
   used a FileIndex of one, which will always be the case providing that
@@ -1021,6 +1091,7 @@ FileIndex=1-1
   specified, so the restore code must search all data in the Volume to find
   the requested file.  A fully specified bootstrap file would have the File
   and Blocks specified as follows:
+
 \footnotesize
 \begin{verbatim}
 Volume="DLT-22Apr05"
@@ -1032,6 +1103,29 @@ FileIndex=1-1
 \end{verbatim}
 \normalsize
 
+   Once you have restored the ASCII dump of the database,
+   you will then to follow the instructions for your
+   database type to recreate the database from the ASCII backup file.
+   See the \ilink {Catalog Maintenance}{_ChapterStart12} chapter of
+   this manual for examples of the command needed to restore a 
+   database from an ASCII dump (they are shown in the Compacting Your
+   XXX Database sections).
+    
+   Also, please note that after you restore your database from an ASCII
+   backup, you do NOT want to do a {\bf make_bacula_tables}  command, or
+   you will probably erase your newly restored database tables.
+
+\item [Solution withou a Job Listing]
+   If you do not have a job listing, then it is a bit more difficult.
+   Either you use the \ilink{bscan}{bscan} program to scan the contents
+   of your tape into a database, which can be very time consuming 
+   depending on the size of the tape, or you can use the \ilink{bls}{bls}
+   program to list everything on the tape, and reconstruct a bootstrap 
+   file from the bls listing for the file or files you want following
+   the instructions given above.
+
+   There is a specific example of how to use {\bf bls} below.
+
 \item [Problem]
    I try to restore the last known good full backup by specifying
    item 3 on the restore menu then the JobId to restore.  Bacula 
@@ -1098,7 +1192,8 @@ select VolumeName from JobMedia,Media where JobId=1 and JobMedia.MediaId=Media.M
   know the Volume to which it was backed up.
   
 \item [Solution]
-  Use {\bf bls} to indicate where it is on the tape. For example:
+  Either bscan the tape, or use {\bf bls} to indicate where it is on the
+  tape.  For example:
 
 \footnotesize
 \begin{verbatim}