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