%%
%%

\section*{The Bacula Console Restore Command}
\label{_ChapterStart13}
\index[general]{Command!Bacula Console Restore }
\index[general]{Bacula Console Restore Command }
\addcontentsline{toc}{section}{Bacula Console Restore Command}

\subsection*{General}
\index[general]{General }
\addcontentsline{toc}{subsection}{General}

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 
\ilink{Bacula Utility Programs}{bextract} chapter of this manual.
You will also want to look at the {\bf bls} program in the same chapter, which
allows you to list the contents of your Volumes. Finally, if you have an old
Volume that is no longer in the catalog, you can restore the catalog entries
using the program named {\bf bscan}, documented in the same 
\ilink{Bacula Utility Programs}{bextract} chapter. 

In general, to restore a file or a set of files, you must run a {\bf restore}
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. 

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
correct Client and the correct hard disk location for restoring those files.
{\bf Bacula} will quite willingly backup client A, and restore it by sending
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}

\subsection*{The Restore Command}
\index[general]{Command!Restore }
\index[general]{Restore Command }
\addcontentsline{toc}{subsection}{Restore Command}

Since Bacula maintains a catalog of your files and on which Volumes (disk or
tape), they are stored, it can do most of the bookkeeping work, allowing you
simply to specify what kind of restore you want (current, before a particular
date), and what files to restore. Bacula will then do the rest. 

This is accomplished using the {\bf restore} command in the Console. First you
select the kind of restore you want, then the JobIds are selected,
the File records for those Jobs are placed in an internal Bacula directory
tree, and the restore enters a file selection mode that allows you to
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. 

Within the Console program, after entering the {\bf restore} command, you are
presented with the following selection prompt:  

\footnotesize
\begin{verbatim}
First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
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
     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):
     
\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 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. 
\item Item 3 allows you the enter a list of comma separated JobIds whose 
   files will be put into the directory tree. 
\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.  
\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.  
\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.  
\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.  
\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}

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
the Clients found in the database as follows:  

\footnotesize
\begin{verbatim}
Defined clients:
     1: Rufus
     2: Matou
     3: Polymatou
     4: Minimatou
     5: Minou
     6: MatouVerify
     7: PmatouVerify
     8: RufusVerify
     9: Watchdog
Select Client (File daemon) resource (1-9):
     
\end{verbatim}
\normalsize

You will probably have far fewer Clients than this example, and  if you have
only one Client, it will be automatically selected. In this case, I enter
{\bf Rufus} to select the Client. Then  Bacula needs to know what FileSet is
to be restored, so it  prompts with:  

\footnotesize
\begin{verbatim}
The defined FileSet resources are:
     1: Full Set
     2: Kerns Files
Select FileSet resource (1-2):
     
\end{verbatim}
\normalsize

I choose item 1, which is my full backup. Normally, you will only have a
single FileSet for each Job, and if your machines are similar (all Linux) you
may only have one FileSet for all your Clients. 

At this point, {\bf Bacula} has all the information it needs to find the most
recent set of backups. It will then query the database, which may take a bit
of time, and it will come up with something like the following. Note, some of
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 |
+-------+------+----------+-------------+-------------+------+-------+------------+
You have selected the following JobId: 1792,1792,1797
Building directory tree for JobId 1792 ...
Building directory tree for JobId 1797 ...
Building directory tree for JobId 1798 ...
cwd is: /
$
\end{verbatim}
\normalsize

Depending on the number of {\bf JobFiles} for each JobId, the {\bf Building
directory tree ...``} can take a bit of time. 

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
that Job wrote on two different Volumes. The third Job was an incremental
backup to the previous Full backup, and it only saved 254 Files compared to
128,374 for the Full backup. The fourth Job was also an incremental backup
that saved 15 files. 

Next Bacula entered those Jobs into the directory tree, with no files marked
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. 

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. 

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
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). 

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
  =======    ===========
  cd         change current directory
  count      count marked files in and below the cd
  dir        list current directory
  done       leave file selection mode
  estimate   estimate restore size
  exit       exit = done
  find       find files -- wildcards allowed
  help       print help
  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
  pwd        print current working directory
  unmark     unmark file to be restored
  unmarkdir  unmark directory -- no recursion
  quit       quit
  ?          print help
     
\end{verbatim}
\normalsize

As a default no files have been selected for restore. 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. 

If you do not enter the above mentioned {\bf mark *} command, you will start
with an empty slate. Now you can simply start looking at the tree and {\bf
mark} particular files or directories you want restored. It is easy to make
a mistake in specifying a file to mark or unmark, and Bacula's error handling
is not perfect, so please check your work by using the {\bf ls} or {\bf dir}
commands to see what files are actually selected. Any selected file has its
name preceded by an asterisk. 

To check what is marked or not marked, enter the {\bf count} command, which
displays:  

\footnotesize
\begin{verbatim}
128401 total files. 128401 marked to be restored.
     
\end{verbatim}
\normalsize

Each of the above commands will be described in more detail in the next
section. We continue with the above example, having accepted to restore all
files as Bacula set by default. On entering the {\bf done} command, Bacula
prints:  

\footnotesize
\begin{verbatim}
Bootstrap records written to /home/kern/bacula/working/restore.bsr
The restore job will require the following Volumes:
   
   DLT-19Jul02
   DLT-04Aug02
128401 files selected to restore.
Run Restore job
JobName:    kernsrestore
Bootstrap:  /home/kern/bacula/working/restore.bsr
Where:      /tmp/bacula-restores
Replace:    always
FileSet:    Kerns Files
Client:     Rufus
Storage:    SDT-10000
JobId:      *None*
OK to run? (yes/mod/no):
    
\end{verbatim}
\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. 

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
resource definition because by its nature, restoring is a manual operation,
and using the Console interface, you will be able to modify the Restore Job to
do what you want. 

An example Restore Job resource definition is given below. 

Returning to the above example, you should verify that the Client name is
correct before running the Job. However, you may want to modify some of the
parameters of the restore job. For example, in addition to checking the Client
it is wise to check that the Storage device chosen by Bacula is indeed
correct. Although the {\bf FileSet} is shown, it will be ignored in restore.
The restore will choose the files to be restored either by reading the {\bf
Bootstrap} file, or if not specified, it will restore all files associated
with the specified backup {\bf JobId} (i.e. the JobId of the Job that
originally backed up the files). 

Finally before running the job, please note that the default location for
restoring files is {\bf not} their original locations, but rather the directory
{\bf /tmp/bacula-restores}. You can change this default by modifying your {\bf
bacula-dir.conf} file, or you can modify it using the {\bf mod} option. If you
want to restore the files to their original location, you must have {\bf
Where} set to nothing or to the root, i.e. {\bf /}. 

If you now enter {\bf yes}, Bacula will run the restore Job. The Storage
daemon will first request Volume {\bf DLT-19Jul02} and after the appropriate
files have been restored from that volume, it will request Volume {\bf
DLT-04Aug02}. 

\subsection*{Selecting Files by Filename}
\index[general]{Selecting Files by Filename }
\index[general]{Filename!Selecting Files by }
\addcontentsline{toc}{subsection}{Selecting Files by Filename}

If you have a small number of files to restore, and you know the filenames,
you can either put the list of filenames in a file to be read by Bacula, or
you can enter the names one at a time. The filenames must include the full
path and filename. No wild cards are used. 

To enter the files, after the {\bf restore}, you select item number 7 from the
prompt list: 

\footnotesize
\begin{verbatim}
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
     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
\end{verbatim}
\normalsize

which then prompts you for the client name: 

\footnotesize
\begin{verbatim}
Defined Clients:
     1: Timmy
     2: Tibs
     3: Rufus
Select the Client (1-3): 3
\end{verbatim}
\normalsize

Of course, your client list will be different, and if you have only one
client, it will be automatically selected. And finally, Bacula requests you to
enter a filename: 

\footnotesize
\begin{verbatim}
Enter filename:
\end{verbatim}
\normalsize

At this point, you can enter the full path and filename 

\footnotesize
\begin{verbatim}
Enter filename: /home/kern/bacula/k/Makefile.in
Enter filename:
\end{verbatim}
\normalsize

as you can see, it took the filename. If Bacula cannot find a copy of the
file, it prints the following: 

\footnotesize
\begin{verbatim}
Enter filename: junk filename
No database record found for: junk filename
Enter filename:
\end{verbatim}
\normalsize

If you want Bacula to read the filenames from a file, you simply precede the
filename with a less-than symbol (\lt{}). When you have entered all the
filenames, you enter a blank line, and Bacula will write the bootstrap file,
tells you what tapes will be used, and proposes a Restore job to be run: 

\footnotesize
\begin{verbatim}
Enter filename:
Automatically selected Storage: DDS-4
Bootstrap records written to /home/kern/bacula/working/restore.bsr
The restore job will require the following Volumes:
   
   test1
1 file selected to restore.
Run Restore job
JobName:    kernsrestore
Bootstrap:  /home/kern/bacula/working/restore.bsr
Where:      /tmp/bacula-restores
Replace:    always
FileSet:    Kerns Files
Client:     Rufus
Storage:    DDS-4
When:       2003-09-11 10:20:53
Priority:   10
OK to run? (yes/mod/no):
\end{verbatim}
\normalsize

It is possible to automate the selection by file by putting your list of files
in say {\bf /tmp/file-list}, then using the following command: 

\footnotesize
\begin{verbatim}
restore client=Rufus file=</tmp/file-list
\end{verbatim}
\normalsize

If in modifying the parameters for the Run Restore job, you find that Bacula
asks you to enter a Job number, this is because you have no yet specified
either a Job number or a Bootstrap file. Simply entering zero will allow you
to continue and to select another option to be modified. 
\label{CommandArguments}

\subsection*{Command Line Arguments}
\index[general]{Arguments!Command Line }
\index[general]{Command Line Arguments }
\addcontentsline{toc}{subsection}{Command Line Arguments}

If all the above sounds complicated, you will probably agree that it really
isn't after trying it a few times. It is possible to do everything that was
shown above, with the exception of selecting the FileSet, by using command
line arguments with a single command by entering: 

\footnotesize
\begin{verbatim}
restore client=Rufus select current all done yes
\end{verbatim}
\normalsize

The {\bf client=Rufus} specification will automatically select Rufus as the
client, the {\bf current} tells Bacula that you want to restore the system to
the most current state possible, and the {\bf yes} suppresses the final {\bf
yes/mod/no} prompt and simply runs the restore. 

The full list of possible command line arguments are: 

\begin{itemize}
\item {\bf all} -- select all Files to be restored.  
\item {\bf select} -- use the tree selection method.  
\item {\bf done} -- do not prompt the user in tree mode.  
\item {\bf current} -- automatically select the most current set of  backups
   for the specified client.  
\item {\bf client=xxxx} -- select the specified client.  
\item {\bf jobid=nnn} -- specify a JobId or comma separated list of  JobIds to
   be restored.  
\item {\bf before=YYYY-MM-DD HH:MM:SS} -- specify a date and time to  which
   the system should be restored. Only Jobs started before  the specified
   date/time will be selected, and as is the case  for {\bf current} Bacula will
automatically find the most  recent prior Full save and all Differential and
Incremental  saves run before the date you specify. Note, this command is  not
too user friendly in that you must specify the date/time  exactly as shown. 
\item {\bf file=filename} -- specify a filename to be restored. You  must
   specify the full path and filename. Prefixing the entry  with a less-than sign
   (\lt{}) will cause Bacula to assume that the  filename is on your system and
contains a list of files to be  restored. Bacula will thus read the list from
that file. Multiple  file=xxx specifications may be specified on the command
line. 
\item {\bf jobid=nnn} -- specify a JobId to be restored. 
\item {\bf pool=pool-name} -- specify a Pool name to be used for selection  of
   Volumes when specifying options 5 and 6 (restore current system,  and restore
   current system before given date). This permits you to  have several Pools,
possibly one offsite, and to select the Pool to  be used for restoring.  
\item {\bf yes} -- automatically run the restore without prompting  for
   modifications (most useful in batch scripts). 
   \end{itemize}

\subsection*{Restoring Directory Attributes}
\index[general]{Attributes!Restoring Directory }
\index[general]{Restoring Directory Attributes }
\addcontentsline{toc}{subsection}{Restoring Directory Attributes}

Depending how you do the restore, you may or may not get the directory entries
back to their original state. Here are a few of the problems you can
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. 
\end{itemize}

\label{Windows}

\subsection*{Restoring on Windows}
\index[general]{Restoring on Windows }
\index[general]{Windows!Restoring on }
\addcontentsline{toc}{subsection}{Restoring on Windows}

If you are restoring on WinNT/2K/XP systems, Bacula will restore the files
with the original ownerships and permissions as would be expected.  This is
also true if you are restoring those files to an alternate directory (using
the Where option in restore).  However, if the alternate directory does not
already exist, the Bacula File daemon (Client) will try to create it.  In
some cases, it may not create the directories, and if it does since the
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). 

The default restore location is {\bf /tmp/bacula-restores/} and if you are
restoring from drive {\bf E:}, the default will be 
{\bf /tmp/bacula-restores/e/}, so you should ensure that this directory
exists before doing the restore, or use the {\bf mod} option to
select a different {\bf where} directory that does exist.

Some users have experienced problems restoring files that participate in
the Active Directory. They also report that changing the userid under which
Bacula (bacula-fd.exe) runs, from SYSTEM to a Domain Admin userid, resolves
the problem.


\subsection*{Restoring Files Can Be Slow}
\index[general]{Slow!Restoring Files Can Be }
\index[general]{Restoring Files Can Be Slow }
\addcontentsline{toc}{subsection}{Restoring Files Can Be Slow}

Restoring files is generally {\bf much} slower than backing it up for several
reasons. The first is that during a backup the tape is normally already
positioned and Bacula only needs to write. On the other hand, because restoring
files is done so rarely, Bacula keeps only the he start file and block on the
tape for the whole job rather than on a file by file basis which would use
quite a lot of space in the catalog. 

Bacula versions 1.31a and older would seek to the first file on the first
tape, then sequentially search the tape for the specified files. If you were
doing a full restore, this is OK, but if you want to restore one or two files,
the process could be quite long. 

This deficiency has been corrected in version 1.32. The consequence is that
Bacula will forward space to the correct file mark on the tape for the Job,
then forward space to the correct block, and finally sequentially read each
record until it gets to the correct one(s) for the file or files you want to
restore. Once the desired files are restored, Bacula will stop reading the
tape. For restoring a small number of files, version 1.32 and greater are
hundreds of times faster than previous versions. 

Finally, instead of just reading a file for backup, during the restore, Bacula
must create the file, and the operating system must allocate disk space for
the file as Bacula is restoring it. 

For all the above reasons the restore process is generally much slower than
backing up. 

\subsection*{Problems Restoring Files}
\index[general]{Files!Problems Restoring }
\index[general]{Problems Restoring Files }
\addcontentsline{toc}{subsection}{Problems Restoring Files}

The most frequent problems users have restoring files are error messages such
as: 

\footnotesize
\begin{verbatim}
04-Jan 00:33 z217-sd: RestoreFiles.2005-01-04_00.31.04 Error:
block.c:868 Volume data error at 20:0! Short block of 512 bytes on
device /dev/tape discarded.
\end{verbatim}
\normalsize

or 

\footnotesize
\begin{verbatim}
04-Jan 00:33 z217-sd: RestoreFiles.2005-01-04_00.31.04 Error:
block.c:264 Volume data error at 20:0! Wanted ID: "BB02", got ".".
Buffer discarded.
\end{verbatim}
\normalsize

Both these kinds of messages indicate that you were probably running your tape
drive in fixed block mode rather than variable block mode. Fixed block mode
will work with any program that reads tapes sequentially such as tar, but
Bacula repositions the tape on a block basis when restoring files because this
will speed up the restore by orders of magnitude when only a few files are being
restored. There are several ways that you can attempt to recover from this
unfortunate situation. 

Try the following things, each separately, and reset your Device resource to
what it is now after each individual test: 

\begin{enumerate}
\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. 
\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. 
\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. 
\end{enumerate}

\subsection*{Example Restore Job Resource}
\index[general]{Example Restore Job Resource }
\index[general]{Resource!Example Restore Job }
\addcontentsline{toc}{subsection}{Example Restore Job Resource}

\footnotesize
\begin{verbatim}
Job {
  Name = "RestoreFiles"
  Type = Restore
  Client = Any-client
  FileSet = "Any-FileSet"
  Storage = Any-storage
  Where = /tmp/bacula-restores
  Messages = Standard
  Pool = Default
}
\end{verbatim}
\normalsize

If {\bf Where} is not specified, the default location for restoring files will
be their original locations. 
\label{Selection}

\subsection*{File Selection Commands}
\index[general]{Commands!File Selection }
\index[general]{File Selection Commands }
\addcontentsline{toc}{subsection}{File Selection Commands}

After you have selected the Jobs to be restored and Bacula has created the
in-memory directory tree, you will enter file selection mode as indicated by
the dollar sign ({\bf \$}) prompt. While in this mode, you may use the
commands listed above. The basic idea is to move up and down the in memory
directory structure with the {\bf cd} command much as you normally do on the
system. Once you are in a directory, you may select the files that you want
restored. As a default no files are marked to be restored. If you wish to
start with all files, simply enter: {\bf cd /} and {\bf mark *}. Otherwise
proceed to select the files you wish to restore by marking them with the {\bf
mark} command. The available commands are: 

\begin{description}

\item [cd]
   The {\bf cd} command changes the current directory to  the argument specified.
   It operates much like the Unix {\bf cd} command.  Wildcard specifications are
not permitted.  

Note, on Windows systems, the various drives (c:, d:, ...) are treated  like a
directory within the file tree while in the file  selection mode. As a
consequence, you must do a {\bf cd c:} or  possibly in some cases a {\bf cd
C:} (note upper case)  to get down to the first directory.  

\item [dir]
   \index[dir]{dir }
   The {\bf dir} command is similar to the {\bf ls} command,  except that it
prints it in long format (all details). This command  can be a bit slower than
the {\bf ls} command because it must access  the catalog database for the
detailed information for each file.  

\item [estimate]
   \index[dir]{estimate }
   The {\bf estimate} command prints a summary of  the total files in the tree,
how many are marked to be restored, and  an estimate of the number of bytes to
be restored. This can be useful  if you are short on disk space on the machine
where the files will be  restored.  

\item [find]
   \index[dir]{find }
   The {\bf find} command accepts one or more arguments  and displays all files
in the tree that match that argument. The argument  may have wildcards. It is
somewhat similar to the Unix command  {\bf find / -name arg}.  

\item [ls]
   The {\bf ls} command produces a listing of all the files  contained in the
   current directory much like the Unix {\bf ls} command.  You may specify an
argument containing wildcards, in which case only  those files will be listed.
Any file that is marked to be restored will  have its name preceded by an
asterisk ({\bf *}). Directory names  will be terminated with a forward slash
({\bf /}) to distinguish them  from filenames.  

\item [lsmark]
   \index[fd]{lsmark }
   The {\bf lsmark} command is the same as the  {\bf ls} except that it will
print only those files marked for  extraction. The other distinction is that
it will recursively  descend into any directory selected. 

\item [mark]
   \index[dir]{mark }
   The {\bf mark} command allows you to mark files  to be restored. It takes a
single argument which is the filename  or directory name in the current
directory to be marked for extraction.  The argument may be a wildcard
specification, in which  case all files that match in the current directory
are marked to be  restored. If the argument matches a directory rather than a
file,  then the directory and all the files contained in that directory
(recursively)  are marked to be restored. Any marked file will have its name 
preceded with an asterisk ({\bf *}) in the output produced by the  {\bf ls} or
{\bf dir} commands. Note, supplying a full path on  the mark command does not
work as expected to select a file or  directory in the current directory.
Also, the {\bf mark} command works  on the current and lower directories but
does not touch higher level  directories.  

After executing the {\bf mark} command, it will print a brief summary:  

\footnotesize
\begin{verbatim}
    No files marked.
    
\end{verbatim}
\normalsize

If no files were marked, or:  

\footnotesize
\begin{verbatim}
    nn files marked.
    
\end{verbatim}
\normalsize

if some files are marked.  

\item [unmark]
   \index[dir]{unmark }
   The {\bf unmark} is identical to the {\bf mark}  command, except that it
unmarks the specified file or files so that  they will not be restored. Note:
the {\bf unmark} command works from  the current directory, so it does not
unmark any files at a higher  level. First do a {\bf cd /} before the {\bf
unmark *} command if  you want to unmark everything.  

\item [pwd]
   \index[dir]{pwd }
   The {\bf pwd} command prints the current working  directory. It accepts no
arguments.  

\item [count]
   \index[dir]{count }
   The {\bf count} command prints the total files in the  directory tree and the
number of files marked to be restored.  

\item [done]
   \index[dir]{done }
   This command terminates file selection mode.  

\item [exit]
   \index[fd]{exit }
   This command terminates file selection mode (the same as  done).  

\item [quit]
   \index[fd]{quit }
   This command terminates the file selection and does  not run the restore job. 


\item [help]
   \index[fd]{help }
   This command prints a summary of the commands available.  

\item [?]
   This command is the same as the {\bf help} command.  
   \end{description}
