Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > df754e4e6f7f5fc8ab9d6ed8559f3e3d > files > 144

bacula-docs-5.0.3-19.fc16.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2008 (1.71)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>A Brief Tutorial</TITLE>
<META NAME="description" CONTENT="A Brief Tutorial">
<META NAME="keywords" CONTENT="main">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2008">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="main.css">

<LINK REL="next" HREF="Customizing_Configuration_F.html">
<LINK REL="previous" HREF="Critical_Items_Implement_Be.html">
<LINK REL="up" HREF="Bacula_Main_Reference.html">
<LINK REL="next" HREF="Customizing_Configuration_F.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1393"
  HREF="Customizing_Configuration_F.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html1387"
  HREF="Bacula_Main_Reference.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html1381"
  HREF="Critical_Items_Implement_Be.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html1389"
  HREF="Contents.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html1391"
  HREF="Thanks.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1394"
  HREF="Customizing_Configuration_F.html">Customizing the Configuration Files</A>
<B> Up:</B> <A NAME="tex2html1388"
  HREF="Bacula_Main_Reference.html">Bacula Main Reference</A>
<B> Previous:</B> <A NAME="tex2html1382"
  HREF="Critical_Items_Implement_Be.html">Critical Items to Implement</A>
 &nbsp; <B>  <A NAME="tex2html1390"
  HREF="Contents.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html1392"
  HREF="Thanks.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html1395"
  HREF="Brief_Tutorial.html#SECTION001610000000000000000">Before Running Bacula</A>
<LI><A NAME="tex2html1396"
  HREF="Brief_Tutorial.html#SECTION001620000000000000000">Starting the Database</A>
<LI><A NAME="tex2html1397"
  HREF="Brief_Tutorial.html#SECTION001630000000000000000">Starting the Daemons</A>
<LI><A NAME="tex2html1398"
  HREF="Brief_Tutorial.html#SECTION001640000000000000000">Using the Director to Query and Start Jobs</A>
<LI><A NAME="tex2html1399"
  HREF="Brief_Tutorial.html#SECTION001650000000000000000">Running a Job</A>
<LI><A NAME="tex2html1400"
  HREF="Brief_Tutorial.html#SECTION001660000000000000000">Restoring Your Files</A>
<LI><A NAME="tex2html1401"
  HREF="Brief_Tutorial.html#SECTION001670000000000000000">Quitting the Console Program</A>
<LI><A NAME="tex2html1402"
  HREF="Brief_Tutorial.html#SECTION001680000000000000000">Adding a Second Client</A>
<LI><A NAME="tex2html1403"
  HREF="Brief_Tutorial.html#SECTION001690000000000000000">When The Tape Fills</A>
<LI><A NAME="tex2html1404"
  HREF="Brief_Tutorial.html#SECTION0016100000000000000000">Other Useful Console Commands</A>
<LI><A NAME="tex2html1405"
  HREF="Brief_Tutorial.html#SECTION0016110000000000000000">Debug Daemon Output</A>
<LI><A NAME="tex2html1406"
  HREF="Brief_Tutorial.html#SECTION0016120000000000000000">Patience When Starting Daemons or Mounting Blank Tapes</A>
<LI><A NAME="tex2html1407"
  HREF="Brief_Tutorial.html#SECTION0016130000000000000000">Difficulties Connecting from the FD to the SD</A>
<LI><A NAME="tex2html1408"
  HREF="Brief_Tutorial.html#SECTION0016140000000000000000">Daemon Command Line Options</A>
<LI><A NAME="tex2html1409"
  HREF="Brief_Tutorial.html#SECTION0016150000000000000000">Creating a Pool</A>
<LI><A NAME="tex2html1410"
  HREF="Brief_Tutorial.html#SECTION0016160000000000000000">Labeling Your Volumes</A>
<LI><A NAME="tex2html1411"
  HREF="Brief_Tutorial.html#SECTION0016170000000000000000">Labeling Volumes with the Console Program</A>
</UL>
<!--End of Table of Child-Links-->
<HR>

<H1><A NAME="SECTION001600000000000000000"></A>
<A NAME="TutorialChapter"></A>
<BR>
A Brief Tutorial
</H1>
<A NAME="4878"></A>
<A NAME="4879"></A>

<P>
This chapter will guide you through running Bacula. To do so, we assume you
have installed Bacula, possibly in a single file as shown in the previous
chapter, in which case, you can run Bacula as non-root for these tests.
However, we assume that you have not changed the .conf files. If you have
modified the .conf files, please go back and uninstall Bacula, then reinstall
it, but do not make any changes. The examples in this chapter use the default
configuration files, and will write the volumes to disk in your <B>/tmp</B>
directory, in addition, the data backed up will be the source directory where
you built Bacula. As a consequence, you can run all the Bacula daemons for
these tests as non-root. Please note, in production, your File daemon(s) must
run as root. See the Security chapter for more information on this subject. 

<P>
The general flow of running Bacula is: 

<P>

<OL>
<LI>cd install-directory  
</LI>
<LI>Start the Database (if using MySQL or PostgreSQL)  
</LI>
<LI>Start the Daemons with <B>./bacula start</B>  
</LI>
<LI>Start the Console program to interact with the Director  
</LI>
<LI>Run a job  
</LI>
<LI>When the Volume fills, unmount the Volume, if it is a  tape, label a new
   one, and continue running. In this  chapter, we will write only to disk files
   so you won't  need to worry about tapes for the moment. 
</LI>
<LI>Test recovering some files from the Volume just written to  ensure the
   backup is good and that you know how to recover.  Better test before disaster
   strikes  
</LI>
<LI>Add a second client. 
   
</LI>
</OL>

<P>
Each of these steps is described in more detail below. 

<P>

<H1><A NAME="SECTION001610000000000000000">
Before Running Bacula</A>
</H1>
<A NAME="4887"></A>
<A NAME="4888"></A>

<P>
Before running Bacula for the first time in production, we recommend that you
run the <B>test</B> command in the <B>btape</B> program as described in the 
Utility Program Chapterbtape of this manual. This will
help ensure that Bacula functions correctly with your tape drive. If you have
a modern HP, Sony, or Quantum DDS or DLT tape drive running on Linux or
Solaris, you can probably skip this test as Bacula is well tested with these
drives and systems. For all other cases, you are <B>strongly</B> encouraged to
run the test before continuing. <B>btape</B> also has a <B>fill</B> command that
attempts to duplicate what Bacula does when filling a tape and writing on the
next tape. You should consider trying this command as well, but be forewarned,
it can take hours (about four hours on my drive) to fill a large capacity tape. 

<P>

<H1><A NAME="SECTION001620000000000000000"></A>
<A NAME="StartDB"></A>
<BR>
Starting the Database
</H1>
<A NAME="4898"></A>
<A NAME="4899"></A>

<P>
If you are using MySQL or PostgreSQL as the Bacula database, you should start
it before you attempt to run a job to avoid getting error messages from Bacula
when it starts. The scripts <B>startmysql</B> and <B>stopmysql</B> are what I
(Kern) use to start and stop my local MySQL. Note, if you are using SQLite,
you will not want to use <B>startmysql</B> or <B>stopmysql</B>. If you are
running this in production, you will probably want to find some way to
automatically start MySQL or PostgreSQL after each system reboot. 

<P>
If you are using SQLite (i.e. you specified the <B><code>--</code>with-sqlite=xxx</B> option
on the <B>./configure</B> command, you need do nothing. SQLite is automatically
started by <B>Bacula</B>. 

<P>

<H1><A NAME="SECTION001630000000000000000"></A>
<A NAME="StartDaemon"></A>
<BR>
Starting the Daemons
</H1>
<A NAME="4909"></A>
<A NAME="4910"></A>

<P>
Assuming you have built from source or have installed the rpms,
to start the three daemons, from your installation directory, simply enter: 

<P>
./bacula start 

<P>
The <B>bacula</B> script starts the Storage daemon, the File daemon, and the
Director daemon, which all normally run as daemons in the background. If you
are using the autostart feature of Bacula, your daemons will either be
automatically started on reboot, or you can control them individually with the
files <B>bacula-dir</B>, <B>bacula-fd</B>, and <B>bacula-sd</B>, which are
usually located in <B>/etc/init.d</B>, though the actual location is system
dependent. 
Some distributions may do this differently.

<P>
Note, on Windows, currently only the File daemon is ported, and it must be
started differently. Please see the 
Windows Version of BaculaWin32Chapter Chapter of this
manual. 

<P>
The rpm packages configure the daemons to run as user=root and group=bacula.
The rpm installation also creates the group bacula if it does not exist on the
system. Any users that you add to the group bacula will have access to files
created by the daemons. To disable or alter this behavior edit the daemon
startup scripts: 

<P>

<UL>
<LI>/etc/bacula/bacula 
</LI>
<LI>/etc/init.d/bacula-dir 
</LI>
<LI>/etc/init.d/bacula-sd 
</LI>
<LI>/etc/init.d/bacula-fd 
   
</LI>
</UL>

<P>
and then restart as noted above. 

<P>
The 
installation chapterInstallChapter of this manual
explains how you can install scripts that will automatically restart the
daemons when the system starts. 

<P>

<H1><A NAME="SECTION001640000000000000000">
Using the Director to Query and Start Jobs</A>
</H1>
<A NAME="4923"></A>
<A NAME="4924"></A>

<P>
To communicate with the director and to query the state of Bacula or run jobs,
from the top level directory, simply enter: 

<P>
./bconsole 

<P>
Alternatively to running the command line console, if you have
Qt4 installed and used the <B><code>--</code>enable-bat</B> on the configure command,
you may use the Bacula Administration Tool (<B>bat</B>):

<P>
./bat

<P>
Which has a graphical interface, and many more features than bconsole.

<P>
Two other possibilities are to run the GNOME console 
<B>bgnome-console</B> or the wxWidgets program <B>bwx-console</B>.

<P>
For simplicity, here we will describe only the <B>./bconsole</B> program. Most
of what is described here applies equally well to <B>./bat</B>,
<B>./bgnome-console</B>, and to <B>bwx-console</B>.

<P>
The <B>./bconsole</B> runs the Bacula Console program, which connects to the
Director daemon. Since Bacula is a network program, you can run the Console
program anywhere on your network. Most frequently, however, one runs it on the
same machine as the Director. Normally, the Console program will print
something similar to the following: 

<P>
<PRE>
[kern@polymatou bin]$ ./bconsole
Connecting to Director lpmatou:9101
1000 OK: HeadMan Version: 2.1.8 (14 May 2007)
*
</PRE>
<P>
the asterisk is the console command prompt. 

<P>
Type <B>help</B> to see a list of available commands: 

<P>
<PRE>
*help
  Command    Description
  =======    ===========
  add        add media to a pool
  autodisplay autodisplay [on|off] -- console messages
  automount  automount [on|off] -- after label
  cancel     cancel [&lt;jobid=nnn&gt; | &lt;job=name&gt;] -- cancel a job
  create     create DB Pool from resource
  delete     delete [pool=&lt;pool-name&gt; | media volume=&lt;volume-name&gt;]
  disable    disable &lt;job=name&gt; -- disable a job
  enable     enable &lt;job=name&gt; -- enable a job
  estimate   performs FileSet estimate, listing gives full listing
  exit       exit = quit
  gui        gui [on|off] -- non-interactive gui mode
  help       print this command
  list       list [pools | jobs | jobtotals | media &lt;pool=pool-name&gt; |
files &lt;jobid=nn&gt;]; from catalog
  label      label a tape
  llist      full or long list like list command
  memory     print current memory usage
  messages   messages
  mount      mount &lt;storage-name&gt;
  prune      prune expired records from catalog
  purge      purge records from catalog
  python     python control commands
  quit       quit
  query      query catalog
  restore    restore files
  relabel    relabel a tape
  release    release &lt;storage-name&gt;
  reload     reload conf file
  run        run &lt;job-name&gt;
  status     status [[slots] storage | dir | client]=&lt;name&gt;
  setdebug   sets debug level
  setip      sets new client address -- if authorized
  show       show (resource records) [jobs | pools | ... | all]
  sqlquery   use SQL to query catalog
  time       print current time
  trace      turn on/off trace to file
  unmount    unmount &lt;storage-name&gt;
  umount     umount &lt;storage-name&gt; for old-time Unix guys
  update     update Volume, Pool or slots
  use        use catalog xxx
  var        does variable expansion
  version    print Director version
  wait       wait until no jobs are running [&lt;jobname=name&gt; | &lt;jobid=nnn&gt; | &lt;ujobid=complete_name&gt;]
*
</PRE>
<P>
Details of the console program's commands are explained in the 
Console Chapter_ConsoleChapter of this manual. 

<P>

<H1><A NAME="SECTION001650000000000000000"></A>
<A NAME="Running"></A>
<BR>
Running a Job
</H1>
<A NAME="4943"></A>
<A NAME="4944"></A>

<P>
At this point, we assume you have done the following: 

<P>

<UL>
<LI>Configured Bacula with <B>./configure <code>--</code>your-options</B> 
</LI>
<LI>Built Bacula using <B>make</B> 
</LI>
<LI>Installed Bacula using <B>make install</B> 
</LI>
<LI>Have created your database with, for example,  <B>   ./create_sqlite_database</B> 
</LI>
<LI>Have created the Bacula database tables with,  <B>   ./make_bacula_tables</B> 
</LI>
<LI>Have possibly edited your <B>bacula-dir.conf</B> file  to personalize it
   a bit. BE CAREFUL! if you change the  Director's name or password, you will
   need to make similar  modifications in the other .conf files. For the moment
   it is  probably better to make no changes.  
</LI>
<LI>You have started Bacula with <B>./bacula start</B>  
</LI>
<LI>You have invoked the Console program with <B>./bconsole</B> 
</LI>
</UL>

<P>
Furthermore, we assume for the moment you are using the default configuration
files. 

<P>
At this point, enter the following command: 

<P>
<PRE>
show filesets
</PRE>
<P>
and you should get something similar to: 

<P>
<PRE>
FileSet: name=Full Set
      O M
      N
      I /home/kern/bacula/regress/build
      N
      E /proc
      E /tmp
      E /.journal
      E /.fsck
      N
FileSet: name=Catalog
      O M
      N
      I /home/kern/bacula/regress/working/bacula.sql
      N
</PRE>
<P>
This is a pre-defined <B>FileSet</B> that will backup the Bacula source
directory. The actual directory names printed should correspond to your system
configuration. For testing purposes, we have chosen a directory of moderate
size (about 40 Megabytes) and complexity without being too big. The FileSet
<B>Catalog</B> is used for backing up Bacula's catalog and is not of interest
to us for the moment. The <B>I</B> entries are the files or directories that
will be included in the backup and the <B>E</B> are those that will be
excluded, and the <B>O</B> entries are the options specified for
the FileSet. You can change what is backed up by editing <B>bacula-dir.conf</B>  
and changing the <B>File =</B> line in the <B>FileSet</B> resource.

<P>
Now is the time to run your first backup job. We are going to backup your
Bacula source directory to a File Volume in your <B>/tmp</B> directory just to
show you how easy it is. Now enter: 

<P>
<PRE>
status dir
</PRE>
<P>
and you should get the following output: 

<P>
<PRE>
rufus-dir Version: 1.30 (28 April 2003)
Daemon started 28-Apr-2003 14:03, 0 Jobs run.
Console connected at 28-Apr-2003 14:03
No jobs are running.
Level          Type     Scheduled          Name
=================================================================
Incremental    Backup   29-Apr-2003 01:05  Client1
Full           Backup   29-Apr-2003 01:10  BackupCatalog
====
</PRE>
<P>
where the times and the Director's name will be different according to your
setup. This shows that an Incremental job is scheduled to run for the Job <B>Client1</B> at 1:05am and that at 1:10, a <B>BackupCatalog</B> is scheduled to
run. Note, you should probably change the name <B>Client1</B> to be the name of
your machine, if not, when you add additional clients, it will be very
confusing. For my real machine, I use <B>Rufus</B> rather than <B>Client1</B> as
in this example. 

<P>
Now enter: 

<P>
<PRE>
status client
</PRE>
<P>
and you should get something like: 

<P>
<PRE>
The defined Client resources are:
     1: rufus-fd
Item 1 selected automatically.
Connecting to Client rufus-fd at rufus:8102
rufus-fd Version: 1.30 (28 April 2003)
Daemon started 28-Apr-2003 14:03, 0 Jobs run.
Director connected at: 28-Apr-2003 14:14
No jobs running.
====
</PRE>
<P>
In this case, the client is named <B>rufus-fd</B> your name will be different,
but the line beginning with <B>rufus-fd Version ...</B> is printed by your File
daemon, so we are now sure it is up and running. 

<P>
Finally do the same for your Storage daemon with: 

<P>
<PRE>
status storage
</PRE>
<P>
and you should get: 

<P>
<PRE>
The defined Storage resources are:
     1: File
Item 1 selected automatically.
Connecting to Storage daemon File at rufus:8103
rufus-sd Version: 1.30 (28 April 2003)
Daemon started 28-Apr-2003 14:03, 0 Jobs run.
Device /tmp is not open.
No jobs running.
====
</PRE>
<P>
You will notice that the default Storage daemon device is named <B>File</B> and
that it will use device <B>/tmp</B>, which is not currently open. 

<P>
Now, let's actually run a job with: 

<P>
<PRE>
run
</PRE>
<P>
you should get the following output: 

<P>
<PRE>
Using default Catalog name=MyCatalog DB=bacula
A job name must be specified.
The defined Job resources are:
     1: Client1
     2: BackupCatalog
     3: RestoreFiles
Select Job resource (1-3):
</PRE>
<P>
Here, Bacula has listed the three different Jobs that you can run, and you
should choose number <B>1</B> and type enter, at which point you will get: 

<P>
<PRE>
Run Backup job
JobName:  Client1
FileSet:  Full Set
Level:    Incremental
Client:   rufus-fd
Storage:  File
Pool:     Default
When:     2003-04-28 14:18:57
OK to run? (yes/mod/no):
</PRE>
<P>
At this point, take some time to look carefully at what is printed and
understand it. It is asking you if it is OK to run a job named <B>Client1</B>
with FileSet <B>Full Set</B> (we listed above) as an Incremental job on your
Client (your client name will be different), and to use Storage <B>File</B> and
Pool <B>Default</B>, and finally, it wants to run it now (the current time
should be displayed by your console). 

<P>
Here we have the choice to run (<B>yes</B>), to modify one or more of the above
parameters (<B>mod</B>), or to not run the job (<B>no</B>). Please enter <B>yes</B>, at which point you should immediately get the command prompt (an
asterisk). If you wait a few seconds, then enter the command <B>messages</B>
you will get back something like: 

<P>
<PRE>
28-Apr-2003 14:22 rufus-dir: Last FULL backup time not found. Doing
                  FULL backup.
28-Apr-2003 14:22 rufus-dir: Start Backup JobId 1,
                  Job=Client1.2003-04-28_14.22.33
28-Apr-2003 14:22 rufus-sd: Job Client1.2003-04-28_14.22.33 waiting.
                  Cannot find any appendable volumes.
Please use the "label"  command to create a new Volume for:
    Storage:      FileStorage
    Media type:   File
    Pool:         Default
</PRE>
<P>
The first message, indicates that no previous Full backup was done, so Bacula
is upgrading our Incremental job to a Full backup (this is normal). The second
message indicates that the job started with JobId 1., and the third message
tells us that Bacula cannot find any Volumes in the Pool for writing the
output. This is normal because we have not yet created (labeled) any Volumes.
Bacula indicates to you all the details of the volume it needs. 

<P>
At this point, the job is BLOCKED waiting for a Volume. You can check this if
you want by doing a <B>status dir</B>. In order to continue, we must create a
Volume that Bacula can write on. We do so with: 

<P>
<PRE>
label
</PRE>
<P>
and Bacula will print: 

<P>
<PRE>
The defined Storage resources are:
     1: File
Item 1 selected automatically.
Enter new Volume name:
</PRE>
<P>
at which point, you should enter some name beginning with a letter and
containing only letters and numbers (period, hyphen, and underscore) are also
permitted. For example, enter <B>TestVolume001</B>, and you should get back: 

<P>
<PRE>
Defined Pools:
     1: Default
Item 1 selected automatically.
Connecting to Storage daemon File at rufus:8103 ...
Sending label command for Volume "TestVolume001" Slot 0 ...
3000 OK label. Volume=TestVolume001 Device=/tmp
Catalog record for Volume "TestVolume002", Slot 0  successfully created.
Requesting mount FileStorage ...
3001 OK mount. Device=/tmp
</PRE>
<P>
Finally, enter <B>messages</B> and you should get something like: 

<P>
<PRE>
28-Apr-2003 14:30 rufus-sd: Wrote label to prelabeled Volume
   "TestVolume001" on device /tmp
28-Apr-2003 14:30 rufus-dir: Bacula 1.30 (28Apr03): 28-Apr-2003 14:30
JobId:                  1
Job:                    Client1.2003-04-28_14.22.33
FileSet:                Full Set
Backup Level:           Full
Client:                 rufus-fd
Start time:             28-Apr-2003 14:22
End time:               28-Apr-2003 14:30
Files Written:          1,444
Bytes Written:          38,988,877
Rate:                   81.2 KB/s
Software Compression:   None
Volume names(s):        TestVolume001
Volume Session Id:      1
Volume Session Time:    1051531381
Last Volume Bytes:      39,072,359
FD termination status:  OK
SD termination status:  OK
Termination:            Backup OK
28-Apr-2003 14:30 rufus-dir: Begin pruning Jobs.
28-Apr-2003 14:30 rufus-dir: No Jobs found to prune.
28-Apr-2003 14:30 rufus-dir: Begin pruning Files.
28-Apr-2003 14:30 rufus-dir: No Files found to prune.
28-Apr-2003 14:30 rufus-dir: End auto prune.
</PRE>
<P>
If you don't see the output immediately, you can keep entering <B>messages</B>
until the job terminates, or you can enter, <B>autodisplay on</B> and your
messages will automatically be displayed as soon as they are ready. 

<P>
If you do an <B>ls -l</B> of your <B>/tmp</B> directory, you will see that you
have the following item: 

<P>
<PRE>
-rw-r-----    1 kern     kern     39072153 Apr 28 14:30 TestVolume001
</PRE>
<P>
This is the file Volume that you just wrote and it contains all the data of
the job just run. If you run additional jobs, they will be appended to this
Volume unless you specify otherwise. 

<P>
You might ask yourself if you have to label all the Volumes that Bacula is
going to use. The answer for disk Volumes, like the one we used, is no. It is
possible to have Bacula automatically label volumes. For tape Volumes, you
will most likely have to label each of the Volumes you want to use. 

<P>
If you would like to stop here, you can simply enter <B>quit</B> in the Console
program, and you can stop Bacula with <B>./bacula stop</B>. To clean up, simply
delete the file <B>/tmp/TestVolume001</B>, and you should also re-initialize
your database using: 

<P>
<PRE>
./drop_bacula_tables
./make_bacula_tables
</PRE>
<P>
Please note that this will erase all information about the previous jobs that
have run, and that you might want to do it now while testing but that normally
you will not want to re-initialize your database. 

<P>
If you would like to try restoring the files that you just backed up, read the
following section. 
<A NAME="restoring"></A>
<P>

<H1><A NAME="SECTION001660000000000000000">
Restoring Your Files</A>
</H1>
<A NAME="5031"></A>
<A NAME="5032"></A>

<P>
If you have run the default configuration and the save of the Bacula source
code as demonstrated above, you can restore the backed up files in the Console
program by entering: 

<P>
<PRE>
restore all
</PRE>
<P>
where you will get: 

<P>
<PRE>
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 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: 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):
</PRE>
<P>
As you can see, there are a number of options, but for the current
demonstration, please enter <B>5</B> to do a restore of the last backup you
did, and you will get the following output: 

<P>
<PRE>
Defined Clients:
     1: rufus-fd
Item 1 selected automatically.
The defined FileSet resources are:
     1: 1  Full Set  2003-04-28 14:22:33
Item 1 selected automatically.
+-------+-------+----------+---------------------+---------------+
| JobId | Level | JobFiles | StartTime           | VolumeName    |
+-------+-------+----------+---------------------+---------------+
| 1     | F     | 1444     | 2003-04-28 14:22:33 | TestVolume002 |
+-------+-------+----------+---------------------+---------------+
You have selected the following JobId: 1
Building directory tree for JobId 1 ...
1 Job inserted into the tree and marked for extraction.
The defined Storage resources are:
     1: File
Item 1 selected automatically.
You are now entering file selection mode where you add and
remove files to be restored. All files are initially added.
Enter "done" to leave this mode.
cwd is: /
$
</PRE>
<P>
where I have truncated the listing on the right side to make it more readable.
As you can see by starting at the top of the listing, Bacula knows what client
you have, and since there was only one, it selected it automatically, likewise
for the FileSet. Then Bacula produced a listing containing all the jobs that
form the current backup, in this case, there is only one, and the Storage
daemon was also automatically chosen. Bacula then took all the files that were
in Job number 1 and entered them into a <B>directory tree</B> (a sort of in
memory representation of your filesystem). At this point, you can use the <B>cd</B> and <B>ls</B> ro <B>dir</B> commands to walk up and down the directory tree
and view what files will be restored. For example, if I enter <B>cd
/home/kern/bacula/bacula-1.30</B> and then enter <B>dir</B> I will get a listing
of all the files in the Bacula source directory. On your system, the path will
be somewhat different. For more information on this, please refer to the 
Restore Command ChapterRestoreChapter of this manual for
more details. 

<P>
To exit this mode, simply enter: 

<P>
<PRE>
done
</PRE>
<P>
and you will get the following output: 

<P>
<PRE>
Bootstrap records written to
   /home/kern/bacula/testbin/working/restore.bsr
The restore job will require the following Volumes:
   
   TestVolume001
1444 files selected to restore.
Run Restore job
JobName:         RestoreFiles
Bootstrap:      /home/kern/bacula/testbin/working/restore.bsr
Where:          /tmp/bacula-restores
Replace:        always
FileSet:        Full Set
Backup Client:  rufus-fd
Restore Client: rufus-fd
Storage:        File
JobId:          *None*
When:           2005-04-28 14:53:54
OK to run? (yes/mod/no):
</PRE>
<P>
If you answer <B>yes</B> your files will be restored to <B>/tmp/bacula-restores</B>. If you want to restore the files to their original
locations, you must use the <B>mod</B> option and explicitly set <B>Where:</B>
to nothing (or to /). We recommend you go ahead and answer <B>yes</B> and after
a brief moment, enter <B>messages</B>, at which point you should get a listing
of all the files that were restored as well as a summary of the job that looks
similar to this: 

<P>
<PRE>
28-Apr-2005 14:56 rufus-dir: Bacula 2.1.8 (08May07): 08-May-2007 14:56:06
Build OS:               i686-pc-linux-gnu suse 10.2
JobId:                  2
Job:                    RestoreFiles.2007-05-08_14.56.06
Restore Client:         rufus-fd
Start time:             08-May-2007 14:56
End time:               08-May-2007 14:56
Files Restored:         1,444
Bytes Restored:         38,816,381
Rate:                   9704.1 KB/s
FD Errors:              0
FD termination status:  OK
SD termination status:  OK
Termination:            Restore OK
08-May-2007 14:56 rufus-dir: Begin pruning Jobs.
08-May-2007 14:56 rufus-dir: No Jobs found to prune.
08-May-2007 14:56 rufus-dir: Begin pruning Files.
08-May-2007 14:56 rufus-dir: No Files found to prune.
08-May-2007 14:56 rufus-dir: End auto prune.
</PRE>
<P>
After exiting the Console program, you can examine the files in <B>/tmp/bacula-restores</B>, which will contain a small directory tree with all the
files. Be sure to clean up at the end with: 

<P>
<PRE>
rm -rf /tmp/bacula-restore
</PRE>
<P>

<H1><A NAME="SECTION001670000000000000000">
Quitting the Console Program</A>
</H1>
<A NAME="5064"></A>
<A NAME="5065"></A>

<P>
Simply enter the command <B>quit</B>. 
<A NAME="SecondClient"></A>
<P>

<H1><A NAME="SECTION001680000000000000000">
Adding a Second Client</A>
</H1>
<A NAME="5069"></A>
<A NAME="5070"></A>

<P>
If you have gotten the example shown above to work on your system, you may be
ready to add a second Client (File daemon). That is you have a second machine
that you would like backed up. The only part you need installed on the other
machine is the binary <B>bacula-fd</B> (or <B>bacula-fd.exe</B> for Windows) and
its configuration file <B>bacula-fd.conf</B>. You can start with the same <B>bacula-fd.conf</B> file that you are currently using and make one minor
modification to it to create the conf file for your second client. Change the
File daemon name from whatever was configured, <B>rufus-fd</B> in the example
above, but your system will have a different name. The best is to change it to
the name of your second machine. For example: 

<P>
<PRE>
...
#
# "Global" File daemon configuration specifications
#
FileDaemon {                          # this is me
  Name = rufus-fd
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /home/kern/bacula/working
  Pid Directory = /var/run
}
...
</PRE>
<P>
would become: 

<P>
<PRE>
...
#
# "Global" File daemon configuration specifications
#
FileDaemon {                          # this is me
  Name = matou-fd
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /home/kern/bacula/working
  Pid Directory = /var/run
}
...
</PRE>
<P>
where I show just a portion of the file and have changed <B>rufus-fd</B> to
<B>matou-fd</B>. The names you use are your choice. For the moment, I recommend
you change nothing else. Later, you will want to change the password. 

<P>
Now you should install that change on your second machine. Then you need to
make some additions to your Director's configuration file to define the new
File daemon or Client. Starting from our original example which should be
installed on your system, you should add the following lines (essentially
copies of the existing data but with the names changed) to your Director's
configuration file <B>bacula-dir.conf</B>. 

<P>
<PRE>
#
# Define the main nightly save backup job
#   By default, this job will back up to disk in /tmp
Job {
  Name = "Matou"
  Type = Backup
  Client = matou-fd
  FileSet = "Full Set"
  Schedule = "WeeklyCycle"
  Storage = File
  Messages = Standard
  Pool = Default
  Write Bootstrap = "/home/kern/bacula/working/matou.bsr"
}
# Client (File Services) to backup
Client {
  Name = matou-fd
  Address = matou
  FDPort = 9102
  Catalog = MyCatalog
  Password = "xxxxx"                  # password for
  File Retention = 30d                # 30 days
  Job Retention = 180d                # six months
  AutoPrune = yes                     # Prune expired Jobs/Files
}
</PRE>
<P>
Then make sure that the Address parameter in the Storage resource is set to
the fully qualified domain name and not to something like "localhost". The
address specified is sent to the File daemon (client) and it must be a fully
qualified domain name. If you pass something like "localhost" it will not
resolve correctly and will result in a time out when the File daemon fails to
connect to the Storage daemon. 

<P>
That is all that is necessary. I copied the existing resource to create a
second Job (Matou) to backup the second client (matou-fd). It has the name
<B>Matou</B>, the Client is named <B>matou-fd</B>, and the bootstrap file name
is changed, but everything else is the same. This means that Matou will be
backed up on the same schedule using the same set of tapes. You may want to
change that later, but for now, let's keep it simple. 

<P>
The second change was to add a new Client resource that defines <B>matou-fd</B>
and has the correct address <B>matou</B>, but in real life, you may need a
fully qualified domain name or an IP address. I also kept the password the
same (shown as xxxxx for the example). 

<P>
At this point, if you stop Bacula and restart it, and start the Client on the
other machine, everything will be ready, and the prompts that you saw above
will now include the second machine. 

<P>
To make this a real production installation, you will possibly want to use
different Pool, or a different schedule. It is up to you to customize. In any
case, you should change the password in both the Director's file and the
Client's file for additional security. 

<P>
For some important tips on changing names and passwords, and a diagram of what
names and passwords must match, please see 
Authorization ErrorsAuthorizationErrors in the FAQ chapter
of this manual. 

<P>

<H1><A NAME="SECTION001690000000000000000"></A>
<A NAME="FullTape"></A>
<BR>
When The Tape Fills
</H1>
<A NAME="5093"></A>
<A NAME="5094"></A>

<P>
If you have scheduled your job, typically nightly, there will come a time when
the tape fills up and <B>Bacula</B> cannot continue. In this case, Bacula will
send you a message similar to the following: 

<P>
<PRE>
rufus-sd: block.c:337 === Write error errno=28: ERR=No space left
          on device
</PRE>
<P>
This indicates that Bacula got a write error because the tape is full. Bacula
will then search the Pool specified for your Job looking for an appendable
volume. In the best of all cases, you will have properly set your Retention
Periods and you will have all your tapes marked to be Recycled, and <B>Bacula</B> will automatically recycle the tapes in your pool requesting and
overwriting old Volumes. For more information on recycling, please see the 
Recycling chapterRecyclingChapter of this manual. If you
find that your Volumes were not properly recycled (usually because of a
configuration error), please see the 
Manually Recycling Volumesmanualrecycling section of
the Recycling chapter. 

<P>
If like me, you have a very large set of Volumes and you label them with the
date the Volume was first writing, or you have not set up your Retention
periods, Bacula will not find a tape in the pool, and it will send you a
message similar to the following: 

<P>
<PRE>
rufus-sd: Job kernsave.2002-09-19.10:50:48 waiting. Cannot find any
          appendable volumes.
Please use the "label"  command to create a new Volume for:
    Storage:      SDT-10000
    Media type:   DDS-4
    Pool:         Default
</PRE>
<P>
Until you create a new Volume, this message will be repeated an hour later,
then two hours later, and so on doubling the interval each time up to a
maximum interval of one day. 

<P>
The obvious question at this point is: What do I do now? 

<P>
The answer is simple: first, using the Console program, close the tape drive
using the <B>unmount</B> command. If you only have a single drive, it will be
automatically selected, otherwise, make sure you release the one specified on
the message (in this case <B>STD-10000</B>). 

<P>
Next, you remove the tape from the drive and insert a new blank tape. Note, on
some older tape drives, you may need to write an end of file mark (<B>mt  -f  /dev/nst0  weof</B>) to prevent the drive from running away when Bacula
attempts to read the label. 

<P>
Finally, you use the <B>label</B> command in the Console to write a label to
the new Volume. The <B>label</B> command will contact the Storage daemon to
write the software label, if it is successful, it will add the new Volume to
the Pool, then issue a <B>mount</B> command to the Storage daemon. See the
previous sections of this chapter for more details on labeling tapes. 

<P>
The result is that Bacula will continue the previous Job writing the backup to
the new Volume. 

<P>
If you have a Pool of volumes and Bacula is cycling through them, instead of
the above message "Cannot find any appendable volumes.", Bacula may ask you
to mount a specific volume. In that case, you should attempt to do just that.
If you do not have the volume any more (for any of a number of reasons), you
can simply mount another volume from the same Pool, providing it is
appendable, and Bacula will use it. You can use the <B>list volumes</B> command
in the console program to determine which volumes are appendable and which are
not. 

<P>
If like me, you have your Volume retention periods set correctly, but you have
no more free Volumes, you can relabel and reuse a Volume as follows: 

<P>

<UL>
<LI>Do a <B>list volumes</B> in the Console and select the oldest  Volume for
   relabeling.  
</LI>
<LI>If you have setup your Retention periods correctly, the  Volume should
   have VolStatus <B>Purged</B>.  
</LI>
<LI>If the VolStatus is not set to Purged, you will need to purge  the
   database of Jobs that are written on that Volume. Do so  by using the command
   <B>purge jobs volume</B> in the Console.  If you have multiple Pools, you will
be prompted for the  Pool then enter the VolumeName (or MediaId) when
requested.  
</LI>
<LI>Then simply use the <B>relabel</B> command to relabel the  Volume. 
   
</LI>
</UL>

<P>
To manually relabel the Volume use the following additional steps: 

<P>

<UL>
<LI>To delete the Volume from the catalog use the <B>delete volume</B> 
   command in the Console and select the VolumeName (or MediaId) to be  deleted. 

<P>
</LI>
<LI>Use the <B>unmount</B> command in the Console to unmount the  old tape.  
</LI>
<LI>Physically relabel the old Volume that you deleted so that it  can be
   reused.  
</LI>
<LI>Insert the old Volume in the tape drive.  
</LI>
<LI>From a command line do: <B>mt  -f  /dev/st0  rewind</B> and  <B>mt     -f  /dev/st0  weof</B>, where you need to use the proper  tape drive name for
   your system in place of <B>/dev/st0</B>.  
</LI>
<LI>Use the <B>label</B> command in the Console to write a new  Bacula label
   on your tape.  
</LI>
<LI>Use the <B>mount</B> command in the Console if it is not automatically 
   done, so that Bacula starts using your newly labeled tape. 
   
</LI>
</UL>

<P>

<H1><A NAME="SECTION0016100000000000000000">
Other Useful Console Commands</A>
</H1>
<A NAME="5128"></A>
<A NAME="5129"></A>

<P>
<DL>
<DT><STRONG>status dir</STRONG></DT>
<DD><A NAME="5131"></A>
   Print a status of all running jobs and jobs  scheduled in the next 24 hours.  

<P>
</DD>
<DT><STRONG>status</STRONG></DT>
<DD><A NAME="5132"></A>
   The console program will prompt you to select  a daemon type, then will
request the daemon's status.  

<P>
</DD>
<DT><STRONG>status jobid=nn</STRONG></DT>
<DD><A NAME="5133"></A>
   Print a status of JobId nn if it is running.  The Storage daemon is contacted
and requested to print a current  status of the job as well.  

<P>
</DD>
<DT><STRONG>list pools</STRONG></DT>
<DD><A NAME="5134"></A>
   List the pools defined in the Catalog (normally  only Default is used).  

<P>
</DD>
<DT><STRONG>list media</STRONG></DT>
<DD><A NAME="5135"></A>
   Lists all the media defined in the Catalog.  

<P>
</DD>
<DT><STRONG>list jobs</STRONG></DT>
<DD><A NAME="5136"></A>
   Lists all jobs in the Catalog that have run.  

<P>
</DD>
<DT><STRONG>list jobid=nn</STRONG></DT>
<DD><A NAME="5137"></A>
   Lists JobId nn from the Catalog.  

<P>
</DD>
<DT><STRONG>list jobtotals</STRONG></DT>
<DD><A NAME="5138"></A>
   Lists totals for all jobs in the Catalog.  

<P>
</DD>
<DT><STRONG>list files jobid=nn</STRONG></DT>
<DD><A NAME="5139"></A>
   List the files that were saved for JobId nn.  

<P>
</DD>
<DT><STRONG>list jobmedia</STRONG></DT>
<DD><A NAME="5140"></A>
   List the media information for each Job run.  

<P>
</DD>
<DT><STRONG>messages</STRONG></DT>
<DD><A NAME="5141"></A>
   Prints any messages that have been directed to the console.  

<P>
</DD>
<DT><STRONG>unmount storage=storage-name</STRONG></DT>
<DD><A NAME="5142"></A>
   Unmounts the drive associated with the storage  device with the name <B>storage-name</B> if the drive is not currently being  used. This command is used
if you wish Bacula to free the drive so  that you can use it to label a tape. 

<P>
</DD>
<DT><STRONG>mount storage=storage-name</STRONG></DT>
<DD><A NAME="5144"></A>
   Causes the drive associated with the  storage device to be mounted again. When
Bacula reaches the end of a volume and requests you to mount a  new volume,
you must issue this command after you have placed the  new volume in the
drive. In effect, it is the signal needed by  Bacula to know to start reading
or writing the new volume.  

<P>
</DD>
<DT><STRONG>quit</STRONG></DT>
<DD><A NAME="5145"></A>
   Exit or quit the console program. 
</DD>
</DL>

<P>
Most of the commands given above, with the exception of <B>list</B>, will
prompt you for the necessary arguments if you simply enter the command name. 

<P>

<H1><A NAME="SECTION0016110000000000000000">
Debug Daemon Output</A>
</H1>
<A NAME="5149"></A>
<A NAME="5150"></A>

<P>
If you want debug output from the daemons as they are running, start the
daemons from the install directory as follows: 

<P>
<PRE>
./bacula start -d100
</PRE>
<P>
This can be particularly helpful if your daemons do not start correctly,
because direct daemon output to the console is normally directed to the
NULL device, but with the debug level greater than zero, the output
will be sent to the starting terminal.

<P>
To stop the three daemons, enter the following from the install directory: 

<P>
<PRE>
./bacula stop
</PRE>
<P>
The execution of <B>bacula stop</B> may complain about pids not found. This is
OK, especially if one of the daemons has died, which is very rare. 

<P>
To do a full system save, each File daemon must be running as root so that it
will have permission to access all the files. None of the other daemons
require root privileges. However, the Storage daemon must be able to open the
tape drives. On many systems, only root can access the tape drives. Either run
the Storage daemon as root, or change the permissions on the tape devices to
permit non-root access. MySQL and PostgreSQL can be installed and run with any
userid; root privilege is not necessary. 

<P>

<H1><A NAME="SECTION0016120000000000000000">
Patience When Starting Daemons or Mounting Blank Tapes</A>
</H1>

<P>
When you start the Bacula daemons, the Storage daemon attempts to open all
defined storage devices and verify the currently mounted Volume (if
configured). Until all the storage devices are verified, the Storage daemon
will not accept connections from the Console program. If a tape was previously
used, it will be rewound, and on some devices this can take several minutes.
As a consequence, you may need to have a bit of patience when first contacting
the Storage daemon after starting the daemons. If you can see your tape drive,
once the lights stop flashing, the drive will be ready to be used. 

<P>
The same considerations apply if you have just mounted a blank tape in a drive
such as an HP DLT. It can take a minute or two before the drive properly
recognizes that the tape is blank. If you attempt to <B>mount</B> the tape with
the Console program during this recognition period, it is quite possible that
you will hang your SCSI driver (at least on my Red Hat Linux system). As a
consequence, you are again urged to have patience when inserting blank tapes.
Let the device settle down before attempting to access it. 

<P>

<H1><A NAME="SECTION0016130000000000000000">
Difficulties Connecting from the FD to the SD</A>
</H1>
<A NAME="5159"></A>
<A NAME="5160"></A>

<P>
If you are having difficulties getting one or more of your File daemons to
connect to the Storage daemon, it is most likely because you have not used a
fully qualified domain name on the <B>Address</B> directive in the
Director's Storage resource. That is the resolver on the File daemon's machine
(not on the Director's) must be able to resolve the name you supply into an IP
address. An example of an address that is guaranteed not to work: <B>localhost</B>. An example that may work: <B>megalon</B>. An example that is more
likely to work: <B>magalon.mydomain.com</B>. On Win32 if you don't have a good
resolver (often true on older Win98 systems), you might try using an IP
address in place of a name. 

<P>
If your address is correct, then make sure that no other program is using the
port 9103 on the Storage daemon's machine. The Bacula port numbers are
authorized by IANA, and should not be used by other programs, but apparently
some HP printers do use these port numbers. A <B>netstat -a</B> on the Storage
daemon's machine can determine who is using the 9103 port (used for FD to SD
communications in Bacula). 

<P>

<H1><A NAME="SECTION0016140000000000000000">
Daemon Command Line Options</A>
</H1>
<A NAME="5167"></A>
<A NAME="5168"></A>

<P>
Each of the three daemons (Director, File, Storage) accepts a small set of
options on the command line. In general, each of the daemons as well as the
Console program accepts the following options: 

<P>
<DL>
<DT><STRONG>-c file</STRONG></DT>
<DD><A NAME="5234"></A>
   Define the file to use as a  configuration file. The default is the daemon
   name followed  by <B>.conf</B> i.e. <B>bacula-dir.conf</B> for the Director, 
   <B>bacula-fd.conf</B> for the File daemon, and <B>bacula-sd</B>  for the Storage
   daemon.  

<P>
</DD>
<DT><STRONG>-d nn</STRONG></DT>
<DD><A NAME="5178"></A>
   Set the debug level to <B>nn</B>. Higher levels  of debug cause more
   information to be displayed on STDOUT concerning  what the daemon is doing.  

<P>
</DD>
<DT><STRONG>-f</STRONG></DT>
<DD>Run the daemon in the foreground. This option is  needed to run the daemon
   under the debugger.  

<P>
</DD>
<DT><STRONG>-g &lt;group&gt;</STRONG></DT>
<DD>Run the daemon under this group.  This must be a group name, not a GID.

<P>
</DD>
<DT><STRONG>-s</STRONG></DT>
<DD>Do not trap signals. This option is needed to run  the daemon under the
   debugger.  

<P>
</DD>
<DT><STRONG>-t</STRONG></DT>
<DD>Read the configuration file and print any error messages,  then immediately
   exit. Useful for syntax testing of  new configuration files.  

<P>
</DD>
<DT><STRONG>-u &lt;user&gt;</STRONG></DT>
<DD>Run the daemon as this user.  This must be a user name, not a UID.

<P>
</DD>
<DT><STRONG>-v</STRONG></DT>
<DD>Be more verbose or more complete in printing error  and informational
   messages. Recommended.  

<P>
</DD>
<DT><STRONG>-?</STRONG></DT>
<DD>Print the version and list of options. 

<P>
</DD>
</DL>

<P>

<H1><A NAME="SECTION0016150000000000000000"></A>
<A NAME="Pool"></A>
<BR>
Creating a Pool
</H1>
<A NAME="5183"></A>
<A NAME="5184"></A>

<P>
Creating the Pool is automatically done when <B>Bacula</B> starts, so if you
understand Pools, you can skip to the next section. 

<P>
When you run a job, one of the things that Bacula must know is what Volumes to
use to backup the FileSet. Instead of specifying a Volume (tape) directly, you
specify which Pool of Volumes you want Bacula to consult when it wants a tape
for writing backups. Bacula will select the first available Volume from the
Pool that is appropriate for the Storage device you have specified for the Job
being run. When a volume has filled up with data, <B>Bacula</B> will change its
VolStatus from <B>Append</B> to <B>Full</B>, and then <B>Bacula</B> will use the
next volume and so on. If no appendable Volume exists in the Pool, the
Director will attempt to recycle an old Volume, if there are still no
appendable Volumes available, <B>Bacula</B> will send a message requesting the
operator to create an appropriate Volume. 

<P>
<B>Bacula</B> keeps track of the Pool name, the volumes contained in the Pool,
and a number of attributes of each of those Volumes. 

<P>
When Bacula starts, it ensures that all Pool resource definitions have been
recorded in the catalog. You can verify this by entering: 

<P>
<PRE>
list pools
</PRE>
<P>
to the console program, which should print something like the following: 

<P>
<PRE>
*list pools
Using default Catalog name=MySQL DB=bacula
+--------+---------+---------+---------+----------+-------------+
| PoolId | Name    | NumVols | MaxVols | PoolType | LabelFormat |
+--------+---------+---------+---------+----------+-------------+
| 1      | Default | 3       | 0       | Backup   | *           |
| 2      | File    | 12      | 12      | Backup   | File        |
+--------+---------+---------+---------+----------+-------------+
*
</PRE>
<P>
If you attempt to create the same Pool name a second time, <B>Bacula</B> will
print: 

<P>
<PRE>
Error: Pool Default already exists.
Once created, you may use the {\bf update} command to
modify many of the values in the Pool record.
</PRE>
<P>
<A NAME="Labeling"></A>
<P>

<H1><A NAME="SECTION0016160000000000000000">
Labeling Your Volumes</A>
</H1>
<A NAME="5201"></A>
<A NAME="5202"></A>

<P>
Bacula requires that each Volume contains a software label. There are several
strategies for labeling volumes. The one I use is to label them as they are
needed by <B>Bacula</B> using the console program. That is when Bacula needs a
new Volume, and it does not find one in the catalog, it will send me an email
message requesting that I add Volumes to the Pool. I then use the <B>label</B>
command in the Console program to label a new Volume and to define it in the
Pool database, after which Bacula will begin writing on the new Volume.
Alternatively, I can use the Console <B>relabel</B> command to relabel a Volume
that is no longer used providing it has VolStatus <B>Purged</B>. 

<P>
Another strategy is to label a set of volumes at the start, then use them as
<B>Bacula</B> requests them. This is most often done if you are cycling through
a set of tapes, for example using an autochanger. For more details on
recycling, please see the 
Automatic Volume RecyclingRecyclingChapter chapter of
this manual. 

<P>
If you run a Bacula job, and you have no labeled tapes in the Pool, Bacula
will inform you, and you can create them "on-the-fly" so to speak. In my
case, I label my tapes with the date, for example: <B>DLT-18April02</B>. See
below for the details of using the <B>label</B> command. 

<P>

<H1><A NAME="SECTION0016170000000000000000">
Labeling Volumes with the Console Program</A>
</H1>
<A NAME="5213"></A>
<A NAME="5214"></A>

<P>
Labeling volumes is normally done by using the console program. 

<P>

<OL>
<LI>./bconsole  
</LI>
<LI>label 
   
</LI>
</OL>

<P>
If Bacula complains that you cannot label the tape because it is already
labeled, simply <B>unmount</B> the tape using the <B>unmount</B> command in the
console, then physically mount a blank tape and re-issue the <B>label</B>
command. 

<P>
Since the physical storage media is different for each device, the <B>label</B>
command will provide you with a list of the defined Storage resources such as
the following: 

<P>
<PRE>
The defined Storage resources are:
     1: File
     2: 8mmDrive
     3: DLTDrive
     4: SDT-10000
Select Storage resource (1-4):
</PRE>
<P>
At this point, you should have a blank tape in the drive corresponding to the
Storage resource that you select. 

<P>
It will then ask you for the Volume name. 

<P>
<PRE>
Enter new Volume name:
</PRE>
<P>
If Bacula complains: 

<P>
<PRE>
Media record for Volume xxxx already exists.
</PRE>
<P>
It means that the volume name <B>xxxx</B> that you entered already exists in
the Media database. You can list all the defined Media (Volumes) with the <B>list media</B> command. Note, the LastWritten column has been truncated for
proper printing. 

<P>
<PRE>
+---------------+---------+--------+----------------+-----/~/-+------------+-----+
| VolumeName    | MediaTyp| VolStat| VolBytes       | LastWri | VolReten   | Recy|
+---------------+---------+--------+----------------+---------+------------+-----+
| DLTVol0002    | DLT8000 | Purged | 56,128,042,217 | 2001-10 | 31,536,000 |   0 |
| DLT-07Oct2001 | DLT8000 | Full   | 56,172,030,586 | 2001-11 | 31,536,000 |   0 |
| DLT-08Nov2001 | DLT8000 | Full   | 55,691,684,216 | 2001-12 | 31,536,000 |   0 |
| DLT-01Dec2001 | DLT8000 | Full   | 55,162,215,866 | 2001-12 | 31,536,000 |   0 |
| DLT-28Dec2001 | DLT8000 | Full   | 57,888,007,042 | 2002-01 | 31,536,000 |   0 |
| DLT-20Jan2002 | DLT8000 | Full   | 57,003,507,308 | 2002-02 | 31,536,000 |   0 |
| DLT-16Feb2002 | DLT8000 | Full   | 55,772,630,824 | 2002-03 | 31,536,000 |   0 |
| DLT-12Mar2002 | DLT8000 | Full   | 50,666,320,453 | 1970-01 | 31,536,000 |   0 |
| DLT-27Mar2002 | DLT8000 | Full   | 57,592,952,309 | 2002-04 | 31,536,000 |   0 |
| DLT-15Apr2002 | DLT8000 | Full   | 57,190,864,185 | 2002-05 | 31,536,000 |   0 |
| DLT-04May2002 | DLT8000 | Full   | 60,486,677,724 | 2002-05 | 31,536,000 |   0 |
| DLT-26May02   | DLT8000 | Append |  1,336,699,620 | 2002-05 | 31,536,000 |   1 |
+---------------+---------+--------+----------------+-----/~/-+------------+-----+
</PRE>
<P>
Once Bacula has verified that the volume does not already exist, it will
prompt you for the name of the Pool in which the Volume (tape) is to be
created.  If there is only one Pool (Default), it will be automatically
selected.

<P>
If the tape is successfully labeled, a Volume record will also be created in
the Pool. That is the Volume name and all its other attributes will appear
when you list the Pool. In addition, that Volume will be available for backup
if the MediaType matches what is requested by the Storage daemon. 

<P>
When you labeled the tape, you answered very few questions about it -
principally the Volume name, and perhaps the Slot. However, a Volume record in
the catalog database (internally known as a Media record) contains quite a few
attributes. Most of these attributes will be filled in from the default values
that were defined in the Pool (i.e. the Pool holds most of the default
attributes used when creating a Volume). 

<P>
It is also possible to add media to the pool without physically labeling the
Volumes. This can be done with the <B>add</B> command. For more information,
please see the 
Console Chapter_ConsoleChapter of this manual. 

<P>

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1393"
  HREF="Customizing_Configuration_F.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html1387"
  HREF="Bacula_Main_Reference.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html1381"
  HREF="Critical_Items_Implement_Be.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html1389"
  HREF="Contents.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html1391"
  HREF="Thanks.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1394"
  HREF="Customizing_Configuration_F.html">Customizing the Configuration Files</A>
<B> Up:</B> <A NAME="tex2html1388"
  HREF="Bacula_Main_Reference.html">Bacula Main Reference</A>
<B> Previous:</B> <A NAME="tex2html1382"
  HREF="Critical_Items_Implement_Be.html">Critical Items to Implement</A>
 &nbsp; <B>  <A NAME="tex2html1390"
  HREF="Contents.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html1392"
  HREF="Thanks.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>

2012-01-24
</ADDRESS>
</BODY>
</HTML>