4 \section*{Getting Started with Bacula}
5 \label{_ChapterStart37}
6 \index[general]{Getting Started with Bacula }
7 \addcontentsline{toc}{section}{Getting Started with Bacula}
9 If you are like me, you want to get Bacula running immediately to get a feel
10 for it, then later you want to go back and read about all the details. This
11 chapter attempts to accomplish just that: get you going quickly without all
12 the details. If you want to skip the section on Pools, Volumes and Labels, you
13 can always come back to it, but please read to the end of this chapter, and in
14 particular follow the instructions for testing your tape drive.
16 We assume that you have managed to build and install Bacula, if not, you might
17 want to first look at the
18 \ilink{System Requirements}{SysReqs} then at the
19 \ilink{Compiling and Installing Bacula}{_ChapterStart17} chapter of
22 \label{JobsandSchedules}
23 \subsection*{Understanding Jobs and Schedules}
24 \index[general]{Jobs!Understanding}
25 \index[general]{Schedules!Understanding}
26 \addcontentsline{toc}{subsection}{Understanding Jobs and Schedules}
28 In order to make Bacula as flexible as possible, the directions given
29 to Bacula are specified in several pieces. The main instruction is the
30 job resource, which defines a job. A backup job generally consists of a
31 FileSet, a Client, a Schedule for one or several types or times of backups,
32 a Pool, as well as additional instructions. Another way of looking
33 at it is the FileSet is what to backup; the Client is who to backup; the
34 Schedule defines when, and the Pool defines where (i.e. what Volume).
36 Typically one FileSet/Client combination will have one corresponding job.
37 Most of the directives, such as FileSets, Pools, Schedules, can be mixed
38 and matched among the jobs. So you might have two different Job
39 definitions (resources) backing up different servers using the same
40 Schedule, the same Fileset (backing up the same directories on 2 machines)
41 and maybe even the same Pools. The Schedule will define what type of
42 backup will run when (e.g Full on Monday, incremental the rest of the
43 week), and when more than one job uses the same schedule, the job priority
44 determines which actually runs first. If you have a lot of jobs, you might
45 want to use JobDefs, where you can set defaults for the jobs, which can
46 then be changed int the job resource, but this saves rewriting the
47 identical parameters for each job. In addition to the FileSets you want to
48 back up, you should also have a job that backs up your catalog.
50 Finally, be aware that in addition to the backup jobs there are
51 restore, verify, and admin jobs, which have different requirements.
53 \ label{PoolsVolsLabels}
54 \ subsection*{Understanding Pools, Volumes and Labels}
55 \ index[general]{Labels!Understanding Pools Volumes and }
56 \ index[general]{Understanding Pools, Volumes and Labels }
57 \ addcontentsline{toc}{subsection}{Understanding Pools, Volumes and Labels}
59 If you have been using a program such as {\bf tar} to backup your system,
60 Pools, Volumes, and labeling may be a bit confusing at first. A Volume is a
61 single physical tape (or possibly a single file) on which Bacula will write
62 your backup data. Pools group together Volumes so that a backup is not
63 restricted to the length of a single Volume (tape). Consequently, rather than
64 explicitly naming Volumes in your Job, you specify a Pool, and Bacula will
65 select the next appendable Volume from the Pool and request you to mount it.
67 Although the basic Pool options are specified in the Director's Pool resource,
68 the {\bf real} Pool is maintained in the Bacula Catalog. It contains
69 information taken from the Pool resource (bacula-dir.conf) as well as
70 information on all the Volumes that have been added to the Pool. Adding
71 Volumes to a Pool is usually done manually with the Console program using the
74 For each Volume, Bacula maintains a fair amount of catalog information such as
75 the first write date/time, the last write date/time, the number of files on
76 the Volume, the number of bytes on the Volume, the number of Mounts, etc.
78 Before Bacula will read or write a Volume, the physical Volume must have a
79 Bacula software label so that Bacula can be sure the correct Volume is
80 mounted. This is usually done using the {\bf label} command in the Console
83 The steps for creating a Pool, adding Volumes to it, and writing software
84 labels to the Volumes, may seem tedious at first, but in fact, they are quite
85 simple to do, and they allow you to use multiple Volumes (rather than being
86 limited to the size of a single tape). Pools also give you significant
87 flexibility in your backup process. For example, you can have a "Daily" Pool
88 of Volumes for Incremental backups and a "Weekly" Pool of Volumes for Full
89 backups. By specifying the appropriate Pool in the daily and weekly backup
90 Jobs, you thereby insure that no daily Job ever writes to a Volume in the
91 Weekly Pool and vice versa, and Bacula will tell you what tape is needed and
94 For more on Pools, see the
95 \ilink{Pool Resource}{PoolResource} section of the Director
96 Configuration chapter, or simply read on, and we will come back to this
99 \subsection*{Setting Up Bacula Configuration Files}
101 \index[general]{Setting Up Bacula Configuration Files }
102 \index[general]{Files!Setting Up Bacula Configuration }
103 \addcontentsline{toc}{subsection}{Setting Up Bacula Configuration Files}
105 After running the appropriate {\bf ./configure} command and doing a {\bf
106 make}, and a {\bf make install}, if this is the first time you are running
107 Bacula, you must create valid configuration files for the Director, the File
108 daemon, the Storage daemon, and the Console programs. If you have followed our
109 recommendations, default configuration files as well as the daemon binaries
110 will be located in your installation directory. In any case, the binaries are
111 found in the directory you specified on the {\bf \verb:--:sbindir} option to the
113 ./configure} command, and the configuration files are found in the directory
114 you specified on the {\bf \verb:--:sysconfdir} option.
116 When initially setting up Bacula you will need to invest a bit of time in
117 modifying the default configuration files to suit your environment. This may
118 entail starting and stopping Bacula a number of times until you get everything
119 right. Please do not despair. Once you have created your configuration files,
120 you will rarely need to change them nor will you stop and start Bacula very
121 often. Most of the work will simply be in changing the tape when it is full.
124 \ilink{Configuring the Console Program}{_ChapterStart36}}
125 \index[general]{Configuring the Console Program }
126 \index[general]{Program!Configuring the Console }
127 \addcontentsline{toc}{subsubsection}{Configuring the Console Program}
129 The Console program is used by the administrator to interact with the Director
130 and to manually start/stop Jobs or to obtain Job status information.
132 The Console configuration file is found in the directory specified on the {\bf
133 \verb:--:sysconfdir} option that you specified on the {\bf ./configure} command
135 by default is named {\bf console.conf}.
137 If you choose to build the GNOME console with the {\bf \verb:--:enable-gnome}
139 you also find a default configuration file for it, named {\bf
142 The same applies to the wxWidgets console, which is build with the {\bf
143 \verb:--:enable-wx-console} option, and the name of the default configuration
145 is, in this case, {\bf wx-console.conf}.
147 Normally, for first time users, no change is needed to these files. Reasonable
151 \ilink{Configuring the Monitor Program}{_MonitorChapter}}
152 \index[general]{Program!Configuring the Monitor }
153 \index[general]{Configuring the Monitor Program }
154 \addcontentsline{toc}{subsubsection}{Configuring the Monitor Program}
156 The Monitor program is typically an icon in the system tray. However, once the
157 icon is expanded into a full window, the administrator or user can obtain
158 status information about the Director or the backup status on the local
159 workstation or any other Bacula daemon that is configured.
161 \addcontentsline{lof}{figure}{Bacula Tray Monitor}
162 \includegraphics{./Bacula-tray-monitor.eps}
164 The image shows a tray-monitor configured for three daemons. By clicking on
165 the radio buttons in the upper left corner of the image, you can see the
166 status for each of the daemons. The image shows the status for the Storage
167 daemon (MainSD) that is currently selected.
169 The Monitor configuration file is found in the directory specified on the {\bf
170 \verb:--:sysconfdir} option that you specified on the {\bf ./configure} command
172 by default is named {\bf tray-monitor.conf}. Normally, for first time users,
173 you just need to change the permission of this file to allow non-root users to
174 run the Monitor, as this application must run as the same user as the
175 graphical environment (don't forget to allow non-root users to execute {\bf
176 bacula-tray-monitor}). This is not a security problem as long as you use the
180 \ilink{Configuring the File daemon}{_ChapterStart25}}
181 \index[general]{Daemon!Configuring the File }
182 \index[general]{Configuring the File daemon }
183 \addcontentsline{toc}{subsubsection}{Configuring the File daemon}
185 The File daemon is a program that runs on each (Client) machine. At the
186 request of the Director, finds the files to be backed up and sends them (their
187 data) to the Storage daemon.
189 The File daemon configuration file is found in the directory specified on
190 the {\bf \verb:--:sysconfdir} option that you specified on the {\bf ./configure}
191 command. By default, the File daemon's configuration file is named {\bf
192 bacula-fd.conf}. Normally, for first time users, no change is needed to this
193 file. Reasonable defaults are set. However, if you are going to back up more
194 than one machine, you will need to install the File daemon with a unique
195 configuration file on each machine to be backed up. The information about each
196 File daemon must appear in the Director's configuration file.
199 \ilink{Configuring the Director}{_ChapterStart40}}
200 \index[general]{Director!Configuring the }
201 \index[general]{Configuring the Director }
202 \addcontentsline{toc}{subsubsection}{Configuring the Director}
204 The Director is the central control program for all the other daemons. It
205 schedules and monitors all jobs to be backed up.
207 The Director configuration file is found in the directory specified on the
208 {\bf \verb:--:sysconfdir} option that you specified on the {\bf ./configure}
209 command. Normally the Director's configuration file is named {\bf bacula-dir.conf}.
211 In general, the only change you must make is modify the FileSet resource so
212 that the {\bf Include} configuration directive contains at least one line with
213 a valid name of a directory (or file) to be saved.
215 If you do not have a DLT tape drive, you will probably want to edit the
216 Storage resource to contain names that are more representative of your actual
217 storage device. You can always use the existing names as you are free to
218 arbitrarily assign them, but they must agree with the corresponding names in
219 the Storage daemon's configuration file.
221 You may also want to change the email address for notification from the
222 default {\bf root} to your email address.
224 Finally, if you have multiple systems to be backed up, you will need a
225 separate File daemon or Client specification for each system, specifying its
226 name, address, and password. We have found that giving your daemons the same
227 name as your system but post fixed with {\bf -fd} helps a lot in debugging.
228 That is, if your system name is {\bf foobaz}, you would give the File daemon
229 the name {\bf foobaz-fd}. For the Director, you should use {\bf foobaz-dir},
230 and for the storage daemon, you might use {\bf foobaz-sd}.
231 Each of your Bacula components {\bf must} have a unique name. If you
232 make them all the same, aside fromt the fact that you will not
233 know what daemon is sending what message, if they share the same
234 working directory, the daemons temporary file names will not
235 be unique, and you will get many strange failures.
238 \ilink{Configuring the Storage daemon}{_ChapterStart31}}
239 \index[general]{Daemon!Configuring the Storage }
240 \index[general]{Configuring the Storage daemon }
241 \addcontentsline{toc}{subsubsection}{Configuring the Storage daemon}
243 The Storage daemon is responsible, at the Director's request, for accepting
244 data from a File daemon and placing it on Storage media, or in the case of a
245 restore request, to find the data and send it to the File daemon.
247 The Storage daemon's configuration file is found in the directory specified on
248 the {\bf \verb:--:sysconfdir} option that you specified on the {\bf ./configure}
249 command. By default, the Storage daemon's file is named {\bf bacula-sd.conf}.
250 Edit this file to contain the correct Archive device names for any tape
251 devices that you have. If the configuration process properly detected your
252 system, they will already be correctly set. These Storage resource name and
253 Media Type must be the same as the corresponding ones in the Director's
254 configuration file {\bf bacula-dir.conf}. If you want to backup to a file
255 instead of a tape, the Archive device must point to a directory in which the
256 Volumes will be created as files when you label the Volume.
257 \label{ConfigTesting}
259 \subsection*{Testing your Configuration Files}
260 \index[general]{Testing your Configuration Files }
261 \index[general]{Files!Testing your Configuration }
262 \addcontentsline{toc}{subsection}{Testing your Configuration Files}
264 You can test if your configuration file is syntactically correct by running
265 the appropriate daemon with the {\bf -t} option. The daemon will process the
266 configuration file and print any error messages then terminate. For example,
267 assuming you have installed your binaries and configuration files in the same
272 cd <installation-directory>
273 ./bacula-dir -t -c bacula-dir.conf
274 ./bacula-fd -t -c bacula-fd.conf
275 ./bacula-sd -t -c bacula-sd.conf
276 ./bconsole -t -c bconsole.conf
277 ./gnome-console -t -c gnome-console.conf
278 ./wx-console -t -c wx-console.conf
279 su <normal user> -c "./bacula-tray-monitor -t -c tray-monitor.conf"
283 will test the configuration files of each of the main programs. If the
284 configuration file is OK, the program will terminate without printing
285 anything. Please note that, depending on the configure options you choose,
286 some, or even all, of the three last commands will not be available on your
287 system. If you have installed the binaries in traditional Unix locations
288 rather than a single file, you will need to modify the above commands
289 appropriately (no ./ in front of the command name, and a path in front of the
293 \subsection*{Testing Bacula Compatibility with Your Tape Drive}
294 \index[general]{Drive!Testing Bacula Compatibility with Your Tape }
295 \index[general]{Testing Bacula Compatibility with Your Tape Drive }
296 \addcontentsline{toc}{subsection}{Testing Bacula Compatibility with Your Tape
299 Before spending a lot of time on Bacula only to find that it doesn't work
300 with your tape drive, please read the \ilink{btape -- Testing Your Tape
301 Drive}{_ChapterStart27} chapter of this manual. If you have a modern
302 standard SCSI tape drive on a Linux or Solaris, most likely it will work,
303 but better test than be sorry. For FreeBSD (and probably other xBSD
304 flavors), reading the above mentioned tape testing chapter is a must.
305 Also, for FreeBSD, please see \elink{The FreeBSD
306 Diary}{http://www.freebsddiary.org/bacula.php} for a detailed description
307 on how to make Bacula work on your system. In addition, users of FreeBSD
308 prior to 4.9-STABLE dated Mon Dec 29 15:18:01 2003 UTC who plan to use tape
309 devices, please see the file {\bf platforms/freebsd/pthreads-fix.txt} in
310 the main Bacula directory concerning important information concerning
311 compatibility of Bacula and your system. \label{notls}
313 \subsection*{Get Rid of the /lib/tls Directory}
314 \index[general]{Directory!Get Rid of the /lib/tls }
315 \index[general]{Get Rid of the /lib/tls Directory }
316 \addcontentsline{toc}{subsection}{Get Rid of the /lib/tls Directory}
318 The new pthreads library {\bf /lib/tls} installed by default on recent Red Hat
319 systems running kernel 2.4.x is defective. You must remove it or rename it,
320 then reboot your system before running Bacula otherwise after a week or so of
321 running, Bacula will either block for long periods or deadlock entirely.
322 You may want to use the loader environment variable override rather
323 than removing /lib/tls. Please see \ilink{ Supported Operating
324 Systems}{SupportedOSes} for more
325 information on this problem.
327 This problem does not seem to occur on systems running 2.6.x kernels.
331 \subsection*{Running Bacula}
332 \index[general]{Bacula!Running }
333 \index[general]{Running Bacula }
334 \addcontentsline{toc}{subsection}{Running Bacula}
336 Probably the most important part of running Bacula is being able to restore
337 files. If you haven't tried recovering files at least once, when you actually
338 have to do it, you will be under a lot more pressure, and prone to make
339 errors, than if you had already tried it once.
341 To get a good idea how to use Bacula in a short time, we {\bf strongly}
342 recommend that you follow the example in the
343 \ilink{Running Bacula Chapter}{_ChapterStart1} of this manual where
344 you will get detailed instructions on how to run Bacula.
346 \subsection*{Log Rotation}
347 \index[general]{Rotation!Log }
348 \index[general]{Log Rotation }
349 \addcontentsline{toc}{subsection}{Log Rotation}
350 If you use the default {\bf bacula-dir.conf} or some variation of it, you will
351 note that it logs all the Bacula output to a file. To avoid that this file
352 grows without limit, we recommend that you copy the file {\bf logrotate} from
353 the {\bf scripts/logrotate} to {\bf /etc/logrotate.d/bacula}. This will cause
354 the log file to be rotated once a month and kept for a maximum of 5 months.
355 You may want to edit this file to change the default log rotation preferences.
357 \subsection*{Log Watch}
358 \index[general]{Watch!Log}
359 \index[general]{Log Watch}
360 \addcontentsline{toc}{subsection}{Log Watch}
361 Some systems such as RedHat and Fedora run the logwatch program
362 every night, which does an analysis of your log file and sends an
363 email report. If you wish to include the output from your Bacula
364 jobs in that report, please look in the {\bf scripts/logwatch}
365 directory. The {\bf README} file in that directory gives a brief
366 explanation on how to install it and what kind of output to expect.
369 \subsection*{Disaster Recovery}
370 \index[general]{Recovery!Disaster }
371 \index[general]{Disaster Recovery }
372 \addcontentsline{toc}{subsection}{Disaster Recovery}
374 If you intend to use Bacula as a disaster recovery tool rather than simply a
375 program to restore lost or damaged files, you will want to read the
376 \ilink{Disaster Recovery Using Bacula Chapter}{_ChapterStart38} of
379 In any case, you are strongly urged to carefully test restoring some files
380 that you have saved rather than wait until disaster strikes. This way, you