| 1 |
\chapter{Getting Started with \bacula{}} |
| 2 |
\label{blb:QuickStartChapter} |
| 3 |
\index[general]{Getting Started with \bacula{} } |
| 4 |
|
| 5 |
If you are like me, you want to get \bacula{} running immediately to get a feel |
| 6 |
for it, then later you want to go back and read about all the details. This |
| 7 |
chapter attempts to accomplish just that: get you going quickly without all |
| 8 |
the details. If you want to skip the section on Pools, Volumes and Labels, you |
| 9 |
can always come back to it, but please read to the end of this chapter, and in |
| 10 |
particular follow the instructions for testing your tape drive. |
| 11 |
|
| 12 |
We assume that you have managed to build and install \bacula{}, if not, you might |
| 13 |
want to first look at the |
| 14 |
\bilink{System Requirements}{blb:SysReqs} then at the |
| 15 |
\bilink{Compiling and Installing \bacula{}}{blb:InstallChapter} chapter of |
| 16 |
this manual. |
| 17 |
|
| 18 |
\label{blb:JobsandSchedules} |
| 19 |
\section{Understanding Jobs and Schedules} |
| 20 |
\index[general]{Jobs!Understanding} |
| 21 |
\index[general]{Schedules!Understanding} |
| 22 |
|
| 23 |
In order to make \bacula{} as flexible as possible, the directions given |
| 24 |
to \bacula{} are specified in several pieces. The main instruction is the |
| 25 |
job resource, which defines a job. A backup job generally consists of a |
| 26 |
FileSet, a Client, a Schedule for one or several levels or times of backups, |
| 27 |
a Pool, as well as additional instructions. Another way of looking |
| 28 |
at it is the FileSet is what to backup; the Client is who to backup; the |
| 29 |
Schedule defines when, and the Pool defines where (i.e. what Volume). |
| 30 |
|
| 31 |
Typically one FileSet/Client combination will have one corresponding job. |
| 32 |
Most of the directives, such as FileSets, Pools, Schedules, can be mixed |
| 33 |
and matched among the jobs. So you might have two different Job |
| 34 |
definitions (resources) backing up different servers using the same |
| 35 |
Schedule, the same Fileset (backing up the same directories on two machines) |
| 36 |
and maybe even the same Pools. The Schedule will define what type of |
| 37 |
backup will run when (e.g. Full on Monday, incremental the rest of the |
| 38 |
week), and when more than one job uses the same schedule, the job priority |
| 39 |
determines which actually runs first. If you have a lot of jobs, you might |
| 40 |
want to use JobDefs, where you can set defaults for the jobs, which can |
| 41 |
then be changed in the job resource, but this saves rewriting the |
| 42 |
identical parameters for each job. In addition to the FileSets you want to |
| 43 |
back up, you should also have a job that backs up your catalog. |
| 44 |
|
| 45 |
Finally, be aware that in addition to the backup jobs there are |
| 46 |
restore, verify, and admin jobs, which have different requirements. |
| 47 |
|
| 48 |
\label{blb:PoolsVolsLabels} |
| 49 |
\section{Understanding Pools, Volumes and Labels} |
| 50 |
\index[general]{Labels!Understanding Pools Volumes and } |
| 51 |
\index[general]{Understanding Pools, Volumes and Labels } |
| 52 |
|
| 53 |
If you have been using a program such as \tar{} to backup your system, |
| 54 |
Pools, Volumes, and labeling may be a bit confusing at first. A Volume is a |
| 55 |
single physical tape (or possibly a single file) on which \bacula{} will write |
| 56 |
your backup data. Pools group together Volumes so that a backup is not |
| 57 |
restricted to the length of a single Volume (tape). Consequently, rather than |
| 58 |
explicitly naming Volumes in your Job, you specify a Pool, and \bacula{} will |
| 59 |
select the next appendable Volume from the Pool and request you to mount it. |
| 60 |
% TODO: can't it mount it itself if already available? |
| 61 |
|
| 62 |
Although the basic Pool options are specified in the Director's Pool resource, |
| 63 |
the \textbf{real} Pool is maintained in the \bacula{} Catalog. It contains |
| 64 |
information taken from the Pool resource (bacula-dir.conf) as well as |
| 65 |
information on all the Volumes that have been added to the Pool. Adding |
| 66 |
Volumes to a Pool is usually done manually with the Console program using the |
| 67 |
\bcommandname{label} command. |
| 68 |
|
| 69 |
For each Volume, \bacula{} maintains a fair amount of catalog information such as |
| 70 |
the first write date/time, the last write date/time, the number of files on |
| 71 |
the Volume, the number of bytes on the Volume, the number of Mounts, etc. |
| 72 |
|
| 73 |
Before \bacula{} will read or write a Volume, the physical Volume must have a |
| 74 |
\bacula{} software label so that \bacula{} can be sure the correct Volume is |
| 75 |
mounted. This is usually done using the \bcommandname{label} command in the Console |
| 76 |
program. |
| 77 |
|
| 78 |
The steps for creating a Pool, adding Volumes to it, and writing software |
| 79 |
labels to the Volumes, may seem tedious at first, but in fact, they are quite |
| 80 |
simple to do, and they allow you to use multiple Volumes (rather than being |
| 81 |
limited to the size of a single tape). Pools also give you significant |
| 82 |
flexibility in your backup process. For example, you can have a "Daily" Pool |
| 83 |
of Volumes for Incremental backups and a "Weekly" Pool of Volumes for Full |
| 84 |
backups. By specifying the appropriate Pool in the daily and weekly backup |
| 85 |
Jobs, you thereby insure that no daily Job ever writes to a Volume in the |
| 86 |
Weekly Pool and vice versa, and \bacula{} will tell you what tape is needed and |
| 87 |
when. |
| 88 |
|
| 89 |
For more on Pools, see the |
| 90 |
\bilink{Pool Resource}{blb:PoolResource} section of the Director |
| 91 |
Configuration chapter, or simply read on, and we will come back to this |
| 92 |
subject later. |
| 93 |
|
| 94 |
\section{Setting Up \bacula{} Configuration Files} |
| 95 |
\label{blb:config} |
| 96 |
\index[general]{Setting Up \bacula{} Configuration Files } |
| 97 |
\index[general]{Files!Setting Up \bacula{} Configuration } |
| 98 |
|
| 99 |
Normally, if you are using the \bacula{} Enterprise version, you |
| 100 |
will install it from packages (.deb, .rpm, .pkg, .dmg, ...), |
| 101 |
in which case, default configuration files will already be |
| 102 |
setup in \bdirectoryname{/opt/bacula/etc}. However, you will need to |
| 103 |
reconfigure these files to correspond to your production |
| 104 |
environment including adding definitions of additional |
| 105 |
Client machines to be backed up. |
| 106 |
|
| 107 |
When initially setting up \bacula{} you will need to invest a bit of time in |
| 108 |
modifying the default configuration files to suit your environment. This may |
| 109 |
entail starting and stopping \bacula{} a number of times until you get everything |
| 110 |
right. Please do not despair. Once you have created your production |
| 111 |
configuration files, you will rarely need to change them nor will you stop |
| 112 |
and start \bacula{} very often. Most of the work will simply be in |
| 113 |
monitoring that there is sufficient disk space or tapes available and that |
| 114 |
no jobs are failing. |
| 115 |
|
| 116 |
\subsection{Configuring the Console Program} |
| 117 |
\index[general]{Configuring the Console Program } |
| 118 |
\index[general]{Program!Configuring the Console } |
| 119 |
|
| 120 |
The Console program is used by the administrator to interact with the Director |
| 121 |
and to manually start/stop Jobs or to obtain Job status information. |
| 122 |
|
| 123 |
The Console configuration file is found in the directory specified on the |
| 124 |
\textbf{{-}{-}sysconfdir} option that you specified on the \btool{./configure} |
| 125 |
command and by default is named \bfilename{bconsole.conf}. |
| 126 |
|
| 127 |
The same applies to the wxWidgets console, which is build with the |
| 128 |
\textbf{{-}{-}enable-bwx-console} option, and the name of the default |
| 129 |
configuration file is, in this case, \bfilename{bwx-console.conf}. |
| 130 |
|
| 131 |
Normally, for first time users, no change is needed to these files. Reasonable |
| 132 |
defaults are set. |
| 133 |
|
| 134 |
Further details are in the |
| 135 |
\bilink{Console configuration}{blb:ConsoleConfChapter} chapter. |
| 136 |
|
| 137 |
\subsection{Configuring the File daemon} |
| 138 |
\index[general]{Daemon!Configuring the File } |
| 139 |
\index[general]{Configuring the File daemon } |
| 140 |
|
| 141 |
The File daemon is a program that runs on each (Client) machine. At the |
| 142 |
request of the Director, finds the files to be backed up and sends them (their |
| 143 |
data) to the Storage daemon. |
| 144 |
|
| 145 |
The File daemon configuration file is found in the directory specified on |
| 146 |
the \textbf{{-}{-}sysconfdir} option that you specified on the \btool{./configure} |
| 147 |
command. By default, the File daemon's configuration file is named |
| 148 |
\bfilename{bacula-fd.conf}. Normally, for first time users, no change is needed to this |
| 149 |
file. Reasonable defaults are set. However, if you are going to back up more |
| 150 |
than one machine, you will need to install the File daemon with a unique |
| 151 |
configuration file on each machine to be backed up. The information about each |
| 152 |
File daemon must appear in the Director's configuration file. |
| 153 |
% TODO: point to section about how to install just the File daemon |
| 154 |
% TODO: and creating the unique configuration file. |
| 155 |
|
| 156 |
Further details are in the |
| 157 |
\bilink{File daemon configuration}{blb:FiledConfChapter} chapter. |
| 158 |
|
| 159 |
\subsection{Configuring the Director} |
| 160 |
\index[general]{Director!Configuring the } |
| 161 |
\index[general]{Configuring the Director } |
| 162 |
|
| 163 |
The Director is the central control program for all the other daemons. It |
| 164 |
schedules and monitors all jobs to be backed up. |
| 165 |
|
| 166 |
The Director configuration file is found in the directory specified on the |
| 167 |
\textbf{{-}{-}sysconfdir} option that you specified on the \btool{./configure} |
| 168 |
command. Normally the Director's configuration file is named \bfilename{bacula-dir.conf}. |
| 169 |
|
| 170 |
In general, the only change you must make is modify the FileSet resource so |
| 171 |
that the \textbf{Include} configuration directive contains at least one line with |
| 172 |
a valid name of a directory (or file) to be saved. |
| 173 |
|
| 174 |
% TODO: is DLT still the default config? |
| 175 |
If you do not have a DLT tape drive, you will probably want to edit the |
| 176 |
Storage resource to contain names that are more representative of your actual |
| 177 |
storage device. You can always use the existing names as you are free to |
| 178 |
arbitrarily assign them, but they must agree with the corresponding names in |
| 179 |
the Storage daemon's configuration file. |
| 180 |
|
| 181 |
You may also want to change the email address for notification from the |
| 182 |
default \textbf{root} to your email address. |
| 183 |
|
| 184 |
Finally, if you have multiple systems to be backed up, you will need a |
| 185 |
separate File daemon or Client specification for each system, specifying its |
| 186 |
% TODO: I don't see any example "File" configuraton in the default |
| 187 |
% TODO: bacula-dir.conf; I do see FileDaemon config in the default |
| 188 |
% TODO: bacula-fd.conf. Be more clear about this or point to explanation |
| 189 |
% TODO: about this. |
| 190 |
name, address, and password. We have found that giving your daemons the same |
| 191 |
% TODO: what passwords should I use? I have different ones in the |
| 192 |
% TODO: different configs on different systems. Point to explanation of |
| 193 |
% this. |
| 194 |
name as your system but post fixed with \textbf{-fd} helps a lot in debugging. |
| 195 |
That is, if your system name is \textbf{foobaz}, you would give the File daemon |
| 196 |
the name \textbf{foobaz-fd}. For the Director, you should use \textbf{foobaz-dir}, |
| 197 |
and for the storage daemon, you might use \textbf{foobaz-sd}. |
| 198 |
Each of your \bacula{} components \textbf{must} have a unique name. If you |
| 199 |
make them all the same, aside from the fact that you will not |
| 200 |
know what daemon is sending what message, if they share the same |
| 201 |
working directory, the daemons temporary file names will not |
| 202 |
be unique, and you will get many strange failures. |
| 203 |
% TODO: why not check for that and not allow sharing working directory? |
| 204 |
|
| 205 |
More information is in the |
| 206 |
\bilink{Director configuration}{blb:DirectorChapter} chapter. |
| 207 |
|
| 208 |
\subsection{Configuring the Storage daemon} |
| 209 |
\index[general]{Daemon!Configuring the Storage } |
| 210 |
\index[general]{Configuring the Storage daemon } |
| 211 |
|
| 212 |
The Storage daemon is responsible, at the Director's request, for accepting |
| 213 |
data from a File daemon and placing it on Storage media, or in the case of a |
| 214 |
restore request, to find the data and send it to the File daemon. |
| 215 |
|
| 216 |
The Storage daemon's configuration file is found in the directory specified on |
| 217 |
the \textbf{{-}{-}sysconfdir} option that you specified on the \btool{./configure} |
| 218 |
command. By default, the Storage daemon's file is named \bfilename{bacula-sd.conf}. |
| 219 |
Edit this file to contain the correct Archive device names for any tape |
| 220 |
devices that you have. If the configuration process properly detected your |
| 221 |
system, they will already be correctly set. These Storage resource name and |
| 222 |
Media Type must be the same as the corresponding ones in the Director's |
| 223 |
configuration file \bfilename{bacula-dir.conf}. If you want to backup to a file |
| 224 |
instead of a tape, the Archive device must point to a directory in which the |
| 225 |
Volumes will be created as files when you label the Volume. |
| 226 |
\label{blb:ConfigTesting} |
| 227 |
|
| 228 |
Further information is in the |
| 229 |
\bilink{Storage daemon configuration}{blb:StoredConfChapter} chapter. |
| 230 |
|
| 231 |
\subsection{Configuring the Monitor Program} |
| 232 |
\index[general]{Program!Configuring the Monitor } |
| 233 |
\index[general]{Configuring the Monitor Program } |
| 234 |
|
| 235 |
The Monitor program is typically an icon in the system tray. However, once the |
| 236 |
icon is expanded into a full window, the administrator or user can obtain |
| 237 |
status information about the Director or the backup status on the local |
| 238 |
workstation or any other \bacula{} daemon that is configured. |
| 239 |
|
| 240 |
\bimageH[0.7\linewidth]{Bacula-tray-monitor}{\bacula{} Tray Monitor}{figstart:baculatray} |
| 241 |
|
| 242 |
% TODO: image may be too wide for 6" wide printed page. |
| 243 |
The image shows a tray-monitor configured for three daemons. By clicking on |
| 244 |
the radio buttons in the upper left corner of the image, you can see the |
| 245 |
status for each of the daemons. The image shows the status for the Storage |
| 246 |
daemon (MainSD) that is currently selected. |
| 247 |
|
| 248 |
The Monitor configuration file is found in the directory specified on the |
| 249 |
{\tt\verb:--:sysconfdir} option that you specified on the |
| 250 |
\btool{./configure} command and |
| 251 |
by default is named \bfilename{tray-monitor.conf}. Normally, for first time users, |
| 252 |
you just need to change the permission of this file to allow non-root users to |
| 253 |
run the Monitor, as this application must run as the same user as the |
| 254 |
graphical environment (don't forget to allow non-root users to execute |
| 255 |
\btool{bacula-tray-monitor}). This is not a security problem as long as you use the |
| 256 |
default settings. |
| 257 |
|
| 258 |
More information is in the |
| 259 |
\bilink{Monitor configuration}{blb:MonitorChapter} chapter. |
| 260 |
|
| 261 |
\section{Testing your Configuration Files} |
| 262 |
\index[general]{Testing your Configuration Files } |
| 263 |
\index[general]{Files!Testing your Configuration } |
| 264 |
|
| 265 |
You can test if your configuration file is syntactically correct by running |
| 266 |
the appropriate daemon with the \textbf{-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 |
| 269 |
directory. |
| 270 |
% TODO: why assume that? common default install has the executable |
| 271 |
% TODO: is in ./sbin and the configs are in ./etc. So maybe just have |
| 272 |
% TODO: example correct or change default install to be same. |
| 273 |
|
| 274 |
\begin{bVerbatim} |
| 275 |
cd <installation-directory> |
| 276 |
./bacula-dir -t -c bacula-dir.conf |
| 277 |
./bacula-fd -t -c bacula-fd.conf |
| 278 |
./bacula-sd -t -c bacula-sd.conf |
| 279 |
./bconsole -t -c bconsole.conf |
| 280 |
./bwx-console -t -c bwx-console.conf |
| 281 |
./bat -t -c bat.conf |
| 282 |
su <normal user> -c "./bacula-tray-monitor -t -c tray-monitor.conf" |
| 283 |
\end{bVerbatim} |
| 284 |
|
| 285 |
will test the configuration files of each of the main programs. If the |
| 286 |
configuration file is OK, the program will terminate without printing |
| 287 |
anything. Please note that, depending on the configure options you choose, |
| 288 |
some, or even all, of the three last commands will not be available on your |
| 289 |
system. If you have installed the binaries in traditional Unix locations |
| 290 |
rather than a single file, you will need to modify the above commands |
| 291 |
appropriately (no ./ in front of the command name, and a path in front of the |
| 292 |
conf file name). |
| 293 |
\label{blb:TapeTesting} |
| 294 |
|
| 295 |
\section{Testing Compatibility with Your Tape Drive} |
| 296 |
\index[general]{Drive!Testing \bacula{} Compatibility with Your Tape} |
| 297 |
\index[general]{Testing \bacula{} Compatibility with Your Tape Drive} |
| 298 |
|
| 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 \textbf{Testing Your Tape Drive} |
| 301 |
chapter of this manual. If you have a modern |
| 302 |
standard \acs{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 \bfootref{http://www.freebsddiary.org/bacula.php}{The FreeBSD Diary} |
| 306 |
for a detailed description |
| 307 |
%TODO: fix elink so it shows URL in PDF - Done by using \bfootref instead of \bref |
| 308 |
%% Philippe 20 dec 2016 |
| 309 |
on how to make \bacula{} work on your system. In addition, users of FreeBSD |
| 310 |
prior to 4.9-STABLE dated Mon Dec 29 15:18:01 2003 UTC who plan to use tape |
| 311 |
devices, please see the file \bfilename{platforms/freebsd/pthreads-fix.txt} in |
| 312 |
the main \bacula{} directory concerning important information concerning |
| 313 |
compatibility of \bacula{} and your system. |
| 314 |
|
| 315 |
\label{blb:notls} |
| 316 |
\section{Get Rid of the /lib/tls Directory} |
| 317 |
\index[general]{Directory!Get Rid of the \bdirectoryname{/lib/tls} } |
| 318 |
\index[general]{Get Rid of the \bdirectoryname{/lib/tls} Directory } |
| 319 |
This section only applies to really old 2.4.x kernel version, |
| 320 |
which we hope you are no longer running. |
| 321 |
|
| 322 |
\smallskip |
| 323 |
The new pthreads library \bdirectoryname{/lib/tls} installed by default on recent Red |
| 324 |
Hat systems running Linux kernel 2.4.x is defective. You must remove it or |
| 325 |
rename it, then reboot your system before running \bacula{} otherwise after a |
| 326 |
week or so of running, \bacula{} will either block for long periods or |
| 327 |
deadlock entirely. You may want to use the loader environment variable |
| 328 |
override rather than removing /lib/tls. Please see |
| 329 |
\bilink{Supported Operating Systems}{blb:SupportedOSes} for more information on this problem. |
| 330 |
|
| 331 |
This problem does not occur on systems running Linux 2.6.x kernels. |
| 332 |
|
| 333 |
\label{blb:Running1} |
| 334 |
|
| 335 |
\section{Running \bacula{}} |
| 336 |
\index[general]{\bacula{}!Running } |
| 337 |
\index[general]{Running \bacula{} } |
| 338 |
|
| 339 |
Probably the most important part of running \bacula{} is being able to restore |
| 340 |
files. If you haven't tried recovering files at least once, when you actually |
| 341 |
have to do it, you will be under a lot more pressure, and prone to make |
| 342 |
errors, than if you had already tried it once. |
| 343 |
|
| 344 |
To get a good idea how to use \bacula{} in a short time, we \textbf{strongly} |
| 345 |
recommend that you follow the example in the |
| 346 |
\bilink{Running \bacula{} Chapter}{blb:TutorialChapter} of this manual where |
| 347 |
you will get detailed instructions on how to run \bacula{}. |
| 348 |
|
| 349 |
\section{Log Rotation} |
| 350 |
\index[general]{Rotation!Log } |
| 351 |
\index[general]{Log Rotation } |
| 352 |
If you use the default \bfilename{bacula-dir.conf} or some variation of it, you |
| 353 |
will note that it logs all the \bacula{} output to a file. To avoid that this |
| 354 |
file grows without limit, we recommend that you copy the file |
| 355 |
\bfilename{logrotate} from the \bdirectoryname{scripts/logrotate} to |
| 356 |
\bfilename{/etc/logrotate.d/bacula}. This will cause the log file to be rotated once |
| 357 |
a month and kept for a maximum of five months. You may want to edit this |
| 358 |
file to change the default log rotation preferences. |
| 359 |
|
| 360 |
\section{Log Watch} |
| 361 |
\index[general]{Watch!Log} |
| 362 |
\index[general]{Log Watch} |
| 363 |
Some systems such as Red Hat and Fedora run the logwatch program |
| 364 |
every night, which does an analysis of your log file and sends an |
| 365 |
email report. If you wish to include the output from your \bacula{} |
| 366 |
jobs in that report, please look in the \bdirectoryname{scripts/logwatch} |
| 367 |
directory. The \bfilename{README} file in that directory gives a brief |
| 368 |
explanation on how to install it and what kind of output to expect. |
| 369 |
|
| 370 |
\section{Disaster Recovery} |
| 371 |
\index[general]{Recovery!Disaster } |
| 372 |
\index[general]{Disaster Recovery } |
| 373 |
|
| 374 |
If you intend to use \bacula{} as a disaster recovery tool rather than simply |
| 375 |
a program to restore lost or damaged files, you will want to read the |
| 376 |
\bilink{Disaster Recovery Using \bacula{} Chapter}{blb:RescueChapter} of this |
| 377 |
manual. |
| 378 |
|
| 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 |
| 381 |
will be prepared. |