]> git.sur5r.net Git - bacula/docs/blobdiff - docs/manual/restore.tex
Update
[bacula/docs] / docs / manual / restore.tex
index 4443d4c0ef81dc1508a15f39530d8414dcada817..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}
@@ -620,11 +633,10 @@ File daemon runs under the SYSTEM account, the directory will be created
 with SYSTEM ownership and permissions.  In this case, you may have problems
 accessing the newly restored files.
 
-To avoid this problem, you should create any alternate directory before doing
-the
-restore. Bacula will not change the ownership and permissions of the directory
-if it is already created as long as it is not one of the directories being
-restored (i.e. written to tape). 
+To avoid this problem, you should create any alternate directory before
+doing the restore.  Bacula will not change the ownership and permissions of
+the directory if it is already created as long as it is not one of the
+directories being restored (i.e.  written to tape).
 
 The default restore location is {\bf /tmp/bacula-restores/} and if you are
 restoring from drive {\bf E:}, the default will be 
@@ -704,23 +716,57 @@ 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 occur if
-   you have a fixed block size set  for your drive. The VolFile commands also
-   cause repositioning,  but this will work regardless of the block size. 
+   before starting the restore job and remove all the VolBlock statements.
+   These are what causes Bacula to reposition the tape, and where problems
+   occur if you have a fixed block size set for your drive.  The VolFile
+   commands also cause repositioning, but this will work regardless of the
+   block size.
 \item Use bextract to extract the files you want -- it reads the  Volume
-   sequentially if you use the include list feature, or  if you use a .bsr file,
-   but remove all the VolBlock statements  after the .bsr file is created (at
-   the
-   Run yes/mod/no) prompt but  before you start the restore. 
+   sequentially if you use the include list feature, or if you use a .bsr
+   file, but remove all the VolBlock statements after the .bsr file is
+   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 }
@@ -889,24 +935,42 @@ job.
    This command is the same as the {\bf help} command.  
 \end{description}
 
+\label{database_restore}
 \subsection*{Restoring When Things Go Wrong}
 \index[general]{Restoring When Things Go Wrong }
+\index[general]{Restoring Your Database}
+\index[general]{Database!Restoring}
 \addcontentsline{toc}{subsection}{Restoring When Things Go Wrong}
 
 This and the following sections will try to present a few of the kinds of
 problems that can come up making restoring more difficult. I'll try to
 provide a few ideas how to get out of these problem situations.
+In addition to what is presented here, there is more specific information
+on restoring a \ilink{Client}{restore_client} and your
+\ilink{Server}{restore_server} in the \ilink{Disaster Recovery Using
+Bacula}{_ChapterRescue} chapter of this manual.
 
 \begin{description}
+\item[Problem]
+   My database is broken.
+\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
@@ -945,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
@@ -992,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"
@@ -1004,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
@@ -1014,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"
@@ -1025,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 
@@ -1091,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}