]> git.sur5r.net Git - bacula/docs/blob - docs/manual/storedconf.tex
- Litle fix
[bacula/docs] / docs / manual / storedconf.tex
1 %%
2 %%
3
4 \section*{Storage Daemon Configuration}
5 \label{_ChapterStart31}
6 \index[general]{Storage Daemon Configuration }
7 \index[general]{Configuration!Storage Daemon }
8 \addcontentsline{toc}{section}{Storage Daemon Configuration}
9
10 \subsection*{General}
11 \index[general]{General }
12 \addcontentsline{toc}{subsection}{General}
13
14 The Storage Daemon configuration file has relatively few resource definitions.
15 However, due to the great variation in backup media and system capabilities,
16 the storage daemon must be highly configurable. As a consequence, there are
17 quite a large number of directives in the Device Resource definition that
18 allow you to define all the characteristics of your Storage device (normally a
19 tape drive). Fortunately, with modern storage devices, the defaults are
20 sufficient, and very few directives are actually needed. 
21
22 Examples of {\bf Device} resource directives that are known to work for a
23 number of common tape drives can be found in the {\bf
24 \lt{}bacula-src\gt{}/examples/devices} directory, and most will also be listed
25 here. 
26
27 For a general discussion of configuration file and resources including the
28 data types recognized by {\bf Bacula}, please see the 
29 \ilink{Configuration}{_ChapterStart16} chapter of this manual. The
30 following Storage Resource definitions must be defined: 
31
32 \begin{itemize}
33 \item 
34    \ilink{Storage}{StorageResource} -- to define the  name of the
35    Storage daemon.  
36 \item 
37    \ilink{Director}{DirectorResource1} -- to  define the Director's
38    name and his access password.  
39 \item 
40    \ilink{Device}{DeviceResource} -- to define  the
41    characteristics of your storage device (tape  drive).  
42 \item 
43    \ilink{Messages}{_ChapterStart15} -- to define where error  and
44    information messages are to be sent. 
45 \end{itemize}
46
47 \subsection*{Storage Resource}
48 \label{StorageResource}
49 \index[general]{Resource!Storage }
50 \index[general]{Storage Resource }
51 \addcontentsline{toc}{subsection}{Storage Resource}
52
53 In general, the properties specified under the Storage resource define global
54 properties of the Storage daemon. Each Storage daemon configuration file must
55 have one and only one Storage resource definition. 
56
57 \begin{description}
58
59 \item [Name = \lt{}Storage-Daemon-Name\gt{}]
60    \index[sd]{Name  }
61    Specifies the Name of the Storage daemon. This  directive is required. 
62
63 \item [Working Directory = \lt{}Directory\gt{}]
64    \index[sd]{Working Directory  }
65    This directive  is mandatory and specifies a directory in which the Storage
66    daemon  may put its status files. This directory should be used only  by {\bf
67    Bacula}, but may be shared by other Bacula daemons. This  directive is
68    required  
69
70 \item [Pid Directory = \lt{}Directory\gt{}]
71    \index[sd]{Pid Directory  }
72    This directive  is mandatory and specifies a directory in which the Director 
73    may put its process Id file files. The process Id file is used to  shutdown
74    Bacula and to prevent multiple copies of  Bacula from running simultaneously. 
75    This directive is required. Standard shell expansion of the {\bf Directory} 
76    is done when the configuration file is read so that values such  as {\bf
77    \$HOME} will be properly expanded.  
78
79    Typically on Linux systems, you will set this to:  {\bf /var/run}. If you are
80    not installing Bacula in the  system directories, you can use the {\bf Working
81    Directory} as  defined above. 
82
83 \item [Heartbeat Interval = \lt{}time-interval\gt{}]
84    \index[sd]{Heartbeat Interval  }
85    \index[general]{Heartbeat Interval}
86    \index[general]{Broken pipe}
87    This directive defines an interval of time.  When the Storage daemon is
88    waiting for the operator to mount a tape, each time interval, it will
89    send a heartbeat signal to the File daemon.  The default interval is
90    zero which disables the heartbeat.  This feature is particularly useful
91    if you have a router such as 3Com that does not follow Internet
92    standards and times out an valid connection after a short duration 
93    despite the fact that keepalive is set. This usually results
94    in a broken pipe error message.
95
96 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
97    \index[sd]{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    Specify the ports and addresses on which the Storage daemon will listen
113    for Director connections.  Normally, the default is sufficient and you
114    do not need to specify this directive.  Probably the simplest way to
115    explain how this directive works is to show an example:
116
117 \footnotesize
118 \begin{verbatim}
119  SDAddresses  = { ip = {
120         addr = 1.2.3.4; port = 1205; }
121     ipv4 = {
122         addr = 1.2.3.4; port = http; }
123     ipv6 = {
124         addr = 1.2.3.4;
125         port = 1205;
126     }
127     ip = {
128         addr = 1.2.3.4
129         port = 1205
130     }
131     ip = {
132         addr = 1.2.3.4
133     }
134     ip = {
135         addr = 201:220:222::2
136     }
137     ip = {
138         addr = bluedot.thun.net
139     }
140  }
141 \end{verbatim}
142 \normalsize
143
144 where ip, ip4, ip6, addr, and port are all keywords. Note, that  the address
145 can be specified as either a dotted quadruple, or  IPv6 colon notation, or as
146 a symbolic name (only in the ip specification).  Also, port can be specified
147 as a number or as the mnemonic value from  the /etc/services file.  If a port
148 is not specified, the default will be used. If an ip  section is specified,
149 the resolution can be made either by IPv4 or  IPv6. If ip4 is specified, then
150 only IPv4 resolutions will be permitted,  and likewise with ip6.  
151
152 Using this directive, you can replace both the SDPort and SDAddress 
153 directives shown below. 
154
155 \item [SDPort = \lt{}port-number\gt{}]
156    \index[sd]{SDPort  }
157    Specifies port number on which the Storage daemon  listens for Director
158    connections. The default is 9103.  
159    
160 \item [SDAddress = \lt{}IP-Address\gt{}]
161    \index[sd]{SDAddress  }
162    This directive is optional,  and if it is specified, it will cause the Storage
163    daemon server (for  Director and File daemon connections) to bind to the
164    specified  {\bf IP-Address}, which is either a domain name or an IP address 
165    specified as a dotted quadruple. If this directive is not specified,  the
166    Storage daemon will bind to any available address (the default).
167
168 \end{description}
169
170 The following is a typical Storage daemon Storage definition. 
171
172 \footnotesize
173 \begin{verbatim}
174 #
175 # "Global" Storage daemon configuration specifications appear
176 # under the Storage resource.
177 #
178 Storage {
179   Name = "Storage daemon"
180   Address = localhost
181   WorkingDirectory = "~/bacula/working"
182   Pid    Directory = "~/bacula/working"
183 }
184 \end{verbatim}
185 \normalsize
186
187 \subsection*{Director Resource}
188 \label{DirectorResource1}
189 \index[general]{Director Resource }
190 \index[general]{Resource!Director }
191 \addcontentsline{toc}{subsection}{Director Resource}
192
193 The Director resource specifies the Name of the Director which is permitted
194 to use the services of the Storage daemon.  There may be multiple Director
195 resources.  The Director Name and Password must match the corresponding
196 values in the Director's configuration file.
197
198 \begin{description}
199
200 \item [Name = \lt{}Director-Name\gt{}]
201    \index[sd]{Name  }
202    Specifies the Name of the Director allowed to connect  to the Storage daemon.
203    This directive is required.  
204
205 \item [Password = \lt{}Director-password\gt{}]
206    \index[sd]{Password  }
207    Specifies the password that must be supplied by the above named  Director.
208    This directive is required.  
209
210 \item [Monitor = \lt{}yes|no\gt{}]
211    \index[sd]{Monitor  }
212    If Monitor is set to {\bf no} (default), this director will have full
213    access to this Storage daemon.  If Monitor is set to {\bf yes}, this
214    director will only be able to fetch the current status of this Storage
215    daemon.
216
217    Please note that if this director is being used by a Monitor, we highly 
218    recommend to set this directive to {\bf yes} to avoid serious security 
219    problems. 
220
221 \end{description}
222
223 The following is an example of a valid Director resource definition: 
224
225 \footnotesize
226 \begin{verbatim}
227 Director {
228   Name = MainDirector
229   Password = my_secret_password
230 }
231 \end{verbatim}
232 \normalsize
233
234 \label{DeviceResource}
235 \subsection*{Device Resource}
236 \index[general]{Resource!Device }
237 \index[general]{Device Resource }
238 \addcontentsline{toc}{subsection}{Device Resource}
239
240 The Device Resource specifies the details of each device (normally a tape
241 drive) that can be used by the Storage daemon.  There may be multiple
242 Device resources for a single Storage daemon.  In general, the properties
243 specified within the Device resource are specific to the Device.
244
245 \begin{description}
246
247 \item [Name = {\it Device-Name}]
248    \index[sd]{Name  }
249    Specifies the Name that the Director will use when asking to backup or
250    restore to or from to this device. This is the logical  Device name, and may
251    be any string up to 127 characters in length.  It is generally a good idea to
252    make it correspond to the English  name of the backup device. The physical
253    name of the device is  specified on the {\bf Archive Device} directive
254    described below.  The name you specify here is also used in your Director's
255    conf  file on the 
256    \ilink{Device directive}{StorageResource2}  in its Storage
257    resource. 
258
259 \item [Archive Device = {\it name-string}]
260    \index[sd]{Archive Device  }
261    The specified {\bf name-string} gives the system file name of the  storage
262    device managed by this storage daemon. This will usually be  the device file
263    name of a removable storage device (tape drive),  for example ``{\bf
264    /dev/nst0}'' or ``{\bf /dev/rmt/0mbn}''.  For a DVD-writer, it will be for
265    example {\bf /dev/hdc}.  It may also be a directory name if you are archiving
266    to disk storage.  In this case, you must supply the full absolute path to the
267    directory.  When specifying a tape device, it is preferable that the 
268    ``non-rewind'' variant of the device file name be given.  In addition, on
269    systems such as Sun, which have multiple tape  access methods, you must be
270    sure to specify to use  Berkeley I/O conventions with the device. The {\bf b}
271    in the Solaris (Sun)  archive specification {\bf /dev/rmt/0mbn} is what is
272    needed in  this case. Bacula does not support SysV tape drive behavior.  
273    
274    As noted above, normally the Archive Device is the name of a  tape drive, but
275    you may also specify an absolute path to  an existing directory. If the Device
276    is a directory  Bacula will write to file storage in the specified directory,
277    and  the filename used will be the Volume name as specified in the  Catalog.
278    If you want to write into more than one directory (i.e.  to spread the load to
279    different disk drives), you will need to define  two Device resources, each
280    containing an Archive Device with a  different directory.  
281    
282    In addition to a tape device name or a directory name, Bacula will  accept the
283    name of a FIFO. A FIFO is a special kind of file that  connects two programs
284    via kernel memory. If a FIFO device is specified  for a backup operation, you
285    must have a program that reads what Bacula  writes into the FIFO. When the
286    Storage daemon starts the job, it  will wait for {\bf MaximumOpenWait} seconds
287    for the read program to start reading, and then time it out and  terminate
288    the job. As a consequence, it is best to start the read  program at the
289    beginning of the job perhaps with the {\bf RunBeforeJob}  directive. For this
290    kind of device, you never want to specify  {\bf AlwaysOpen}, because you want
291    the Storage daemon to open it only  when a job starts, so you must explicitly
292    set it to {\bf No}.  Since a FIFO is a one way device, Bacula will not attempt
293    to read  a label of a FIFO device, but will simply write on it. To create a 
294    FIFO Volume in the catalog, use the {\bf add} command rather than  then {\bf
295    label} command to avoid attempting to write a label.  
296    
297    During a restore operation, if the Archive Device is a FIFO, Bacula  will
298    attempt to read from the FIFO, so you must have an external program  that
299    writes into the FIFO. Bacula will wait {\bf MaximumOpenWait} seconds  for the
300    program to begin writing and will then time it out and  terminate the job. As
301    noted above, you may use the {\bf RunBeforeJob}  to start the writer program
302    at the beginning of the job.  
303    
304    The Archive Device directive is required. 
305
306 \item [Media Type = {\it name-string}]
307    \index[sd]{Media Type  }
308    The specified {\bf name-string} names the type of media supported  by this
309    device, for example, ``DLT7000''. Media type names  are arbitrary in that you
310    set it to anything you want, but  must be known to the volume database to keep
311    track of which  storage daemons can read which volumes. The same  {\bf
312    name-string} must appear in the appropriate Storage  resource definition in
313    the Director's configuration file.  
314    
315    Even though the names you assign are arbitrary (i.e. you  choose the name you
316    want), you should take care in specifying  them because the Media Type is used
317    to determine which  storage device Bacula will select during restore. Thus you
318    should probably use the same Media Type specification for all  drives where
319    the Media can be freely interchanged. This is  not generally an issue if you
320    have a single Storage daemon,  but it is with multiple Storage daemons,
321    especially if they  have incompatible media.  
322    
323    For example, if you specify a Media  Type of ``DDS-4'' then during the
324    restore, Bacula  will be able to choose any Storage Daemon that handles 
325    ``DDS-4''. If you have an autochanger, you might  want to name the Media Type
326    in a way that is unique to the  autochanger, unless you wish to possibly use
327    the Volumes in  other drives. You should also ensure to have unique Media 
328    Type names if the Media is not compatible between drives.  This specification
329    is required for all devices. 
330
331 \label{Autochanger}
332 \item [Autochanger = {\it Yes|No}]
333    \index[sd]{Autochanger  }
334    If {\bf Yes}, this device is an automatic tape changer, and  you should also
335    specify a {\bf Changer Device} as well as  a {\bf Changer Command}.  If {\bf
336    No} (default), the volume must be manually changed.  You should also
337    have an identical directive to the  
338    \ilink{ Storage resource}{Autochanger1}  in the Director's
339    configuration file so that  when labeling tapes you are prompted for the slot.
340  
341
342 \item [Changer Device = {\it name-string}]
343    \index[sd]{Changer Device  }
344    The specified {\bf name-string} gives the system file name of the  autochanger
345    device name that corresponds to the {\bf Archive Device}  specified. This
346    device name is specified if you have an autochanger  or if you want to use the
347    {\bf Alert Command} (see below).  Normally you will specify the {\bf generic
348    SCSI} device  name in this directive. For example, on Linux systems, for 
349    archive device {\bf /dev/nst0}, This directive is optional.  See the 
350    \ilink{ Using Autochangers}{_ChapterStart18}  chapter of this
351    manual for more details of using this and the  following autochanger
352    directives. 
353
354 \item [Changer Command = {\it name-string}]
355    \index[sd]{Changer Command  }
356    The {\bf name-string} specifies an external program to be called  that will
357    automatically change volumes as required by {\bf Bacula}.  Most frequently,
358    you will specify the Bacula supplied {\bf mtx-changer}  script as follows:  
359
360 \footnotesize
361 \begin{verbatim}
362 Changer Command = "/path/mtx-changer %c %o %S %a %d"
363 \end{verbatim}
364 \normalsize
365
366    and you will install the {\bf mtx} on your system (found  in the {\bf depkgs}
367    release). An example of this command is in the default bacula-sd.conf file. 
368    For more details on the substitution characters that may be specified  to
369    configure your autochanger please see  the 
370    \ilink{Autochangers}{_ChapterStart18} chapter of this  manual.
371    For FreeBSD users, you might want to see one of the  several {\bf chio}
372    scripts in {\bf examples/autochangers}.  
373
374 \item [Alert Command = {\it name-string}]
375    \index[sd]{Alert Command  }
376    The {\bf name-string} specifies an external program to be called  at the
377    completion of each Job after the device is released.  The purpose of this
378    command is to check for Tape Alerts, which  are present when something is
379    wrong with your tape drive  (at least for most modern tape drives).  The same
380    substitution characters that may be specified  in the Changer Command may also
381    be used in this string.  For more information, please see  the 
382    \ilink{Autochangers}{_ChapterStart18} chapter of this  manual. 
383    
384    
385    Note, it is not necessary to have an autochanger to use this  command. The
386    example below uses the {\bf tapeinfo} program  that comes with the {\bf mtx}
387    package, but it can be used  on any tape drive. However, you will need to
388    specify  a {\bf Changer Device} directive in your Device resource  (see above)
389    so that the generic SCSI device name can be  edited into the command (with the
390    \%c).  
391    
392    An example of the use of this command to print Tape Alerts  in the Job report
393    is:  
394
395 \footnotesize
396 \begin{verbatim}
397 Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert'"
398       
399 \end{verbatim}
400 \normalsize
401
402 and an example output when there is a problem could be:  
403
404 \footnotesize
405 \begin{verbatim}
406 bacula-sd  Alert: TapeAlert[32]: Interface: Problem with SCSI interface
407                   between tape drive and initiator.
408       
409 \end{verbatim}
410 \normalsize
411
412 \item [Drive Index = {\it number}]
413    \index[sd]{Drive Index  }
414    The {\bf Drive Index} that you specify is passed to the  {\bf mtx-changer}
415    script and is thus passed to the {\bf mtx}  program. By default, the Drive
416    Index is zero, so if you have only  one drive in your autochanger, everything
417    will work normally.  However, if you have multiple drives, you may specify two
418    Bacula  Device resources. The first will either set Drive Index to zero,  or
419    leave it unspecified, and the second Device Resource should  contain a Drive
420    Index set to 1. This will then permit you to  use two or more drives in your
421    autochanger. However, you must ensure  that Bacula does not request the same
422    Volume on both drives  at the same time. You may also need to modify the
423    mtx-changer  script to do locking so that two jobs don't attempt to use  the
424    autochanger at the same time. An example script can  be found in {\bf
425    examples/autochangers/locking-mtx-changer}.  
426
427 \item [Maximum Changer Wait = {\it time}]
428    \index[sd]{Maximum Changer Wait  }
429    This directive specifies the maximum time for Bacula to wait  for an
430    autochanger to change the volume. If this time is exceeded,  Bacula will
431    invalidate the Volume slot number stored in  the catalog and try again. If no
432    additional changer volumes exist,  Bacula will ask the operator to intervene.
433    The default time  out is 5 minutes.
434
435 \item [Always Open = {\it Yes|No}]
436    \index[sd]{Always Open  }
437    If {\bf Yes} (default), Bacula will always keep the device  open unless
438    specifically {\bf unmounted} by the Console program.  This permits Bacula to
439    ensure that the tape drive is always  available. If you set {\bf AlwaysOpen}
440    to {\bf no} {\bf Bacula}  will only open the drive when necessary, and at the
441    end of the Job  if no other Jobs are using the drive, it will be freed. The
442    next time Bacula wants to append to a tape on a drive that was freed, Bacula
443    must rewind the tape and position to the end. To avoid unnecessary tape positioning 
444    and to minimize unnecessary operator intervention, it is highly recommended  that
445    {\bf Always Open = yes}. This also ensures that the drive  is available when
446    Bacula needs it.  
447    
448    If you have {\bf Always Open = yes} (recommended) and you want  to use the
449    drive for something else, simply use the {\bf unmount}  command in the Console
450    program to release the drive. However, don't  forget to remount the drive with
451    {\bf mount} when the drive is  available or the next Bacula job will block.  
452    
453    For File storage, this directive is ignored. For a FIFO storage  device, you
454    must set this to {\bf No}.  
455    
456    Please note that if you set this directive to {\bf No} Bacula  will release
457    the tape drive between each job, and thus the next job  will rewind the tape
458    and position it to the end of the data. This  can be a very time consuming
459    operation. 
460
461 \item [Volume Poll Interval = {\it time}]
462    \index[sd]{Volume Poll Interval  }
463    If the time  specified on this directive is non-zero, after  asking the
464    operator to mount a new volume Bacula will  periodically poll (or read) the
465    drive at the specified  interval to see if a new volume has been mounted. If
466    the  time interval is zero (the default), no polling will occur.  This
467    directive can be useful if you want to avoid operator  intervention via the
468    console. Instead, the operator can  simply remove the old volume and insert
469    the requested one,  and Bacula on the next poll will recognize the new tape
470    and  continue. Please be aware that if you set this interval  too small, you
471    may excessively wear your tape drive if the  old tape remains in the drive,
472    since Bacula will read it on  each poll. This can be avoided by ejecting the
473    tape using  the {\bf Offline On Unmount} and the {\bf Close on Poll} 
474    directives. 
475
476 \item [Close on Poll= {\it Yes|No}]
477    \index[sd]{Close on Poll }
478    If {\bf Yes}, Bacula close the device (equivalent to  an unmount except no
479    mount is required) and reopen it at each  poll. Normally this is not too
480    useful unless you have the  {\bf Offline on Unmount} directive set, in which
481    case the  drive will be taken offline preventing wear on the tape  during any
482    future polling. Once the operator inserts a new  tape, Bacula will recognize
483    the drive on the next poll and  automatically continue with the backup. 
484
485 \item [Maximum Open Wait = {\it time}]
486    \index[sd]{Maximum Open Wait  }
487    This directive specifies the maximum amount of time that  Bacula will wait for
488    a device that is busy. The default is  5 minutes. If the device cannot be
489    obtained, the current Job will  be terminated in error. Bacula will re-attempt
490    to open the  drive the next time a Job starts that needs the the drive.
491
492 \item [Removable media = {\it Yes|No}]
493    \index[sd]{Removable media  }
494    If {\bf Yes}, this device supports removable media (for  example, tapes or
495    CDs). If {\bf No}, media cannot be removed  (for example, an intermediate
496    backup area on a hard disk).  
497
498 \item [Random access = {\it Yes|No}]
499    \index[sd]{Random access  }
500    If {\bf Yes}, the archive device is assumed to be a random  access medium
501    which supports the {\bf lseek} (or  {\bf lseek64} if Largefile is enabled
502    during configuration) facility.  
503
504 \item [Minimum block size = {\it size-in-bytes}]
505    \index[sd]{Minimum block size  }
506    On most modern tape drives, you will not need or wamt to  specify this directive, and
507    if you do so, it will be  to make Bacula use fixed block sizes.  This
508    statement applies only to non-random access devices (e.g.  tape drives).
509    Blocks written by the storage daemon to a non-random  archive device will
510    never be smaller than the given  {\bf size-in-bytes}. The Storage daemon will
511    attempt to  efficiently fill blocks with data received from active sessions
512    but  will, if necessary, add padding to a block to achieve the required 
513    minimum size.  
514    
515    To force the block size to be fixed, as is  the case for some non-random
516    access devices (tape drives), set  the {\bf Minimum block size} and the {\bf
517    Maximum block size} to  the same value (zero included). The default is that
518    both the  minimum and maximum block size are zero and the default block size 
519    is 64,512 bytes. If you wish the block size to be fixed and  different from
520    the default, specify the same value for both  {\bf Minimum block size} and
521    {\bf Maximum block size}.  
522    
523    For  example, suppose you want a fixed block size of 100K bytes, then you 
524    would specify:  
525
526 \footnotesize
527 \begin{verbatim}
528  
529     Minimum block size = 100K
530     Maximum block size = 100K
531     
532 \end{verbatim}
533 \normalsize
534
535    Please note that if you specify a fixed block size as shown above,  the tape
536    drive must either be in variable block size mode, or  if it is in fixed block
537    size mode, the block size (generally  defined by {\bf mt}) {\bf must} be
538    identical to the size specified  in Bacula -- otherwise when you attempt to
539    re-read your Volumes,  you will get an error.  
540    
541    If you want the  block size to be variable but with a 64K minimum and 200K
542    maximum (and  default as well), you would specify:  
543
544 \footnotesize
545 \begin{verbatim}
546  
547     Minimum block size = 64K
548     Maximum blocksize = 200K
549    
550 \end{verbatim}
551 \normalsize
552
553 \item [Maximum block size = {\it size-in-bytes}]
554    \index[sd]{Maximum block size  }
555    On most modern tape drives, you will not need to specify  this directive. If
556    you do so, it will most likely be to  use fixed block sizes (see Minimum block
557    size above).  The Storage daemon will aways attempt to write blocks of the 
558    specified {\bf size-in-bytes} to the archive device. As a  consequence, this
559    statement specifies both the default block size  and the maximum block size.
560    The size written never exceed the given  {\bf size-in-bytes}. If adding data
561    to a block would cause it to  exceed the given maximum size, the block will be
562    written to the  archive device, and the new data will begin a new block. 
563    
564    If no  value is specified or zero is specified, the Storage daemon will use  a
565    default block size of 64,512 bytes (126 * 512). 
566
567 \item [Hardware End of Medium = {\it Yes|No}]
568    \index[sd]{Hardware End of Medium  }
569    If {\bf No}, the archive device is not required to support end  of medium
570    ioctl request, and the storage daemon will use the forward  space file
571    function to find the end of the recorded data. If  {\bf Yes}, the archive
572    device must support the {\tt ioctl}  {\tt MTEOM} call, which will position the
573    tape to the end of the  recorded data. In addition, your SCSI driver must keep
574    track  of the file number on the tape and report it back correctly by  the
575    {\bf MTIOCGET} ioctl. Note, some SCSI drivers will correctly  forward space to
576    the end of the recorded data, but they do not  keep track of the file number.
577    On Linux machines, the SCSI driver  has a {\bf fast-eod} option, which if set
578    will cause the driver  to lose track of the file number. You should ensure
579    that this  option is always turned off using the {\bf mt} program.  
580    
581    Default setting for Hardware End of Medium is {\bf Yes}. This  function is
582    used before appending to a tape to ensure that no  previously written data is
583    lost. We recommend if you have a non  standard or unusual tape drive that you
584    use the {\bf btape} program  to test your drive to see whether or not it
585    supports this function.  All modern (after 1998) tape drives support this
586    feature.  
587    
588    If you set Hardware End of Medium = no, you should also set  {\bf Fast Forward
589    Space File = no}. If you do not, Bacula will  most likely be unable to
590    correctly find the end of data on the  tape.  
591
592 \item [Fast Forward Space File = {\it Yes|No}]
593    \index[sd]{Fast Forward Space File  }
594    If {\bf No}, the archive device is not required to support  keeping track of
595    the file number ({\bf MTIOCGET} ioctl) during  forward space file. If {\bf
596    Yes}, the archive device must support  the {\tt ioctl} {\tt MTFSF} call, which
597    virtually all drivers  support, but in addition, your SCSI driver must keep
598    track of the  file number on the tape and report it back correctly by the 
599    {\bf MTIOCGET} ioctl. Note, some SCSI drivers will correctly  forward space,
600    but they do not keep track of the file number or more  seriously, they do not
601    report end of meduim.  
602    
603    Default setting for Fast Forward Space File is {\bf Yes}. If  you disable
604    Hardware End of Medium, most likely you should also  disable Fast Forward
605    Space file. The {\bf test} command in the  program {\bf btape} will test this
606    feature and advise you if  it should be turned off.  
607    
608 \item [Use MTIOCGET = {\it Yes|No}]
609    \index[sd]{Fast Forward Space File  }
610    If {\bf No}, the operating system is not required to support keeping track of
611    the file number and reporting it in the ({\bf MTIOCGET} ioctl). The default
612    is {\bf Yes}. If you must set this to No, Bacula will do the proper file
613    position determination, but it is very unfortunate because it means that 
614    tape movement is very inefficient.
615    Fortunately, this operation system deficiency seems to be the case only on 
616    a few *BSD systems. Operating systems known to work correctly are Solaris, Linux 
617    and FreeBSD.
618
619 \item [BSF at EOM = {\it Yes|No}]
620    \index[sd]{BSF at EOM  }
621    If {\bf No}, the default, no special action is taken by  Bacula with the End
622    of Medium (end of tape) is reached because  the tape will be positioned after
623    the last EOF tape mark, and  Bacula can append to the tape as desired.
624    However, on some  systems, such as FreeBSD, when Bacula reads the End of
625    Medium  (end of tape), the tape will be positioned after the second  EOF tape
626    mark (two successive EOF marks indicated End of  Medium). If Bacula appends
627    from that point, all the appended  data will be lost. The solution for such
628    systems is to  specify {\bf BSF at EOM} which causes Bacula to backspace  over
629    the second EOF mark. Determination of whether or not  you need this directive
630    is done using the {\bf test} command  in the {\bf btape} program.
631
632 \item [TWO EOF = {\it Yes|No}]
633    \index[sd]{TWO EOF  }
634    If {\bf Yes}, Bacula will write two end of file marks when  terminating a tape
635 -- i.e. after the last job or at the end of  the medium. If {\bf No}, the
636 default, Bacula will only write  one end of file to terminate the tape. 
637
638 \item [Backward Space Record = {\it Yes|No}]
639    \index[sd]{Backward Space Record}
640    If {\it Yes}, the archive device supports the {\tt MTBSR  ioctl} to backspace
641    records. If {\it No}, this call is not  used and the device must be rewound
642    and advanced forward to the  desired position. Default is {\bf Yes} for non
643    random-access  devices. This function if enabled is used at the end of a 
644    Volume after writing the end of file and any ANSI/IBM labels to determine whether
645    or not the last block was written correctly. If you turn this function off,
646    the test will not be done. This causes no harm as the re-read process is
647    precautionary rather than required.
648
649 \item [Backward Space File = {\it Yes|No}]
650    \index[sd]{Backward Space File  }
651    If {\it Yes}, the archive device supports the {\bf MTBSF} and  {\bf MTBSF
652   ioctl}s to backspace over an end of file mark and to the  start of a file. If
653   {\it No}, these calls are not used and the  device must be rewound and
654   advanced forward to the desired position.  Default is {\bf Yes} for non
655   random-access devices. 
656
657 \item [Forward Space Record = {\it Yes|No}]
658    \index[sd]{Forward Space Record  }
659    If {\it Yes}, the archive device must support the {\bf MTFSR  ioctl} to
660    forward space over records. If {\bf No}, data must  be read in order to
661    advance the position on the device. Default is  {\bf Yes} for non
662    random-access devices. 
663
664 \item [Forward Space File = {\it Yes|No}]
665    \index[sd]{Forward Space File  }
666    If {\bf Yes}, the archive device must support the {\tt MTFSF  ioctl} to
667    forward space by file marks. If {\it No}, data  must be read to advance the
668    position on the device. Default is  {\bf Yes} for non random-access devices. 
669
670 \item [Offline On Unmount = {\it Yes|No}]
671    \index[sd]{Offline On Unmount  }
672    The default for this directive is {\bf No}. If {\bf Yes} the  archive device
673    must support the {\tt MTOFFL ioctl} to rewind and  take the volume offline. In
674    this case, Bacula will issue the  offline (eject) request before closing the
675    device during the {\bf unmount}  command. If {\bf No} Bacula will not attempt
676    to offline the  device before unmounting it. After an offline is issued,  the
677    cassette will be ejected thus {\bf requiring operator intervention}  to
678    continue, and on some systems require an explicit load command  to be issued
679    ({\bf mt -f /dev/xxx load}) before the system will recognize  the tape. If you
680    are using an autochanger, some devices  require an offline to be issued prior
681    to changing the volume. However,  most devices do not and may get very
682    confused.  
683
684 \item [Maximum Volume Size = {\it size}]
685    \index[sd]{Maximum Volume Size  }
686    No more than {\bf size} bytes will be written onto a given  volume on the
687    archive device. This directive is used mainly in  testing Bacula to simulate a
688    small Volume. It can also  be useful if you wish to limit the size of a File
689    Volume to say  less than 2GB of data. In some rare cases of really antiquated 
690    tape drives that do not properly indicate when the end of a  tape is reached
691    during writing (though I have read about such  drives, I have never personally
692    encountered one). Please note,  this directive is deprecated (being phased
693    out) in favor of the  {\bf Maximum Volume Bytes} defined in the Director's
694    configuration  file.  
695
696 \item [Maximum File Size = {\it size}]
697    \index[sd]{Maximum File Size  }
698    No more than {\bf size} bytes will be written into a given  logical file on
699    the volume. Once this size is reached, an end of  file mark is written on the
700    volume and subsequent data are written  into the next file. Breaking long
701    sequences of data blocks with  file marks permits quicker positioning to the
702    start of a given  stream of data and can improve recovery from read errors on
703    the  volume. The default is one Gigabyte.
704
705 \item [Block Positioning = {\it yes|no}]
706    \index[sd]{Block Positioning  }
707    This directive is not normally used (and has not yet been  tested). It will
708    tell Bacula not to use block positioning when  it is reading tapes. This can
709    cause Bacula to be {\bf extremely}  slow when restoring files. You might use
710    this directive if you  wrote your tapes with Bacula in variable block mode
711    (the default),  but your drive was in fixed block mode. If it then works as  I
712    hope, Bacula will be able to re-read your tapes. 
713
714 \item [Maximum Network Buffer Size = {\it bytes}]
715    \index[sd]{Maximum Network Buffer Size  }
716    where {\it bytes} specifies the initial network buffer  size to use with the
717 File daemon. This size will be adjusted down  if it is too large until it is
718 accepted by the OS. Please use  care in setting this value since if it is too
719 large, it will  be trimmed by 512 bytes until the OS is happy, which may
720 require  a large number of system calls. The default value is 32,768 bytes. 
721
722 \item [Maximum Spool Size = {\it bytes}]
723    \index[sd]{Maximum Spool Size  }
724    where the bytes specify the maximum spool size for all jobs  that are running.
725 The default is no limit. 
726
727 \item [Maximum Job Spool Size = {\it bytes}]
728    \index[sd]{Maximum Job Spool Size  }
729    where the bytes specify the maximum spool size for any one job  that is
730    running. The default is no limit. 
731    This directive is implemented only in version 1.37 and later.
732
733 \item [Spool Directory = {\it directory}]
734    \index[sd]{Spool Directory  }
735    specifies the name of the directory to be used to store  the spool files for
736    this device. This directory is also used to store  temporary part files when
737    writing to a device that requires mount (DVD).  The default is to use the
738    working directory. 
739
740 \item [Maximum Part Size = {\it bytes}]
741    \index[sd]{Maximum Part Size  }
742    This is the maximum size of a volume part file. The default is no limit.
743    This directive is implemented only in version 1.37 and later.
744
745    If the device requires  mount, it is transfered to the device when this size
746    is reached.  In this case, you must take care to have enough disk space left
747    in  the spool directory.  
748
749    Otherwise, it is left on the hard disk.  
750
751    It is ignored for tape and FIFO devices.  
752
753
754 \end{description}
755
756 \subsection*{Devices that require a mount (DVD)}
757 \index[general]{Devices that require a mount (DVD) }
758 \index[general]{DVD!Devices that require a mount }
759 \addcontentsline{toc}{subsection}{Devices that require a mount (DVD)}
760
761 All the directives in this section are implemented only in
762 Bacula version 1.37 and later.
763
764 \begin{description}
765
766 \item [Requires Mount = {\it Yes|No}]
767    \index[sd]{Requires Mount  }
768    You must set this directive to {\bf yes} for DVD-writers,  and to {\bf no} for
769    all other devices (tapes/files).  This directive indicates if the device
770    requires to be mounted to be read,  and if it must be written in a special way.
771    If it set, {\bf Mount Point},  {\bf Mount Command}, {\bf Unmount Command} and
772    {\bf Write Part Command}  directives must also be defined. 
773
774 \item [Mount Point = {\it directory}]
775    \index[sd]{Mount Point  }
776    Directory where the device can be mounted. 
777
778 \item [Mount Command = {\it name-string}]
779    \index[sd]{Mount Command  }
780    Command that must be executed to mount the device. Before the command is 
781    executed, \%a is replaced with the Archive Device, and \%m with the Mount 
782    Point.
783
784    Most frequently, you will define it as follows:  
785
786 \footnotesize
787 \begin{verbatim}
788   Mount Command = "/bin/mount -t iso9660 -o ro %a %m"
789 \end{verbatim}
790 \normalsize
791
792 \item [Unmount Command = {\it name-string}]
793    \index[sd]{Unmount Command  }
794    Command that must be executed to unmount the device. Before the command  is
795    executed, \%a is replaced with the Archive Device, and \%m with the  Mount
796    Point.
797
798    Most frequently, you will define it as follows:  
799
800 \footnotesize
801 \begin{verbatim}
802   Unmount Command = "/bin/umount %m"
803 \end{verbatim}
804 \normalsize
805
806 \item [Write Part Command = {\it name-string}]
807    \index[sd]{Write Part Command  }
808    Command that must be executed to write a part to the device. Before the 
809    command is executed, \%a is replaced with the Archive Device, \%m with the 
810    Mount Point, \%n with the current part number (0-based), and \%v with the 
811    current part filename.
812
813    For a DVD, you will most frequently specify the Bacula supplied  {\bf
814    dvd-writepart} script as follows:  
815
816 \footnotesize
817 \begin{verbatim}
818   Write Part Command = "/path/dvd-writepart %n %a %v"
819 \end{verbatim}
820 \normalsize
821
822   Where {\bf /path} is the path to your scripts install directory, and
823   dvd-writepart is the Bacula supplied script file.  
824   This command will already be present, but commented out,
825   in the default bacula-sd.conf file. To use it, simply remove
826   the comment (#) symbol.
827
828
829 \item [Free Space Command = {\it name-string}]
830    \index[sd]{Free Space Command  }
831    Command that must be executed to check how much free space is left on the 
832    device. Before the command is executed, \%a is replaced with the Archive 
833    Device, \%m with the Mount Point, \%n with the current part number (0-based), 
834    and \%v with the current part filename.
835
836    For a DVD, you will most frequently specify the Bacula supplied  {\bf
837    dvd-freespace} script as follows:  
838
839 \footnotesize
840 \begin{verbatim}
841   Free Space Command = "/path/dvd-freespace %n %a"
842 \end{verbatim}
843 \normalsize
844
845   Where {\bf /path} is the path to your scripts install directory, and
846   dvd-freespace is the Bacula supplied script file.
847   If you want to specify your own command, please look at the code of
848   dvd-freespace to see what output Bacula expects from this command.
849   This command will already be present, but commented out,
850   in the default bacula-sd.conf file. To use it, simply remove
851   the comment (#) symbol.
852
853   If you do not set it, Bacula will expect there is always free space on the
854   device. 
855
856 \end{description}
857
858 \label{AutochangerRes}
859 \label{AutochangerResource1}
860 \input{autochangerres}
861
862 \subsection*{Capabilities}
863 \index[general]{Capabilities }
864 \addcontentsline{toc}{subsection}{Capabilities}
865
866 \begin{description}
867
868 \item [Label media = {\it Yes|No}]
869    \index[sd]{Label media  }
870    If {\bf Yes}, permits this device to automatically  label blank media without
871    an explicit operator command.  It does so by using an internal algorithm as
872    defined  on the 
873    \ilink{Label Format }{Label} record in each Pool resource.  If
874    this is {\bf No} as by default,  Bacula will label tapes only by specific
875    operator  command ({\bf label} in the Console) or when the tape has been
876    recycled.  The automatic labeling feature is most useful when writing to disk 
877    rather than tape volumes.  
878
879 \item [Automatic mount = {\it Yes|No}]
880    \index[sd]{Automatic mount  }
881    If {\bf Yes} (the default), permits the daemon to examine the  device to
882    determine if it contains a Bacula labeled  volume. This is done initially when
883    the daemon is started,  and then at the beginning of each job. This directive
884    is particularly  important if you have set {\bf Always Open = no} because it 
885    permits Bacula to attempt to read the device before asking  the system
886    operator to mount a tape.  
887
888 \end{description}
889
890 \subsection*{Messages Resource}
891 \label{MessagesResource1}
892 \index[general]{Resource!Messages }
893 \index[general]{Messages Resource }
894 \addcontentsline{toc}{subsection}{Messages Resource}
895
896 For a description of the Messages Resource, please see the 
897 \ilink{Messages Resource}{_ChapterStart15} Chapter of this
898 manual. 
899
900 \subsection*{Sample Storage Daemon Configuration File}
901 \label{SampleConfiguration}
902 \index[general]{File!Sample Storage Daemon Configuration }
903 \index[general]{Sample Storage Daemon Configuration File }
904 \addcontentsline{toc}{subsection}{Sample Storage Daemon Configuration File}
905
906 A example Storage Daemon configuration file might be the following: 
907
908 \footnotesize
909 \begin{verbatim}
910 #
911 # Default Bacula Storage Daemon Configuration file
912 #
913 #  For Bacula release 1.37.2 (07 July 2005) -- gentoo 1.4.16
914 #
915 # You may need to change the name of your tape drive
916 #   on the "Archive Device" directive in the Device
917 #   resource.  If you change the Name and/or the
918 #   "Media Type" in the Device resource, please ensure
919 #   that bacula-dir.conf has corresponding changes.
920 #
921 Storage {                               # definition of myself
922   Name = rufus-sd
923   Address = rufus
924   WorkingDirectory = "$HOME/bacula/bin/working"
925   Pid Directory = "$HOME/bacula/bin/working"
926   Maximum Concurrent Jobs = 20
927 }
928 #
929 # List Directors who are permitted to contact Storage daemon
930 #
931 Director {
932   Name = rufus-dir
933   Password = "ZF9Ctf5PQoWCPkmR3s4atCB0usUPg+vWWyIo2VS5ti6k"
934 }
935 #
936 # Restricted Director, used by tray-monitor to get the
937 #   status of the storage daemon
938 #
939 Director {
940   Name = rufus-mon
941   Password = "9usxgc307dMbe7jbD16v0PXlhD64UVasIDD0DH2WAujcDsc6"
942   Monitor = yes
943 }
944 #
945 # Devices supported by this Storage daemon
946 # To connect, the Director's bacula-dir.conf must have the
947 #  same Name and MediaType.
948 #
949 Autochanger {
950   Name = Autochanger
951   Device = Drive-1
952   Device = Drive-2
953   Changer Command = "/home/kern/bacula/bin/mtx-changer %c %o %S %a %d"
954   Changer Device = /dev/sg0
955 }
956
957 Device {
958   Name = Drive-1                      #
959   Drive Index = 0 
960   Media Type = DLT-8000
961   Archive Device = /dev/nst0
962   AutomaticMount = yes;               # when device opened, read it
963   AlwaysOpen = yes;
964   RemovableMedia = yes;
965   RandomAccess = no;
966   AutoChanger = yes
967   Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
968 }
969
970 Device {
971   Name = Drive-2                      #
972   Drive Index = 1
973   Media Type = DLT-8000
974   Archive Device = /dev/nst1
975   AutomaticMount = yes;               # when device opened, read it
976   AlwaysOpen = yes;
977   RemovableMedia = yes;
978   RandomAccess = no;
979   AutoChanger = yes
980   Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
981 }
982
983 Device {
984   Name = "HP DLT 80"
985   Media Type = DLT8000
986   Archive Device = /dev/nst0
987   AutomaticMount = yes;                 # when device opened, read it
988   AlwaysOpen = yes;
989   RemovableMedia = yes;
990 }
991 #Device {
992 #  Name = SDT-7000                     #
993 #  Media Type = DDS-2
994 #  Archive Device = /dev/nst0
995 #  AutomaticMount = yes;               # when device opened, read it
996 #  AlwaysOpen = yes;
997 #  RemovableMedia = yes;
998 #}
999 #Device {
1000 #  Name = Floppy
1001 #  Media Type = Floppy
1002 #  Archive Device = /mnt/floppy
1003 #  RemovableMedia = yes;
1004 #  Random Access = Yes;
1005 #  AutomaticMount = yes;               # when device opened, read it
1006 #  AlwaysOpen = no;
1007 #}
1008 #Device {
1009 #  Name = FileStorage
1010 #  Media Type = File
1011 #  Archive Device = /tmp
1012 #  LabelMedia = yes;                   # lets Bacula label unlabeled media
1013 #  Random Access = Yes;
1014 #  AutomaticMount = yes;               # when device opened, read it
1015 #  RemovableMedia = no;
1016 #  AlwaysOpen = no;
1017 #}
1018 #Device {
1019 #  Name = "NEC ND-1300A"
1020 #  Media Type = DVD
1021 #  Archive Device = /dev/hda
1022 #  LabelMedia = yes;                   # lets Bacula label unlabeled media
1023 #  Random Access = Yes;
1024 #  AutomaticMount = yes;               # when device opened, read it
1025 #  RemovableMedia = yes;
1026 #  AlwaysOpen = no;
1027 #  MaximumPartSize = 800M;
1028 #  RequiresMount = yes;
1029 #  MountPoint = /mnt/cdrom;
1030 #  MountCommand = "/bin/mount -t iso9660 -o ro %a %m";
1031 #  UnmountCommand = "/bin/umount %m";
1032 #  SpoolDirectory = /tmp/backup;
1033 #  WritePartCommand = "/etc/bacula/dvd-writepart %n %a %v"
1034 #  FreeSpaceCommand = "/etc/bacula/dvd-freespace %a %n"
1035 #}
1036 #
1037 # A very old Exabyte with no end of media detection
1038 #
1039 #Device {
1040 #  Name = "Exabyte 8mm"
1041 #  Media Type = "8mm"
1042 #  Archive Device = /dev/nst0
1043 #  Hardware end of medium = No;
1044 #  AutomaticMount = yes;               # when device opened, read it
1045 #  AlwaysOpen = Yes;
1046 #  RemovableMedia = yes;
1047 #}
1048 #
1049 # Send all messages to the Director,
1050 # mount messages also are sent to the email address
1051 #
1052 Messages {
1053   Name = Standard
1054   director = rufus-dir = all
1055   operator = root = mount
1056 }
1057 \end{verbatim}
1058 \normalsize