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