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