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
106 a {\bf make}, and a {\bf make install}, if this is the first time
107 you are running Bacula, you must create valid configuration files
108 for the Director, the File daemon, the Storage daemon, and the
109 Console programs. If you have followed our recommendations,
110 default configuration files as well as the daemon binaries will
111 be located in your installation directory. In any case, the
112 binaries are found in the directory you specified on the {\bf
113 \verb:--:sbindir} option to the {\bf ./configure} command, and
114 the configuration files are found in the directory you specified
115 on the {\bf \verb:--:sysconfdir} option.
117 When initially setting up Bacula you will need to invest a bit of time in
118 modifying the default configuration files to suit your environment. This may
119 entail starting and stopping Bacula a number of times until you get everything
120 right. Please do not despair. Once you have created your configuration files,
121 you will rarely need to change them nor will you stop and start Bacula very
122 often. Most of the work will simply be in changing the tape when it is full.
125 \ilink{Configuring the Console Program}{_ChapterStart36}}
126 \index[general]{Configuring the Console Program }
127 \index[general]{Program!Configuring the Console }
128 \addcontentsline{toc}{subsubsection}{Configuring the Console Program}
130 The Console program is used by the administrator to interact with the Director
131 and to manually start/stop Jobs or to obtain Job status information.
133 The Console configuration file is found in the directory specified on the {\bf
134 \verb:--:sysconfdir} option that you specified on the {\bf ./configure} command
136 by default is named {\bf console.conf}.
138 If you choose to build the GNOME console with the {\bf \verb:--:enable-gnome}
140 you also find a default configuration file for it, named {\bf
143 The same applies to the wxWidgets console, which is build with the {\bf
144 \verb:--:enable-wx-console} option, and the name of the default configuration
146 is, in this case, {\bf wx-console.conf}.
148 Normally, for first time users, no change is needed to these files. Reasonable
152 \ilink{Configuring the Monitor Program}{_MonitorChapter}}
153 \index[general]{Program!Configuring the Monitor }
154 \index[general]{Configuring the Monitor Program }
155 \addcontentsline{toc}{subsubsection}{Configuring the Monitor Program}
157 The Monitor program is typically an icon in the system tray. However, once the
158 icon is expanded into a full window, the administrator or user can obtain
159 status information about the Director or the backup status on the local
160 workstation or any other Bacula daemon that is configured.
162 \addcontentsline{lof}{figure}{Bacula Tray Monitor}
163 \includegraphics{./Bacula-tray-monitor.eps}
165 The image shows a tray-monitor configured for three daemons. By clicking on
166 the radio buttons in the upper left corner of the image, you can see the
167 status for each of the daemons. The image shows the status for the Storage
168 daemon (MainSD) that is currently selected.
170 The Monitor configuration file is found in the directory specified on the {\bf
171 \verb:--:sysconfdir} option that you specified on the {\bf ./configure} command
173 by default is named {\bf tray-monitor.conf}. Normally, for first time users,
174 you just need to change the permission of this file to allow non-root users to
175 run the Monitor, as this application must run as the same user as the
176 graphical environment (don't forget to allow non-root users to execute {\bf
177 bacula-tray-monitor}). This is not a security problem as long as you use the
181 \ilink{Configuring the File daemon}{_ChapterStart25}}
182 \index[general]{Daemon!Configuring the File }
183 \index[general]{Configuring the File daemon }
184 \addcontentsline{toc}{subsubsection}{Configuring the File daemon}
186 The File daemon is a program that runs on each (Client) machine. At the
187 request of the Director, finds the files to be backed up and sends them (their
188 data) to the Storage daemon.
190 The File daemon configuration file is found in the directory specified on
191 the {\bf \verb:--:sysconfdir} option that you specified on the {\bf ./configure}
192 command. By default, the File daemon's configuration file is named {\bf
193 bacula-fd.conf}. Normally, for first time users, no change is needed to this
194 file. Reasonable defaults are set. However, if you are going to back up more
195 than one machine, you will need to install the File daemon with a unique
196 configuration file on each machine to be backed up. The information about each
197 File daemon must appear in the Director's configuration file.
200 \ilink{Configuring the Director}{_ChapterStart40}}
201 \index[general]{Director!Configuring the }
202 \index[general]{Configuring the Director }
203 \addcontentsline{toc}{subsubsection}{Configuring the Director}
205 The Director is the central control program for all the other daemons. It
206 schedules and monitors all jobs to be backed up.
208 The Director configuration file is found in the directory specified on the
209 {\bf \verb:--:sysconfdir} option that you specified on the {\bf ./configure}
210 command. Normally the Director's configuration file is named {\bf bacula-dir.conf}.
212 In general, the only change you must make is modify the FileSet resource so
213 that the {\bf Include} configuration directive contains at least one line with
214 a valid name of a directory (or file) to be saved.
216 If you do not have a DLT tape drive, you will probably want to edit the
217 Storage resource to contain names that are more representative of your actual
218 storage device. You can always use the existing names as you are free to
219 arbitrarily assign them, but they must agree with the corresponding names in
220 the Storage daemon's configuration file.
222 You may also want to change the email address for notification from the
223 default {\bf root} to your email address.
225 Finally, if you have multiple systems to be backed up, you will need a
226 separate File daemon or Client specification for each system, specifying its
227 name, address, and password. We have found that giving your daemons the same
228 name as your system but post fixed with {\bf -fd} helps a lot in debugging.
229 That is, if your system name is {\bf foobaz}, you would give the File daemon
230 the name {\bf foobaz-fd}. For the Director, you should use {\bf foobaz-dir},
231 and for the storage daemon, you might use {\bf foobaz-sd}.
232 Each of your Bacula components {\bf must} have a unique name. If you
233 make them all the same, aside from the fact that you will not
234 know what daemon is sending what message, if they share the same
235 working directory, the daemons temporary file names will not
236 be unique, and you will get many strange failures.
239 \ilink{Configuring the Storage daemon}{_ChapterStart31}}
240 \index[general]{Daemon!Configuring the Storage }
241 \index[general]{Configuring the Storage daemon }
242 \addcontentsline{toc}{subsubsection}{Configuring the Storage daemon}
244 The Storage daemon is responsible, at the Director's request, for accepting
245 data from a File daemon and placing it on Storage media, or in the case of a
246 restore request, to find the data and send it to the File daemon.
248 The Storage daemon's configuration file is found in the directory specified on
249 the {\bf \verb:--:sysconfdir} option that you specified on the {\bf ./configure}
250 command. By default, the Storage daemon's file is named {\bf bacula-sd.conf}.
251 Edit this file to contain the correct Archive device names for any tape
252 devices that you have. If the configuration process properly detected your
253 system, they will already be correctly set. These Storage resource name and
254 Media Type must be the same as the corresponding ones in the Director's
255 configuration file {\bf bacula-dir.conf}. If you want to backup to a file
256 instead of a tape, the Archive device must point to a directory in which the
257 Volumes will be created as files when you label the Volume.
258 \label{ConfigTesting}
260 \subsection*{Testing your Configuration Files}
261 \index[general]{Testing your Configuration Files }
262 \index[general]{Files!Testing your Configuration }
263 \addcontentsline{toc}{subsection}{Testing your Configuration Files}
265 You can test if your configuration file is syntactically correct by running
266 the appropriate daemon with the {\bf -t} option. The daemon will process the
267 configuration file and print any error messages then terminate. For example,
268 assuming you have installed your binaries and configuration files in the same
273 cd <installation-directory>
274 ./bacula-dir -t -c bacula-dir.conf
275 ./bacula-fd -t -c bacula-fd.conf
276 ./bacula-sd -t -c bacula-sd.conf
277 ./bconsole -t -c bconsole.conf
278 ./gnome-console -t -c gnome-console.conf
279 ./wx-console -t -c wx-console.conf
280 su <normal user> -c "./bacula-tray-monitor -t -c tray-monitor.conf"
284 will test the configuration files of each of the main programs. If the
285 configuration file is OK, the program will terminate without printing
286 anything. Please note that, depending on the configure options you choose,
287 some, or even all, of the three last commands will not be available on your
288 system. If you have installed the binaries in traditional Unix locations
289 rather than a single file, you will need to modify the above commands
290 appropriately (no ./ in front of the command name, and a path in front of the
294 \subsection*{Testing Bacula Compatibility with Your Tape Drive}
295 \index[general]{Drive!Testing Bacula Compatibility with Your Tape }
296 \index[general]{Testing Bacula Compatibility with Your Tape Drive }
297 \addcontentsline{toc}{subsection}{Testing Bacula Compatibility with Your Tape
300 Before spending a lot of time on Bacula only to find that it doesn't work
301 with your tape drive, please read the \ilink{btape -- Testing Your Tape
302 Drive}{_ChapterStart27} chapter of this manual. If you have a modern
303 standard SCSI tape drive on a Linux or Solaris, most likely it will work,
304 but better test than be sorry. For FreeBSD (and probably other xBSD
305 flavors), reading the above mentioned tape testing chapter is a must.
306 Also, for FreeBSD, please see \elink{The FreeBSD
307 Diary}{http://www.freebsddiary.org/bacula.php} for a detailed description
308 on how to make Bacula work on your system. In addition, users of FreeBSD
309 prior to 4.9-STABLE dated Mon Dec 29 15:18:01 2003 UTC who plan to use tape
310 devices, please see the file {\bf platforms/freebsd/pthreads-fix.txt} in
311 the main Bacula directory concerning important information concerning
312 compatibility of Bacula and your system. \label{notls}
314 \subsection*{Get Rid of the /lib/tls Directory}
315 \index[general]{Directory!Get Rid of the /lib/tls }
316 \index[general]{Get Rid of the /lib/tls Directory }
317 \addcontentsline{toc}{subsection}{Get Rid of the /lib/tls Directory}
319 The new pthreads library {\bf /lib/tls} installed by default on recent Red Hat
320 systems running kernel 2.4.x is defective. You must remove it or rename it,
321 then reboot your system before running Bacula otherwise after a week or so of
322 running, Bacula will either block for long periods or deadlock entirely.
323 You may want to use the loader environment variable override rather
324 than removing /lib/tls. Please see \ilink{ Supported Operating
325 Systems}{SupportedOSes} for more
326 information on this problem.
328 This problem does not seem to occur on systems running 2.6.x kernels.
332 \subsection*{Running Bacula}
333 \index[general]{Bacula!Running }
334 \index[general]{Running Bacula }
335 \addcontentsline{toc}{subsection}{Running Bacula}
337 Probably the most important part of running Bacula is being able to restore
338 files. If you haven't tried recovering files at least once, when you actually
339 have to do it, you will be under a lot more pressure, and prone to make
340 errors, than if you had already tried it once.
342 To get a good idea how to use Bacula in a short time, we {\bf strongly}
343 recommend that you follow the example in the
344 \ilink{Running Bacula Chapter}{_ChapterStart1} of this manual where
345 you will get detailed instructions on how to run Bacula.
347 \subsection*{Log Rotation}
348 \index[general]{Rotation!Log }
349 \index[general]{Log Rotation }
350 \addcontentsline{toc}{subsection}{Log Rotation}
351 If you use the default {\bf bacula-dir.conf} or some variation of it, you will
352 note that it logs all the Bacula output to a file. To avoid that this file
353 grows without limit, we recommend that you copy the file {\bf logrotate} from
354 the {\bf scripts/logrotate} to {\bf /etc/logrotate.d/bacula}. This will cause
355 the log file to be rotated once a month and kept for a maximum of 5 months.
356 You may want to edit this file to change the default log rotation preferences.
358 \subsection*{Log Watch}
359 \index[general]{Watch!Log}
360 \index[general]{Log Watch}
361 \addcontentsline{toc}{subsection}{Log Watch}
362 Some systems such as RedHat and Fedora run the logwatch program
363 every night, which does an analysis of your log file and sends an
364 email report. If you wish to include the output from your Bacula
365 jobs in that report, please look in the {\bf scripts/logwatch}
366 directory. The {\bf README} file in that directory gives a brief
367 explanation on how to install it and what kind of output to expect.
370 \subsection*{Disaster Recovery}
371 \index[general]{Recovery!Disaster }
372 \index[general]{Disaster Recovery }
373 \addcontentsline{toc}{subsection}{Disaster Recovery}
375 If you intend to use Bacula as a disaster recovery tool rather than simply a
376 program to restore lost or damaged files, you will want to read the
377 \ilink{Disaster Recovery Using Bacula Chapter}{_ChapterRescue} of
380 In any case, you are strongly urged to carefully test restoring some files
381 that you have saved rather than wait until disaster strikes. This way, you