Sophie

Sophie

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

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>Tips and Suggestions</TITLE>
<META NAME="description" CONTENT="Tips and Suggestions">
<META NAME="keywords" CONTENT="problems">
<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="problems.css">

<LINK REL="next" HREF="Testing_Your_Tape_Drive.html">
<LINK REL="previous" HREF="Bacula_Frequently_Asked_Que.html">
<LINK REL="up" HREF="Bacula_Problem_Resolution_G.html">
<LINK REL="next" HREF="Testing_Your_Tape_Drive.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<A NAME="tex2html280"
  HREF="Testing_Your_Tape_Drive.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html274"
  HREF="Bacula_Problem_Resolution_G.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html268"
  HREF="Bacula_Frequently_Asked_Que.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html276"
  HREF="Contents.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html278"
  HREF="GNU_Free_Documentation_Lice.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html281"
  HREF="Testing_Your_Tape_Drive.html">Testing Your Tape Drive</A>
<B> Up:</B> <A NAME="tex2html275"
  HREF="Bacula_Problem_Resolution_G.html">Bacula Problem Resolution Guide</A>
<B> Previous:</B> <A NAME="tex2html269"
  HREF="Bacula_Frequently_Asked_Que.html">Bacula Frequently Asked Questions</A>
 &nbsp; <B>  <A NAME="tex2html277"
  HREF="Contents.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html279"
  HREF="GNU_Free_Documentation_Lice.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="tex2html282"
  HREF="Tips_Suggestions.html#SECTION00310000000000000000">Upgrading Bacula Versions</A>
<LI><A NAME="tex2html283"
  HREF="Tips_Suggestions.html#SECTION00320000000000000000">Getting Notified of Job Completion</A>
<LI><A NAME="tex2html284"
  HREF="Tips_Suggestions.html#SECTION00330000000000000000">Getting Email Notification to Work</A>
<LI><A NAME="tex2html285"
  HREF="Tips_Suggestions.html#SECTION00340000000000000000">Getting Notified that Bacula is Running</A>
<LI><A NAME="tex2html286"
  HREF="Tips_Suggestions.html#SECTION00350000000000000000">Maintaining a Valid Bootstrap File</A>
<LI><A NAME="tex2html287"
  HREF="Tips_Suggestions.html#SECTION00360000000000000000">Rejected Volumes After a Crash</A>
<LI><A NAME="tex2html288"
  HREF="Tips_Suggestions.html#SECTION00370000000000000000">Security Considerations</A>
<LI><A NAME="tex2html289"
  HREF="Tips_Suggestions.html#SECTION00380000000000000000">Creating Holiday Schedules</A>
<LI><A NAME="tex2html290"
  HREF="Tips_Suggestions.html#SECTION00390000000000000000">Automatic Labeling Using Your Autochanger</A>
<LI><A NAME="tex2html291"
  HREF="Tips_Suggestions.html#SECTION003100000000000000000">Backing Up Portables Using DHCP</A>
<LI><A NAME="tex2html292"
  HREF="Tips_Suggestions.html#SECTION003110000000000000000">Going on Vacation</A>
<LI><A NAME="tex2html293"
  HREF="Tips_Suggestions.html#SECTION003120000000000000000">Exclude Files on Windows Regardless of Case</A>
<LI><A NAME="tex2html294"
  HREF="Tips_Suggestions.html#SECTION003130000000000000000">Executing Scripts on a Remote Machine</A>
<LI><A NAME="tex2html295"
  HREF="Tips_Suggestions.html#SECTION003140000000000000000">Recycling All Your Volumes</A>
<LI><A NAME="tex2html296"
  HREF="Tips_Suggestions.html#SECTION003150000000000000000">Backing up ACLs on ext3 or XFS filesystems</A>
<LI><A NAME="tex2html297"
  HREF="Tips_Suggestions.html#SECTION003160000000000000000">Total Automation of Bacula Tape Handling</A>
<LI><A NAME="tex2html298"
  HREF="Tips_Suggestions.html#SECTION003170000000000000000">Running Concurrent Jobs</A>
</UL>
<!--End of Table of Child-Links-->
<HR>

<H1><A NAME="SECTION00300000000000000000"></A>
<A NAME="TipsChapter"></A>
<BR>
Tips and Suggestions
</H1>
<A NAME="726"></A>
<A NAME="727"></A>
<A NAME="examples"></A><A NAME="729"></A>

<P>
There are a number of example scripts for various things that can be found in
the <B>example</B> subdirectory and its subdirectories of the Bacula source
distribution. 

<P>
For additional tips, please see the Bacula
wikihttp://wiki.bacula.org.

<P>

<H1><A NAME="SECTION00310000000000000000"></A>
<A NAME="upgrading"></A>
<BR>
Upgrading Bacula Versions
</H1>
<A NAME="735"></A>
<A NAME="736"></A>
<A NAME="737"></A>

<P>
The first thing to do before upgrading from one version to another is to
ensure that you don't overwrite or delete your production (current) version
of Bacula until you have tested that the new version works.

<P>
If you have installed Bacula into a single directory, this is simple: simply
make a copy of your Bacula directory. 

<P>
If you have done a more typical Unix installation where the binaries are
placed in one directory and the configuration files are placed in another,
then the simplest way is to configure your new Bacula to go into a single
file. Alternatively, make copies of all your binaries and especially your 
conf files.

<P>
Whatever your situation may be (one of the two just described), you should
probably start with the <B>defaultconf</B> script that can be found in the <B>examples</B> subdirectory. Copy this script to the main Bacula directory, modify
it as necessary (there should not need to be many modifications), configure
Bacula, build it, install it, then stop your production Bacula, copy all the
<B>*.conf</B> files from your production Bacula directory to the test Bacula
directory, start the test version, and run a few test backups. If all seems
good, then you can proceed to install the new Bacula in place of or possibly
over the old Bacula. 

<P>
When installing a new Bacula you need not worry about losing the changes you
made to your configuration files as the installation process will not
overwrite them providing that you do not do a <B>make uninstall</B>.

<P>
If the new version of Bacula requires an upgrade to the database,
you can upgrade it with the script <B>update_bacula_tables</B>, which
will be installed in your scripts directory (default <B>/etc/bacula</B>),
or alternatively, you can find it in the  
<B>bacula-source/src/cats</B> directory.

<P>

<H1><A NAME="SECTION00320000000000000000"></A>
<A NAME="notification"></A>
<BR>
Getting Notified of Job Completion
</H1>
<A NAME="748"></A>
<A NAME="749"></A>

<P>
One of the first things you should do is to ensure that you are being properly
notified of the status of each Job run by Bacula, or at a minimum of each Job
that terminates with an error. 

<P>
Until you are completely comfortable with <B>Bacula</B>, we recommend that you
send an email to yourself for each Job that is run. This is most easily
accomplished by adding an email notification address in the <B>Messages</B>
resource of your Director's configuration file. An email is automatically
configured in the default configuration files, but you must ensure that the
default <B>root</B> address is replaced by your email address. 

<P>
For additional examples of how to configure a Bacula, please take a look at the
<B>.conf</B> files found in the <B>examples</B> sub-directory. We recommend the
following configuration (where you change the paths and email address to
correspond to your setup). Note, the <B>mailcommand</B> and <B>operatorcommand</B> should be on a single line. They were split here for
presentation: 

<P>
<PRE>
Messages {
  Name = Standard
  mailcommand = "/home/bacula/bin/bsmtp -h localhost
                -f \"\(Bacula\) %r\"
                -s \"Bacula: %t %e of %c %l\" %r"
  operatorcommand = "/home/bacula/bin/bsmtp -h localhost
                -f \"\(Bacula\) %r\"
                -s \"Bacula: Intervention needed for %j\" %r"
  Mail = your-email-address = all, !skipped, !terminate
  append = "/home/bacula/bin/log" = all, !skipped, !terminate
  operator = your-email-address = mount
  console = all, !skipped, !saved
}
</PRE>
<P>
You will need to ensure that the <B>/home/bacula/bin</B> path on the <B>mailcommand</B> and the <B>operatorcommand</B> lines point to your <B>Bacula</B>
binary directory where the <B>bsmtp</B> program will be installed. You will
also want to ensure that the <B>your-email-address</B> is replaced by your
email address, and finally, you will also need to ensure that the <B>/home/bacula/bin/log</B> points to the file where you want to log all messages. 

<P>
With the above Messages resource, you will be notified by email of every Job
that ran, all the output will be appended to the <B>log</B> file you specify,
all output will be directed to the console program, and all mount messages
will be emailed to you. Note, some messages will be sent to multiple
destinations. 

<P>
The form of the mailcommand is a bit complicated, but it allows you to
distinguish whether the Job terminated in error or terminated normally. Please
see the 
Mail Commandmailcommand section of the Messages
Resource chapter of this manual for the details of the substitution characters
used above. 

<P>
Once you are totally comfortable with Bacula as I am, or if you have a large
number of nightly Jobs as I do (eight), you will probably want to change the
<B>Mail</B> command to <B>Mail On Error</B> which will generate an email message
only if the Job terminates in error. If the Job terminates normally, no email
message will be sent, but the output will still be appended to the log file as
well as sent to the Console program. 

<P>

<H1><A NAME="SECTION00330000000000000000"></A>
<A NAME="email"></A>
<BR>
Getting Email Notification to Work
</H1>
<A NAME="773"></A>
<A NAME="774"></A>

<P>
The section above describes how to get email notification of job status.
Occasionally, however, users have problems receiving any email at all. In that
case, the things to check are the following: 

<P>

<UL>
<LI>Ensure that you have a valid email address specified on your  <B>Mail</B>
   record in the Director's Messages resource. The email  address should be fully
   qualified. Simply using <B>root</B> generally  will not work, rather you should
use <B>root@localhost</B> or better  yet your full domain.  
</LI>
<LI>Ensure that you do not have a <B>Mail</B> record in the Storage  daemon's
   or File daemon's configuration files. The only record  you should have is <B>   director</B>:  

<P>
<PRE>
      director = director-name = all
</PRE>
<P>
</LI>
<LI>If all else fails, try replacing the <B>mailcommand</B> with 

<P>
<PRE>
mailcommand = "mail -s test your@domain.com"
</PRE>
<P>
</LI>
<LI>Once the above is working, assuming you want to use <B>bsmtp</B>,  submit
   the desired bsmtp command by hand and ensure that the email  is delivered,
   then put that command into <B>Bacula</B>. Small  differences in things such as
the parenthesis around the word  Bacula can make a big difference to some
bsmtp programs.  For example, you might start simply by using: 

<P>
<PRE>
mailcommand = "/home/bacula/bin/bsmtp -f \"root@localhost\" %r"
</PRE>
<P>
</LI>
</UL>

<P>

<H1><A NAME="SECTION00340000000000000000"></A>
<A NAME="JobNotification"></A>
<BR>
Getting Notified that Bacula is Running
</H1>
<A NAME="793"></A>
<A NAME="794"></A>

<P>
If like me, you have setup Bacula so that email is sent only when a Job has
errors, as described in the previous section of this chapter, inevitably, one
day, something will go wrong and <B>Bacula</B> can stall. This could be because
Bacula crashes, which is vary rare, or more likely the network has caused <B>Bacula</B> to <B>hang</B> for some unknown reason. 

<P>
To avoid this, you can use the <B>RunAfterJob</B> command in the Job resource
to schedule a Job nightly, or weekly that simply emails you a message saying
that Bacula is still running. For example, I have setup the following Job in
my Director's configuration file: 

<P>
<PRE>
Schedule {
  Name = "Watchdog"
  Run = Level=Full sun-sat at 6:05
}
Job {
  Name = "Watchdog"
  Type = Admin
  Client=Watchdog
  FileSet="Verify Set"
  Messages = Standard
  Storage = DLTDrive
  Pool = Default
  Schedule = "Watchdog"
  RunAfterJob = "/home/kern/bacula/bin/watchdog %c %d"
}
Client {
  Name = Watchdog
  Address = rufus
  FDPort = 9102
  Catalog = Verify
  Password = ""
  File Retention = 1day
  Job Retention = 1 month
  AutoPrune = yes
}
</PRE>
<P>
Where I established a schedule to run the Job nightly. The Job itself is type
<B>Admin</B> which means that it doesn't actually do anything, and I've defined
a FileSet, Pool, Storage, and Client, all of which are not really used (and
probably don't need to be specified). The key aspect of this Job is the
command: 

<P>
<PRE>
  RunAfterJob = "/home/kern/bacula/bin/watchdog %c %d"
</PRE>
<P>
which runs my "watchdog" script. As an example, I have added the Job codes
%c and %d which will cause the Client name and the Director's name to be
passed to the script. For example, if the Client's name is <B>Watchdog</B> and
the Director's name is <B>main-dir</B> then referencing $1 in the script would
get <B>Watchdog</B> and referencing $2 would get <B>main-dir</B>. In this case,
having the script know the Client and Director's name is not really useful,
but in other situations it may be. 

<P>
You can put anything in the watchdog script. In my case, I like to monitor the
size of my catalog to be sure that <B>Bacula</B> is really pruning it. The
following is my watchdog script: 

<P>
<PRE>
#!/bin/sh
cd /home/kern/mysql/var/bacula
du . * |
/home/kern/bacula/bin/bsmtp  \
   -f "\(Bacula\) abuse@whitehouse.com" -h mail.yyyy.com \
   -s "Bacula running" abuse@whitehouse.com
</PRE>
<P>
If you just wish to send yourself a message, you can do it with: 

<P>
<PRE>
#!/bin/sh
cd /home/kern/mysql/var/bacula
/home/kern/bacula/bin/bsmtp  \
   -f "\(Bacula\) abuse@whitehouse.com" -h mail.yyyy.com \
   -s "Bacula running" abuse@whitehouse.com &lt;&lt;END-OF-DATA
Bacula is still running!!!
END-OF-DATA
</PRE>
<P>

<H1><A NAME="SECTION00350000000000000000"></A>
<A NAME="bootstrap"></A>
<BR>
Maintaining a Valid Bootstrap File
</H1>
<A NAME="815"></A>
<A NAME="816"></A>

<P>
By using a 
 WriteBootstrapwritebootstrap record in each of your
Director's Job resources, you can constantly maintain a 
bootstrapBootstrapChapter file that will enable you to
recover the state of your system as of the last backup without having the
Bacula catalog. This permits you to more easily recover from a disaster that
destroys your Bacula catalog. 

<P>
When a Job resource has a <B>WriteBootstrap</B> record, Bacula will maintain
the designated file (normally on another system but mounted by NFS) with up to
date information necessary to restore your system. For example, in my
Director's configuration file, I have the following record: 

<P>
<PRE>
 Write Bootstrap = "/mnt/deuter/files/backup/client-name.bsr"
</PRE>
<P>
where I replace <B>client-name</B> by the actual name of the client that is
being backed up. Thus, Bacula automatically maintains one file for each of my
clients. The necessary bootstrap information is appended to this file during
each <B>Incremental</B> backup, and the file is totally rewritten during each
<B>Full</B> backup. 

<P>
Note, one disadvantage of writing to an NFS mounted volume as I do is
that if the other machine goes down, the OS will wait forever on the fopen()
call that Bacula makes. As a consequence, Bacula will completely stall until
the machine exporting the NFS mounts comes back up. A possible solution to this
problem was provided by Andrew Hilborne, and consists of using the <B>soft</B>
option instead of the <B>hard</B> option when mounting the NFS volume, which is
typically done in <B>/etc/fstab</B>/. The NFS documentation explains these
options in detail. However, I found that with the <B>soft</B> option 
NFS disconnected frequently causing even more problems.

<P>
If you are starting off in the middle of a cycle (i.e. with Incremental
backups) rather than at the beginning (with a Full backup), the <B>bootstrap</B> file will not be immediately valid as it must always have the
information from a Full backup as the first record. If you wish to synchronize
your bootstrap file immediately, you can do so by running a <B>restore</B>
command for the client and selecting a full restore, but when the restore
command asks for confirmation to run the restore Job, you simply reply no,
then copy the bootstrap file that was written to the location specified on the
<B>Write Bootstrap</B> record. The restore bootstrap file can be found in <B>restore.bsr</B> in the working directory that you defined. In the example given
below for the client <B>rufus</B>, my input is shown in bold. Note, the JobId
output has been partially truncated to fit on the page here: 

<P>
<PRE>
(in the Console program)
*restore
First you select one or more JobIds that contain files
to be restored. You will then 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: Cancel
Select item:  (1-6): 5
The defined Client resources are:
     1: Minimatou
     2: Rufus
     3: Timmy
Select Client (File daemon) resource (1-3): 2
The defined FileSet resources are:
     1: Other Files
Item 1 selected automatically.
+-------+------+-------+---------+---------+------+-------+------------+
| JobId | Levl | Files | StrtTim | VolName | File | SesId | VolSesTime |
+-------+------+-------+---------+---------+------+-------+------------+
| 2     | F    | 84    |  ...    | test1   | 0    | 1     | 1035645259 |
+-------+------+-------+---------+---------+------+-------+------------+
You have selected the following JobId: 2
Building directory tree for JobId 2 ...
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: /
$ done
84 files selected to restore.
Run Restore job
JobName:    kernsrestore
Bootstrap:  /home/kern/bacula/working/restore.bsr
Where:      /tmp/bacula-restores
FileSet:    Other Files
Client:     Rufus
Storage:    File
JobId:      *None*
OK to run? (yes/mod/no): no
quit
(in a shell window)
cp ../working/restore.bsr /mnt/deuter/files/backup/rufus.bsr
</PRE>
<P>

<H1><A NAME="SECTION00360000000000000000"></A>
<A NAME="RejectedVolumes"></A>
<BR>
Rejected Volumes After a Crash
</H1>
<A NAME="840"></A>
<A NAME="841"></A>

<P>
Bacula keeps a count of the number of files on each Volume in its Catalog
database so that before appending to a tape, it can verify that the number of
files are correct, and thus prevent overwriting valid data. If the Director or
the Storage daemon crashes before the job has completed, the tape will contain
one more file than is noted in the Catalog, and the next time you attempt to
use the same Volume, Bacula will reject it due to a mismatch between the
physical tape (Volume) and the catalog. 

<P>
The easiest solution to this problem is to label a new tape and start fresh.
If you wish to continue appending to the current tape, you can do so by using
the <B>update</B> command in the console program to change the <B>Volume
Files</B> entry in the catalog. A typical sequence of events would go like the
following: 

<P>
<PRE>
- Bacula crashes
- You restart Bacula
</PRE>
<P>
Bacula then prints: 

<P>
<PRE>
17-Jan-2003 16:45 rufus-dir: Start Backup JobId 13,
                  Job=kernsave.2003-01-17_16.45.46
17-Jan-2003 16:45 rufus-sd: Volume test01 previously written,
                  moving to end of data.
17-Jan-2003 16:46 rufus-sd: kernsave.2003-01-17_16.45.46 Error:
                  I cannot write on this volume because:
                  The number of files mismatch! Volume=11 Catalog=10
17-Jan-2003 16:46 rufus-sd: Job kernsave.2003-01-17_16.45.46 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>
(note, lines wrapped for presentation)
The key here is the line that reads: 

<P>
<PRE>
  The number of files mismatch! Volume=11 Catalog=10
</PRE>
<P>
It says that Bacula found eleven files on the volume, but that the catalog
says there should be ten. When you see this, you can be reasonably sure that
the SD was interrupted while writing before it had a chance to update the
catalog. As a consequence, you can just modify the catalog count to eleven,
and even if the catalog contains references to files saved in file 11,
everything will be OK and nothing will be lost. Note that if the SD had
written several file marks to the volume, the difference between the Volume
count and the Catalog count could be larger than one, but this is unusual. 

<P>
If on the other hand the catalog is marked as having more files than Bacula
found on the tape, you need to consider the possible negative consequences of
modifying the catalog. Please see below for a more complete discussion of
this. 

<P>
Continuing with the example of <B>Volume = 11 Catalog = 10</B>, to enable to
Bacula to append to the tape, you do the following: 

<P>
<PRE>
update
Update choice:
     1: Volume parameters
     2: Pool from resource
     3: Slots from autochanger
Choose catalog item to update (1-3): 1
Defined Pools:
     1: Default
     2: File
Select the Pool (1-2):
+-------+---------+--------+---------+-----------+------+----------+------+-----+
| MedId | VolName | MedTyp | VolStat | VolBytes  | Last | VolReten | Recy | Slt |
+-------+---------+--------+---------+-----------+------+----------+------+-----+
| 1     | test01  | DDS-4  | Error   | 352427156 | ...  | 31536000 | 1    | 0   |
+-------+---------+--------+---------+-----------+------+----------+------+-----+
Enter MediaId or Volume name: 1
</PRE>
<P>
(note table output truncated for presentation) First, you chose to update the
Volume parameters by entering a <B>1</B>. In the volume listing that follows,
notice how the VolStatus is <B>Error</B>. We will correct that after changing
the Volume Files. Continuing, you respond 1, 

<P>
<PRE>
Updating Volume "test01"
Parameters to modify:
     1: Volume Status
     2: Volume Retention Period
     3: Volume Use Duration
     4: Maximum Volume Jobs
     5: Maximum Volume Files
     6: Maximum Volume Bytes
     7: Recycle Flag
     8: Slot
     9: Volume Files
    10: Pool
    11: Done
Select parameter to modify (1-11): 9
Warning changing Volume Files can result
in loss of data on your Volume
Current Volume Files is: 10
Enter new number of Files for Volume: 11
New Volume Files is: 11
Updating Volume "test01"
Parameters to modify:
     1: Volume Status
     2: Volume Retention Period
     3: Volume Use Duration
     4: Maximum Volume Jobs
     5: Maximum Volume Files
     6: Maximum Volume Bytes
     7: Recycle Flag
     8: Slot
     9: Volume Files
    10: Pool
    11: Done
Select parameter to modify (1-10): 1
</PRE>
<P>
Here, you have selected <B>9</B> in order to update the Volume Files, then you
changed it from <B>10</B> to <B>11</B>, and you now answer <B>1</B> to change the
Volume Status. 

<P>
<PRE>
Current Volume status is: Error
Possible Values are:
     1: Append
     2: Archive
     3: Disabled
     4: Full
     5: Used
     6: Read-Only
Choose new Volume Status (1-6): 1
New Volume status is: Append
Updating Volume "test01"
Parameters to modify:
     1: Volume Status
     2: Volume Retention Period
     3: Volume Use Duration
     4: Maximum Volume Jobs
     5: Maximum Volume Files
     6: Maximum Volume Bytes
     7: Recycle Flag
     8: Slot
     9: Volume Files
    10: Pool
    11: Done
Select parameter to modify (1-11): 11
Selection done.
</PRE>
<P>
At this point, you have changed the Volume Files from <B>10</B> to <B>11</B> to
account for the last file that was written but not updated in the database,
and you changed the Volume Status back to <B>Append</B>. 

<P>
This was a lot of words to describe something quite simple. 

<P>
The <B>Volume Files</B> option exists only in version 1.29 and later, and you
should be careful using it. Generally, if you set the value to that which
Bacula said is on the tape, you will be OK, especially if the value is one
more than what is in the catalog. 

<P>
Now lets consider the case: 

<P>
<PRE>
  The number of files mismatch! Volume=10 Catalog=12
</PRE>
<P>
Here the Bacula found fewer files on the volume than what is marked in the
catalog. Now, in this case, you should hesitate a lot before modifying the count
in the catalog, because if you force the catalog from 12 to 10, Bacula will
start writing after the file 10 on the tape, possibly overwriting valid data,
and if you ever try to restore any of the files that the catalog has marked as
saved on Files 11 and 12, all chaos will break out. In this case, you will
probably be better off using a new tape. In fact, you might want to see what
files the catalog claims are actually stored on that Volume, and back them up
to another tape and recycle this tape. 

<P>

<H1><A NAME="SECTION00370000000000000000"></A>
<A NAME="security"></A>
<BR>
Security Considerations
</H1>
<A NAME="871"></A>
<A NAME="872"></A>

<P>
Only the File daemon needs to run with root permission (so that it can access
all files). As a consequence, you may run your Director, Storage daemon, and
MySQL or PostgreSQL database server as non-root processes. Version 1.30 has
the <B>-u</B> and the <B>-g</B> options that allow you to specify a userid and
groupid on the command line to be used after Bacula starts. 

<P>
As of version 1.33, thanks to Dan Langille, it is easier to configure the
Bacula Director and Storage daemon to run as non-root. 

<P>
You should protect the Bacula port addresses (normally 9101, 9102, and 9103)
from outside access by a firewall or other means of protection to prevent
unauthorized use of your daemons. 

<P>
You should ensure that the configuration files are not world readable since
they contain passwords that allow access to the daemons. Anyone who can access
the Director using a console program can restore any file from a backup
Volume. 

<P>
You should protect your Catalog database. If you are using SQLite, make sure
that the working directory is readable only by root (or your Bacula userid),
and ensure that <B>bacula.db</B> has permissions <B>-rw-r<code>--</code>r<code>--</code></B> (i.e. 640) or
more strict. If you are using MySQL or PostgreSQL, please note that the Bacula
setup procedure leaves the database open to anyone. At a minimum, you should
assign the user <B>bacula</B> a userid and add it to your Director's
configuration file in the appropriate Catalog resource. 

<P>
If you use the make_catalog_backup script provided by Bacula, remember that
you should take care when supplying passwords on the command line.  Read the
Backing Up Your Bacula
Database - Security Considerations BackingUpBaculaSecurityConsiderations
section for more information.

<P>

<H1><A NAME="SECTION00380000000000000000"></A>
<A NAME="holiday"></A>
<BR>
Creating Holiday Schedules
</H1>
<A NAME="882"></A>
<A NAME="883"></A>

<P>
If you normally change tapes every day or at least every Friday, but Thursday
is a holiday, you can use a trick proposed by Lutz Kittler to ensure that no
job runs on Thursday so that you can insert Friday's tape and be sure it will
be used on Friday. To do so, define a <B>RunJobBefore</B> script that normally
returns zero, so that the Bacula job will normally continue. You can then
modify the script to return non-zero on any day when you do not want Bacula to
run the job. 

<P>

<H1><A NAME="SECTION00390000000000000000"></A>
<A NAME="autolabel"></A>
<BR>
Automatic Labeling Using Your Autochanger
</H1>
<A NAME="887"></A>
<A NAME="888"></A>

<P>
If you have an autochanger but it does not support barcodes, using a "trick"
you can make Bacula automatically label all the volumes in your autochanger's
magazine. 

<P>
First create a file containing one line for each slot in your autochanger that
has a tape to be labeled. The line will contain the slot number a colon (:)
then the Volume name you want to use. For example, create a file named <B>volume-list</B>, which contains: 

<P>
<PRE>
1:Volume001
2:TestVolume02
5:LastVolume
</PRE>
<P>
The records do not need to be in any order and you don't need to mention all
the slots. Normally, you will have a consistent set of Volume names and a
sequential set of numbers for each slot you want labeled. In the example
above, I've left out slots 3 and 4 just as an example. Now, modify your <B>mtx-changer</B> script and comment out all the lines in the <B>list)</B> case by
putting a # in column 1. Then add the following two lines: 

<P>
<PRE>
  cat &lt;absolute-path&gt;/volume-list
  exit 0
</PRE>
<P>
so that the whole case looks like: 

<P>
<PRE>
  list)
#
# commented out lines
   cat &lt;absolute-path&gt;/volume-list
   exit 0
   ;;
</PRE>
<P>
where you replace absolute-path with the full path to the
volume-list file. Then using the console, you enter the following command: 

<P>
<PRE>
   label barcodes
</PRE>
<P>
and Bacula will proceed to mount the autochanger Volumes in the list and label
them with the Volume names you have supplied. Bacula will think that the list
was provided by the autochanger barcodes, but in reality, it was you who
supplied the barcodes. 

<P>
If it seems to work, when it finishes, enter: 

<P>
<PRE>
   list volumes
</PRE>
<P>
and you should see all the volumes nicely created. 

<P>

<H1><A NAME="SECTION003100000000000000000"></A>
<A NAME="DNS"></A>
<BR>
Backing Up Portables Using DHCP
</H1>
<A NAME="908"></A>
<A NAME="909"></A>

<P>
You may want to backup laptops or portables that are not always connected to
the network. If you are using DHCP to assign an IP address to those machines
when they connect, you will need to use the Dynamic Update capability of DNS
to assign a name to those machines that can be used in the Address field of
the Client resource in the Director's conf file. 

<P>

<H1><A NAME="SECTION003110000000000000000"></A>
<A NAME="Vacation"></A>
<BR>
Going on Vacation
</H1>
<A NAME="912"></A>
<A NAME="913"></A>

<P>
At some point, you may want to be absent for a week or two and you want to
make sure Bacula has enough tape left so that the backups will complete. You
start by doing a <B>list volumes</B> in the Console program: 

<P>
<PRE>
list volumes
 
Using default Catalog name=BackupDB DB=bacula
Pool: Default
+---------+---------------+-----------+-----------+----------------+-
| MediaId | VolumeName    | MediaType | VolStatus |       VolBytes |
+---------+---------------+-----------+-----------+----------------+-
|      23 | DLT-30Nov02   | DLT8000   | Full      | 54,739,278,128 |
|      24 | DLT-21Dec02   | DLT8000   | Full      | 56,331,524,629 |
|      25 | DLT-11Jan03   | DLT8000   | Full      | 67,863,514,895 |
|      26 | DLT-02Feb03   | DLT8000   | Full      | 63,439,314,216 |
|      27 | DLT-03Mar03   | DLT8000   | Full      | 66,022,754,598 |
|      28 | DLT-04Apr03   | DLT8000   | Full      | 60,792,559,924 |
|      29 | DLT-28Apr03   | DLT8000   | Full      | 62,072,494,063 |
|      30 | DLT-17May03   | DLT8000   | Full      | 65,901,767,839 |
|      31 | DLT-07Jun03   | DLT8000   | Used      | 56,558,490,015 |
|      32 | DLT-28Jun03   | DLT8000   | Full      | 64,274,871,265 |
|      33 | DLT-19Jul03   | DLT8000   | Full      | 64,648,749,480 |
|      34 | DLT-08Aug03   | DLT8000   | Full      | 64,293,941,255 |
|      35 | DLT-24Aug03   | DLT8000   | Append    |  9,999,216,782 |
+---------+---------------+-----------+-----------+----------------+
</PRE>
<P>
Note, I have truncated the output for presentation purposes. What is
significant, is that I can see that my current tape has almost 10 Gbytes of
data, and that the average amount of data I get on my tapes is about 60
Gbytes. So if I go on vacation now, I don't need to worry about tape capacity
(at least not for short absences). 

<P>
Equally significant is the fact that I did go on vacation the 28th of June
2003, and when I did the <B>list volumes</B> command, my current tape at that
time, DLT-07Jun03 MediaId 31, had 56.5 Gbytes written. I could see that the
tape would fill shortly. Consequently, I manually marked it as <B>Used</B> and
replaced it with a fresh tape that I labeled as DLT-28Jun03, thus assuring
myself that the backups would all complete without my intervention. 

<P>

<H1><A NAME="SECTION003120000000000000000"></A>
<A NAME="Case"></A>
<BR>
Exclude Files on Windows Regardless of Case
</H1>
<A NAME="921"></A>

<P>
This tip was submitted by Marc Brueckner who wasn't sure of the case of some
of his files on Win32, which is case insensitive. The problem is that Bacula
thinks that <B>/UNIMPORTANT FILES</B> is different from <B>/Unimportant
Files</B>. Marc was aware that the file exclusion permits wild-cards. So, he
specified: 

<P>
<PRE>
"/[Uu][Nn][Ii][Mm][Pp][Oo][Rr][Tt][Aa][Nn][Tt] [Ff][Ii][Ll][Ee][Ss]"
</PRE>
<P>
As a consequence, the above exclude works for files of any case. 

<P>
Please note that this works only in Bacula Exclude statement and not in
Include. 

<P>

<H1><A NAME="SECTION003130000000000000000"></A>
<A NAME="RemoteExecution"></A>
<BR>
Executing Scripts on a Remote Machine
</H1>
<A NAME="928"></A>
<A NAME="929"></A>

<P>
This tip also comes from Marc Brueckner. (Note, this tip is probably outdated
by the addition of <B>ClientRunBeforJob</B> and <B>ClientRunAfterJob</B> Job
records, but the technique still could be useful.) First I thought the "Run
Before Job" statement in the Job-resource is for executing a script on the
remote machine (the machine to be backed up). (Note, this is possible as mentioned
above by using <B>ClientRunBeforJob</B> and <B>ClientRunAfterJob</B>).
It could be useful to execute
scripts on the remote machine e.g. for stopping databases or other services
while doing the backup. (Of course I have to start the services again when the
backup has finished) I found the following solution: Bacula could execute
scripts on the remote machine by using ssh. The authentication is done
automatically using a private key. First you have to generate a keypair. I've
done this by: 

<P>
<PRE>
ssh-keygen -b 4096 -t dsa -f Bacula_key
</PRE>
<P>
This statement may take a little time to run. It creates a public/private key
pair with no passphrase. You could save the keys in /etc/bacula. Now you have
two new files : Bacula_key which contains the private key and Bacula_key.pub
which contains the public key. 

<P>
Now you have to append the Bacula_key.pub file to the file authorized_keys
in the &#92;root&#92;.ssh directory of the remote
machine. Then you have to add (or uncomment) the line 

<P>
<PRE>
AuthorizedKeysFile           %h/.ssh/authorized_keys
</PRE>
<P>
to the sshd_config file on the remote machine. Where the %h stands for the
home-directory of the user (root in this case). 

<P>
Assuming that your sshd is already running on the remote machine, you can now
enter the following on the machine where Bacula runs: 

<P>
<PRE>
ssh -i Bacula_key  -l root &lt;machine-name-or-ip-address&gt; "ls -la"
</PRE>
<P>
This should execute the "ls -la" command on the remote machine. 

<P>
Now you could add lines like the following to your Director's conf file: 

<P>
<PRE>
...
Run Before Job = ssh -i /etc/bacula/Bacula_key 192.168.1.1 \
                 "/etc/init.d/database stop"
Run After Job = ssh -i /etc/bacula/Bacula_key 192.168.1.1 \
                 "/etc/init.d/database start"
...
</PRE>
<P>
Even though Bacula version 1.32 and later has a ClientRunBeforeJob, the ssh method still
could be useful for updating all the Bacula clients on several remote machines
in a single script. 

<P>

<H1><A NAME="SECTION003140000000000000000"></A>
<A NAME="recycle"></A>
<BR>
Recycling All Your Volumes
</H1>
<A NAME="946"></A>
<A NAME="947"></A>

<P>
This tip comes from Phil Stracchino. 

<P>
If you decide to blow away your catalog and start over, the simplest way to
re-add all your prelabeled tapes with a minimum of fuss (provided you don't
care about the data on the tapes) is to add the tape labels using the console
<B>add</B> command, then go into the catalog and manually set the VolStatus of
every tape to <B>Recycle</B>. 

<P>
The SQL command to do this is very simple, either use your vendor's
command line interface (mysql, postgres, sqlite, ...) or use the sql
command in the Bacula console:

<P>
<PRE>
update Media set VolStatus='Recycle';
</PRE>
<P>
Bacula will then ignore the data already stored on the tapes and just re-use
each tape without further objection. 

<P>

<H1><A NAME="SECTION003150000000000000000"></A>
<A NAME="ACLs"></A>
<BR>
Backing up ACLs on ext3 or XFS filesystems
</H1>
<A NAME="954"></A>
<A NAME="955"></A>

<P>
This tip comes from Volker Sauer. 

<P>
Note, this tip was given prior to implementation of ACLs in Bacula (version
1.34.5). It is left here because dumping/displaying ACLs can still be useful
in testing/verifying that Bacula is backing up and restoring your ACLs
properly. Please see the 
aclsupportACLSupport FileSet option in the
configuration chapter of this manual. 

<P>
For example, you could dump the ACLs to a file with a script similar to the
following: 

<P>
<PRE>
#!/bin/sh
BACKUP_DIRS="/foo /bar"
STORE_ACL=/root/acl-backup
umask 077
for i in $BACKUP_DIRS; do
 cd $i /usr/bin/getfacl -R --skip-base .&gt;$STORE_ACL/${i//\//_}
done
</PRE>
<P>
Then use Bacula to backup <B>/root/acl-backup</B>. 

<P>
The ACLs could be restored using Bacula to the <B>/root/acl-backup</B> file,
then restored to your system using: 

<P>
<PRE>
setfacl --restore/root/acl-backup
</PRE>
<P>

<H1><A NAME="SECTION003160000000000000000"></A>
<A NAME="automate"></A>
<BR>
Total Automation of Bacula Tape Handling
</H1>
<A NAME="966"></A>
<A NAME="967"></A>

<P>
This tip was provided by Alexander Kuehn. 

<P>
Baculahttp://www.bacula.org/ is a really nice backup program except
that the manual tape changing requires user interaction with the bacula
console. 

<P>
Fortunately I can fix this.
NOTE!!! This suggestion applies for people who do *NOT* have tape autochangers
and must change tapes manually.!!!!! 

<P>
Bacula supports a variety of tape changers through the use of mtx-changer
scripts/programs. This highly flexible approach allowed me to create 
this shell scripthttp://www.bacula.org/en/rel-manual/mtx-changer.txt which does the following:
Whenever a new tape is required it sends a mail to the operator to insert the
new tape. Then it waits until a tape has been inserted, sends a mail again to
say thank you and let's bacula continue its backup.
So you can schedule and run backups without ever having to log on or see the
console.
To make the whole thing work you need to create a Device resource which looks
something like this ("Archive Device", "Maximum Changer Wait", "Media
Type" and "Label media" may have different values): 

<P>
<PRE>
Device {
   Name=DDS3
   Archive Device = # use yours not mine! ;)/dev/nsa0
   Changer Device = # not really required/dev/nsa0
   Changer Command = "# use this (maybe change the path)!
         /usr/local/bin/mtx-changer %o %a %S"
   Maximum Changer Wait = 3d          # 3 days in seconds
   AutomaticMount = yes;              # mount on start
   AlwaysOpen = yes;                  # keep device locked
   Media Type = DDS3                  # it's just a name
   RemovableMedia = yes;              #
   Offline On Unmount = Yes;          # keep this too
   Label media = Yes;                 #
}
</PRE>
<P>
As the script has to emulate the complete wisdom of a mtx-changer it has an
internal "database" containing where which tape is stored, you can see this on
the following line:

<P>
<PRE>
labels="VOL-0001 VOL-0002 VOL-0003 VOL-0004 VOL-0005 VOL-0006
VOL-0007 VOL-0008 VOL-0009 VOL-0010 VOL-0011 VOL-0012"
</PRE>
<P>
The above should be all on one line, and it effectively tells Bacula that
volume "VOL-0001" is located in slot 1 (which is our lowest slot), that
volume "VOL-0002" is located in slot 2 and so on..
The script also maintains a logfile (/var/log/mtx.log) where you can monitor
its operation.

<P>

<H1><A NAME="SECTION003170000000000000000"></A>
<A NAME="ConcurrentJobs"></A>
<BR>
Running Concurrent Jobs
</H1>
<A NAME="978"></A>
<A NAME="979"></A>
<A NAME="980"></A>

<P>
Bacula can run multiple concurrent jobs, but the default configuration files
do not enable it. Using the <B>Maximum Concurrent Jobs</B> directive, you
can configure how many and which jobs can be run simultaneously. 
The Director's default value for <B>Maximum Concurrent Jobs</B> is "1".

<P>
To initially setup concurrent jobs you need to define <B>Maximum Concurrent Jobs</B> in 
the Director's configuration file (bacula-dir.conf) in the 
Director, Job, Client, and Storage resources.

<P>
Additionally the File daemon, and the Storage daemon each have their own
<B>Maximum Concurrent Jobs</B> directive that sets the overall maximum
number of concurrent jobs the daemon will run.  The default for both the
File daemon and the Storage daemon is "20".

<P>
For example, if you want two different jobs to run simultaneously backing up
the same Client to the same Storage device, they will run concurrently only if
you have set <B>Maximum Concurrent Jobs</B> greater than one in the Director
resource, the Client resource, and the Storage resource in bacula-dir.conf. 

<P>
We recommend that you read the Data
SpoolingSpoolingChapter of this manual first, then test your multiple
concurrent backup including restore testing before you put it into
production.

<P>
Below is a super stripped down bacula-dir.conf file showing you the four
places where the the file must be modified to allow the same job <B>NightlySave</B> to run up to four times concurrently. The change to the Job
resource is not necessary if you want different Jobs to run at the same time,
which is the normal case. 

<P>
<PRE>
#
# Bacula Director Configuration file -- bacula-dir.conf
#
Director {
  Name = rufus-dir
  Maximum Concurrent Jobs = 4
  ...
}
Job {
  Name = "NightlySave"
  Maximum Concurrent Jobs = 4
  Client = rufus-fd
  Storage = File
  ...
}
Client {
  Name = rufus-fd
  Maximum Concurrent Jobs = 4
  ...
}
Storage {
  Name = File
  Maximum Concurrent Jobs = 4
  ...
}
</PRE>
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html280"
  HREF="Testing_Your_Tape_Drive.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html274"
  HREF="Bacula_Problem_Resolution_G.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html268"
  HREF="Bacula_Frequently_Asked_Que.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html276"
  HREF="Contents.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html278"
  HREF="GNU_Free_Documentation_Lice.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html281"
  HREF="Testing_Your_Tape_Drive.html">Testing Your Tape Drive</A>
<B> Up:</B> <A NAME="tex2html275"
  HREF="Bacula_Problem_Resolution_G.html">Bacula Problem Resolution Guide</A>
<B> Previous:</B> <A NAME="tex2html269"
  HREF="Bacula_Frequently_Asked_Que.html">Bacula Frequently Asked Questions</A>
 &nbsp; <B>  <A NAME="tex2html277"
  HREF="Contents.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html279"
  HREF="GNU_Free_Documentation_Lice.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>

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