| 1 |
\chapter{A Brief Tutorial} |
| 2 |
\label{blb:TutorialChapter} |
| 3 |
\index[general]{Brief Tutorial } |
| 4 |
\index[general]{Tutorial!Brief } |
| 5 |
|
| 6 |
This chapter will guide you through running \bacula{}. To do so, we assume you |
| 7 |
have installed \bacula{}, possibly in a single file as shown in the previous |
| 8 |
chapter, in which case, you can run \bacula{} as non-root for these tests. |
| 9 |
However, we assume that you have not changed the .conf files. If you have |
| 10 |
modified the .conf files, please go back and uninstall \bacula{}, then reinstall |
| 11 |
it, but do not make any changes. The examples in this chapter use the default |
| 12 |
configuration files, and will write the volumes to disk in your \bdirectoryname{/tmp} |
| 13 |
directory, in addition, the data backed up will be the source directory where |
| 14 |
you built \bacula{}. As a consequence, you can run all the \bacula{} daemons for |
| 15 |
these tests as non-root. Please note, in production, your File daemon(s) must |
| 16 |
run as root. See the Security chapter for more information on this subject. |
| 17 |
|
| 18 |
% TODO: use crossreferences above |
| 19 |
% TODO: add a section here |
| 20 |
|
| 21 |
The general flow of running \bacula{} is: |
| 22 |
|
| 23 |
\begin{benumerate} |
| 24 |
\item cd \bbracket{install-directory} |
| 25 |
\item Start the Database (if using \mysql{} or \postgresql{}) |
| 26 |
\item Start the Daemons with \btool{ ./bacula start} |
| 27 |
\item Start the Console program to interact with the Director |
| 28 |
\item Run a job |
| 29 |
\item When the Volume fills, unmount the Volume, if it is a tape, label a new |
| 30 |
one, and continue running. In this chapter, we will write only to disk files |
| 31 |
so you won't need to worry about tapes for the moment. |
| 32 |
\item Test recovering some files from the Volume just written to ensure the |
| 33 |
backup is good and that you know how to recover. Better test before disaster |
| 34 |
strikes |
| 35 |
\item Add a second client. |
| 36 |
\end{benumerate} |
| 37 |
|
| 38 |
Each of these steps is described in more detail below. |
| 39 |
|
| 40 |
\section{Before Running \bacula{}} |
| 41 |
\index[general]{\bacula{}!Before Running } |
| 42 |
\index[general]{Before Running \bacula{} } |
| 43 |
|
| 44 |
% TODO: some of this content is already covered once or twice critical |
| 45 |
% TODO: or quickstart. Consolidate! |
| 46 |
|
| 47 |
Before running \bacula{} for the first time in production, we recommend that you |
| 48 |
run the \bcommandname{test} command in the \btool{btape} program as described in the |
| 49 |
\bxlink{Utility Program}{blb:btape}{utility}{chapter} of the \butilityman{}. This will |
| 50 |
help ensure that \bacula{} functions correctly with your tape drive. If you have |
| 51 |
a modern HP, Sony, or Quantum DDS or DLT tape drive running on Linux or |
| 52 |
Solaris, you can probably skip this test as \bacula{} is well tested with these |
| 53 |
drives and systems. For all other cases, you are \textbf{strongly} encouraged to |
| 54 |
run the test before continuing. \btool{btape} also has a \bcommandname{fill} command that |
| 55 |
attempts to duplicate what \bacula{} does when filling a tape and writing on the |
| 56 |
next tape. You should consider trying this command as well, but be forewarned, |
| 57 |
it can take hours (about four hours on my drive) to fill a large capacity tape. |
| 58 |
|
| 59 |
\section{Starting the Database} |
| 60 |
\label{blb:StartDB} |
| 61 |
\index[general]{Starting the Database } |
| 62 |
\index[general]{Database!Starting the } |
| 63 |
|
| 64 |
If you are using \mysql{} or \postgresql{} as the \bacula{} database, you should start |
| 65 |
it before you attempt to run a job to avoid getting error messages from \bacula{} |
| 66 |
when it starts. Normally if you have installed the \mysql{} or \postgresql{} |
| 67 |
packages, the database server will automatically restart when your system |
| 68 |
is booted. In any case you must start the database server prior to |
| 69 |
starting the \bacula{} Director. |
| 70 |
|
| 71 |
|
| 72 |
\section{Starting the Daemons} |
| 73 |
\label{blb:StartDaemon} |
| 74 |
\index[general]{Starting the Daemons } |
| 75 |
\index[general]{Daemons!Starting the } |
| 76 |
|
| 77 |
Assuming you have built from source or have installed the rpms, |
| 78 |
to start the three daemons, from your installation directory, simply enter: |
| 79 |
|
| 80 |
./bacula start |
| 81 |
|
| 82 |
The \btool{bacula} script starts the Storage daemon, the File daemon, and the |
| 83 |
Director daemon, which all normally run as daemons in the background. If you |
| 84 |
are using the autostart feature of \bacula{}, your daemons will either be |
| 85 |
automatically started on reboot, or you can control them individually with the |
| 86 |
files \bfilename{bacula-dir}, \bfilename{bacula-fd}, and \bfilename{bacula-sd}, which are |
| 87 |
usually located in \bdirectoryname{/etc/init.d}, though the actual location is system |
| 88 |
dependent. |
| 89 |
Some distributions may do this differently. |
| 90 |
|
| 91 |
Note, on Windows, currently only the File daemon is ported, and it must be |
| 92 |
started differently. Please see the |
| 93 |
\bilink{Windows Version of \bacula{}}{blb:Win32Chapter} Chapter of this |
| 94 |
manual. |
| 95 |
|
| 96 |
The rpm packages configure the daemons to run as user=root and group=bacula. |
| 97 |
The rpm installation also creates the group bacula if it does not exist on the |
| 98 |
system. Any users that you add to the group bacula will have access to files |
| 99 |
created by the daemons. To disable or alter this behavior edit the daemon |
| 100 |
startup scripts: |
| 101 |
|
| 102 |
\begin{bitemize} |
| 103 |
\item /etc/bacula/bacula |
| 104 |
\item /etc/init.d/bacula-dir |
| 105 |
\item /etc/init.d/bacula-sd |
| 106 |
\item /etc/init.d/bacula-fd |
| 107 |
\end{bitemize} |
| 108 |
|
| 109 |
and then restart as noted above. |
| 110 |
|
| 111 |
The |
| 112 |
\bilink{installation chapter}{blb:InstallChapter} of this manual |
| 113 |
explains how you can install scripts that will automatically restart the |
| 114 |
daemons when the system starts. |
| 115 |
|
| 116 |
\section{Using the Director to Query and Start Jobs} |
| 117 |
\index[general]{Jobs!Querying or Starting Jobs} |
| 118 |
\index[general]{Querying or starting Jobs} |
| 119 |
% TODO: section name is too long; maybe use "Using the Console Program" ?? |
| 120 |
|
| 121 |
To communicate with the director and to query the state of \bacula{} or run jobs, |
| 122 |
from the top level directory, simply enter: |
| 123 |
|
| 124 |
./bconsole |
| 125 |
|
| 126 |
Alternatively to running the command line console, if you have |
| 127 |
Qt4 installed and used the \textbf{{-}{-}enable-bat} on the configure command, |
| 128 |
you may use the \bat{};%\bacula{} Administration Tool (\bat{}): |
| 129 |
|
| 130 |
\begin{bVerbatim} |
| 131 |
./bat |
| 132 |
\end{bVerbatim} |
| 133 |
|
| 134 |
Which has a graphical interface, and many more features than bconsole. |
| 135 |
|
| 136 |
Two other possibilities are to run the GNOME console |
| 137 |
\btool{bgnome-console} or the wxWidgets program \btool{bwx-console}. |
| 138 |
|
| 139 |
For simplicity, here we will describe only the \btool{./bconsole} program. Most |
| 140 |
of what is described here applies equally well to \btool{./bat}, |
| 141 |
\btool{./bgnome-console}, and to \btool{bwx-console}. |
| 142 |
|
| 143 |
The \btool{./bconsole} runs the \bacula{} Console program, which connects to the |
| 144 |
Director daemon. Since \bacula{} is a network program, you can run the Console |
| 145 |
program anywhere on your network. Most frequently, however, one runs it on the |
| 146 |
same machine as the Director. Normally, the Console program will print |
| 147 |
something similar to the following: |
| 148 |
|
| 149 |
\begin{bVerbatim} |
| 150 |
[kern@polymatou bin]$ ./bconsole |
| 151 |
Connecting to Director lpmatou:9101 |
| 152 |
1000 OK: HeadMan Version: 2.1.8 (14 May 2007) |
| 153 |
* |
| 154 |
\end{bVerbatim} |
| 155 |
|
| 156 |
the asterisk is the console command prompt. |
| 157 |
|
| 158 |
Type \bcommandname{help} to see a list of available commands: |
| 159 |
|
| 160 |
\begin{bVerbatim} |
| 161 |
*help |
| 162 |
Command Description |
| 163 |
======= =========== |
| 164 |
add Add media to a pool |
| 165 |
autodisplay Autodisplay console messages |
| 166 |
automount Automount after label |
| 167 |
cancel Cancel a job |
| 168 |
cloud Specific Cloud commands |
| 169 |
create Create DB Pool from resource |
| 170 |
delete Delete volume, pool, client or job |
| 171 |
disable Disable a job, attributes batch process |
| 172 |
enable Enable a job, attributes batch process |
| 173 |
estimate Performs FileSet estimate, listing gives full listing |
| 174 |
exit Terminate Bconsole session |
| 175 |
gui Non-interactive gui mode |
| 176 |
help Print help on specific command |
| 177 |
label Label a tape |
| 178 |
list List objects from catalog |
| 179 |
llist Full or long list like list command |
| 180 |
messages Display pending messages |
| 181 |
memory Print current memory usage |
| 182 |
mount Mount storage |
| 183 |
prune Prune expired records from catalog |
| 184 |
purge Purge records from catalog |
| 185 |
quit Terminate Bconsole session |
| 186 |
query Query catalog |
| 187 |
dedup Manage Global Deduplication Engine |
| 188 |
restore Restore files |
| 189 |
relabel Relabel a tape |
| 190 |
release Release storage |
| 191 |
reload Reload conf file |
| 192 |
run Run a job |
| 193 |
restart Restart a job |
| 194 |
resume Resume a job |
| 195 |
status Report status |
| 196 |
stop Stop a job |
| 197 |
setdebug Sets debug level |
| 198 |
setbandwidth Sets bandwidth |
| 199 |
snapshot Handle snapshots |
| 200 |
setip Sets new client address -- if authorized |
| 201 |
show Show resource records |
| 202 |
sqlquery Use SQL to query catalog |
| 203 |
statistics Display daemon statistics data |
| 204 |
tag Manage tags |
| 205 |
time Print current time |
| 206 |
trace Turn on/off trace to file |
| 207 |
truncate Truncate one or more Volumes |
| 208 |
unmount Unmount storage |
| 209 |
umount Umount - for old-time Unix guys, see unmount |
| 210 |
update Update volume, pool, job or stats |
| 211 |
use Use catalog xxx |
| 212 |
var Does variable expansion |
| 213 |
version Print Director version |
| 214 |
wait Wait until no jobs are running |
| 215 |
|
| 216 |
When at a prompt, entering a period cancels the command. |
| 217 |
* |
| 218 |
\end{bVerbatim} |
| 219 |
|
| 220 |
Details of the console program's commands are explained in the |
| 221 |
\bxlink{Console}{blb:ConsoleChapter}{console}{chapter} of the \bconsoleman{}. |
| 222 |
|
| 223 |
\section{Running a Job} |
| 224 |
\label{blb:Running} |
| 225 |
\index[general]{Job!Running a } |
| 226 |
\index[general]{Running a Job } |
| 227 |
|
| 228 |
At this point, we assume you have done the following: |
| 229 |
|
| 230 |
\begin{bitemize} |
| 231 |
\item Configured \bacula{} with \btool{./configure {-}{-}:your-options} |
| 232 |
\item Built \bacula{} using \btool{make} |
| 233 |
\item Installed \bacula{} using \btool{make install} |
| 234 |
\item Have created your database with, for example, |
| 235 |
\btool{./create\_mysql\_database} |
| 236 |
\item Have created the \bacula{} database tables with, |
| 237 |
\btool{./make\_bacula\_tables} |
| 238 |
\item Have possibly edited your \bfilename{bacula-dir.conf} file to personalize it |
| 239 |
a bit. BE CAREFUL! if you change the Director's name or password, you will |
| 240 |
need to make similar modifications in the other .conf files. For the moment |
| 241 |
it is probably better to make no changes. |
| 242 |
\item You have started \bacula{} with \btool{./bacula start} |
| 243 |
\item You have invoked the Console program with \btool{./bconsole} |
| 244 |
\end{bitemize} |
| 245 |
|
| 246 |
Furthermore, we assume for the moment you are using the default configuration |
| 247 |
files. |
| 248 |
|
| 249 |
At this point, enter the following command: |
| 250 |
|
| 251 |
\begin{bVerbatim} |
| 252 |
show filesets |
| 253 |
\end{bVerbatim} |
| 254 |
|
| 255 |
and you should get something similar to: |
| 256 |
|
| 257 |
\begin{bVerbatim} |
| 258 |
FileSet: name=Full Set |
| 259 |
O M |
| 260 |
N |
| 261 |
I /home/kern/bacula/regress/build |
| 262 |
N |
| 263 |
E /proc |
| 264 |
E /tmp |
| 265 |
E /.journal |
| 266 |
E /.fsck |
| 267 |
N |
| 268 |
FileSet: name=Catalog |
| 269 |
O M |
| 270 |
N |
| 271 |
I /home/kern/bacula/regress/working/bacula.sql |
| 272 |
N |
| 273 |
\end{bVerbatim} |
| 274 |
|
| 275 |
This is a pre-defined \textbf{FileSet} that will backup the \bacula{} source |
| 276 |
directory. The actual directory names printed should correspond to your system |
| 277 |
configuration. For testing purposes, we have chosen a directory of moderate |
| 278 |
size (about 40 Megabytes) and complexity without being too big. The FileSet |
| 279 |
\textbf{Catalog} is used for backing up \bacula{}'s catalog and is not of interest |
| 280 |
to us for the moment. The \textbf{I} entries are the files or directories that |
| 281 |
will be included in the backup and the \textbf{E} are those that will be |
| 282 |
excluded, and the \textbf{O} entries are the options specified for |
| 283 |
the FileSet. You can change what is backed up by editing \bfilename{bacula-dir.conf} |
| 284 |
and changing the \textbf{File =} line in the \textbf{FileSet} resource. |
| 285 |
|
| 286 |
Now is the time to run your first backup job. We are going to backup your |
| 287 |
\bacula{} source directory to a File Volume in your \bdirectoryname{/tmp} directory just to |
| 288 |
show you how easy it is. Now enter: |
| 289 |
|
| 290 |
\begin{bVerbatim} |
| 291 |
status dir |
| 292 |
\end{bVerbatim} |
| 293 |
|
| 294 |
and you should get the following output: |
| 295 |
|
| 296 |
\begin{bVerbatim} |
| 297 |
rufus-dir Version: 1.30 (28 April 2003) |
| 298 |
Daemon started 28-Apr-2003 14:03, 0 Jobs run. |
| 299 |
Console connected at 28-Apr-2003 14:03 |
| 300 |
No jobs are running. |
| 301 |
Level Type Scheduled Name |
| 302 |
================================================================= |
| 303 |
Incremental Backup 29-Apr-2003 01:05 Client1 |
| 304 |
Full Backup 29-Apr-2003 01:10 BackupCatalog |
| 305 |
==== |
| 306 |
\end{bVerbatim} |
| 307 |
|
| 308 |
where the times and the Director's name will be different according to your |
| 309 |
setup. This shows that an Incremental job is scheduled to run for the Job \textbf{ |
| 310 |
Client1} at 1:05am and that at 1:10, a \textbf{BackupCatalog} is scheduled to |
| 311 |
run. Note, you should probably change the name \textbf{Client1} to be the name of |
| 312 |
your machine, if not, when you add additional clients, it will be very |
| 313 |
confusing. For my real machine, I use \textbf{Rufus} rather than \textbf{Client1} as |
| 314 |
in this example. |
| 315 |
|
| 316 |
Now enter: |
| 317 |
|
| 318 |
\begin{bVerbatim} |
| 319 |
status client |
| 320 |
\end{bVerbatim} |
| 321 |
|
| 322 |
and you should get something like: |
| 323 |
|
| 324 |
\begin{bVerbatim} |
| 325 |
The defined Client resources are: |
| 326 |
1: rufus-fd |
| 327 |
Item 1 selected automatically. |
| 328 |
Connecting to Client rufus-fd at rufus:9102 |
| 329 |
rufus-fd Version: 1.30 (28 April 2003) |
| 330 |
Daemon started 28-Apr-2003 14:03, 0 Jobs run. |
| 331 |
Director connected at: 28-Apr-2003 14:14 |
| 332 |
No jobs running. |
| 333 |
==== |
| 334 |
\end{bVerbatim} |
| 335 |
|
| 336 |
In this case, the client is named \textbf{rufus-fd} your name will be different, |
| 337 |
but the line beginning with \textbf{rufus-fd Version ...} is printed by your File |
| 338 |
daemon, so we are now sure it is up and running. |
| 339 |
|
| 340 |
Finally do the same for your Storage daemon with: |
| 341 |
|
| 342 |
\begin{bVerbatim} |
| 343 |
status storage |
| 344 |
\end{bVerbatim} |
| 345 |
|
| 346 |
and you should get: |
| 347 |
|
| 348 |
\begin{bVerbatim} |
| 349 |
The defined Storage resources are: |
| 350 |
1: File |
| 351 |
Item 1 selected automatically. |
| 352 |
Connecting to Storage daemon File at rufus:9103 |
| 353 |
rufus-sd Version: 1.30 (28 April 2003) |
| 354 |
Daemon started 28-Apr-2003 14:03, 0 Jobs run. |
| 355 |
Device /tmp is not open. |
| 356 |
No jobs running. |
| 357 |
==== |
| 358 |
\end{bVerbatim} |
| 359 |
|
| 360 |
You will notice that the default Storage daemon device is named \textbf{File} and |
| 361 |
that it will use device \textbf{/tmp}, which is not currently open. |
| 362 |
|
| 363 |
Now, let's actually run a job with: |
| 364 |
|
| 365 |
\begin{bVerbatim} |
| 366 |
run |
| 367 |
\end{bVerbatim} |
| 368 |
|
| 369 |
you should get the following output: |
| 370 |
|
| 371 |
\begin{bVerbatim} |
| 372 |
Using default Catalog name=MyCatalog DB=bacula |
| 373 |
A job name must be specified. |
| 374 |
The defined Job resources are: |
| 375 |
1: Client1 |
| 376 |
2: BackupCatalog |
| 377 |
3: RestoreFiles |
| 378 |
Select Job resource (1-3): |
| 379 |
\end{bVerbatim} |
| 380 |
|
| 381 |
Here, \bacula{} has listed the three different Jobs that you can run, and you |
| 382 |
should choose number \textbf{1} and type enter, at which point you will get: |
| 383 |
|
| 384 |
\begin{bVerbatim} |
| 385 |
Run Backup job |
| 386 |
JobName: Client1 |
| 387 |
FileSet: Full Set |
| 388 |
Level: Incremental |
| 389 |
Client: rufus-fd |
| 390 |
Storage: File |
| 391 |
Pool: Default |
| 392 |
When: 2003-04-28 14:18:57 |
| 393 |
OK to run? (yes/mod/no): |
| 394 |
\end{bVerbatim} |
| 395 |
|
| 396 |
At this point, take some time to look carefully at what is printed and |
| 397 |
understand it. It is asking you if it is OK to run a job named \textbf{Client1} |
| 398 |
with FileSet \textbf{Full Set} (we listed above) as an Incremental job on your |
| 399 |
Client (your client name will be different), and to use Storage \textbf{File} and |
| 400 |
Pool \textbf{Default}, and finally, it wants to run it now (the current time |
| 401 |
should be displayed by your console). |
| 402 |
|
| 403 |
Here we have the choice to run (\textbf{yes}), to modify one or more of the above |
| 404 |
parameters (\textbf{mod}), or to not run the job (\textbf{no}). Please enter \textbf{yes}, |
| 405 |
at which point you should immediately get the command prompt (an |
| 406 |
asterisk). If you wait a few seconds, then enter the command \bcommandname{messages} |
| 407 |
you will get back something like: |
| 408 |
|
| 409 |
\begin{bVerbatim} |
| 410 |
28-Apr-2003 14:22 rufus-dir: Last FULL backup time not found. Doing |
| 411 |
FULL backup. |
| 412 |
28-Apr-2003 14:22 rufus-dir: Start Backup JobId 1, |
| 413 |
Job=Client1.2003-04-28_14.22.33 |
| 414 |
28-Apr-2003 14:22 rufus-sd: Job Client1.2003-04-28_14.22.33 waiting. |
| 415 |
Cannot find any appendable volumes. |
| 416 |
Please use the "label" command to create a new Volume for: |
| 417 |
Storage: FileStorage |
| 418 |
Media type: File |
| 419 |
Pool: Default |
| 420 |
\end{bVerbatim} |
| 421 |
|
| 422 |
The first message, indicates that no previous Full backup was done, so \bacula{} |
| 423 |
is upgrading our Incremental job to a Full backup (this is normal). The second |
| 424 |
message indicates that the job started with JobId 1., and the third message |
| 425 |
tells us that \bacula{} cannot find any Volumes in the Pool for writing the |
| 426 |
output. This is normal because we have not yet created (labeled) any Volumes. |
| 427 |
\bacula{} indicates to you all the details of the volume it needs. |
| 428 |
|
| 429 |
At this point, the job is BLOCKED waiting for a Volume. You can check this if |
| 430 |
you want by doing a \bcommandname{status dir}. In order to continue, we must create a |
| 431 |
Volume that \bacula{} can write on. We do so with: |
| 432 |
|
| 433 |
\begin{bVerbatim} |
| 434 |
label |
| 435 |
\end{bVerbatim} |
| 436 |
|
| 437 |
and \bacula{} will print: |
| 438 |
|
| 439 |
\begin{bVerbatim} |
| 440 |
The defined Storage resources are: |
| 441 |
1: File |
| 442 |
Item 1 selected automatically. |
| 443 |
Enter new Volume name: |
| 444 |
\end{bVerbatim} |
| 445 |
|
| 446 |
at which point, you should enter some name beginning with a letter and |
| 447 |
containing only letters and numbers (period, hyphen, and underscore) are also |
| 448 |
permitted. For example, enter \textbf{TestVolume001}, and you should get back: |
| 449 |
|
| 450 |
\begin{bVerbatim} |
| 451 |
Defined Pools: |
| 452 |
1: Default |
| 453 |
Item 1 selected automatically. |
| 454 |
Connecting to Storage daemon File at rufus:9103 ... |
| 455 |
Sending label command for Volume "TestVolume001" Slot 0 ... |
| 456 |
3000 OK label. Volume=TestVolume001 Device=/tmp |
| 457 |
Catalog record for Volume "TestVolume002", Slot 0 successfully created. |
| 458 |
Requesting mount FileStorage ... |
| 459 |
3001 OK mount. Device=/tmp |
| 460 |
\end{bVerbatim} |
| 461 |
|
| 462 |
Finally, enter \bcommandname{messages} and you should get something like: |
| 463 |
|
| 464 |
\begin{bVerbatim} |
| 465 |
28-Apr-2003 14:30 rufus-sd: Wrote label to prelabeled Volume |
| 466 |
"TestVolume001" on device /tmp |
| 467 |
28-Apr-2003 14:30 rufus-dir: \bacula{} 1.30 (28Apr03): 28-Apr-2003 14:30 |
| 468 |
JobId: 1 |
| 469 |
Job: Client1.2003-04-28_14.22.33 |
| 470 |
FileSet: Full Set |
| 471 |
Backup Level: Full |
| 472 |
Client: rufus-fd |
| 473 |
Start time: 28-Apr-2003 14:22 |
| 474 |
End time: 28-Apr-2003 14:30 |
| 475 |
Files Written: 1,444 |
| 476 |
Bytes Written: 38,988,877 |
| 477 |
Rate: 81.2 KB/s |
| 478 |
Software Compression: None |
| 479 |
Volume names(s): TestVolume001 |
| 480 |
Volume Session Id: 1 |
| 481 |
Volume Session Time: 1051531381 |
| 482 |
Last Volume Bytes: 39,072,359 |
| 483 |
FD termination status: OK |
| 484 |
SD termination status: OK |
| 485 |
Termination: Backup OK |
| 486 |
28-Apr-2003 14:30 rufus-dir: Begin pruning Jobs. |
| 487 |
28-Apr-2003 14:30 rufus-dir: No Jobs found to prune. |
| 488 |
28-Apr-2003 14:30 rufus-dir: Begin pruning Files. |
| 489 |
28-Apr-2003 14:30 rufus-dir: No Files found to prune. |
| 490 |
28-Apr-2003 14:30 rufus-dir: End auto prune. |
| 491 |
\end{bVerbatim} |
| 492 |
|
| 493 |
If you don't see the output immediately, you can keep entering \bcommandname{messages} |
| 494 |
until the job terminates, or you can enter, \bcommandname{autodisplay on} and your |
| 495 |
messages will automatically be displayed as soon as they are ready. |
| 496 |
|
| 497 |
If you do an \btool{ls -l} of your \bdirectoryname{/tmp} directory, you will see that you |
| 498 |
have the following item: |
| 499 |
|
| 500 |
\begin{bVerbatim} |
| 501 |
-rw-r----- 1 kern kern 39072153 Apr 28 14:30 TestVolume001 |
| 502 |
\end{bVerbatim} |
| 503 |
|
| 504 |
This is the file Volume that you just wrote and it contains all the data of |
| 505 |
the job just run. If you run additional jobs, they will be appended to this |
| 506 |
Volume unless you specify otherwise. |
| 507 |
|
| 508 |
You might ask yourself if you have to label all the Volumes that \bacula{} is |
| 509 |
going to use. The answer for disk Volumes, like the one we used, is no. It is |
| 510 |
possible to have \bacula{} automatically label volumes. For tape Volumes, you |
| 511 |
will most likely have to label each of the Volumes you want to use. |
| 512 |
|
| 513 |
If you would like to stop here, you can simply enter \bcommandname{quit} in the Console |
| 514 |
program, and you can stop \bacula{} with \btool{./bacula stop}. To clean up, simply |
| 515 |
delete the file \bfilename{/tmp/TestVolume001}, and you should also re-initialize |
| 516 |
your database using: |
| 517 |
|
| 518 |
\begin{bVerbatim} |
| 519 |
./drop_bacula_tables |
| 520 |
./make_bacula_tables |
| 521 |
\end{bVerbatim} |
| 522 |
|
| 523 |
Please note that this will erase all information about the previous jobs that |
| 524 |
have run, and that you might want to do it now while testing but that normally |
| 525 |
you will not want to re-initialize your database. |
| 526 |
|
| 527 |
If you would like to try restoring the files that you just backed up, read the |
| 528 |
following section. |
| 529 |
\label{blb:restoring} |
| 530 |
|
| 531 |
\section{Restoring Your Files} |
| 532 |
\index[general]{Files!Restoring Your } |
| 533 |
\index[general]{Restoring Your Files } |
| 534 |
|
| 535 |
If you have run the default configuration and the save of the \bacula{} source |
| 536 |
code as demonstrated above, you can restore the backed up files in the Console |
| 537 |
program by entering: |
| 538 |
|
| 539 |
\begin{bVerbatim} |
| 540 |
restore all |
| 541 |
\end{bVerbatim} |
| 542 |
|
| 543 |
where you will get: |
| 544 |
|
| 545 |
\begin{bVerbatim} |
| 546 |
First you select one or more JobIds that contain files |
| 547 |
to be restored. You will be presented several methods |
| 548 |
of specifying the JobIds. Then you will be allowed to |
| 549 |
select which files from those JobIds are to be restored. |
| 550 |
|
| 551 |
To select the JobIds, you have the following choices: |
| 552 |
1: List last 20 Jobs run |
| 553 |
2: List Jobs where a given File is saved |
| 554 |
3: Enter list of comma separated JobIds to select |
| 555 |
4: Enter SQL list command |
| 556 |
5: Select the most recent backup for a client |
| 557 |
6: Select backup for a client before a specified time |
| 558 |
7: Enter a list of files to restore |
| 559 |
8: Enter a list of files to restore before a specified time |
| 560 |
9: Find the JobIds of the most recent backup for a client |
| 561 |
10: Find the JobIds for a backup for a client before a specified time |
| 562 |
11: Enter a list of directories to restore for found JobIds |
| 563 |
12: Select full restore to a specified Job date |
| 564 |
13: Select object to restore |
| 565 |
14: Cancel |
| 566 |
Select item: (1-14): |
| 567 |
\end{bVerbatim} |
| 568 |
|
| 569 |
As you can see, there are a number of options, but for the current |
| 570 |
demonstration, please enter \textbf{5} to do a restore of the last backup you |
| 571 |
did, and you will get the following output: |
| 572 |
|
| 573 |
\begin{bVerbatim} |
| 574 |
Defined Clients: |
| 575 |
1: rufus-fd |
| 576 |
Item 1 selected automatically. |
| 577 |
The defined FileSet resources are: |
| 578 |
1: 1 Full Set 2003-04-28 14:22:33 |
| 579 |
Item 1 selected automatically. |
| 580 |
+-------+-------+----------+---------------------+---------------+ |
| 581 |
| JobId | Level | JobFiles | StartTime | VolumeName | |
| 582 |
+-------+-------+----------+---------------------+---------------+ |
| 583 |
| 1 | F | 1444 | 2003-04-28 14:22:33 | TestVolume002 | |
| 584 |
+-------+-------+----------+---------------------+---------------+ |
| 585 |
You have selected the following JobId: 1 |
| 586 |
Building directory tree for JobId 1 ... |
| 587 |
1 Job inserted into the tree and marked for extraction. |
| 588 |
The defined Storage resources are: |
| 589 |
1: File |
| 590 |
Item 1 selected automatically. |
| 591 |
You are now entering file selection mode where you add and |
| 592 |
remove files to be restored. All files are initially added. |
| 593 |
Enter "done" to leave this mode. |
| 594 |
cwd is: / |
| 595 |
$ |
| 596 |
\end{bVerbatim} |
| 597 |
%$ |
| 598 |
|
| 599 |
where I have truncated the listing on the right side to make it more readable. |
| 600 |
As you can see by starting at the top of the listing, \bacula{} knows what client |
| 601 |
you have, and since there was only one, it selected it automatically, likewise |
| 602 |
for the FileSet. Then \bacula{} produced a listing containing all the jobs that |
| 603 |
form the current backup, in this case, there is only one, and the Storage |
| 604 |
daemon was also automatically chosen. \bacula{} then took all the files that were |
| 605 |
in Job number 1 and entered them into a \textbf{directory tree} (a sort of in |
| 606 |
memory representation of your filesystem). At this point, you can use the \bcommandname{cd} |
| 607 |
and \bcommandname{ls} or \bcommandname{dir} commands to walk up and down the directory tree |
| 608 |
and view what files will be restored. For example, if I enter \bcommandname{cd /home/kern/bacula/bacula-1.30} |
| 609 |
and then enter \bcommandname{dir} I will get a listing |
| 610 |
of all the files in the \bacula{} source directory. On your system, the path will |
| 611 |
be somewhat different. For more information on this, please refer to the |
| 612 |
\bilink{Restore Command Chapter}{blb:RestoreChapter} of this manual for |
| 613 |
more details. |
| 614 |
|
| 615 |
To exit this mode, simply enter: |
| 616 |
|
| 617 |
\begin{bVerbatim} |
| 618 |
done |
| 619 |
\end{bVerbatim} |
| 620 |
|
| 621 |
and you will get the following output: |
| 622 |
|
| 623 |
\begin{bVerbatim} |
| 624 |
Bootstrap records written to |
| 625 |
/home/kern/bacula/testbin/working/restore.bsr |
| 626 |
The restore job will require the following Volumes: |
| 627 |
|
| 628 |
TestVolume001 |
| 629 |
1444 files selected to restore. |
| 630 |
Run Restore job |
| 631 |
JobName: RestoreFiles |
| 632 |
Bootstrap: /home/kern/bacula/testbin/working/restore.bsr |
| 633 |
Where: /tmp/bacula-restores |
| 634 |
Replace: always |
| 635 |
FileSet: Full Set |
| 636 |
Backup Client: rufus-fd |
| 637 |
Restore Client: rufus-fd |
| 638 |
Storage: File |
| 639 |
JobId: *None* |
| 640 |
When: 2005-04-28 14:53:54 |
| 641 |
OK to run? (yes/mod/no): |
| 642 |
\end{bVerbatim} |
| 643 |
|
| 644 |
If you answer \textbf{yes} your files will be restored to |
| 645 |
\bdirectoryname{/tmp/bacula-restores}. If you want to restore the files to their original |
| 646 |
locations, you must use the \textbf{mod} option and explicitly set \textbf{Where:} |
| 647 |
to nothing (or to /). We recommend you go ahead and answer \textbf{yes} and after |
| 648 |
a brief moment, enter \bcommandname{messages}, at which point you should get a listing |
| 649 |
of all the files that were restored as well as a summary of the job that looks |
| 650 |
similar to this: |
| 651 |
|
| 652 |
\begin{bVerbatim} |
| 653 |
28-Apr-2005 14:56 rufus-dir: \bacula{} 2.1.8 (08May07): 08-May-2007 14:56:06 |
| 654 |
Build OS: i686-pc-linux-gnu suse 10.2 |
| 655 |
JobId: 2 |
| 656 |
Job: RestoreFiles.2007-05-08_14.56.06 |
| 657 |
Restore Client: rufus-fd |
| 658 |
Start time: 08-May-2007 14:56 |
| 659 |
End time: 08-May-2007 14:56 |
| 660 |
Files Restored: 1,444 |
| 661 |
Bytes Restored: 38,816,381 |
| 662 |
Rate: 9704.1 KB/s |
| 663 |
FD Errors: 0 |
| 664 |
FD termination status: OK |
| 665 |
SD termination status: OK |
| 666 |
Termination: Restore OK |
| 667 |
08-May-2007 14:56 rufus-dir: Begin pruning Jobs. |
| 668 |
08-May-2007 14:56 rufus-dir: No Jobs found to prune. |
| 669 |
08-May-2007 14:56 rufus-dir: Begin pruning Files. |
| 670 |
08-May-2007 14:56 rufus-dir: No Files found to prune. |
| 671 |
08-May-2007 14:56 rufus-dir: End auto prune. |
| 672 |
\end{bVerbatim} |
| 673 |
|
| 674 |
After exiting the Console program, you can examine the files in |
| 675 |
\bdirectoryname{/tmp/bacula-restores}, which will contain a small directory tree with all the |
| 676 |
files. Be sure to clean up at the end with: |
| 677 |
|
| 678 |
\begin{bVerbatim} |
| 679 |
rm -rf /tmp/bacula-restores |
| 680 |
\end{bVerbatim} |
| 681 |
|
| 682 |
\section{Quitting the Console Program} |
| 683 |
\index[general]{Program!Quitting the Console } |
| 684 |
\index[general]{Quitting the Console Program } |
| 685 |
|
| 686 |
Simply enter the command \bcommandname{quit}. |
| 687 |
\label{blb:SecondClient} |
| 688 |
|
| 689 |
\section{Adding a Second Client} |
| 690 |
\index[general]{Client!Adding a Second } |
| 691 |
\index[general]{Adding a Second Client } |
| 692 |
|
| 693 |
If you have gotten the example shown above to work on your system, you may be |
| 694 |
ready to add a second Client (File daemon). That is you have a second machine |
| 695 |
that you would like backed up. The only part you need installed on the other |
| 696 |
machine is the binary \btool{bacula-fd} (or \btool{bacula-fd.exe} for Windows) and |
| 697 |
its configuration file \bfilename{bacula-fd.conf}. You can start with the same |
| 698 |
\bfilename{bacula-fd.conf} file that you are currently using and make one minor |
| 699 |
modification to it to create the conf file for your second client. Change the |
| 700 |
File daemon name from whatever was configured, \textbf{rufus-fd} in the example |
| 701 |
above, but your system will have a different name. The best is to change it to |
| 702 |
the name of your second machine. For example: |
| 703 |
|
| 704 |
\begin{bVerbatim} |
| 705 |
... |
| 706 |
# |
| 707 |
# "Global" File daemon configuration specifications |
| 708 |
# |
| 709 |
FileDaemon { # this is me |
| 710 |
Name = rufus-fd |
| 711 |
FDport = 9102 # where we listen for the director |
| 712 |
WorkingDirectory = /home/kern/bacula/working |
| 713 |
Pid Directory = /var/run |
| 714 |
} |
| 715 |
... |
| 716 |
\end{bVerbatim} |
| 717 |
|
| 718 |
would become: |
| 719 |
|
| 720 |
\begin{bVerbatim} |
| 721 |
... |
| 722 |
# |
| 723 |
# "Global" File daemon configuration specifications |
| 724 |
# |
| 725 |
FileDaemon { # this is me |
| 726 |
Name = matou-fd |
| 727 |
FDport = 9102 # where we listen for the director |
| 728 |
WorkingDirectory = /home/kern/bacula/working |
| 729 |
Pid Directory = /var/run |
| 730 |
} |
| 731 |
... |
| 732 |
\end{bVerbatim} |
| 733 |
|
| 734 |
where I show just a portion of the file and have changed \textbf{rufus-fd} to |
| 735 |
\textbf{matou-fd}. The names you use are your choice. For the moment, I recommend |
| 736 |
you change nothing else. Later, you will want to change the password. |
| 737 |
|
| 738 |
Now you should install that change on your second machine. Then you need to |
| 739 |
make some additions to your Director's configuration file to define the new |
| 740 |
File daemon or Client. Starting from our original example which should be |
| 741 |
installed on your system, you should add the following lines (essentially |
| 742 |
copies of the existing data but with the names changed) to your Director's |
| 743 |
configuration file \bfilename{bacula-dir.conf}. |
| 744 |
|
| 745 |
\begin{bVerbatim} |
| 746 |
# |
| 747 |
# Define the main nightly save backup job |
| 748 |
# By default, this job will back up to disk in /tmp |
| 749 |
Job { |
| 750 |
Name = "Matou" |
| 751 |
Type = Backup |
| 752 |
Client = matou-fd |
| 753 |
FileSet = "Full Set" |
| 754 |
Schedule = "WeeklyCycle" |
| 755 |
Storage = File |
| 756 |
Messages = Standard |
| 757 |
Pool = Default |
| 758 |
Write Bootstrap = "/home/kern/bacula/working/matou.bsr" |
| 759 |
} |
| 760 |
# Client (File Services) to backup |
| 761 |
Client { |
| 762 |
Name = matou-fd |
| 763 |
Address = matou |
| 764 |
FDPort = 9102 |
| 765 |
Catalog = MyCatalog |
| 766 |
Password = "xxxxx" # password for |
| 767 |
File Retention = 30d # 30 days |
| 768 |
Job Retention = 180d # six months |
| 769 |
AutoPrune = yes # Prune expired Jobs/Files |
| 770 |
} |
| 771 |
\end{bVerbatim} |
| 772 |
|
| 773 |
Then make sure that the Address parameter in the Storage resource is set to |
| 774 |
the fully qualified domain name and not to something like "localhost". The |
| 775 |
address specified is sent to the File daemon (client) and it must be a fully |
| 776 |
qualified domain name. If you pass something like "localhost" it will not |
| 777 |
resolve correctly and will result in a time out when the File daemon fails to |
| 778 |
connect to the Storage daemon. |
| 779 |
|
| 780 |
That is all that is necessary. I copied the existing resource to create a |
| 781 |
second Job (Matou) to backup the second client (matou-fd). It has the name |
| 782 |
\textbf{Matou}, the Client is named \textbf{matou-fd}, and the bootstrap file name |
| 783 |
is changed, but everything else is the same. This means that Matou will be |
| 784 |
backed up on the same schedule using the same set of tapes. You may want to |
| 785 |
change that later, but for now, let's keep it simple. |
| 786 |
|
| 787 |
The second change was to add a new Client resource that defines \textbf{matou-fd} |
| 788 |
and has the correct address \textbf{matou}, but in real life, you may need a |
| 789 |
fully qualified domain name or an IP address. I also kept the password the |
| 790 |
same (shown as xxxxx for the example). |
| 791 |
|
| 792 |
At this point, if you stop \bacula{} and restart it, and start the Client on the |
| 793 |
other machine, everything will be ready, and the prompts that you saw above |
| 794 |
will now include the second machine. |
| 795 |
|
| 796 |
To make this a real production installation, you will possibly want to use |
| 797 |
different Pool, or a different schedule. It is up to you to customize. In any |
| 798 |
case, you should change the password in both the Director's file and the |
| 799 |
Client's file for additional security. |
| 800 |
|
| 801 |
For some important tips on changing names and passwords, and a diagram of what |
| 802 |
names and passwords must match, please see |
| 803 |
\bxlink{Authorization Errors}{blb:AuthorizationErrors}{problems}{chapter} in the \bproblemman{}. |
| 804 |
|
| 805 |
\section{When The Tape Fills} |
| 806 |
\label{blb:FullTape} |
| 807 |
\index[general]{Fills!When The Tape } |
| 808 |
\index[general]{When The Tape Fills } |
| 809 |
|
| 810 |
If you have scheduled your job, typically nightly, there will come a time when |
| 811 |
the tape fills up and \textbf{\bacula{}} cannot continue. In this case, \bacula{} will |
| 812 |
send you a message similar to the following: |
| 813 |
|
| 814 |
\begin{bVerbatim} |
| 815 |
rufus-sd: block.c:337 === Write error errno=28: ERR=No space left |
| 816 |
on device |
| 817 |
\end{bVerbatim} |
| 818 |
|
| 819 |
This indicates that \bacula{} got a write error because the tape is full. \bacula{} |
| 820 |
will then search the Pool specified for your Job looking for an appendable |
| 821 |
volume. In the best of all cases, you will have properly set your Retention |
| 822 |
Periods and you will have all your tapes marked to be Recycled, and \textbf{ |
| 823 |
\bacula{}} will automatically recycle the tapes in your pool requesting and |
| 824 |
overwriting old Volumes. For more information on recycling, please see the |
| 825 |
\bilink{Recycling chapter}{blb:RecyclingChapter} of this manual. If you |
| 826 |
find that your Volumes were not properly recycled (usually because of a |
| 827 |
configuration error), please see the |
| 828 |
\bilink{Manually Recycling Volumes}{blb:manualrecycling} section of |
| 829 |
the Recycling chapter. |
| 830 |
|
| 831 |
If like me, you have a very large set of Volumes and you label them with the |
| 832 |
date the Volume was first writing, or you have not set up your Retention |
| 833 |
periods, \bacula{} will not find a tape in the pool, and it will send you a |
| 834 |
message similar to the following: |
| 835 |
|
| 836 |
\begin{bVerbatim} |
| 837 |
rufus-sd: Job kernsave.2002-09-19.10:50:48 waiting. Cannot find any |
| 838 |
appendable volumes. |
| 839 |
Please use the "label" command to create a new Volume for: |
| 840 |
Storage: SDT-10000 |
| 841 |
Media type: DDS-4 |
| 842 |
Pool: Default |
| 843 |
\end{bVerbatim} |
| 844 |
|
| 845 |
Until you create a new Volume, this message will be repeated an hour later, |
| 846 |
then two hours later, and so on doubling the interval each time up to a |
| 847 |
maximum interval of one day. |
| 848 |
|
| 849 |
The obvious question at this point is: What do I do now? |
| 850 |
|
| 851 |
The answer is simple: first, using the Console program, close the tape drive |
| 852 |
using the \bcommandname{unmount} command. If you only have a single drive, it will be |
| 853 |
automatically selected, otherwise, make sure you release the one specified on |
| 854 |
the message (in this case \textbf{STD-10000}). |
| 855 |
|
| 856 |
Next, you remove the tape from the drive and insert a new blank tape. Note, on |
| 857 |
some older tape drives, you may need to write an end of file mark ( |
| 858 |
\btool{mt -f /dev/nst0 weof}) to prevent the drive from running away when \bacula{} |
| 859 |
attempts to read the label. |
| 860 |
|
| 861 |
Finally, you use the \bcommandname{label} command in the Console to write a label to |
| 862 |
the new Volume. The \bcommandname{label} command will contact the Storage daemon to |
| 863 |
write the software label, if it is successful, it will add the new Volume to |
| 864 |
the Pool, then issue a \bcommandname{mount} command to the Storage daemon. See the |
| 865 |
previous sections of this chapter for more details on labeling tapes. |
| 866 |
|
| 867 |
The result is that \bacula{} will continue the previous Job writing the backup to |
| 868 |
the new Volume. |
| 869 |
|
| 870 |
If you have a Pool of volumes and \bacula{} is cycling through them, instead of |
| 871 |
the above message "Cannot find any appendable volumes.", \bacula{} may ask you |
| 872 |
to mount a specific volume. In that case, you should attempt to do just that. |
| 873 |
If you do not have the volume any more (for any of a number of reasons), you |
| 874 |
can simply mount another volume from the same Pool, providing it is |
| 875 |
appendable, and \bacula{} will use it. You can use the \bcommandname{list volumes} command |
| 876 |
in the console program to determine which volumes are appendable and which are |
| 877 |
not. |
| 878 |
|
| 879 |
If like me, you have your Volume retention periods set correctly, but you have |
| 880 |
no more free Volumes, you can relabel and reuse a Volume as follows: |
| 881 |
|
| 882 |
\begin{bitemize} |
| 883 |
\item Do a \bcommandname{list volumes} in the Console and select the oldest Volume for |
| 884 |
relabeling. |
| 885 |
\item If you have setup your Retention periods correctly, the Volume should |
| 886 |
have VolStatus \textbf{Purged}. |
| 887 |
\item If the VolStatus is not set to Purged, you will need to purge the |
| 888 |
database of Jobs that are written on that Volume. Do so by using the command |
| 889 |
\bcommandname{purge jobs volume} in the Console. If you have multiple Pools, you will |
| 890 |
be prompted for the Pool then enter the VolumeName (or MediaId) when |
| 891 |
requested. |
| 892 |
\item Then simply use the \bcommandname{relabel} command to relabel the Volume. |
| 893 |
\end{bitemize} |
| 894 |
|
| 895 |
To manually relabel the Volume use the following additional steps: |
| 896 |
|
| 897 |
\begin{bitemize} |
| 898 |
\item To delete the Volume from the catalog use the \bcommandname{delete volume} |
| 899 |
command in the Console and select the VolumeName (or MediaId) to be deleted. |
| 900 |
|
| 901 |
\item Use the \bcommandname{unmount} command in the Console to unmount the old tape. |
| 902 |
\item Physically relabel the old Volume that you deleted so that it can be |
| 903 |
reused. |
| 904 |
\item Insert the old Volume in the tape drive. |
| 905 |
\item From a command line do: \btool{mt -f /dev/st0 rewind} and |
| 906 |
\btool{mt -f /dev/st0 weof}, where you need to use the proper tape drive name for |
| 907 |
your system in place of \bfilename{/dev/st0}. |
| 908 |
\item Use the \bcommandname{label} command in the Console to write a new \bacula{} label |
| 909 |
on your tape. |
| 910 |
\item Use the \bcommandname{mount} command in the Console if it is not automatically |
| 911 |
done, so that \bacula{} starts using your newly labeled tape. |
| 912 |
\end{bitemize} |
| 913 |
|
| 914 |
\section{Other Useful Console Commands} |
| 915 |
\index[general]{Commands!Other Useful Console } |
| 916 |
\index[general]{Other Useful Console Commands } |
| 917 |
|
| 918 |
\begin{bdescription} |
| 919 |
|
| 920 |
\item [status dir] |
| 921 |
\index[console]{status dir } |
| 922 |
Print a status of all running jobs and jobs scheduled in the next 24 hours. |
| 923 |
|
| 924 |
\item [status] |
| 925 |
\index[console]{status } |
| 926 |
The console program will prompt you to select a daemon type, then will |
| 927 |
request the daemon's status. |
| 928 |
|
| 929 |
\item [status jobid=nn] |
| 930 |
\index[console]{status jobid } |
| 931 |
Print a status of JobId nn if it is running. The Storage daemon is contacted |
| 932 |
and requested to print a current status of the job as well. |
| 933 |
|
| 934 |
\item [list pools] |
| 935 |
\index[console]{list pools } |
| 936 |
List the pools defined in the Catalog (normally only Default is used). |
| 937 |
|
| 938 |
\item [list media] |
| 939 |
\index[console]{list media } |
| 940 |
Lists all the media defined in the Catalog. |
| 941 |
|
| 942 |
\item [list jobs] |
| 943 |
\index[console]{list jobs } |
| 944 |
Lists all jobs in the Catalog that have run. |
| 945 |
|
| 946 |
\item [list jobid=nn] |
| 947 |
\index[console]{list jobid } |
| 948 |
Lists JobId nn from the Catalog. |
| 949 |
|
| 950 |
\item [list jobtotals] |
| 951 |
\index[console]{list jobtotals } |
| 952 |
Lists totals for all jobs in the Catalog. |
| 953 |
|
| 954 |
\item [list files jobid=nn] |
| 955 |
\index[console]{list files jobid } |
| 956 |
List the files that were saved for JobId nn. |
| 957 |
|
| 958 |
\item [list jobmedia] |
| 959 |
\index[console]{list jobmedia } |
| 960 |
List the media information for each Job run. |
| 961 |
|
| 962 |
\item [messages] |
| 963 |
\index[console]{messages } |
| 964 |
Prints any messages that have been directed to the console. |
| 965 |
|
| 966 |
\item [unmount storage=storage-name] |
| 967 |
\index[console]{unmount storage } |
| 968 |
Unmounts the drive associated with the storage device with the name \textbf{ |
| 969 |
storage-name} if the drive is not currently being used. This command is used |
| 970 |
if you wish \bacula{} to free the drive so that you can use it to label a tape. |
| 971 |
|
| 972 |
|
| 973 |
\item [mount storage=storage-name] |
| 974 |
\index[sd]{mount storage } |
| 975 |
Causes the drive associated with the storage device to be mounted again. When |
| 976 |
\bacula{} reaches the end of a volume and requests you to mount a new volume, |
| 977 |
you must issue this command after you have placed the new volume in the |
| 978 |
drive. In effect, it is the signal needed by \bacula{} to know to start reading |
| 979 |
or writing the new volume. |
| 980 |
|
| 981 |
\item [quit] |
| 982 |
\index[sd]{quit } |
| 983 |
Exit or quit the console program. |
| 984 |
\end{bdescription} |
| 985 |
|
| 986 |
Most of the commands given above, with the exception of \bcommandname{list}, will |
| 987 |
prompt you for the necessary arguments if you simply enter the command name. |
| 988 |
|
| 989 |
\section{Debug Daemon Output} |
| 990 |
\index[general]{Debug Daemon Output } |
| 991 |
\index[general]{Output!Debug Daemon } |
| 992 |
|
| 993 |
If you want debug output from the daemons as they are running, start the |
| 994 |
daemons from the install directory as follows: |
| 995 |
|
| 996 |
\begin{bVerbatim} |
| 997 |
./bacula start -d100 |
| 998 |
\end{bVerbatim} |
| 999 |
|
| 1000 |
This can be particularly helpful if your daemons do not start correctly, |
| 1001 |
because direct daemon output to the console is normally directed to the |
| 1002 |
NULL device, but with the debug level greater than zero, the output |
| 1003 |
will be sent to the starting terminal. |
| 1004 |
|
| 1005 |
To stop the three daemons, enter the following from the install directory: |
| 1006 |
|
| 1007 |
\begin{bVerbatim} |
| 1008 |
./bacula stop |
| 1009 |
\end{bVerbatim} |
| 1010 |
|
| 1011 |
The execution of \btool{bacula stop} may complain about pids not found. This is |
| 1012 |
OK, especially if one of the daemons has died, which is very rare. |
| 1013 |
|
| 1014 |
To do a full system save, each File daemon must be running as root so that it |
| 1015 |
will have permission to access all the files. None of the other daemons |
| 1016 |
require root privileges. However, the Storage daemon must be able to open the |
| 1017 |
tape drives. On many systems, only root can access the tape drives. Either run |
| 1018 |
the Storage daemon as root, or change the permissions on the tape devices to |
| 1019 |
permit non-root access. \mysql{} and \postgresql{} can be installed and run with any |
| 1020 |
userid; root privilege is not necessary. |
| 1021 |
|
| 1022 |
\section{Patience When Starting Daemons or Mounting Blank Tapes} |
| 1023 |
|
| 1024 |
When you start the \bacula{} daemons, the Storage daemon attempts to open all |
| 1025 |
defined storage devices and verify the currently mounted Volume (if |
| 1026 |
configured). Until all the storage devices are verified, the Storage daemon |
| 1027 |
will not accept connections from the Console program. If a tape was previously |
| 1028 |
used, it will be rewound, and on some devices this can take several minutes. |
| 1029 |
As a consequence, you may need to have a bit of patience when first contacting |
| 1030 |
the Storage daemon after starting the daemons. If you can see your tape drive, |
| 1031 |
once the lights stop flashing, the drive will be ready to be used. |
| 1032 |
|
| 1033 |
The same considerations apply if you have just mounted a blank tape in a drive |
| 1034 |
such as an HP DLT. It can take a minute or two before the drive properly |
| 1035 |
recognizes that the tape is blank. If you attempt to \bcommandname{mount} the tape with |
| 1036 |
the Console program during this recognition period, it is quite possible that |
| 1037 |
you will hang your SCSI driver (at least on my Red Hat Linux system). As a |
| 1038 |
consequence, you are again urged to have patience when inserting blank tapes. |
| 1039 |
Let the device settle down before attempting to access it. |
| 1040 |
|
| 1041 |
\section{Difficulties Connecting from the FD to the SD} |
| 1042 |
\index[general]{Difficulties Connecting from the FD to the SD} |
| 1043 |
\index[general]{SD!Difficulties Connecting from the FD to the SD} |
| 1044 |
|
| 1045 |
If you are having difficulties getting one or more of your File daemons to |
| 1046 |
connect to the Storage daemon, it is most likely because you have not used a |
| 1047 |
fully qualified domain name on the \textbf{Address} directive in the |
| 1048 |
Director's Storage resource. That is the resolver on the File daemon's machine |
| 1049 |
(not on the Director's) must be able to resolve the name you supply into an IP |
| 1050 |
address. An example of an address that is guaranteed not to work: \textbf{ |
| 1051 |
localhost}. An example that may work: \textbf{megalon}. An example that is more |
| 1052 |
likely to work: \textbf{magalon.mydomain.com}. On Win32 if you don't have a good |
| 1053 |
resolver (often true on older Win98 systems), you might try using an IP |
| 1054 |
address in place of a name. |
| 1055 |
|
| 1056 |
If your address is correct, then make sure that no other program is using the |
| 1057 |
port 9103 on the Storage daemon's machine. The \bacula{} port numbers are |
| 1058 |
authorized by IANA, and should not be used by other programs, but apparently |
| 1059 |
some HP printers do use these port numbers. A \btool{netstat -a} on the Storage |
| 1060 |
daemon's machine can determine who is using the 9103 port (used for FD to SD |
| 1061 |
communications in \bacula{}). |
| 1062 |
|
| 1063 |
\section{Daemon Command Line Options} |
| 1064 |
\index[general]{Daemon Command Line Options } |
| 1065 |
\index[general]{Options!Daemon Command Line } |
| 1066 |
|
| 1067 |
Each of the three daemons (Director, File, Storage) accepts a small set of |
| 1068 |
options on the command line. In general, each of the daemons as well as the |
| 1069 |
Console program accepts the following options: |
| 1070 |
|
| 1071 |
\begin{bdescription} |
| 1072 |
|
| 1073 |
\item [-c \bbracket{file}] |
| 1074 |
\index[sd]{-c \bbracket{file} } |
| 1075 |
Define the file to use as a configuration file. The default is the daemon |
| 1076 |
name followed by \textbf{.conf} i.e. \bfilename{bacula-dir.conf} for the Director, |
| 1077 |
\bfilename{bacula-fd.conf} for the File daemon, and \bfilename{bacula-sd.conf} for the Storage |
| 1078 |
daemon. |
| 1079 |
|
| 1080 |
\item [-d nn] |
| 1081 |
\index[sd]{-d nn } |
| 1082 |
Set the debug level to \textbf{nn}. Higher levels of debug cause more |
| 1083 |
information to be displayed on STDOUT concerning what the daemon is doing. |
| 1084 |
|
| 1085 |
\item [-f] |
| 1086 |
Run the daemon in the foreground. This option is needed to run the daemon |
| 1087 |
under the debugger. |
| 1088 |
|
| 1089 |
\item [-g \bbracket{group}] |
| 1090 |
Run the daemon under this group. This must be a group name, not a GID. |
| 1091 |
|
| 1092 |
\item [-s] |
| 1093 |
Do not trap signals. This option is needed to run the daemon under the |
| 1094 |
debugger. |
| 1095 |
|
| 1096 |
\item [-t] |
| 1097 |
Read the configuration file and print any error messages, then immediately |
| 1098 |
exit. Useful for syntax testing of new configuration files. |
| 1099 |
|
| 1100 |
\item [-u \bbracket{user}] |
| 1101 |
Run the daemon as this user. This must be a user name, not a UID. |
| 1102 |
|
| 1103 |
\item [-v] |
| 1104 |
Be more verbose or more complete in printing error and informational |
| 1105 |
messages. Recommended. |
| 1106 |
|
| 1107 |
\item [-?] |
| 1108 |
Print the version and list of options. |
| 1109 |
|
| 1110 |
\end{bdescription} |
| 1111 |
|
| 1112 |
|
| 1113 |
\section{Creating a Pool} |
| 1114 |
\label{blb:Pool} |
| 1115 |
\index[general]{Pool!Creating a } |
| 1116 |
\index[general]{Creating a Pool } |
| 1117 |
|
| 1118 |
Creating the Pool is automatically done when \textbf{\bacula{}} starts, so if you |
| 1119 |
understand Pools, you can skip to the next section. |
| 1120 |
|
| 1121 |
When you run a job, one of the things that \bacula{} must know is what Volumes to |
| 1122 |
use to backup the FileSet. Instead of specifying a Volume (tape) directly, you |
| 1123 |
specify which Pool of Volumes you want \bacula{} to consult when it wants a tape |
| 1124 |
for writing backups. \bacula{} will select the first available Volume from the |
| 1125 |
Pool that is appropriate for the Storage device you have specified for the Job |
| 1126 |
being run. When a volume has filled up with data, \textbf{\bacula{}} will change its |
| 1127 |
VolStatus from \textbf{Append} to \textbf{Full}, and then \textbf{\bacula{}} will use the |
| 1128 |
next volume and so on. If no appendable Volume exists in the Pool, the |
| 1129 |
Director will attempt to recycle an old Volume, if there are still no |
| 1130 |
appendable Volumes available, \textbf{\bacula{}} will send a message requesting the |
| 1131 |
operator to create an appropriate Volume. |
| 1132 |
|
| 1133 |
\textbf{\bacula{}} keeps track of the Pool name, the volumes contained in the Pool, |
| 1134 |
and a number of attributes of each of those Volumes. |
| 1135 |
|
| 1136 |
When \bacula{} starts, it ensures that all Pool resource definitions have been |
| 1137 |
recorded in the catalog. You can verify this by entering: |
| 1138 |
|
| 1139 |
\begin{bVerbatim} |
| 1140 |
list pools |
| 1141 |
\end{bVerbatim} |
| 1142 |
|
| 1143 |
to the console program, which should print something like the following: |
| 1144 |
|
| 1145 |
\begin{bVerbatim} |
| 1146 |
*list pools |
| 1147 |
Using default Catalog name=MySQL DB=bacula |
| 1148 |
+--------+---------+---------+---------+----------+-------------+ |
| 1149 |
| PoolId | Name | NumVols | MaxVols | PoolType | LabelFormat | |
| 1150 |
+--------+---------+---------+---------+----------+-------------+ |
| 1151 |
| 1 | Default | 3 | 0 | Backup | * | |
| 1152 |
| 2 | File | 12 | 12 | Backup | File | |
| 1153 |
+--------+---------+---------+---------+----------+-------------+ |
| 1154 |
* |
| 1155 |
\end{bVerbatim} |
| 1156 |
|
| 1157 |
If you attempt to create the same Pool name a second time, \textbf{\bacula{}} will |
| 1158 |
print: |
| 1159 |
|
| 1160 |
\begin{bVerbatim} |
| 1161 |
Error: Pool Default already exists. |
| 1162 |
Once created, you may use the \bcommandname{update} command to |
| 1163 |
modify many of the values in the Pool record. |
| 1164 |
\end{bVerbatim} |
| 1165 |
|
| 1166 |
\label{blb:Labeling} |
| 1167 |
|
| 1168 |
\section{Labeling Your Volumes} |
| 1169 |
\index[general]{Volumes!Labeling Your } |
| 1170 |
\index[general]{Labeling Your Volumes } |
| 1171 |
|
| 1172 |
\bacula{} requires that each Volume contains a software label. There are several |
| 1173 |
strategies for labeling volumes. The one I use is to label them as they are |
| 1174 |
needed by \textbf{\bacula{}} using the console program. That is when \bacula{} needs a |
| 1175 |
new Volume, and it does not find one in the catalog, it will send me an email |
| 1176 |
message requesting that I add Volumes to the Pool. I then use the \bcommandname{label} |
| 1177 |
command in the Console program to label a new Volume and to define it in the |
| 1178 |
Pool database, after which \bacula{} will begin writing on the new Volume. |
| 1179 |
Alternatively, I can use the Console \bcommandname{relabel} command to relabel a Volume |
| 1180 |
that is no longer used providing it has VolStatus \textbf{Purged}. |
| 1181 |
|
| 1182 |
Another strategy is to label a set of volumes at the start, then use them as |
| 1183 |
\textbf{\bacula{}} requests them. This is most often done if you are cycling through |
| 1184 |
a set of tapes, for example using an autochanger. For more details on |
| 1185 |
recycling, please see the |
| 1186 |
\bilink{Automatic Volume Recycling}{blb:RecyclingChapter} chapter of |
| 1187 |
this manual. |
| 1188 |
|
| 1189 |
If you run a \bacula{} job, and you have no labeled tapes in the Pool, \bacula{} |
| 1190 |
will inform you, and you can create them "on-the-fly" so to speak. In my |
| 1191 |
case, I label my tapes with the date, for example: \textbf{DLT-18April02}. See |
| 1192 |
below for the details of using the \bcommandname{label} command. |
| 1193 |
|
| 1194 |
\section{Labeling Volumes with the Console Program} |
| 1195 |
\index[general]{Labeling Volumes with the Console Program } |
| 1196 |
\index[general]{Program!Labeling Volumes with the Console } |
| 1197 |
|
| 1198 |
Labeling volumes is normally done by using the console program. |
| 1199 |
|
| 1200 |
\begin{benumerate} |
| 1201 |
\item ./bconsole |
| 1202 |
\item label |
| 1203 |
\end{benumerate} |
| 1204 |
|
| 1205 |
If \bacula{} complains that you cannot label the tape because it is already |
| 1206 |
labeled, simply \bcommandname{unmount} the tape using the \bcommandname{unmount} command in the |
| 1207 |
console, then physically mount a blank tape and re-issue the \bcommandname{label} |
| 1208 |
command. |
| 1209 |
|
| 1210 |
Since the physical storage media is different for each device, the \bcommandname{label} |
| 1211 |
command will provide you with a list of the defined Storage resources such as |
| 1212 |
the following: |
| 1213 |
|
| 1214 |
\begin{bVerbatim} |
| 1215 |
The defined Storage resources are: |
| 1216 |
1: File |
| 1217 |
2: 8mmDrive |
| 1218 |
3: DLTDrive |
| 1219 |
4: SDT-10000 |
| 1220 |
Select Storage resource (1-4): |
| 1221 |
\end{bVerbatim} |
| 1222 |
|
| 1223 |
At this point, you should have a blank tape in the drive corresponding to the |
| 1224 |
Storage resource that you select. |
| 1225 |
|
| 1226 |
It will then ask you for the Volume name. |
| 1227 |
|
| 1228 |
\begin{bVerbatim} |
| 1229 |
Enter new Volume name: |
| 1230 |
\end{bVerbatim} |
| 1231 |
|
| 1232 |
If \bacula{} complains: |
| 1233 |
|
| 1234 |
\begin{bVerbatim} |
| 1235 |
Media record for Volume xxxx already exists. |
| 1236 |
\end{bVerbatim} |
| 1237 |
|
| 1238 |
It means that the volume name \textbf{xxxx} that you entered already exists in |
| 1239 |
the Media database. You can list all the defined Media (Volumes) with the |
| 1240 |
\bcommandname{list media} command. Note, the LastWritten column has been truncated for |
| 1241 |
proper printing. |
| 1242 |
|
| 1243 |
\begin{bVerbatim} |
| 1244 |
+---------------+---------+--------+----------------+-----/~/-+------------+-----+ |
| 1245 |
| VolumeName | MediaTyp| VolStat| VolBytes | LastWri | VolReten | Recy| |
| 1246 |
+---------------+---------+--------+----------------+---------+------------+-----+ |
| 1247 |
| DLTVol0002 | DLT8000 | Purged | 56,128,042,217 | 2001-10 | 31,536,000 | 0 | |
| 1248 |
| DLT-07Oct2001 | DLT8000 | Full | 56,172,030,586 | 2001-11 | 31,536,000 | 0 | |
| 1249 |
| DLT-08Nov2001 | DLT8000 | Full | 55,691,684,216 | 2001-12 | 31,536,000 | 0 | |
| 1250 |
| DLT-01Dec2001 | DLT8000 | Full | 55,162,215,866 | 2001-12 | 31,536,000 | 0 | |
| 1251 |
| DLT-28Dec2001 | DLT8000 | Full | 57,888,007,042 | 2002-01 | 31,536,000 | 0 | |
| 1252 |
| DLT-20Jan2002 | DLT8000 | Full | 57,003,507,308 | 2002-02 | 31,536,000 | 0 | |
| 1253 |
| DLT-16Feb2002 | DLT8000 | Full | 55,772,630,824 | 2002-03 | 31,536,000 | 0 | |
| 1254 |
| DLT-12Mar2002 | DLT8000 | Full | 50,666,320,453 | 1970-01 | 31,536,000 | 0 | |
| 1255 |
| DLT-27Mar2002 | DLT8000 | Full | 57,592,952,309 | 2002-04 | 31,536,000 | 0 | |
| 1256 |
| DLT-15Apr2002 | DLT8000 | Full | 57,190,864,185 | 2002-05 | 31,536,000 | 0 | |
| 1257 |
| DLT-04May2002 | DLT8000 | Full | 60,486,677,724 | 2002-05 | 31,536,000 | 0 | |
| 1258 |
| DLT-26May02 | DLT8000 | Append | 1,336,699,620 | 2002-05 | 31,536,000 | 1 | |
| 1259 |
+---------------+---------+--------+----------------+-----/~/-+------------+-----+ |
| 1260 |
\end{bVerbatim} |
| 1261 |
|
| 1262 |
Once \bacula{} has verified that the volume does not already exist, it will |
| 1263 |
prompt you for the name of the Pool in which the Volume (tape) is to be |
| 1264 |
created. If there is only one Pool (Default), it will be automatically |
| 1265 |
selected. |
| 1266 |
|
| 1267 |
If the tape is successfully labeled, a Volume record will also be created in |
| 1268 |
the Pool. That is the Volume name and all its other attributes will appear |
| 1269 |
when you list the Pool. In addition, that Volume will be available for backup |
| 1270 |
if the MediaType matches what is requested by the Storage daemon. |
| 1271 |
|
| 1272 |
When you labeled the tape, you answered very few questions about it -- |
| 1273 |
principally the Volume name, and perhaps the Slot. However, a Volume record in |
| 1274 |
the catalog database (internally known as a Media record) contains quite a few |
| 1275 |
attributes. Most of these attributes will be filled in from the default values |
| 1276 |
that were defined in the Pool (i.e. the Pool holds most of the default |
| 1277 |
attributes used when creating a Volume). |
| 1278 |
|
| 1279 |
It is also possible to add media to the pool without physically labeling the |
| 1280 |
Volumes. This can be done with the \bcommandname{add} command. For more information, |
| 1281 |
please see the |
| 1282 |
\bxlink{Console}{blb:ConsoleChapter}{console}{chapter} of the \bconsoleman{}. |