| 1 |
\chapter{Basic Volume Management} |
| 2 |
\label{blb:DiskChapter} |
| 3 |
\index[general]{Basic Volume Management} |
| 4 |
\index[general]{Management!Basic Volume} |
| 5 |
\index[general]{Disk Volumes} |
| 6 |
|
| 7 |
This chapter presents most all the features needed to do Volume management. |
| 8 |
Most of the concepts apply equally well to both tape and disk Volumes. |
| 9 |
However, the chapter was originally written to explain backing up to disk, so |
| 10 |
you will see it is slanted in that direction, but all the directives |
| 11 |
presented here apply equally well whether your volume is disk or tape. |
| 12 |
|
| 13 |
If you have a lot of hard disk storage or you absolutely must have your |
| 14 |
backups run within a small time window, you may want to direct \bacula{} to |
| 15 |
backup to disk Volumes rather than tape Volumes. This chapter is intended to |
| 16 |
give you some of the options that are available to you so that you can manage |
| 17 |
either disk or tape volumes. |
| 18 |
|
| 19 |
\label{blb:Concepts} |
| 20 |
\section{Key Concepts and Resource Records} |
| 21 |
\index[general]{Key Concepts and Resource Records } |
| 22 |
\index[general]{Records!Key Concepts and Resource } |
| 23 |
|
| 24 |
Getting \bacula{} to write to disk rather than tape in the simplest case is |
| 25 |
rather easy. In the Storage daemon's configuration file, you simply define an |
| 26 |
\textbf{Archive Device} to be a directory. For example, if you want your disk |
| 27 |
backups to go into the directory \bdirectoryname{/home/bacula/backups}, you could use the |
| 28 |
following: |
| 29 |
|
| 30 |
\begin{bVerbatim} |
| 31 |
Device { |
| 32 |
Name = FileBackup |
| 33 |
Media Type = File |
| 34 |
Archive Device = /home/bacula/backups |
| 35 |
Random Access = Yes; |
| 36 |
AutomaticMount = yes; |
| 37 |
RemovableMedia = no; |
| 38 |
AlwaysOpen = no; |
| 39 |
} |
| 40 |
\end{bVerbatim} |
| 41 |
|
| 42 |
Assuming you have the appropriate \textbf{Storage} resource in your Director's |
| 43 |
configuration file that references the above Device resource, |
| 44 |
|
| 45 |
\begin{bVerbatim} |
| 46 |
Storage { |
| 47 |
Name = FileStorage |
| 48 |
Address = ... |
| 49 |
Password = ... |
| 50 |
Device = FileBackup |
| 51 |
Media Type = File |
| 52 |
} |
| 53 |
\end{bVerbatim} |
| 54 |
|
| 55 |
\bacula{} will then write the archive to the file |
| 56 |
\textbf{/home/bacula/backups/\bbracket{volume-name}} where \bbracket{volume-name} is the |
| 57 |
volume name of a Volume defined in the Pool. For example, if you have labeled |
| 58 |
a Volume named \textbf{Vol001}, \bacula{} will write to the file \bfilename{/home/bacula/backups/Vol001}. |
| 59 |
Although you can later move the archive file to |
| 60 |
another directory, you should not rename it or it will become unreadable by |
| 61 |
\bacula{}. This is because each archive has the filename as part of the internal |
| 62 |
label, and the internal label must agree with the system filename before |
| 63 |
\bacula{} will use it. |
| 64 |
|
| 65 |
Although this is quite simple, there are a number of problems. The first is |
| 66 |
that unless you specify otherwise, \bacula{} will always write to the same volume |
| 67 |
until you run out of disk space. This problem is addressed below. |
| 68 |
|
| 69 |
In addition, if you want to use concurrent jobs that write to several |
| 70 |
different volumes at the same time, you will need to understand a number |
| 71 |
of other details. An example of such a configuration is given |
| 72 |
at the end of this chapter under |
| 73 |
\bilink{Concurrent Disk Jobs}{blb:ConcurrentDiskJobs}. |
| 74 |
|
| 75 |
\subsection{Pool Options to Limit the Volume Usage} |
| 76 |
\index[general]{Usage!Pool Options to Limit the Volume } |
| 77 |
\index[general]{Pool Options to Limit the Volume Usage } |
| 78 |
|
| 79 |
Some of the options you have, all of which are specified in the Pool record, |
| 80 |
are: |
| 81 |
|
| 82 |
\begin{bitemize} |
| 83 |
\item To write each Volume only once (i.e. one Job per Volume or file in this |
| 84 |
case), use: |
| 85 |
|
| 86 |
\textbf{UseVolumeOnce = yes}. |
| 87 |
|
| 88 |
\item To write nnn Jobs to each Volume, use: |
| 89 |
|
| 90 |
\textbf{Maximum Volume Jobs = nnn}. |
| 91 |
|
| 92 |
\item To limit the maximum size of each Volume, use: |
| 93 |
|
| 94 |
\textbf{Maximum Volume Bytes = mmmm}. |
| 95 |
|
| 96 |
Note, if you use disk volumes and do not specify a Maximum Volume Bytes, |
| 97 |
\bacula{} will write to your first Volume until your whole disk fills. |
| 98 |
This is probably not what you want. We recommend keeping your total |
| 99 |
number of Volumes created in the Catalog down to less than 5,000 for |
| 100 |
performance reasons when pruning. For a small site (10-20 clients), you |
| 101 |
might choose a Maximum Volume Bytes of 5G, for a medium site (20-100 |
| 102 |
clients) you might choose as size of 50G, and for large sites (greater |
| 103 |
than 100 clients) 200G. |
| 104 |
|
| 105 |
The advantage of bigger Volumes is that it improves performance during |
| 106 |
pruning (smaller number of Volumes to prune). The advantage of smaller |
| 107 |
Volumes is that you waste less disk space by being able to recycle them |
| 108 |
more often than big Volumes. |
| 109 |
|
| 110 |
As of \bacula{} version 2.0 and greater large Volumes present little |
| 111 |
performance penality during restores, because \bacula{} is able to seek to |
| 112 |
the start of each Job (and often within a Job). |
| 113 |
|
| 114 |
\item To limit the use time (i.e. write the Volume for a maximum of five days), |
| 115 |
use: |
| 116 |
|
| 117 |
\textbf{Volume Use Duration = ttt}. |
| 118 |
\end{bitemize} |
| 119 |
|
| 120 |
Note that although you probably would not want to limit the number of bytes on |
| 121 |
a tape as you would on a disk Volume, the other options can be very useful in |
| 122 |
limiting the time \bacula{} will use a particular Volume (be it tape or disk). |
| 123 |
For example, the above directives can allow you to ensure that you rotate |
| 124 |
through a set of daily Volumes if you wish. |
| 125 |
|
| 126 |
As mentioned above, each of those directives is specified in the Pool or |
| 127 |
Pools that you use for your Volumes. In the case of \textbf{Maximum Volume Job}, |
| 128 |
\textbf{Maximum Volume Bytes}, and \textbf{Volume Use Duration}, you can actually |
| 129 |
specify the desired value on a Volume by Volume basis. The value specified in |
| 130 |
the Pool record becomes the default when labeling new Volumes. Once a Volume |
| 131 |
has been created, it gets its own copy of the Pool defaults, and subsequently |
| 132 |
changing the Pool will have no effect on existing Volumes. You can either |
| 133 |
manually change the Volume values, or refresh them from the Pool defaults using |
| 134 |
the \bcommandname{update volume} command in the Console. As an example |
| 135 |
of the use of one of the above, suppose your Pool resource contains: |
| 136 |
|
| 137 |
\begin{bVerbatim} |
| 138 |
Pool { |
| 139 |
Name = File |
| 140 |
Pool Type = Backup |
| 141 |
Volume Use Duration = 23h |
| 142 |
} |
| 143 |
\end{bVerbatim} |
| 144 |
|
| 145 |
then if you run a backup once a day (every 24 hours), \bacula{} will use a new |
| 146 |
Volume for each backup, because each Volume it writes can only be used for 23 hours |
| 147 |
after the first write. Note, setting the use duration to 23 hours is not a very |
| 148 |
good solution for tapes unless you have someone on-site during the weekends, |
| 149 |
because \bacula{} will want a new Volume and no one will be present to mount it, |
| 150 |
so no weekend backups will be done until Monday morning. |
| 151 |
|
| 152 |
\label{blb:AutomaticLabeling} |
| 153 |
\subsection{Automatic Volume Labeling} |
| 154 |
\index[general]{Automatic Volume Labeling } |
| 155 |
\index[general]{Labeling!Automatic Volume } |
| 156 |
|
| 157 |
Use of the above records brings up another problem -- that of labeling your |
| 158 |
Volumes. For automated disk backup, you can either manually label each of your |
| 159 |
Volumes, or you can have \bacula{} automatically label new Volumes when they are |
| 160 |
needed. While, the automatic Volume labeling in version 1.30 and prior is a |
| 161 |
bit simplistic, but it does allow for automation, the features added in |
| 162 |
version 1.31 permit automatic creation of a wide variety of labels including |
| 163 |
information from environment variables and special \bacula{} Counter variables. |
| 164 |
|
| 165 |
|
| 166 |
Please note that automatic Volume labeling can also be used with tapes, but |
| 167 |
it is not nearly so practical since the tapes must be pre-mounted. This |
| 168 |
requires some user interaction. Automatic labeling from templates does NOT |
| 169 |
work with autochangers since \bacula{} will not access unknown slots. There |
| 170 |
are several methods of labeling all volumes in an autochanger magazine. |
| 171 |
For more information on this, please see the \bilink{Autochanger}{blb:AutochangersChapter} |
| 172 |
chapter of this manual. |
| 173 |
|
| 174 |
Automatic Volume labeling is enabled by making a change to both the Pool |
| 175 |
resource (Director) and to the Device resource (Storage daemon) shown above. |
| 176 |
In the case of the Pool resource, you must provide \bacula{} with a label format |
| 177 |
that it will use to create new names. In the simplest form, the label format |
| 178 |
is simply the Volume name, to which \bacula{} will append a four digit number. |
| 179 |
This number starts at 0001 and is incremented for each Volume the catalog |
| 180 |
contains. Thus if you modify your Pool resource to be: |
| 181 |
|
| 182 |
\begin{bVerbatim} |
| 183 |
Pool { |
| 184 |
Name = File |
| 185 |
Pool Type = Backup |
| 186 |
Volume Use Duration = 23h |
| 187 |
LabelFormat = "Vol" |
| 188 |
} |
| 189 |
\end{bVerbatim} |
| 190 |
|
| 191 |
\bacula{} will create Volume names Vol0001, Vol0002, and so on when new Volumes |
| 192 |
are needed. Much more complex and elaborate labels can be created using |
| 193 |
variable expansion defined in the |
| 194 |
\bxlink{Variable Expansion}{blb:VarsChapter}{misc}{chapter} of the \bmiscman{}. |
| 195 |
|
| 196 |
The second change that is necessary to make automatic labeling work is to give |
| 197 |
the Storage daemon permission to automatically label Volumes. Do so by adding |
| 198 |
\textbf{LabelMedia = yes} to the Device resource as follows: |
| 199 |
|
| 200 |
\begin{bVerbatim} |
| 201 |
Device { |
| 202 |
Name = File |
| 203 |
Media Type = File |
| 204 |
Archive Device = /home/bacula/backups |
| 205 |
Random Access = Yes; |
| 206 |
AutomaticMount = yes; |
| 207 |
RemovableMedia = no; |
| 208 |
AlwaysOpen = no; |
| 209 |
LabelMedia = yes |
| 210 |
} |
| 211 |
\end{bVerbatim} |
| 212 |
|
| 213 |
You can find more details of the \textbf{Label Format} Pool record in |
| 214 |
\bilink{Label Format}{blb:Label} description of the Pool resource |
| 215 |
records. |
| 216 |
|
| 217 |
\label{blb:Recycling1} |
| 218 |
\subsection{Restricting the Number of Volumes and Recycling} |
| 219 |
\index[general]{Recycling!Restricting the Number of Volumes and Recycling} |
| 220 |
\index[general]{Restricting the Number of Volumes and Recycling} |
| 221 |
|
| 222 |
Automatic labeling discussed above brings up the problem of Volume |
| 223 |
management. With the above scheme, a new Volume will be created every day. |
| 224 |
If you have not specified Retention periods, your Catalog will continue to |
| 225 |
fill keeping track of all the files \bacula{} has backed up, and this |
| 226 |
procedure will create one new archive file (Volume) every day. |
| 227 |
|
| 228 |
The tools \bacula{} gives you to help automatically manage these problems are |
| 229 |
the following: |
| 230 |
|
| 231 |
\begin{benumerate} |
| 232 |
\item Catalog file record retention periods, the |
| 233 |
\bilink{File Retention = ttt}{blb:FileRetention} record in the Client |
| 234 |
resource. |
| 235 |
\item Catalog job record retention periods, the |
| 236 |
\bilink{Job Retention = ttt}{blb:JobRetention} record in the Client |
| 237 |
resource. |
| 238 |
\item The |
| 239 |
\bilink{AutoPrune = yes}{blb:AutoPrune} record in the Client resource |
| 240 |
to permit application of the above two retention periods. |
| 241 |
\item The |
| 242 |
\bilink{Volume Retention = ttt}{blb:VolRetention} record in the Pool |
| 243 |
resource. |
| 244 |
\item The |
| 245 |
\bilink{AutoPrune = yes}{blb:PoolAutoPrune} record in the Pool |
| 246 |
resource to permit application of the Volume retention period. |
| 247 |
\item The |
| 248 |
\bilink{Recycle = yes}{blb:PoolRecycle} record in the Pool resource |
| 249 |
to permit automatic recycling of Volumes whose Volume retention period has |
| 250 |
expired. |
| 251 |
\item The |
| 252 |
\bilink{Recycle Oldest Volume = yes}{blb:RecycleOldest} record in the |
| 253 |
Pool resource tells \bacula{} to Prune the oldest volume in the Pool, and if all |
| 254 |
files were pruned to recycle this volume and use it. |
| 255 |
\item The |
| 256 |
\bilink{Recycle Current Volume = yes}{blb:RecycleCurrent} record in |
| 257 |
the Pool resource tells \bacula{} to Prune the currently mounted volume in the |
| 258 |
Pool, and if all files were pruned to recycle this volume and use it. |
| 259 |
\item The \bilink{Purge Oldest Volume = yes}{blb:PurgeOldest} record in the |
| 260 |
Pool resource permits a forced recycling of the oldest Volume when a new one |
| 261 |
is needed. \textbf{N.B. This record ignores retention periods! We highly |
| 262 |
recommend not to use this record, but instead use Recycle Oldest Volume} |
| 263 |
\item The |
| 264 |
\bilink{Maximum Volumes = nnn}{blb:MaxVolumes} record in the Pool |
| 265 |
resource to limit the number of Volumes that can be created. |
| 266 |
\end{benumerate} |
| 267 |
|
| 268 |
The first three directives (\bdirectivename{File Retention}, \bdirectivename{Job Retention}, and \bdirectivename{AutoPrune}) |
| 269 |
determine the amount of time that Job and File records will remain in your |
| 270 |
Catalog, and they are discussed in detail in the |
| 271 |
\bilink{Automatic Volume Recycling}{blb:RecyclingChapter} chapter of |
| 272 |
this manual. |
| 273 |
|
| 274 |
\bdirectivename{Volume Retention}, \bdirectivename{AutoPrune}, and \bdirectivename{Recycle} |
| 275 |
determine how long \bacula{} will keep Jobs and Files associated to your Volumes before reusing them, |
| 276 |
and they are also discussed in detail in the \bilink{Automatic Volume Recycling}{blb:RecyclingChapter} |
| 277 |
chapter of this manual. |
| 278 |
|
| 279 |
The Maximum Volumes record can also be used in conjunction with the Volume |
| 280 |
Retention period to limit the total number of archive Volumes (files) that |
| 281 |
\bacula{} will create. By setting an appropriate Volume Retention period, a |
| 282 |
Volume will be purged just before it is needed and thus \bacula{} can cycle |
| 283 |
through a fixed set of Volumes. Cycling through a fixed set of Volumes can |
| 284 |
also be done by setting \textbf{Recycle Oldest Volume = yes} or |
| 285 |
\textbf{Recycle Current Volume = yes}. In this case, when \bacula{} needs a new Volume, it will |
| 286 |
prune the specified volume. |
| 287 |
|
| 288 |
\label{blb:ConcurrentDiskJobs} |
| 289 |
\section{Concurrent Disk Jobs} |
| 290 |
\index[general]{Concurrent Disk Jobs} |
| 291 |
Above, we discussed how you could have a single device named |
| 292 |
\textbf{FileBackup} that writes to volumes in \bdirectoryname{/home/bacula/backups}. |
| 293 |
You can, in fact, run multiple concurrent jobs using the |
| 294 |
Storage definition given with this example, and all the jobs will |
| 295 |
simultaneously write into the Volume that is being written. |
| 296 |
|
| 297 |
Now suppose you want to use multiple Pools, which means multiple |
| 298 |
Volumes, or suppose you want each client to have its own Volume |
| 299 |
and perhaps its own directory such as \bdirectoryname{/home/bacula/client1} |
| 300 |
and \bdirectoryname{/home/bacula/client2} ... With the single Storage and Device |
| 301 |
definition above, neither of these two is possible. Why? Because |
| 302 |
\bacula{} disk storage follows the same rules as tape devices. Only |
| 303 |
one Volume can be mounted on any Device at any time. If you want |
| 304 |
to simultaneously write multiple Volumes, you will need multiple |
| 305 |
Device resources in your \bfilename{bacula-sd.conf} file, and thus multiple |
| 306 |
Storage resources in your \bfilename{bacula-dir.conf}. |
| 307 |
|
| 308 |
OK, so now you should understand that you need multiple Device definitions |
| 309 |
in the case of different directories or different Pools, but you also |
| 310 |
need to know that the catalog data that \bacula{} keeps contains only |
| 311 |
the Media Type and not the specific storage device. This permits a tape |
| 312 |
for example to be re-read on any compatible tape drive. The compatibility |
| 313 |
being determined by the Media Type. The same applies to disk storage. |
| 314 |
Since a volume that is written by a Device in say directory |
| 315 |
\bdirectoryname{/home/bacula/backups} cannot be read by a Device with an Archive Device |
| 316 |
definition of \bdirectoryname{/home/bacula/client1}, you will not be able to |
| 317 |
restore all your files if you give both those devices |
| 318 |
\textbf{Media Type = File}. During the restore, \bacula{} will simply choose |
| 319 |
the first available device, which may not be the correct one. If this |
| 320 |
is confusing, just remember that the Directory has only the Media Type |
| 321 |
and the Volume name. It does not know the \textbf{Archive Device} (or the |
| 322 |
full path) that is specified in the Storage daemon. Thus you must |
| 323 |
explicitly tie your Volumes to the correct Device by using the Media Type. |
| 324 |
|
| 325 |
The example shown below shows a case where there are two clients, each |
| 326 |
using its own Pool and storing their Volumes in different directories. |
| 327 |
|
| 328 |
|
| 329 |
\label{blb:Example2} |
| 330 |
\section{An Example} |
| 331 |
\index[general]{Example } |
| 332 |
|
| 333 |
The following example is not very practical, but can be used to demonstrate |
| 334 |
the proof of concept in a relatively short period of time. The example |
| 335 |
consists of a two clients that are backed up to a set of 12 archive files |
| 336 |
(Volumes) for each client into different directories on the Storage |
| 337 |
machine. Each Volume is used (written) only once, and there are four Full |
| 338 |
saves done every hour (so the whole thing cycles around after three hours). |
| 339 |
|
| 340 |
What is key here is that each physical device on the Storage daemon |
| 341 |
has a different Media Type. This allows the Director to choose the |
| 342 |
correct device for restores ... |
| 343 |
|
| 344 |
The Director's configuration file is as follows: |
| 345 |
|
| 346 |
\begin{bVerbatim} |
| 347 |
Director { |
| 348 |
Name = my-dir |
| 349 |
QueryFile = "~/bacula/bin/query.sql" |
| 350 |
PidDirectory = "~/bacula/working" |
| 351 |
WorkingDirectory = "~/bacula/working" |
| 352 |
Password = dir_password |
| 353 |
} |
| 354 |
Schedule { |
| 355 |
Name = "FourPerHour" |
| 356 |
Run = Level=Full hourly at 0:05 |
| 357 |
Run = Level=Full hourly at 0:20 |
| 358 |
Run = Level=Full hourly at 0:35 |
| 359 |
Run = Level=Full hourly at 0:50 |
| 360 |
} |
| 361 |
Job { |
| 362 |
Name = "RecycleExample" |
| 363 |
Type = Backup |
| 364 |
Level = Full |
| 365 |
Client = Rufus |
| 366 |
FileSet= "Example FileSet" |
| 367 |
Messages = Standard |
| 368 |
Storage = FileStorage |
| 369 |
Pool = Recycle |
| 370 |
Schedule = FourPerHour |
| 371 |
} |
| 372 |
|
| 373 |
Job { |
| 374 |
Name = "RecycleExample2" |
| 375 |
Type = Backup |
| 376 |
Level = Full |
| 377 |
Client = Roxie |
| 378 |
FileSet= "Example FileSet" |
| 379 |
Messages = Standard |
| 380 |
Storage = FileStorage1 |
| 381 |
Pool = Recycle1 |
| 382 |
Schedule = FourPerHour |
| 383 |
} |
| 384 |
|
| 385 |
FileSet { |
| 386 |
Name = "Example FileSet" |
| 387 |
Include { |
| 388 |
Options { |
| 389 |
compression=GZIP |
| 390 |
signature=SHA1 |
| 391 |
} |
| 392 |
File = /home/kern/bacula/bin |
| 393 |
} |
| 394 |
} |
| 395 |
|
| 396 |
Client { |
| 397 |
Name = Rufus |
| 398 |
Address = rufus |
| 399 |
Catalog = BackupDB |
| 400 |
Password = client_password |
| 401 |
} |
| 402 |
|
| 403 |
Client { |
| 404 |
Name = Roxie |
| 405 |
Address = roxie |
| 406 |
Catalog = BackupDB |
| 407 |
Password = client1_password |
| 408 |
} |
| 409 |
|
| 410 |
Storage { |
| 411 |
Name = FileStorage |
| 412 |
Address = rufus |
| 413 |
Password = local_storage_password |
| 414 |
Device = RecycleDir |
| 415 |
Media Type = File |
| 416 |
} |
| 417 |
|
| 418 |
Storage { |
| 419 |
Name = FileStorage1 |
| 420 |
Address = rufus |
| 421 |
Password = local_storage_password |
| 422 |
Device = RecycleDir1 |
| 423 |
Media Type = File1 |
| 424 |
} |
| 425 |
|
| 426 |
Catalog { |
| 427 |
Name = BackupDB |
| 428 |
dbname = bacula; user = bacula; password = "" |
| 429 |
} |
| 430 |
Messages { |
| 431 |
Name = Standard |
| 432 |
... |
| 433 |
} |
| 434 |
Pool { |
| 435 |
Name = Recycle |
| 436 |
Use Volume Once = yes |
| 437 |
Pool Type = Backup |
| 438 |
LabelFormat = "Recycle-" |
| 439 |
AutoPrune = yes |
| 440 |
VolumeRetention = 2h |
| 441 |
Maximum Volumes = 12 |
| 442 |
Recycle = yes |
| 443 |
} |
| 444 |
|
| 445 |
Pool { |
| 446 |
Name = Recycle1 |
| 447 |
Use Volume Once = yes |
| 448 |
Pool Type = Backup |
| 449 |
LabelFormat = "Recycle1-" |
| 450 |
AutoPrune = yes |
| 451 |
VolumeRetention = 2h |
| 452 |
Maximum Volumes = 12 |
| 453 |
Recycle = yes |
| 454 |
} |
| 455 |
|
| 456 |
\end{bVerbatim} |
| 457 |
|
| 458 |
and the Storage daemon's configuration file is: |
| 459 |
|
| 460 |
\begin{bVerbatim} |
| 461 |
Storage { |
| 462 |
Name = my-sd |
| 463 |
WorkingDirectory = "~/bacula/working" |
| 464 |
Pid Directory = "~/bacula/working" |
| 465 |
MaximumConcurrentJobs = 10 |
| 466 |
} |
| 467 |
Director { |
| 468 |
Name = my-dir |
| 469 |
Password = local_storage_password |
| 470 |
} |
| 471 |
Device { |
| 472 |
Name = RecycleDir |
| 473 |
Media Type = File |
| 474 |
Archive Device = /home/bacula/backups |
| 475 |
LabelMedia = yes; |
| 476 |
Random Access = Yes; |
| 477 |
AutomaticMount = yes; |
| 478 |
RemovableMedia = no; |
| 479 |
AlwaysOpen = no; |
| 480 |
} |
| 481 |
|
| 482 |
Device { |
| 483 |
Name = RecycleDir1 |
| 484 |
Media Type = File1 |
| 485 |
Archive Device = /home/bacula/backups1 |
| 486 |
LabelMedia = yes; |
| 487 |
Random Access = Yes; |
| 488 |
AutomaticMount = yes; |
| 489 |
RemovableMedia = no; |
| 490 |
AlwaysOpen = no; |
| 491 |
} |
| 492 |
|
| 493 |
Messages { |
| 494 |
Name = Standard |
| 495 |
director = my-dir = all |
| 496 |
} |
| 497 |
\end{bVerbatim} |
| 498 |
|
| 499 |
With a little bit of work, you can change the above example into a weekly or |
| 500 |
monthly cycle (take care about the amount of archive disk space used). |
| 501 |
|
| 502 |
\label{blb:MultipleDisks} |
| 503 |
\section{Backing up to Multiple Disks} |
| 504 |
\index[general]{Disks!Backing up to Multiple } |
| 505 |
\index[general]{Backing up to Multiple Disks } |
| 506 |
|
| 507 |
\bacula{} can, of course, use multiple disks, but in general, each disk must be a |
| 508 |
separate Device specification in the Storage daemon's conf file, and you must |
| 509 |
then select what clients to backup to each disk. You will also want to |
| 510 |
give each Device specification a different Media Type so that during |
| 511 |
a restore, \bacula{} will be able to find the appropriate drive. |
| 512 |
|
| 513 |
The situation is a bit more complicated if you want to treat two different |
| 514 |
physical disk drives (or partitions) logically as a single drive, which |
| 515 |
\bacula{} does not directly support. However, it is possible to back up your |
| 516 |
data to multiple disks as if they were a single drive by linking the |
| 517 |
Volumes from the first disk to the second disk. |
| 518 |
|
| 519 |
For example, assume that you have two disks named \bdirectoryname{/disk1} and |
| 520 |
\bdirectoryname{/disk2}. If you then create a standard Storage daemon Device resource for |
| 521 |
backing up to the first disk, it will look like the following: |
| 522 |
|
| 523 |
\begin{bVerbatim} |
| 524 |
Device { |
| 525 |
Name = client1 |
| 526 |
Media Type = File |
| 527 |
Archive Device = /disk1 |
| 528 |
LabelMedia = yes; |
| 529 |
Random Access = Yes; |
| 530 |
AutomaticMount = yes; |
| 531 |
RemovableMedia = no; |
| 532 |
AlwaysOpen = no; |
| 533 |
} |
| 534 |
\end{bVerbatim} |
| 535 |
|
| 536 |
Since there is no way to get the above Device resource to reference both |
| 537 |
\bdirectoryname{/disk1} and \bdirectoryname{/disk2} we do it by pre-creating |
| 538 |
Volumes on \bdirectoryname{/disk2} with the following: |
| 539 |
|
| 540 |
\begin{bVerbatim} |
| 541 |
ln -s /disk2/Disk2-vol001 /disk1/Disk2-vol001 |
| 542 |
ln -s /disk2/Disk2-vol002 /disk1/Disk2-vol002 |
| 543 |
ln -s /disk2/Disk2-vol003 /disk1/Disk2-vol003 |
| 544 |
... |
| 545 |
\end{bVerbatim} |
| 546 |
|
| 547 |
At this point, you can label the Volumes as Volume \textbf{Disk2-vol001}, |
| 548 |
\textbf{Disk2-vol002}, ... and \bacula{} will use them as if they were on |
| 549 |
\bdirectoryname{/disk1} but actually write the data to \bdirectoryname{/disk2}. |
| 550 |
The only minor inconvenience with this |
| 551 |
method is that you must explicitly name the disks and cannot use automatic |
| 552 |
labeling unless you arrange to have the labels exactly match the links you |
| 553 |
have created. |
| 554 |
|
| 555 |
An important thing to know is that \bacula{} treats disks like tape drives |
| 556 |
as much as it can. This means that you can only have a single Volume |
| 557 |
mounted at one time on a disk as defined in your Device resource in |
| 558 |
the Storage daemon's conf file. You can have multiple concurrent |
| 559 |
jobs running that all write to the one Volume that is being used, but |
| 560 |
if you want to have multiple concurrent jobs that are writing to |
| 561 |
separate disks drives (or partitions), you will need to define |
| 562 |
separate Device resources for each one, exactly as you would do for |
| 563 |
two different tape drives. There is one fundamental difference, however. |
| 564 |
The Volumes that you create on the two drives cannot be easily exchanged |
| 565 |
as they can for a tape drive, because they are physically resident (already |
| 566 |
mounted in a sense) on the particular drive. As a consequence, you will |
| 567 |
probably want to give them different Media Types so that \bacula{} can |
| 568 |
distinguish what Device resource to use during a restore. |
| 569 |
An example would be the following: |
| 570 |
|
| 571 |
\begin{bVerbatim} |
| 572 |
Device { |
| 573 |
Name = Disk1 |
| 574 |
Media Type = File1 |
| 575 |
Archive Device = /disk1 |
| 576 |
LabelMedia = yes; |
| 577 |
Random Access = Yes; |
| 578 |
AutomaticMount = yes; |
| 579 |
RemovableMedia = no; |
| 580 |
AlwaysOpen = no; |
| 581 |
} |
| 582 |
|
| 583 |
Device { |
| 584 |
Name = Disk2 |
| 585 |
Media Type = File2 |
| 586 |
Archive Device = /disk2 |
| 587 |
LabelMedia = yes; |
| 588 |
Random Access = Yes; |
| 589 |
AutomaticMount = yes; |
| 590 |
RemovableMedia = no; |
| 591 |
AlwaysOpen = no; |
| 592 |
} |
| 593 |
\end{bVerbatim} |
| 594 |
|
| 595 |
With the above device definitions, you can run two concurrent |
| 596 |
jobs each writing at the same time, one to \bdirectoryname{/disk1} and the |
| 597 |
other to \bdirectoryname{/disk2}. The fact that you have given them different |
| 598 |
Media Types will allow \bacula{} to quickly choose the correct |
| 599 |
Storage resource in the Director when doing a restore. |
| 600 |
|
| 601 |
\label{blb:MultipleClients} |
| 602 |
\section{Considerations for Multiple Clients} |
| 603 |
\index[general]{Clients!Considerations for Multiple } |
| 604 |
\index[general]{Multiple Clients} |
| 605 |
|
| 606 |
If we take the above example and add a second Client, here are a few |
| 607 |
considerations: |
| 608 |
|
| 609 |
\begin{bitemize} |
| 610 |
\item Although the second client can write to the same set of Volumes, you |
| 611 |
will probably want to write to a different set. |
| 612 |
\item You can write to a different set of Volumes by defining a second Pool, |
| 613 |
which has a different name and a different \textbf{LabelFormat}. |
| 614 |
\item If you wish the Volumes for the second client to go into a different |
| 615 |
directory (perhaps even on a different filesystem to spread the load), you |
| 616 |
would do so by defining a second Device resource in the Storage daemon. The |
| 617 |
\textbf{Name} must be different, and the \textbf{Archive Device} could be |
| 618 |
different. To ensure that Volumes are never mixed from one pool to another, |
| 619 |
you might also define a different MediaType (e.g. \textbf{File1}). |
| 620 |
\end{bitemize} |
| 621 |
|
| 622 |
In this example, we have two clients, each with a different Pool and a |
| 623 |
different number of archive files retained. They also write to different |
| 624 |
directories with different Volume labeling. |
| 625 |
|
| 626 |
The Director's configuration file is as follows: |
| 627 |
|
| 628 |
\begin{bVerbatim} |
| 629 |
Director { |
| 630 |
Name = my-dir |
| 631 |
QueryFile = "~/bacula/bin/query.sql" |
| 632 |
PidDirectory = "~/bacula/working" |
| 633 |
WorkingDirectory = "~/bacula/working" |
| 634 |
Password = dir_password |
| 635 |
} |
| 636 |
# Basic weekly schedule |
| 637 |
Schedule { |
| 638 |
Name = "WeeklySchedule" |
| 639 |
Run = Level=Full fri at 1:30 |
| 640 |
Run = Level=Incremental sat-thu at 1:30 |
| 641 |
} |
| 642 |
FileSet { |
| 643 |
Name = "Example FileSet" |
| 644 |
Include { |
| 645 |
Options { |
| 646 |
compression=GZIP |
| 647 |
signature=SHA1 |
| 648 |
} |
| 649 |
File = /home/kern/bacula/bin |
| 650 |
} |
| 651 |
} |
| 652 |
Job { |
| 653 |
Name = "Backup-client1" |
| 654 |
Type = Backup |
| 655 |
Level = Full |
| 656 |
Client = client1 |
| 657 |
FileSet= "Example FileSet" |
| 658 |
Messages = Standard |
| 659 |
Storage = File1 |
| 660 |
Pool = client1 |
| 661 |
Schedule = "WeeklySchedule" |
| 662 |
} |
| 663 |
Job { |
| 664 |
Name = "Backup-client2" |
| 665 |
Type = Backup |
| 666 |
Level = Full |
| 667 |
Client = client2 |
| 668 |
FileSet= "Example FileSet" |
| 669 |
Messages = Standard |
| 670 |
Storage = File2 |
| 671 |
Pool = client2 |
| 672 |
Schedule = "WeeklySchedule" |
| 673 |
} |
| 674 |
Client { |
| 675 |
Name = client1 |
| 676 |
Address = client1 |
| 677 |
Catalog = BackupDB |
| 678 |
Password = client1_password |
| 679 |
File Retention = 7d |
| 680 |
} |
| 681 |
Client { |
| 682 |
Name = client2 |
| 683 |
Address = client2 |
| 684 |
Catalog = BackupDB |
| 685 |
Password = client2_password |
| 686 |
} |
| 687 |
# Two Storage definitions with different Media Types |
| 688 |
# permits different directories |
| 689 |
Storage { |
| 690 |
Name = File1 |
| 691 |
Address = rufus |
| 692 |
Password = local_storage_password |
| 693 |
Device = client1 |
| 694 |
Media Type = File1 |
| 695 |
} |
| 696 |
Storage { |
| 697 |
Name = File2 |
| 698 |
Address = rufus |
| 699 |
Password = local_storage_password |
| 700 |
Device = client2 |
| 701 |
Media Type = File2 |
| 702 |
} |
| 703 |
Catalog { |
| 704 |
Name = BackupDB |
| 705 |
dbname = bacula; user = bacula; password = "" |
| 706 |
} |
| 707 |
Messages { |
| 708 |
Name = Standard |
| 709 |
... |
| 710 |
} |
| 711 |
# Two pools permits different cycling periods and Volume names |
| 712 |
# Cycle through 15 Volumes (two weeks) |
| 713 |
Pool { |
| 714 |
Name = client1 |
| 715 |
Use Volume Once = yes |
| 716 |
Pool Type = Backup |
| 717 |
LabelFormat = "Client1-" |
| 718 |
AutoPrune = yes |
| 719 |
VolumeRetention = 13d |
| 720 |
Maximum Volumes = 15 |
| 721 |
Recycle = yes |
| 722 |
} |
| 723 |
# Cycle through 8 Volumes (1 week) |
| 724 |
Pool { |
| 725 |
Name = client2 |
| 726 |
Use Volume Once = yes |
| 727 |
Pool Type = Backup |
| 728 |
LabelFormat = "Client2-" |
| 729 |
AutoPrune = yes |
| 730 |
VolumeRetention = 6d |
| 731 |
Maximum Volumes = 8 |
| 732 |
Recycle = yes |
| 733 |
} |
| 734 |
\end{bVerbatim} |
| 735 |
|
| 736 |
and the Storage daemon's configuration file is: |
| 737 |
|
| 738 |
\begin{bVerbatim} |
| 739 |
Storage { |
| 740 |
Name = my-sd |
| 741 |
WorkingDirectory = "~/bacula/working" |
| 742 |
Pid Directory = "~/bacula/working" |
| 743 |
MaximumConcurrentJobs = 10 |
| 744 |
} |
| 745 |
Director { |
| 746 |
Name = my-dir |
| 747 |
Password = local_storage_password |
| 748 |
} |
| 749 |
# Archive directory for Client1 |
| 750 |
Device { |
| 751 |
Name = client1 |
| 752 |
Media Type = File1 |
| 753 |
Archive Device = /home/bacula/client1 |
| 754 |
LabelMedia = yes; |
| 755 |
Random Access = Yes; |
| 756 |
AutomaticMount = yes; |
| 757 |
RemovableMedia = no; |
| 758 |
AlwaysOpen = no; |
| 759 |
} |
| 760 |
# Archive directory for Client2 |
| 761 |
Device { |
| 762 |
Name = client2 |
| 763 |
Media Type = File2 |
| 764 |
Archive Device = /home/bacula/client2 |
| 765 |
LabelMedia = yes; |
| 766 |
Random Access = Yes; |
| 767 |
AutomaticMount = yes; |
| 768 |
RemovableMedia = no; |
| 769 |
AlwaysOpen = no; |
| 770 |
} |
| 771 |
Messages { |
| 772 |
Name = Standard |
| 773 |
director = my-dir = all |
| 774 |
} |
| 775 |
\end{bVerbatim} |