]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/en/main/storedconf.tex
Document FDStorageAddress for client
[bacula/docs] / docs / manuals / en / main / storedconf.tex
1 %%
2 %%
3
4 \chapter{Storage Daemon Configuration}
5 \label{StoredConfChapter}
6 \index[general]{Storage Daemon Configuration}
7 \index[general]{Configuration!Storage Daemon}
8
9 The Storage Daemon configuration file has relatively few resource definitions.
10 However, due to the great variation in backup media and system capabilities,
11 the storage daemon must be highly configurable. As a consequence, there are
12 quite a large number of directives in the Device Resource definition that
13 allow you to define all the characteristics of your Storage device (normally a
14 tape drive). Fortunately, with modern storage devices, the defaults are
15 sufficient, and very few directives are actually needed.
16
17 Examples of {\bf Device} resource directives that are known to work for a
18 number of common tape drives can be found in the {\bf
19 \lt{}bacula-src\gt{}/examples/devices} directory, and most will also be listed
20 here.
21
22 For a general discussion of configuration file and resources including the
23 data types recognized by {\bf Bacula}, please see the
24 \ilink{Configuration}{ConfigureChapter} chapter of this manual. The
25 following Storage Resource definitions must be defined:
26
27 \begin{bsysitemize}
28 \item
29    \ilink{Storage}{StorageResource2} -- to define the  name of the
30    Storage daemon.
31 \item
32    \ilink{Director}{DirectorResource1} -- to  define the Director's
33    name and his access password.
34 \item
35    \ilink{Device}{DeviceResource} -- to define  the
36    characteristics of your storage device (tape  drive).
37 \item
38    \ilink{Messages}{MessagesChapter} -- to define where error  and
39    information messages are to be sent.
40 \end{bsysitemize}
41
42 \section{Storage Resource}
43 \label{StorageResource2}
44 \index[general]{Resource!Storage}
45 \index[general]{Storage Resource}
46
47 In general, the properties specified under the Storage resource define global
48 properties of the Storage daemon. Each Storage daemon configuration file must
49 have one and only one Storage resource definition.
50
51 \begin{description}
52
53 \label{Storage:Storage:Name}
54 \item [Name = \lt{}Storage-Daemon-Name\gt{}]
55    \index[sd]{Name}
56    \index[sd]{Directive!Name}
57    Specifies the Name of the Storage daemon. This  directive is required.
58
59 \label{Storage:Storage:WorkingDirectory}
60 \item [Working Directory = \lt{}Directory\gt{}]
61    \index[sd]{Working Directory}
62    \index[sd]{Directive!Working Directory}
63    This directive  is mandatory and specifies a directory in which the Storage
64    daemon  may put its status files. This directory should be used only  by {\bf
65    Bacula}, but may be shared by other Bacula daemons provided the names
66    given to each daemon are unique. This  directive is
67    required
68
69 \label{Storage:Storage:PidDirectory}
70 \item [Pid Directory = \lt{}Directory\gt{}]
71    \index[sd]{Pid Directory}
72    \index[sd]{Directive!Pid Directory}
73    This directive  is mandatory and specifies a directory in which the Director
74    may put its process Id file files. The process Id file is used to  shutdown
75    Bacula and to prevent multiple copies of  Bacula from running simultaneously.
76    This directive is required. Standard shell expansion of the {\bf Directory}
77    is done when the configuration file is read so that values such  as {\bf
78    \$HOME} will be properly expanded.
79
80    Typically on Linux systems, you will set this to:  {\bf /var/run}. If you are
81    not installing Bacula in the  system directories, you can use the {\bf Working
82    Directory} as  defined above.
83
84 \label{Storage:Storage:HeartbeatInterval}
85 \item [Heartbeat Interval = \lt{}time-interval\gt{}]
86    \index[sd]{Heartbeat Interval}
87    \index[sd]{Directive!Heartbeat Interval}
88    \index[general]{Heartbeat Interval}
89    \index[general]{Broken pipe}
90    This directive defines an interval of time in seconds.  When
91    the Storage daemon is waiting for the operator to mount a
92    tape, each time interval, it will send a heartbeat signal to
93    the File daemon.  The default interval is zero which disables
94    the heartbeat.  This feature is particularly useful if you
95    have a router such as 3Com that does not follow Internet
96    standards and times out an valid connection after a short
97    duration despite the fact that keepalive is set.  This usually
98    results in a broken pipe error message.
99
100 \label{Storage:Storage:ClientConnectWait}
101 \item [Client Connect Wait = \lt{}time-interval\gt{}]
102    \index[sd]{Connect Wait}
103    \index[sd]{Directive!Connect Wait}
104    \index[general]{Client Connect Wait}
105    This directive defines an interval of time in seconds that
106    the Storage daemon will wait for a Client (the File daemon)
107    to connect.  The default is 30 minutes.  Be aware that the
108    longer the Storage daemon waits for a Client, the more
109    resources will be tied up.
110
111 \label{Storage:Storage:MaximumConcurrentJobs}
112 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
113    \index[sd]{Maximum Concurrent Jobs}
114    \index[sd]{Directive!Maximum Concurrent Jobs}
115    where \lt{}number\gt{} is the maximum number of Jobs that may run
116    concurrently.  The default is set to 10, but you may set it to a larger
117    number.  Each contact from the Director (e.g.  status request, job start
118    request) is considered as a Job, so if you want to be able to do a {\bf
119    status} request in the console at the same time as a Job is running, you
120    will need to set this value greater than 1.  To run simultaneous Jobs,
121    you will need to set a number of other directives in the Director's
122    configuration file.  Which ones you set depend on what you want, but you
123    will almost certainly need to set the {\bf Maximum Concurrent Jobs} in
124    the Storage resource in the Director's configuration file and possibly
125    those in the Job and Client resources.
126
127 \label{Storage:Storage:SDAddresses}
128 \item [SDAddresses = \lt{}IP-address-specification\gt{}]
129    \index[sd]{SDAddresses}
130    \index[sd]{Directive!SDAddresses}
131    Specify the ports and addresses on which the Storage daemon will listen
132    for Director connections.  Normally, the default is sufficient and you
133    do not need to specify this directive.  Probably the simplest way to
134    explain how this directive works is to show an example:
135
136 \footnotesize
137 \begin{lstlisting}
138  SDAddresses  = { ip = {
139         addr = 1.2.3.4; port = 1205; }
140     ipv4 = {
141         addr = 1.2.3.4; port = http; }
142     ipv6 = {
143         addr = 1.2.3.4;
144         port = 1205;
145     }
146     ip = {
147         addr = 1.2.3.4
148         port = 1205
149     }
150     ip = {
151         addr = 1.2.3.4
152     }
153     ip = {
154         addr = 201:220:222::2
155     }
156     ip = {
157         addr = bluedot.thun.net
158     }
159 }
160 \end{lstlisting}
161 \normalsize
162
163 where ip, ip4, ip6, addr, and port are all keywords. Note, that  the address
164 can be specified as either a dotted quadruple, or  IPv6 colon notation, or as
165 a symbolic name (only in the ip specification).  Also, port can be specified
166 as a number or as the mnemonic value from  the /etc/services file.  If a port
167 is not specified, the default will be used. If an ip  section is specified,
168 the resolution can be made either by IPv4 or  IPv6. If ip4 is specified, then
169 only IPv4 resolutions will be permitted,  and likewise with ip6.
170
171 Using this directive, you can replace both the SDPort and SDAddress
172 directives shown below.
173
174 \label{Storage:Storage:SdPort}
175 \item [SDPort = \lt{}port-number\gt{}]
176    \index[sd]{SDPort}
177    \index[sd]{Directive!SDPort}
178    Specifies port number on which the Storage daemon  listens for Director
179    connections. The default is 9103.
180
181 \label{Storage:Storage:SdAddress}
182 \item [SDAddress = \lt{}IP-Address\gt{}]
183    \index[sd]{SDAddress}
184    \index[sd]{Directive!SDAddress}
185    This directive is optional, and if it is specified, it will cause the
186    Storage daemon server (for Director and File daemon connections) to bind
187    to the specified {\bf IP-Address}, which is either a domain name or an
188    IP address specified as a dotted quadruple.  If this directive is not
189    specified, the Storage daemon will bind to any available address (the
190    default).
191
192 \end{description}
193
194 The following is a typical Storage daemon Storage definition.
195
196 \footnotesize
197 \begin{lstlisting}
198 #
199 # "Global" Storage daemon configuration specifications appear
200 # under the Storage resource.
201 #
202 Storage {
203   Name = "Storage daemon"
204   Address = localhost
205   WorkingDirectory = "~/bacula/working"
206   Pid    Directory = "~/bacula/working"
207 }
208 \end{lstlisting}
209 \normalsize
210
211 \section{Director Resource}
212 \label{DirectorResource1}
213 \index[general]{Director Resource}
214 \index[general]{Resource!Director}
215
216 The Director resource specifies the Name of the Director which is permitted
217 to use the services of the Storage daemon.  There may be multiple Director
218 resources.  The Director Name and Password must match the corresponding
219 values in the Director's configuration file.
220
221 \begin{description}
222
223 \label{Storage:Director:Name}
224 \item [Name = \lt{}Director-Name\gt{}]
225    \index[sd]{Name}
226    \index[sd]{Directive!Name}
227    Specifies the Name of the Director allowed to connect  to the Storage daemon.
228    This directive is required.
229
230 \label{Storage:Director:Password}
231 \item [Password = \lt{}Director-password\gt{}]
232    \index[sd]{Password}
233    \index[sd]{Directive!Password}
234    Specifies the password that must be supplied by the above named  Director.
235    This directive is required.
236
237 \label{Storage:Director:Monitor}
238 \item [Monitor = \lt{}yes\vb{}no\gt{}]
239    \index[sd]{Monitor}
240    \index[sd]{Directive!Monitor}
241    If Monitor is set to {\bf no} (default), this director will have full
242    access to this Storage daemon.  If Monitor is set to {\bf yes}, this
243    director will only be able to fetch the current status of this Storage
244    daemon.
245
246    Please note that if this director is being used by a Monitor, we highly
247    recommend to set this directive to {\bf yes} to avoid serious security
248    problems.
249
250 \end{description}
251
252 The following is an example of a valid Director resource definition:
253
254 \footnotesize
255 \begin{lstlisting}
256 Director {
257   Name = MainDirector
258   Password = my_secret_password
259 }
260 \end{lstlisting}
261 \normalsize
262
263 \label{DeviceResource}
264 \section{Device Resource}
265 \index[general]{Resource!Device}
266 \index[general]{Device Resource}
267
268 The Device Resource specifies the details of each device (normally a tape
269 drive) that can be used by the Storage daemon.  There may be multiple
270 Device resources for a single Storage daemon.  In general, the properties
271 specified within the Device resource are specific to the Device.
272
273 \begin{description}
274
275 \label{Storage:Device:Name}
276 \item [Name = {\it Device-Name}]
277    \index[sd]{Name}
278    \index[sd]{Directive!Name}
279    Specifies the Name that the Director will use when asking to backup or
280    restore to or from to this device. This is the logical  Device name, and may
281    be any string up to 127 characters in length.  It is generally a good idea to
282    make it correspond to the English  name of the backup device. The physical
283    name of the device is  specified on the {\bf Archive Device} directive
284    described below.  The name you specify here is also used in your Director's
285    conf  file on the
286    \ilink{Device directive}{StorageResource2}  in its Storage
287    resource.
288
289 \label{Storage:Device:ArchiveDevice}
290 \item [Archive Device = {\it name-string}]
291    \index[sd]{Archive Device}
292    \index[sd]{Directive!Archive Device}
293    The specified {\bf name-string} gives the system file name of the  storage
294    device managed by this storage daemon. This will usually be  the device file
295    name of a removable storage device (tape drive),  for example "{\bf
296    /dev/nst0}" or "{\bf /dev/rmt/0mbn}".  It may also be a directory name
297    if you are archiving to disk storage.  In this case, you must supply the
298    full absolute path to the directory.  When specifying a tape device, it
299    is preferable that the "non-rewind" variant of the device file name be
300    given.  In addition, on systems such as Sun, which have multiple tape
301    access methods, you must be sure to specify to use Berkeley I/O
302    conventions with the device.  The {\bf b} in the Solaris (Sun) archive
303    specification {\bf /dev/rmt/0mbn} is what is needed in this case.
304    Bacula does not support SysV tape drive behavior.
305
306    As noted above, normally the Archive Device is the name of a tape drive, but
307    you may also specify an absolute path to an existing directory. If the
308    Device is a directory Bacula will write to file storage in the specified
309    directory, and the filename used will be the Volume name as specified in the
310    Catalog.  If you want to write into more than one directory (i.e.  to spread
311    the load to different disk drives), you will need to define two Device
312    resources, each containing an Archive Device with a different directory.
313    \label{SetupFifo}
314    In addition to a tape device name or a directory name, Bacula will  accept the
315    name of a FIFO. A FIFO is a special kind of file that  connects two programs
316    via kernel memory. If a FIFO device is specified  for a backup operation, you
317    must have a program that reads what Bacula  writes into the FIFO. When the
318    Storage daemon starts the job, it  will wait for {\bf MaximumOpenWait} seconds
319    for the read program to start reading, and then time it out and  terminate
320    the job. As a consequence, it is best to start the read  program at the
321    beginning of the job perhaps with the {\bf RunBeforeJob}  directive. For this
322    kind of device, you never want to specify  {\bf AlwaysOpen}, because you want
323    the Storage daemon to open it only  when a job starts, so you must explicitly
324    set it to {\bf No}.  Since a FIFO is a one way device, Bacula will not attempt
325    to read  a label of a FIFO device, but will simply write on it. To create a
326    FIFO Volume in the catalog, use the {\bf add} command rather than the {\bf
327    label} command to avoid attempting to write a label.
328
329 \footnotesize
330 \begin{lstlisting}
331 Device {
332   Name = FifoStorage
333   Media Type = Fifo
334   Device Type = Fifo
335   Archive Device = /tmp/fifo
336   LabelMedia = yes
337   Random Access = no
338   AutomaticMount = no
339   RemovableMedia = no
340   MaximumOpenWait = 60
341   AlwaysOpen = no
342 }
343 \end{lstlisting}
344 \normalsize
345
346    During a restore operation, if the Archive Device is a FIFO, Bacula  will
347    attempt to read from the FIFO, so you must have an external program  that
348    writes into the FIFO. Bacula will wait {\bf MaximumOpenWait} seconds  for the
349    program to begin writing and will then time it out and  terminate the job. As
350    noted above, you may use the {\bf RunBeforeJob}  to start the writer program
351    at the beginning of the job.
352
353    The Archive Device directive is required.
354
355 \label{Storage:Device:DeviceType}
356 \item [Device Type = {\it type-specification}]
357    \index[sd]{Device Type}
358    \index[sd]{Directive!Device Type}
359    The Device Type specification allows you to explicitly tell Bacula
360    what kind of device you are defining. It the {\it type-specification}
361    may be one of the following:
362    \begin{description}
363    \item [File]
364      Tells Bacula that the device is a file. It may either be a
365      file defined on fixed medium or a removable filesystem such as
366      USB.  All files must be random access devices.
367    \item [Tape]
368      The device is a tape device and thus is sequential access. Tape devices
369      are controlled using ioctl() calls.
370    \item [Fifo]
371      The device is a first-in-first out sequential access read-only
372      or write-only device.
373   \end{description}
374
375   The Device Type directive is not required, and if not specified, Bacula
376   will attempt to guess what kind of device has been specified using the
377   Archive Device specification supplied. There are several advantages to
378   explicitly specifying the Device Type. First, on some systems, block and
379   character devices have the same type.
380   Secondly, if you explicitly specify the Device Type, the mount point
381   need not be defined until the device is opened. This is the case with
382   most removable devices such as USB that are mounted by the HAL daemon.
383   If the Device Type is not explicitly specified, then the mount point
384   must exist when the Storage daemon starts.
385
386   This directive was implemented in Bacula version 1.38.6.
387
388
389 \label{Storage:Device:MediaType}
390 \item [Media Type = {\it name-string}]
391    \index[sd]{Media Type}
392    \index[sd]{Directive!Media Type}
393    The specified {\bf name-string} names the type of media supported by this
394    device, for example, "DLT7000".  Media type names are arbitrary in that you
395    set them to anything you want, but they must be known to the volume
396    database to keep track of which storage daemons can read which volumes.  In
397    general, each different storage type should have a unique Media Type
398    associated with it.  The same {\bf name-string} must appear in the
399    appropriate Storage resource definition in the Director's configuration
400    file.
401
402    Even though the names you assign are arbitrary (i.e.  you choose the name
403    you want), you should take care in specifying them because the Media Type
404    is used to determine which storage device Bacula will select during
405    restore.  Thus you should probably use the same Media Type specification
406    for all drives where the Media can be freely interchanged.  This is not
407    generally an issue if you have a single Storage daemon, but it is with
408    multiple Storage daemons, especially if they have incompatible media.
409
410    For example, if you specify a Media Type of "DDS-4" then during the
411    restore, Bacula will be able to choose any Storage Daemon that handles
412    "DDS-4".  If you have an autochanger, you might want to name the Media Type
413    in a way that is unique to the autochanger, unless you wish to possibly use
414    the Volumes in other drives.  You should also ensure to have unique Media
415    Type names if the Media is not compatible between drives.  This
416    specification is required for all devices.
417
418    In addition, if you are using disk storage, each Device resource will
419    generally have a different mount point or directory. In order for
420    Bacula to select the correct Device resource, each one must have a
421    unique Media Type.
422
423
424 \label{Storage:Device:Autochanger}
425 \label{Autochanger}
426 \item [Autochanger = {\it yes\vb{}no}]
427    \index[sd]{Autochanger}
428    \index[sd]{Directive!Autochanger}
429    If {\bf Yes}, this device belongs to an automatic tape changer, and you
430    must specify an {\bf Autochanger} resource that points to the {\bf
431    Device} resources.  You must also specify a
432    {\bf Changer Device}.  If the Autochanger directive is set to {\bf
433    No} (default), the volume must be manually changed.  You should also
434    have an identical directive to the
435    \ilink{Storage resource}{Autochanger1}  in the Director's
436    configuration file so that  when labeling tapes you are prompted for the slot.
437
438 \label{Storage:Device:ChangerDevice}
439 \item [Changer Device = {\it name-string}]
440    \index[sd]{Changer Device}
441    \index[sd]{Directive!Changer Device}
442    The specified {\bf name-string} must be the {\bf generic SCSI} device
443    name of the autochanger that corresponds to the normal read/write
444    {\bf Archive Device}  specified in the Device resource. This
445    generic SCSI device name should be specified if you have an autochanger
446    or if you have a standard tape drive and want to use the
447    {\bf Alert Command} (see below). For example, on Linux systems, for
448    an Archive Device name of {\bf /dev/nst0}, you would specify {\bf
449    /dev/sg0} for the Changer Device name. Depending on your exact
450    configuration, and the number of autochangers or the type of
451    autochanger, what you specify here can vary.  This directive is
452    optional.  See the \ilink{ Using Autochangers}{AutochangersChapter} chapter
453    of this manual for more details of using this and the following
454    autochanger directives.
455
456 \label{Storage:Device:ChangerCommand}
457 \item [Changer Command = {\it name-string}]
458    \index[sd]{Changer Command}
459    \index[sd]{Directive!Changer Command}
460    The {\bf name-string} specifies an external program to be called  that will
461    automatically change volumes as required by {\bf Bacula}.  Normally,
462    this directive will be specified only in the {\bf AutoChanger} resource,
463    which is then used for all devices.  However, you may also specify
464    the different {\bf Changer Command} in each Device resource.
465    Most frequently,
466    you will specify the Bacula supplied {\bf mtx-changer}  script as follows:
467
468 \footnotesize
469 \begin{lstlisting}
470 Changer Command = "/path/mtx-changer %c %o %S %a %d"
471 \end{lstlisting}
472 \normalsize
473
474    and you will install the {\bf mtx} on your system (found  in the {\bf depkgs}
475    release). An example of this command is in the default bacula-sd.conf file.
476    For more details on the substitution characters that may be specified  to
477    configure your autochanger please see  the
478    \ilink{Autochangers}{AutochangersChapter} chapter of this  manual.
479    For FreeBSD users, you might want to see one of the  several {\bf chio}
480    scripts in {\bf examples/autochangers}.
481
482 \label{Storage:Device:AlertCommand}
483 \item [Alert Command = {\it name-string}]
484    \index[sd]{Alert Command}
485    The {\bf name-string} specifies an external program to be called at the
486    completion of each Job after the device is released.  The purpose of this
487    command is to check for Tape Alerts, which are present when something is
488    wrong with your tape drive (at least for most modern tape drives).  The same
489    substitution characters that may be specified in the Changer Command may
490    also be used in this string.  For more information, please see the
491    \ilink{Autochangers}{AutochangersChapter} chapter of this manual.
492
493
494    Note, it is not necessary to have an autochanger to use this command. The
495    example below uses the {\bf tapeinfo} program that comes with the {\bf mtx}
496    package, but it can be used on any tape drive. However, you will need to
497    specify a {\bf Changer Device} directive in your Device resource (see above)
498    so that the generic SCSI device name can be edited into the command (with
499    the \%c).
500
501    An example of the use of this command to print Tape Alerts  in the Job report
502    is:
503
504 \footnotesize
505 \begin{lstlisting}
506 Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert'"
507
508 \end{lstlisting}
509 \normalsize
510
511 and an example output when there is a problem could be:
512
513 \footnotesize
514 \begin{lstlisting}
515 bacula-sd  Alert: TapeAlert[32]: Interface: Problem with SCSI interface
516                   between tape drive and initiator.
517
518 \end{lstlisting}
519 \normalsize
520
521 \label{Storage:Device:DriveIndex}
522 \item [Drive Index = {\it number}]
523    \index[sd]{Drive Index}
524    \index[sd]{Directive!Drive Index}
525    The {\bf Drive Index} that you specify is passed to the {\bf
526    mtx-changer} script and is thus passed to the {\bf mtx} program.  By
527    default, the Drive Index is zero, so if you have only one drive in your
528    autochanger, everything will work normally.  However, if you have
529    multiple drives, you must specify multiple Bacula Device resources (one
530    for each drive).  The first Device should have the Drive Index set to 0,
531    and the second Device Resource should contain a Drive Index set to 1,
532    and so on.  This will then permit you to use two or more drives in your
533    autochanger.  As of Bacula version 1.38.0, using the {\bf Autochanger}
534    resource, Bacula will automatically ensure that only one drive at a time
535    uses the autochanger script, so you no longer need locking scripts as in
536    the past -- the default mtx-changer script works for any number of
537    drives.
538
539 \label{Storage:Device:Autoselect}
540 \item [Autoselect = {\it yes\vb{}no}]
541    \index[sd]{Autoselect}
542    \index[sd]{Directive!Autoselect}
543    If this directive is set to {\bf yes} (default), and the Device
544    belongs to an autochanger, then when the Autochanger is referenced
545    by the Director, this device can automatically be selected. If this
546    directive is set to {\bf no}, then the Device can only be referenced
547    by directly using the Device name in the Director. This is useful
548    for reserving a drive for something special such as a high priority
549    backup or restore operations.
550
551 \item[Maximum Concurrent Jobs = {\it num}]
552 \index[sd]{MaximumConcurrentJobs}
553
554 {\bf Maximum Concurrent Jobs} is a directive that permits setting the maximum
555 number of Jobs that can run concurrently on a specified Device.  Using this
556 directive, it is possible to have different Jobs using multiple drives, because
557 when the Maximum Concurrent Jobs limit is reached, the Storage Daemon will
558 start new Jobs on any other available compatible drive.  This facilitates
559 writing to multiple drives with multiple Jobs that all use the same Pool.
560
561 \label{Storage:Device:MaximumChangerWait}
562 \item [Maximum Changer Wait = {\it time}]
563    \index[sd]{Maximum Changer Wait}
564    \index[sd]{Directive!Maximum Changer Wait}
565    This directive specifies the maximum time in seconds for Bacula to wait
566    for an autochanger to change the volume.  If this time is exceeded,
567    Bacula will invalidate the Volume slot number stored in the catalog and
568    try again.  If no additional changer volumes exist, Bacula will ask the
569    operator to intervene.  The default is 5 minutes.
570 % TODO: if this is the format, then maybe "5 minutes" should be in
571 % TODO: quotes? define style. see others.
572
573 \label{Storage:Device:MaximumRewindWait}
574 \item [Maximum Rewind Wait = {\it time}]
575    \index[sd]{Maximum Rewind Wait}
576    \index[sd]{Directive!Maximum Rewind Wait}
577    This directive specifies the maximum time in seconds for Bacula to wait
578    for a rewind before timing out.  If this time is exceeded,
579    Bacula will cancel the job.  The default is 5 minutes.
580
581 \label{Storage:Device:MaximumOpenWait}
582 \item [Maximum Open Wait = {\it time}]
583    \index[sd]{Maximum Open Wait}
584    \index[sd]{Directive!Maximum Open Wait}
585    This directive specifies the maximum time in seconds for Bacula to wait
586    for a open before timing out.  If this time is exceeded,
587    Bacula will cancel the job.  The default is 5 minutes.
588
589 \label{Storage:Device:AlwaysOpen}
590 \item [Always Open = {\it yes\vb{}no}]
591    \index[sd]{Always Open}
592    \index[sd]{Directive!Always Open}
593    If {\bf Yes}, Bacula will always keep the device open unless
594    specifically {\bf unmounted} by the Console program.  This permits
595    Bacula to ensure that the tape drive is always available, and properly
596    positioned. If you set
597    {\bf AlwaysOpen} to {\bf no} (default) {\bf Bacula} will only open the
598    drive when necessary, and at the end of the Job if no other Jobs are
599    using the drive, it will be freed.  The next time Bacula wants to append
600    to a tape on a drive that was freed, Bacula will rewind the tape and
601    position it to the end.  To avoid unnecessary tape positioning and to
602    minimize unnecessary operator intervention, it is highly recommended
603    that {\bf Always Open = yes}.  This also ensures that the drive is
604    available when Bacula needs it.
605
606    If you have {\bf Always Open = yes} (recommended) and you want to use the
607    drive for something else, simply use the {\bf unmount} command in the
608    Console program to release the drive. However, don't forget to remount the
609    drive with {\bf mount} when the drive is available or the next Bacula job
610    will block.
611
612    For File storage, this directive is ignored. For a FIFO storage  device, you
613    must set this to {\bf No}.
614
615    Please note that if you set this directive to {\bf No} Bacula  will release
616    the tape drive between each job, and thus the next job  will rewind the tape
617    and position it to the end of the data. This  can be a very time consuming
618    operation. In addition, with this directive set to no, certain multiple
619    drive autochanger operations will fail.  We strongly recommend to keep
620    {\bf Always Open} set to {\bf Yes}
621
622 \label{Storage:Device:VolumePollInterval}
623 \item [Volume Poll Interval = {\it time}]
624    \index[sd]{Volume Poll Interval}
625    \index[sd]{Directive!Volume Poll Interval}
626    If the time  specified on this directive is non-zero, after  asking the
627    operator to mount a new volume Bacula will  periodically poll (or read) the
628    drive at the specified  interval to see if a new volume has been mounted. If
629    the  time interval is zero (the default), no polling will occur.  This
630    directive can be useful if you want to avoid operator  intervention via the
631    console. Instead, the operator can  simply remove the old volume and insert
632    the requested one,  and Bacula on the next poll will recognize the new tape
633    and  continue. Please be aware that if you set this interval  too small, you
634    may excessively wear your tape drive if the  old tape remains in the drive,
635    since Bacula will read it on  each poll. This can be avoided by ejecting the
636    tape using  the {\bf Offline On Unmount} and the {\bf Close on Poll}
637    directives.
638    However, if you are using a Linux 2.6 kernel or other OSes
639    such as FreeBSD or Solaris, the Offline On Unmount will leave the drive
640    with no tape, and Bacula will not be able to properly open the drive and
641    may fail the job.  For more information on this problem, please see the
642    \bsysxrlink{description of Offline On Unmount}{NoTapeInDrive}{problems}{subsection}
643    in the \bsysxrlink{Tape Testing}{TapeTestingChapter}{problems}{chapter} of the \problemsman{}.
644
645 \label{Storage:Device:CloseOnPoll}
646 \item [Close on Poll = {\it yes\vb{}no}]
647    \index[sd]{Close on Poll}
648    \index[sd]{Directive!Close on Poll}
649    If {\bf Yes}, Bacula close the device (equivalent to  an unmount except no
650    mount is required) and reopen it at each  poll. Normally this is not too
651    useful unless you have the  {\bf Offline on Unmount} directive set, in which
652    case the  drive will be taken offline preventing wear on the tape  during any
653    future polling. Once the operator inserts a new  tape, Bacula will recognize
654    the drive on the next poll and  automatically continue with the backup.
655    Please see above more more details.
656
657 \label{Storage:Device:MaximumOpenWait}
658 \item [Maximum Open Wait = {\it time}]
659    \index[sd]{Maximum Open Wait}
660    \index[sd]{Directive!Maximum Open Wait}
661    This directive specifies the maximum amount of time in seconds that
662    Bacula will wait for a device that is busy.  The default is 5 minutes.
663    If the device cannot be obtained, the current Job will be terminated in
664    error.  Bacula will re-attempt to open the drive the next time a Job
665    starts that needs the the drive.
666
667
668 \label{Storage:Device:RemovableMedia}
669 \label{removablemedia}
670 \item [Removable Media = {\it yes\vb{}no}]
671    \index[sd]{Removable media}
672    \index[sd]{Directive!Removable media}
673    If {\bf Yes}, this device supports removable media (for example, tapes
674    or CDs).  If {\bf No}, media cannot be removed (for example, an
675    intermediate backup area on a hard disk). If {\bf Removable media} is
676    enabled on a File device (as opposed to a tape) the Storage daemon will
677    assume that device may be something like a USB device that can be
678    removed or a simply a removable harddisk. When attempting to open
679    such a device, if the Volume is not found (for File devices, the Volume
680    name is the same as the Filename), then the Storage daemon will search
681    the entire device looking for likely Volume names, and for each one
682    found, it will ask the Director if the Volume can be used.  If so,
683    the Storage daemon will use the first such Volume found.  Thus it
684    acts somewhat like a tape drive -- if the correct Volume is not found,
685    it looks at what actually is found, and if it is an appendable Volume,
686    it will use it.
687
688    If the removable medium is not automatically mounted (e.g. udev), then
689    you might consider using additional Storage daemon device directives
690    such as {\bf Requires Mount}, {\bf Mount Point}, {\bf Mount Command},
691    and {\bf Unmount Command}, all of which can be used in conjunction with
692    {\bf Removable Media}.
693
694
695 \label{Storage:Device:RandomAccess}
696 \item [Random Access = {\it yes\vb{}no}]
697    \index[sd]{Random access}
698    \index[sd]{Directive!Random access}
699    If {\bf Yes}, the archive device is assumed to be a random access medium
700    which supports the {\bf lseek} (or {\bf lseek64} if Largefile is enabled
701    during configuration) facility. This should be set to {\bf Yes} for all
702    file systems such as USB, and fixed files.  It should be set to
703    {\bf No} for non-random access devices such as tapes and named pipes.
704
705
706 \label{Storage:Device:RequiresMount}
707 \item [Requires Mount = {\it yes\vb{}no}]
708    \index[sd]{Requires Mount  }
709    When this directive is enabled, the Storage daemon will submit
710    a {\bf Mount Command} before attempting to open the device.
711    You must set this directive to {\bf yes} for removable
712    file systems such as USB devices that are not automatically mounted
713    by the operating system when plugged in or opened by Bacula.
714    It should be set to {\bf no} for
715    all other devices such as tapes and fixed filesystems. It should also
716    be set to {\bf no} for any removable device that is automatically
717    mounted by the operating system when opened (e.g. USB devices mounted
718    by udev or hotplug). This directive
719    indicates if the device requires to be mounted using the {\bf Mount
720    Command}.  To be able to write devices need a mount, the following
721    directives must also be defined: {\bf Mount Point}, {\bf Mount Command},
722    and {\bf Unmount Command}.
723
724 \label{Storage:Device:MountPoint}
725 \item [Mount Point = {\it directory}]
726    \index[sd]{Mount Point}
727    Directory where the device can be mounted.
728    This directive is used only
729    for devices that have {\bf Requires Mount} enabled such as
730    USB file devices.
731
732 \label{Storage:Device:MountCommand}
733 \item [Mount Command = {\it name-string}]
734    \index[sd]{Mount Command}
735    This directive specifies the command that must be executed to mount
736    devices such as many USB devices. Before the command is
737    executed, \%a is replaced with the Archive Device, and \%m with the Mount
738    Point.
739
740 See the \ilink {Edit Codes}{mountcodes} section below for more details of
741 the editing codes that can be used in this directive.
742
743   If you need to specify multiple commands, create a shell script.
744
745 \label{Storage:Device:UnmountCommand}
746 \item [Unmount Command = {\it name-string}]
747    \index[sd]{Unmount Command}
748    This directive specifies the command that must be executed to unmount
749    devices such as many USB devices. Before the command  is
750    executed, \%a is replaced with the Archive Device, and \%m with the  Mount
751    Point.
752
753    Most frequently, you will define it as follows:
754
755 \footnotesize
756 \begin{lstlisting}
757   Unmount Command = "/bin/umount %m"
758 \end{lstlisting}
759 \normalsize
760
761 See the \ilink {Edit Codes}{mountcodes} section below for more details of
762 the editing codes that can be used in this directive.
763
764   If you need to specify multiple commands, create a shell script.
765
766 \item[Block Checksum = {\it yes/no}]
767
768   You may turn off the Block Checksum (CRC32) code that Bacula uses when
769   writing blocks to a Volume. Doing so can reduce the Storage daemon CPU usage
770   slightly.  It will also permit Bacula to read a Volume that has corrupted
771   data.
772
773   The default is {\bf yes} -- i.e. the checksum is computed on write and
774   checked on read.
775
776   \textbf{We do not recommend to turn this off} particularly on older tape
777   drives or for disk Volumes where doing so may allow corrupted data to go
778   undetected.
779
780 \label{Storage:Device:MinimumBlockSize}
781 \item [Minimum block size = {\it size-in-bytes}]
782    \index[sd]{Minimum block size}
783    \index[sd]{Directive!Minimum block size}
784    On most modern tape drives, you will not need or want to specify this
785    directive, and if you do so, it will be to make Bacula use fixed block
786    sizes.  This statement applies only to non-random access devices (e.g.
787    tape drives).  Blocks written by the storage daemon to a non-random
788    archive device will never be smaller than the given {\bf size-in-bytes}.
789    The Storage daemon will attempt to efficiently fill blocks with data
790    received from active sessions but will, if necessary, add padding to a
791    block to achieve the required minimum size.
792
793    To force the block size to be fixed, as is the case for some non-random
794    access devices (tape drives), set the {\bf Minimum block size} and the
795    {\bf Maximum block size} to the same value (zero included).  The default
796    is that both the minimum and maximum block size are zero and the default
797    block size is 64,512 bytes.
798
799    For  example, suppose you want a fixed block size of 100K bytes, then you
800    would specify:
801
802 \footnotesize
803 \begin{lstlisting}
804
805     Minimum block size = 100K
806     Maximum block size = 100K
807
808 \end{lstlisting}
809 \normalsize
810
811    Please note that if you specify a fixed block size as shown above,  the tape
812    drive must either be in variable block size mode, or  if it is in fixed block
813    size mode, the block size (generally  defined by {\bf mt}) {\bf must} be
814    identical to the size specified  in Bacula -- otherwise when you attempt to
815    re-read your Volumes,  you will get an error.
816
817    If you want the  block size to be variable but with a 64K minimum and 200K
818    maximum (and  default as well), you would specify:
819
820 \footnotesize
821 \begin{lstlisting}
822
823     Minimum block size = 64K
824     Maximum blocksize = 200K
825
826 \end{lstlisting}
827 \normalsize
828
829 \label{Storage:Device:MaximumBlockSize}
830 \item [Maximum block size = {\it size-in-bytes}]
831    \index[sd]{Maximum block size}
832    \index[sd]{Directive!Maximum block size}
833    On most modern tape drives, you will not need to specify this directive.
834    If you do so, it will most likely be to use fixed block sizes (see
835    Minimum block size above).  The Storage daemon will always attempt to
836    write blocks of the specified {\bf size-in-bytes} to the archive device.
837    As a consequence, this statement specifies both the default block size
838    and the maximum block size.  The size written never exceed the given
839    {\bf size-in-bytes}.  If adding data to a block would cause it to exceed
840    the given maximum size, the block will be written to the archive device,
841    and the new data will begin a new block.
842
843    If no value is specified or zero is specified, the Storage daemon will
844    use a default block size of 64,512 bytes (126 * 512).
845
846    The maximum {\bf size-in-bytes} possible is 2,000,000.
847
848 \label{Storage:Device:HardwareEndOfMedium}
849 \item [Hardware End of Medium = {\it yes\vb{}no}]
850    \index[sd]{Hardware End of Medium}
851    \index[sd]{Directive!Hardware End of Medium}
852    If {\bf No}, the archive device is not required to support end of medium
853    ioctl request, and the storage daemon will use the forward space file
854    function to find the end of the recorded data. If {\bf Yes}, the archive
855    device must support the {\tt ioctl} {\tt MTEOM} call, which will position
856    the tape to the end of the recorded data. In addition, your SCSI driver must
857    keep track of the file number on the tape and report it back correctly by
858    the {\bf MTIOCGET} ioctl. Note, some SCSI drivers will correctly forward
859    space to the end of the recorded data, but they do not keep track of the
860    file number.  On Linux machines, the SCSI driver has a {\bf fast-eod}
861    option, which if set will cause the driver to lose track of the file
862    number. You should ensure that this option is always turned off using the
863    {\bf mt} program.
864
865    Default setting for Hardware End of Medium is {\bf Yes}. This  function is
866    used before appending to a tape to ensure that no  previously written data is
867    lost. We recommend if you have a non-standard or unusual tape drive that you
868    use the {\bf btape} program  to test your drive to see whether or not it
869    supports this function.  All modern (after 1998) tape drives support this
870    feature.
871
872 \label{Storage:Device:FastForwardSpaceFile}
873 \item [Fast Forward Space File = {\it yes\vb{}no}]
874    \index[sd]{Fast Forward Space File}
875    \index[sd]{Directive!Fast Forward Space File}
876    If {\bf No}, the archive device is not required to support  keeping track of
877    the file number ({\bf MTIOCGET} ioctl) during  forward space file. If {\bf
878    Yes}, the archive device must support  the {\tt ioctl} {\tt MTFSF} call, which
879    virtually all drivers  support, but in addition, your SCSI driver must keep
880    track of the  file number on the tape and report it back correctly by the
881    {\bf MTIOCGET} ioctl. Note, some SCSI drivers will correctly  forward space,
882    but they do not keep track of the file number or more  seriously, they do not
883    report end of medium.
884
885    Default setting for Fast Forward Space File is {\bf Yes}.
886
887 \label{Storage:Device:UseMtiocget}
888 \item [Use MTIOCGET = {\it yes\vb{}no}]
889    \index[sd]{Use MTIOCGET}
890    \index[sd]{Directive!Use MTIOCGET}
891    If {\bf No}, the operating system is not required to support keeping track of
892    the file number and reporting it in the ({\bf MTIOCGET} ioctl). The default
893    is {\bf Yes}. If you must set this to No, Bacula will do the proper file
894    position determination, but it is very unfortunate because it means that
895    tape movement is very inefficient.
896    Fortunately, this operation system deficiency seems to be the case only
897    on a few *BSD systems.  Operating systems known to work correctly are
898    Solaris, Linux and FreeBSD.
899
900 \label{Storage:Device:BsfAtEom}
901 \item [BSF at EOM = {\it yes\vb{}no}]
902    \index[sd]{BSF at EOM}
903    \index[sd]{Directive!BSF at EOM}
904    If {\bf No}, the default, no special action is taken by Bacula with the End
905    of Medium (end of tape) is reached because the tape will be positioned after
906    the last EOF tape mark, and Bacula can append to the tape as desired.
907    However, on some systems, such as FreeBSD, when Bacula reads the End of
908    Medium (end of tape), the tape will be positioned after the second EOF tape
909    mark (two successive EOF marks indicated End of Medium). If Bacula appends
910    from that point, all the appended data will be lost. The solution for such
911    systems is to specify {\bf BSF at EOM} which causes Bacula to backspace over
912    the second EOF mark. Determination of whether or not you need this directive
913    is done using the {\bf test} command in the {\bf btape} program.
914
915
916 \label{Storage:Device:TwoEof}
917 \item [TWO EOF = {\it yes\vb{}no}]
918    \index[sd]{TWO EOF}
919    \index[sd]{Directive!TWO EOF}
920    If {\bf Yes}, Bacula will write two end of file marks when terminating a
921    tape -- i.e. after the last job or at the end of the medium. If {\bf No},
922    the default, Bacula will only write one end of file to terminate the tape.
923
924 \label{Storage:Device:BackwardSpaceRecord}
925 \item [Backward Space Record = {\it yes\vb{}no}]
926    \index[sd]{Backward Space Record}
927    \index[sd]{Directive!Backward Space Record}
928    If {\it Yes}, the archive device supports the {\tt MTBSR ioctl} to backspace
929    records. If {\it No}, this call is not used and the device must be rewound
930    and advanced forward to the desired position. Default is {\bf Yes} for non
931    random-access devices. This function if enabled is used at the end of a
932    Volume after writing the end of file and any ANSI/IBM labels to determine
933    whether or not the last block was written correctly. If you turn this
934    function off, the test will not be done. This causes no harm as the re-read
935    process is precautionary rather than required.
936
937 \label{Storage:Device:BackwardSpaceFile}
938 \item [Backward Space File = {\it yes\vb{}no}]
939    \index[sd]{Backward Space File}
940    \index[sd]{Directive!Backward Space File}
941    If {\it Yes}, the archive device supports the {\bf MTBSF} and  {\bf MTBSF
942   ioctl}s to backspace over an end of file mark and to the  start of a file. If
943   {\it No}, these calls are not used and the  device must be rewound and
944   advanced forward to the desired position.  Default is {\bf Yes} for non
945   random-access devices.
946
947 \label{Storage:Device:ForwardSpaceRecord}
948 \item [Forward Space Record = {\it yes\vb{}no}]
949    \index[sd]{Forward Space Record}
950    \index[sd]{Directive!Forward Space Record}
951    If {\it Yes}, the archive device must support the {\bf MTFSR  ioctl} to
952    forward space over records. If {\bf No}, data must  be read in order to
953    advance the position on the device. Default is  {\bf Yes} for non
954    random-access devices.
955
956 \label{Storage:Device:ForwardSpaceFile}
957 \item [Forward Space File = {\it yes\vb{}no}]
958    \index[sd]{Forward Space File}
959    \index[sd]{Directive!Forward Space File}
960    If {\bf Yes}, the archive device must support the {\tt MTFSF  ioctl} to
961    forward space by file marks. If {\it No}, data  must be read to advance the
962    position on the device. Default is  {\bf Yes} for non random-access devices.
963
964 \label{Storage:Device:OfflineOnUnmount}
965 \item [Offline On Unmount = {\it yes\vb{}no}]
966    \index[sd]{Offline On Unmount}
967    \index[sd]{Directive!Offline On Unmount}
968    The default for this directive is {\bf No}. If {\bf Yes} the  archive device
969    must support the {\tt MTOFFL ioctl} to rewind and  take the volume offline. In
970    this case, Bacula will issue the  offline (eject) request before closing the
971    device during the {\bf unmount}  command. If {\bf No} Bacula will not attempt
972    to offline the  device before unmounting it. After an offline is issued,  the
973    cassette will be ejected thus {\bf requiring operator intervention}  to
974    continue, and on some systems require an explicit load command  to be issued
975    ({\bf mt -f /dev/xxx load}) before the system will recognize  the tape. If you
976    are using an autochanger, some devices  require an offline to be issued prior
977    to changing the volume. However,  most devices do not and may get very
978    confused.
979
980    If you are using a Linux 2.6 kernel or other OSes
981    such as FreeBSD or Solaris, the Offline On Unmount will leave the drive
982    with no tape, and Bacula will not be able to properly open the drive and
983    may fail the job.  For more information on this problem, please see the
984    \bsysxrlink{description of Offline On Unmount}{NoTapeInDrive}{problems}{subsection}
985    in the \bsysxrlink{Tape Testing}{TapeTestingChapter}{problems}{chapter} of the \problemsman{}.
986
987
988 \label{Storage:Device:MaximumConcurrentJobs}
989 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
990    \index[sd]{Device Maximum Concurrent Jobs}
991    \index[sd]{Directive!Device Maximum Concurrent Jobs}
992    \index[sd]{Directive!New in 3.0.3}
993    where \lt{}number\gt{} is the maximum number of Jobs that can run
994    concurrently on a specified Device.  Using this directive, it is possible
995    to have different Jobs using multiple drives, because when
996    the Maximum Concurrent Jobs limit is
997    reached, the Storage Daemon will start new Jobs on any other available
998    compatible drive.  This facilitates writing to multiple drives with
999    multiple Jobs that all use the same Pool.
1000
1001 \label{Storage:Device:MaximumVolumeSize}
1002 \item [Maximum Volume Size = {\it size}]
1003    \index[sd]{Maximum Volume Size}
1004    \index[sd]{Directive!Maximum Volume Size}
1005    No more than {\bf size} bytes will be written onto a given volume on the
1006    archive device.  This directive is used mainly in testing Bacula to
1007    simulate a small Volume.  It can also be useful if you wish to limit the
1008    size of a File Volume to say less than 2GB of data.  In some rare cases
1009    of really antiquated tape drives that do not properly indicate when the
1010    end of a tape is reached during writing (though I have read about such
1011    drives, I have never personally encountered one).  Please note, this
1012    directive is deprecated (being phased out) in favor of the {\bf Maximum
1013    Volume Bytes} defined in the Director's configuration file.
1014
1015 \label{Storage:Device:MaximumFileSize}
1016 \item [Maximum File Size = {\it size}]
1017    \index[sd]{Maximum File Size}
1018    \index[sd]{Directive!Maximum File Size}
1019    No more than {\bf size} bytes will be written into a given logical file
1020    on the volume.  Once this size is reached, an end of file mark is
1021    written on the volume and subsequent data are written into the next
1022    file.  Breaking long sequences of data blocks with file marks permits
1023    quicker positioning to the start of a given stream of data and can
1024    improve recovery from read errors on the volume.  The default is one
1025    Gigabyte.  This directive creates EOF marks only on tape media.
1026    However, regardless of the medium type (tape, disk, USB ...) each time
1027    a the Maximum File Size is exceeded, a record is put into the catalog
1028    database that permits seeking to that position on the medium for
1029    restore operations. If you set this to a small value (e.g. 1MB),
1030    you will generate lots of database records (JobMedia) and may
1031    significantly increase CPU/disk overhead.
1032
1033    If you are configuring an LTO-3 or LTO-4 tape, you probably will
1034    want to set the {\bf Maximum File Size} to 2GB to avoid making
1035    the drive stop to write an EOF mark.
1036
1037    Note, this directive does not limit the size of Volumes that Bacula
1038    will create regardless of whether they are tape or disk volumes. It
1039    changes only the number of EOF marks on a tape and the number of
1040    block positioning records (see below) that are generated. If you
1041    want to limit the size of all Volumes for a particular device, use
1042    the {\bf Maximum Volume Size} directive (above), or use the
1043    {\bf Maximum Volume Bytes} directive in the Director's Pool resource,
1044    which does the same thing but on a Pool (Volume) basis.
1045
1046 \label{Storage:Device:BlockPositioning}
1047 \item [Block Positioning = {\it yes\vb{}no}]
1048    \index[sd]{Block Positioning}
1049    \index[sd]{Directive!Block Positioning}
1050    This directive tells Bacula not to use block positioning when doing restores.
1051    Turning this directive off can cause Bacula to be {\bf extremely} slow
1052    when restoring files.  You might use this directive if you wrote your
1053    tapes with Bacula in variable block mode (the default), but your drive
1054    was in fixed block mode. The default is {\bf yes}.
1055
1056 \label{Storage:Device:MaximumNetworkBufferSize}
1057 \item [Maximum Network Buffer Size = {\it bytes}]
1058    \index[sd]{Maximum Network Buffer Size}
1059    \index[sd]{Directive!Maximum Network Buffer Size}
1060    where {\it bytes} specifies the initial network buffer  size to use with the
1061    File daemon.  This size will be adjusted down if it is too large until
1062    it is accepted by the OS. Please use care in setting this value since if
1063    it is too large, it will be trimmed by 512 bytes until the OS is happy,
1064    which may require a large number of system calls.  The default value is
1065    32,768 bytes.
1066
1067    The default size was chosen to be relatively large but not too big in
1068    the case that you are transmitting data over Internet.  It is clear that
1069    on a high speed local network, you can increase this number and improve
1070    performance. For example, some users have found that if you use a value
1071    of 65,536 bytes they get five to ten times the throughput.  Larger values for
1072    most users don't seem to improve performance. If you are interested
1073    in improving your backup speeds, this is definitely a place to
1074    experiment. You will probably also want to make the corresponding change
1075    in each of your File daemons conf files.
1076
1077
1078 \label{Storage:Device:MaximumSpoolSize}
1079 \item [Maximum Spool Size = {\it bytes}]
1080    \index[sd]{Maximum Spool Size}
1081    \index[sd]{Directive!Maximum Spool Size}
1082    where the bytes specify the maximum spool size for all jobs that are
1083    running.  The default is no limit.
1084
1085 \label{Storage:Device:MaximumJobSpoolSize}
1086 \item [Maximum Job Spool Size = {\it bytes}]
1087    \index[sd]{Maximum Job Spool Size}
1088    \index[sd]{Directive!Maximum Job Spool Size}
1089    where the bytes specify the maximum spool size for any one job  that is
1090    running. The default is no limit.
1091    This directive is implemented only in version 1.37 and later.
1092
1093 \label{Storage:Device:SpoolDirectory}
1094 \item [Spool Directory = {\it directory}]
1095    \index[sd]{Spool Directory}
1096    \index[sd]{Directive!Spool Directory}
1097    specifies the name of the directory to be used to store  the spool files for
1098    this device. This directory is also used to store  temporary part files when
1099    writing to a device that requires mount (USB).  The default is to use the
1100    working directory.
1101
1102 \label{Storage:Device:MaximumPartSize}
1103 \item [Maximum Part Size = {\it bytes}]
1104    \index[sd]{Maximum Part Size}
1105    \index[sd]{Directive!Maximum Part Size}
1106    This is the maximum size of a volume part file. The default is no limit.
1107    This directive is implemented only in version 1.37 and later.
1108
1109    If the device requires  mount, it is transferred to the device when this size
1110    is reached.  In this case, you must take care to have enough disk space left
1111    in  the spool directory.
1112
1113    Otherwise, it is left on the hard disk.
1114
1115    It is ignored for tape and FIFO devices.
1116
1117
1118 \end{description}
1119
1120 \label{mountcodes}
1121 \section{Edit Codes for Mount and Unmount Directives}
1122 \index[general]{Directives!Edit Codes}
1123 \index[general]{Edit Codes for Mount and Unmount Directives }
1124
1125 Before submitting the {\bf Mount Command}, {\bf Unmount Command},
1126 {\bf Write Part Command}, or {\bf Free Space Command} directives
1127 to the operating system, Bacula performs character substitution of the
1128 following characters:
1129
1130 \footnotesize
1131 \begin{lstlisting}
1132     %% = %
1133     %a = Archive device name
1134     %e = erase (set if cannot mount and first part)
1135     %n = part number
1136     %m = mount point
1137     %v = last part name (i.e. filename)
1138 \end{lstlisting}
1139 \normalsize
1140
1141
1142 \section{Devices that require a mount (USB)}
1143 \index[general]{Devices that require a mount (USB)}
1144
1145 All the directives in this section are implemented only in
1146 Bacula version 1.37 and later and hence are available in version 1.38.6.
1147
1148 As of version 1.39.5, the directives
1149 "Requires Mount", "Mount Point", "Mount Command", and "Unmount Command"
1150 apply to removable filesystems such as USB.
1151
1152 \begin{description}
1153
1154 \label{Storage:Device:RequiresMount}
1155 \item [Requires Mount = {\it yes\vb{}no}]
1156    \index[sd]{Requires Mount}
1157    \index[sd]{Directive!Requires Mount}
1158    You must set this directive to {\bf yes} for removable devices such as
1159    USB unless they are automounted, and to {\bf no} for all other devices
1160    (tapes/files).  This directive indicates if the device requires to be
1161    mounted to be read, and if it must be written in a special way.  If it
1162    set, {\bf Mount Point}, {\bf Mount Command}, {\bf Unmount Command} and
1163    {\bf Write Part Command} directives must also be defined.
1164
1165 \label{Storage:Device:MountPoint}
1166 \item [Mount Point = {\it directory}]
1167    \index[sd]{Mount Point}
1168    \index[sd]{Directive!Mount Point}
1169    Directory where the device can be mounted.
1170
1171 \label{Storage:Device:MountCommand}
1172 \item [Mount Command = {\it name-string}]
1173    \index[sd]{Mount Command}
1174    \index[sd]{Directive!Mount Command}
1175    Command that must be executed to mount the device. Before the command is
1176    executed, \%a is replaced with the Archive Device, and \%m with the Mount
1177    Point.
1178
1179    Most frequently, you will define it as follows:
1180
1181 \footnotesize
1182 \begin{lstlisting}
1183   Mount Command = "/bin/mount -t iso9660 -o ro %a %m"
1184 \end{lstlisting}
1185 \normalsize
1186
1187 For some media, you may need multiple commands.  If so, it is recommended
1188 that you use a shell script instead of putting them all into the Mount
1189 Command.  For example, instead of this:
1190
1191 \footnotesize
1192 \begin{lstlisting}
1193   Mount Command = "/usr/local/bin/mymount"
1194 \end{lstlisting}
1195 \normalsize
1196
1197 Where that script contains:
1198
1199 \footnotesize
1200 \begin{lstlisting}
1201 #!/bin/sh
1202 ndasadmin enable -s 1 -o w
1203 sleep 2
1204 mount /dev/ndas-00323794-0p1 /backup
1205 \end{lstlisting}
1206 \normalsize
1207
1208 Similar consideration should be given to all other Command parameters.
1209
1210 \label{Storage:Device:UnmountCommand}
1211 \item [Unmount Command = {\it name-string}]
1212    \index[sd]{Unmount Command}
1213    \index[sd]{Directive!Unmount Command}
1214    Command that must be executed to unmount the device. Before the command  is
1215    executed, \%a is replaced with the Archive Device, and \%m with the  Mount
1216    Point.
1217
1218    Most frequently, you will define it as follows:
1219
1220 \footnotesize
1221 \begin{lstlisting}
1222   Unmount Command = "/bin/umount %m"
1223 \end{lstlisting}
1224 \normalsize
1225
1226   If you need to specify multiple commands, create a shell script.
1227
1228 \end{description}
1229
1230 %% This pulls in the Autochanger resource from another file.
1231 \label{AutochangerRes}
1232 \label{AutochangerResource1}
1233 \input{autochangerres}
1234
1235 \section{Capabilities}
1236 \index[general]{Capabilities}
1237
1238 \begin{description}
1239
1240 \label{Storage:Device:LabelMedia}
1241 \item [Label Media = {\it yes\vb{}no}]
1242    \index[general]{Label Media}
1243    \index[sd]{Label Media}
1244    \index[sd]{Directive!Label Media}
1245    If {\bf Yes}, permits this device to automatically label blank media
1246    without an explicit operator command.  It does so by using an internal
1247    algorithm as defined on the \ilink{Label Format}{Label} record in each
1248    Pool resource.  If this is {\bf No} as by default, Bacula will label
1249    tapes only by specific operator command ({\bf label} in the Console) or
1250    when the tape has been recycled.  The automatic labeling feature is most
1251    useful when writing to disk rather than tape volumes.
1252
1253 \label{Storage:Device:AutomaticMount}
1254 \item [Automatic mount = {\it yes\vb{}no}]
1255    \index[sd]{Automatic mount}
1256    \index[sd]{Directive!Automatic mount}
1257    If {\bf Yes} (the default), permits the daemon to examine the device to
1258    determine if it contains a Bacula labeled volume.  This is done
1259    initially when the daemon is started, and then at the beginning of each
1260    job.  This directive is particularly important if you have set
1261    {\bf Always Open = no} because it permits Bacula to attempt to read the
1262    device before asking the system operator to mount a tape.  However,
1263    please note that the tape must be mounted before the job begins.
1264
1265 \end{description}
1266
1267 \section{Messages Resource}
1268 \label{MessagesResource1}
1269 \index[general]{Resource!Messages}
1270 \index[general]{Messages Resource}
1271
1272 For a description of the Messages Resource, please see the
1273 \ilink{Messages Resource}{MessagesChapter} Chapter of this
1274 manual.
1275
1276 \section{Sample Storage Daemon Configuration File}
1277 \label{SampleConfiguration}
1278 \index[general]{File!Sample Storage Daemon Configuration}
1279 \index[general]{Sample Storage Daemon Configuration File}
1280
1281 A example Storage Daemon configuration file might be the following:
1282
1283 \footnotesize
1284 \begin{lstlisting}
1285 #
1286 # Default Bacula Storage Daemon Configuration file
1287 #
1288 #  For Bacula release 1.37.2 (07 July 2005) -- gentoo 1.4.16
1289 #
1290 # You may need to change the name of your tape drive
1291 #   on the "Archive Device" directive in the Device
1292 #   resource.  If you change the Name and/or the
1293 #   "Media Type" in the Device resource, please ensure
1294 #   that bacula-dir.conf has corresponding changes.
1295 #
1296 Storage {                               # definition of myself
1297   Name = rufus-sd
1298   Address = rufus
1299   WorkingDirectory = "$HOME/bacula/bin/working"
1300   Pid Directory = "$HOME/bacula/bin/working"
1301   Maximum Concurrent Jobs = 20
1302 }
1303 #
1304 # List Directors who are permitted to contact Storage daemon
1305 #
1306 Director {
1307   Name = rufus-dir
1308   Password = "ZF9Ctf5PQoWCPkmR3s4atCB0usUPg+vWWyIo2VS5ti6k"
1309 }
1310 #
1311 # Restricted Director, used by tray-monitor to get the
1312 #   status of the storage daemon
1313 #
1314 Director {
1315   Name = rufus-mon
1316   Password = "9usxgc307dMbe7jbD16v0PXlhD64UVasIDD0DH2WAujcDsc6"
1317   Monitor = yes
1318 }
1319 #
1320 # Devices supported by this Storage daemon
1321 # To connect, the Director's bacula-dir.conf must have the
1322 #  same Name and MediaType.
1323 #
1324 Autochanger {
1325   Name = Autochanger
1326   Device = Drive-1
1327   Device = Drive-2
1328   Changer Command = "/home/kern/bacula/bin/mtx-changer %c %o %S %a %d"
1329   Changer Device = /dev/sg0
1330 }
1331
1332 Device {
1333   Name = Drive-1                      #
1334   Drive Index = 0
1335   Media Type = DLT-8000
1336   Archive Device = /dev/nst0
1337   AutomaticMount = yes;               # when device opened, read it
1338   AlwaysOpen = yes;
1339   RemovableMedia = yes;
1340   RandomAccess = no;
1341   AutoChanger = yes
1342   Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
1343 }
1344
1345 Device {
1346   Name = Drive-2                      #
1347   Drive Index = 1
1348   Media Type = DLT-8000
1349   Archive Device = /dev/nst1
1350   AutomaticMount = yes;               # when device opened, read it
1351   AlwaysOpen = yes;
1352   RemovableMedia = yes;
1353   RandomAccess = no;
1354   AutoChanger = yes
1355   Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
1356 }
1357
1358 Device {
1359   Name = "HP DLT 80"
1360   Media Type = DLT8000
1361   Archive Device = /dev/nst0
1362   AutomaticMount = yes;                 # when device opened, read it
1363   AlwaysOpen = yes;
1364   RemovableMedia = yes;
1365 }
1366 #Device {
1367 #  Name = SDT-7000                     #
1368 #  Media Type = DDS-2
1369 #  Archive Device = /dev/nst0
1370 #  AutomaticMount = yes;               # when device opened, read it
1371 #  AlwaysOpen = yes;
1372 #  RemovableMedia = yes;
1373 #}
1374 #Device {
1375 #  Name = Floppy
1376 #  Media Type = Floppy
1377 #  Archive Device = /mnt/floppy
1378 #  RemovableMedia = yes;
1379 #  Random Access = Yes;
1380 #  AutomaticMount = yes;               # when device opened, read it
1381 #  AlwaysOpen = no;
1382 #}
1383 #Device {
1384 #  Name = FileStorage
1385 #  Media Type = File
1386 #  Archive Device = /tmp
1387 #  LabelMedia = yes;                   # lets Bacula label unlabeled media
1388 #  Random Access = Yes;
1389 #  AutomaticMount = yes;               # when device opened, read it
1390 #  RemovableMedia = no;
1391 #  AlwaysOpen = no;
1392 #}
1393 #
1394 # A very old Exabyte with no end of media detection
1395 #
1396 #Device {
1397 #  Name = "Exabyte 8mm"
1398 #  Media Type = "8mm"
1399 #  Archive Device = /dev/nst0
1400 #  Hardware end of medium = No;
1401 #  AutomaticMount = yes;               # when device opened, read it
1402 #  AlwaysOpen = Yes;
1403 #  RemovableMedia = yes;
1404 #}
1405 #
1406 # Send all messages to the Director,
1407 # mount messages also are sent to the email address
1408 #
1409 Messages {
1410   Name = Standard
1411   director = rufus-dir = all
1412   operator = root = mount
1413 }
1414 \end{lstlisting}
1415 \normalsize