]> git.sur5r.net Git - bacula/docs/blob - docs/manual/fileset.tex
Update the "Filesystem change prohibited. Will not descend into /misc"
[bacula/docs] / docs / manual / fileset.tex
1 -%
2 %%
3
4 \subsection*{The FileSet Resource}
5 \label{FileSetResource}
6 \index[general]{Resource!FileSet}
7 \index[general]{FileSet Resource}
8 \addcontentsline{toc}{subsection}{FileSet Resource}
9
10 The FileSet resource defines what files are to be included or excluded in a
11 backup job.  A {\bf FileSet} resource is required for each backup Job.  It
12 consists of a list of files or directories to be included, a list of files
13 or directories to be excluded and the various backup options such as
14 compression, encryption, and signatures that are to be applied to each
15 file.
16
17 Any change to the list of the included files will cause Bacula to
18 automatically create a new FileSet (defined by the name and an MD5 checksum
19 of the Include/Exclude contents).  Each time a new FileSet is created,
20 Bacula will ensure that the next backup is always a Full save.
21
22 \begin{description}
23
24 \item [FileSet]
25 \index[dir]{FileSet}
26 \index[dir]{Directive!FileSet}
27 Start of the FileSet resource. One {\bf FileSet}  resource must be
28 defined for each Backup job.
29
30 \item [Name = \lt{}name\gt{}]
31 \index[dir]{Name}
32 \index[dir]{Directive!Name}
33    The name of the FileSet resource.  This directive is required. 
34
35 \item [Ignore FileSet Changes = \lt{}yes|no\gt{}]
36 \index[dir]{Ignore FileSet Changes}
37 \index[dir]{Directive!Ignore FileSet Changes}
38    Normally, if you modify the FileSet Include or Exclude lists,
39    the next backup will be forced to a Full so that Bacula can
40    guarantee that any additions or deletions are properly backed
41    up.
42    If this directive is set to {\bf yes}, any changes you make to the
43    FileSet Include or Exclude lists will be ignored and not cause Bacula to
44    immediately perform a Full backup.  The default is {\bf no}, in which
45    case, if you change the Include or Exclude, Bacula will force a Full
46    backup to ensure that everything is properly backed up.  It is not
47    recommended to set this directive to yes.
48
49 \item [Enable VSS = \lt{}yes|no\gt{}]
50 \index[dir]{Enable VSS}
51 \index[dir]{Directive!Enable VSS}
52   If this directive is set to {\bf yes} the File daemon will be notified
53   that the user wants to use a Volume Shadow Copy Service (VSS) backup
54   for this job. The default is {\bf no}. This directive is effective
55   only for VSS enabled Win32 File daemons. It permits a consistent copy
56   of open files to be made for cooperating writer applications, and for
57   applications that are not VSS away, Bacula can at least copy open files.
58   For more information, please see the
59   \ilink{Windows}{VSS} chapter of this manual.
60
61 \item [Include \{ Options \{\lt{}file-options\gt{}\} ...;
62    \lt{}file-list\gt{} \} ]
63 \index[dir]{Include \{ [ Options \{\lt{}file-options\gt{}\} ...]
64    \lt{}file-list\gt{} \}  }
65 \index[dir]{Directive!Include}
66
67 \item [Options \{ \lt{}file-options\gt{} \} ]
68 \index[dir]{Options  \{ \lt{}file-options\gt{} \}  }
69
70 \item [Exclude \{ \lt{}file-list\gt{} \}]
71 \index[dir]{Exclude \{ \lt{}file-list\gt{} \} }
72 \index[dir]{Directive!Exclude}
73
74 \end{description}
75
76 The Include resource must contain a list of directories and/or files to be
77 processed in the backup job.  Normally, all files found in all
78 subdirectories of any directory in the Include File list will be backed up.
79 Note, see below for the definition of \lt{}file-list\gt{}. 
80 The Include resource may also contain one or more Options resources that
81 specify options such as compression to be applied to all or any subset of
82 the files found when processing the file-list for backup. Please see
83 below for more details concerning Options resources.
84
85 There can be any number of {\bf Include} resources within the FileSet, each
86 having its own list of directories or files to be backed up and the backup
87 options defined by one or more Options resources.  The {\bf file-list}
88 consists of one file or directory name per line.  Directory names should be
89 specified without a trailing slash with Unix path notation.
90
91 Windows users, please take note to specify directories (even c:/...) in
92 Unix path notation. If you use Windows conventions, you will most likely
93 not be able to restore your files due to the fact that the Windows
94 path separator was defined as an escape character long before Windows
95 existed, and Bacula adheres to that convention (i.e. \\  means the next character
96 appears as itself).
97
98 You should always specify a full path for every directory and file that you
99 list in the FileSet.  In addition, on Windows machines, you should {\bf
100 always} prefix the directory or filename with the drive specification in
101 lower case (e.g.  {\bf c:/xxx}) using Unix directory name separators
102 (forward slash).
103
104 Bacula's default for processing directories is to recursively descend in
105 the directory saving all files and subdirectories.  Bacula will not by
106 default cross filesystems (or mount points in Unix parlance).  This means
107 that if you specify the root partition (e.g.  {\bf /}), Bacula will save
108 only the root partition and not any of the other mounted filesystems.
109 Similarly on Windows systems, you must explicitly specify each of the
110 drives you want saved (e.g.
111 {\bf c:/} and {\bf d:/} ...). In addition, at least for Windows systems, you
112 will most likely want to enclose each specification within double quotes
113 particularly if the directory (or file) name contains spaces. The {\bf df}
114 command on Unix systems will show you which mount points you must specify to
115 save everything. See below for an example. 
116
117 Take special care not to include a directory twice or Bacula will backup
118 the same files two times wasting a lot of space on your archive device.
119 Including a directory twice is very easy to do.  For example:
120
121 \footnotesize
122 \begin{verbatim}
123   Include {
124     File = /
125     File = /usr
126     Options { compression=GZIP }
127   }
128 \end{verbatim}
129 \normalsize
130
131 on a Unix system where /usr is a subdirectory (rather than a mounted
132 filesystem) will cause /usr to be backed up twice. In this case, on Bacula
133 versions prior to 1.32f-5-09Mar04 due to a bug, you will not be able to
134 restore hard linked files that were backed up twice. 
135
136 If you have used Bacula prior to version 1.36.3, you will note three things in
137 the new FileSet syntax: 
138
139 \begin{enumerate}
140 \item There is no equal sign (=) after the Include and before the opening
141    brace (\{). The same is true for the Exclude. 
142 \item Each directory (or filename) to be included or excluded is preceded by a {\bf File
143    =}.  Previously they were simply listed on separate lines. 
144 \item The options that previously appeared on the Include line now must be
145    specified within their own Options resource.
146 \item The Exclude resource does not accept Options. 
147 \item When using wild-cards or regular expressions, directory names are
148    always terminated with a slash (/) and filenames have no trailing slash.
149 \end{enumerate}
150
151 The Options resource is optional, but when specified, it will contain a
152 list of {\bf keyword=value} options to be applied to the file-list.
153 See below for the definition of file-list.    
154 Multiple Options resources may be specified one after another.  As the
155 files are found in the specified directories, the Options will applied to
156 the filenames to determine if and how the file should be backed up.  The
157 wildcard and regular expression pattern matching parts of the
158 Options resources are checked in the order they are specified in the
159 FileSet until the first one that matches. Once one matches, the
160 compression and other flags within the Options specification will
161 apply to the pattern matched.
162
163 A key point is that in the absence of an Option or no other Option is
164 matched, every file is accepted for backing up. This means that if
165 you want to exclude something, you must explicitly specify an Option
166 with an {\bf exclude = yes} and some pattern matching.
167
168 Once Bacula determines that the Options resource matches the file under
169 consideration, that file will be saved without looking at any other Options
170 resources that may be present.  This means that any wild cards must appear
171 before an Options resource without wild cards.
172
173 If for some reason, Bacula checks all the Options resources to a file under
174 consideration for backup, but there are no matches (generally because of wild
175 cards that don't match), Bacula as a default will then backup the file.  This
176 is quite logical if you consider the case of no Options clause is specified,
177 where you want everything to be backed up, and it is important to keep in mind
178 when excluding as mentioned above.
179
180 However, one additional point is that in the case that no match was found,
181 Bacula will use the options found in the last Options resource.  As a
182 consequence, if you want a particular set of "default" options, you should put
183 them in an Options resource after any other Options.
184
185 It is a good idea to put all your wild-card and regex expressions inside
186 double quotes to prevent conf file scanning problems.
187
188 This is perhaps a bit overwhelming, so there are a number of examples included 
189 below to illustrate how this works.
190
191 The directives within an Options resource may be one of the following: 
192
193 \begin{description}
194
195 \item [compression=GZIP]
196 \index[dir]{compression}
197 \index[dir]{Directive!compression}
198    All files saved will be software compressed using the GNU ZIP
199    compression format.  The compression is done on a file by file basis by
200    the File daemon.  If there is a problem reading the tape in a single
201    record of a file, it will at most affect that file and none of the other
202    files on the tape.  Normally this option is {\bf not} needed if you have
203    a modern tape drive as the drive will do its own compression.  In fact,
204    if you specify software compression at the same time you have hardware
205    compression turned on, your files may actually take more space on the
206    volume.
207
208    Software compression is very important if you are writing your Volumes
209    to a file, and it can also be helpful if you have a fast computer but a
210    slow network, otherwise it is generally better to rely your tape drive's
211    hardware compression.  As noted above, it is not generally a good idea
212    to do both software and hardware compression.
213
214    Specifying {\bf GZIP} uses the default compression level six (i.e.  {\bf
215    GZIP} is identical to {\bf GZIP6}).  If you want a different compression
216    level (1 through 9), you can specify it by appending the level number
217    with no intervening spaces to {\bf GZIP}.  Thus {\bf compression=GZIP1}
218    would give minimum compression but the fastest algorithm, and {\bf
219    compression=GZIP9} would give the highest level of compression, but
220    requires more computation.  According to the GZIP documentation,
221    compression levels greater than 6 generally give very little extra
222    compression and are rather CPU intensive.
223
224 \item [signature=SHA1]
225 \index[dir]{signature}
226 \index[dir]{SHA1}
227 \index[dir]{Directive!signature}
228    An SHA1 signature will be computed for all The SHA1 algorithm is
229    purported to be some what slower than the MD5 algorithm, but at the same
230    time is significantly better from a cryptographic point of view (i.e.
231    much fewer collisions, much lower probability of being hacked.) It adds
232    four more bytes than the MD5 signature.  We strongly recommend that
233    either this option or MD5 be specified as a default for all files.
234    Note, only one of the two options MD5 or SHA1 can be computed for any
235    file.
236
237 \item [signature=MD5]
238 \index[dir]{signature}
239 \index[dir]{MD5}
240 \index[dir]{Directive!signature}
241    An MD5 signature will be computed for all files saved.  Adding this
242    option generates about 5\% extra overhead for each file saved.  In
243    addition to the additional CPU time, the MD5 signature adds 16 more
244    bytes per file to your catalog.  We strongly recommend that this option
245    or the SHA1 option be specified as a default for all files.
246
247 \item [verify=\lt{}options\gt{}]
248 \index[dir]{verify}
249 \index[dir]{Directive!verify}
250    The options letters specified are used  when running a {\bf Verify
251    Level=Catalog} as well as the  {\bf DiskToCatalog} level job. The options
252    letters may be any  combination of the following:  
253
254       \begin{description}
255
256       \item {\bf i}
257       compare the inodes  
258
259       \item {\bf p}
260       compare the permission bits  
261
262       \item {\bf n}
263       compare the number of links  
264
265       \item {\bf u}
266       compare the user id  
267
268       \item {\bf g}
269       compare the group id  
270
271       \item {\bf s}
272       compare the size  
273
274       \item {\bf a}
275       compare the access time  
276
277       \item {\bf m}
278       compare the modification time (st\_mtime)  
279
280       \item {\bf c}
281       compare the change time (st\_ctime)  
282
283       \item {\bf s}
284       report file size decreases  
285
286       \item {\bf 5}
287       compare the MD5 signature  
288
289       \item {\bf 1}
290       compare the SHA1 signature  
291       \end{description}
292
293    A useful set of general options on the {\bf Level=Catalog}  or {\bf
294    Level=DiskToCatalog}  verify is {\bf pins5} i.e. compare permission bits,
295    inodes, number  of links, size, and MD5 changes. 
296
297 \item [onefs=yes|no]
298 \index[dir]{onefs}
299 \index[dir]{Directive!onefs}
300    If set to {\bf yes} (the default), {\bf Bacula} will remain on a single
301    file system.  That is it will not backup file systems that are mounted
302    on a subdirectory.  If you are using a *nix system, you may not even be
303    aware that there are several different filesystems as they are often
304    automatically mounted by the OS (e.g.  /dev, /net, /sys, /proc, ...).
305    With Bacula 1.38.0 or later, it will inform you when it decides not to
306    traverse into another filesystem.  This can be very useful if you forgot
307    to backup a particular partition.  An example of the informational
308    message in the job report is:
309
310 \footnotesize
311 \begin{verbatim}
312 rufus-fd: /misc is a different filesystem. Will not descend from / into /misc
313 rufus-fd: /net is a different filesystem. Will not descend from / into /net
314 rufus-fd: /var/lib/nfs/rpc_pipefs is a different filesystem. Will not descend from /var/lib/nfs into /var/lib/nfs/rpc_pipefs
315 rufus-fd: /selinux is a different filesystem. Will not descend from / into /selinux
316 rufus-fd: /sys is a different filesystem. Will not descend from / into /sys
317 rufus-fd: /dev is a different filesystem. Will not descend from / into /dev
318 rufus-fd: /home is a different filesystem. Will not descend from / into /home
319 \end{verbatim}
320 \normalsize
321
322    Note: in previous versions of Bacula, the above message was of the form: 
323
324 \footnotesize
325 \begin{verbatim}
326 Filesystem change prohibited. Will not descend into /misc
327 \end{verbatim}
328 \normalsize
329
330    If you wish to backup multiple filesystems, you can  explicitly
331    list each filesystem you want saved.  Otherwise, if you set the onefs option
332    to {\bf no}, Bacula will backup  all mounted file systems (i.e. traverse mount
333    points) that  are found within the {\bf FileSet}. Thus if  you have NFS or
334    Samba file systems mounted on a directory listed  in your FileSet, they will
335    also be backed up. Normally, it is  preferable to set {\bf onefs=yes} and to
336    explicitly name  each filesystem you want backed up. Explicitly naming  the
337    filesystems you want backed up avoids the possibility  of getting into a
338    infinite loop recursing filesystems.  Another possibility is to 
339    use {\bf onefs=no} and to set {\bf fstype=ext2, ...}.             
340    See the example below for more details. 
341
342    If you think that Bacula should be backing up a particular directory
343    and it is not, and you have {\bf onefs=no} set, before you complain,
344    please do:
345
346 \footnotesize
347 \begin{verbatim}
348   stat /
349   stat <filesystem>
350 \end{verbatim}
351 \normalsize
352
353 where you replace {\bf filesystem} with the one in question.  If the 
354 {\bf Device:} number is different for / and for your filesystem, then they
355 are on different filesystems.  E.g.
356 \footnotesize
357 \begin{verbatim}
358 stat /
359   File: `/'
360   Size: 4096            Blocks: 16         IO Block: 4096   directory
361 Device: 302h/770d       Inode: 2           Links: 26
362 Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
363 Access: 2005-11-10 12:28:01.000000000 +0100
364 Modify: 2005-09-27 17:52:32.000000000 +0200
365 Change: 2005-09-27 17:52:32.000000000 +0200
366
367 stat /net
368   File: `/home'
369   Size: 4096            Blocks: 16         IO Block: 4096   directory
370 Device: 308h/776d       Inode: 2           Links: 7
371 Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
372 Access: 2005-11-10 12:28:02.000000000 +0100
373 Modify: 2005-11-06 12:36:48.000000000 +0100
374 Change: 2005-11-06 12:36:48.000000000 +0100
375 \end{verbatim}
376 \normalsize
377
378    Also be aware that even if you include {\bf /home} in your list
379    of files to backup, as you most likely should, you will get the
380    informational message that  "/home is a different filesystem" when 
381    Bacula is processing the {\bf /} directory.  This message does not
382    indicate an error. This message means that while examining the 
383    {\bf File =} referred to in the second part of the message, Bacula will 
384    not descend into the directory mentioned in the first part of the message.
385    However, it is possible that the separate filesystem will be backed up 
386    despite the message. For example, consider the following FileSet:
387
388 \footnotesize
389 \begin{verbatim}
390   File = /
391   File = /var
392 \end{verbatim}
393 \normalsize
394
395    where {\bf /var} is a separate filesystem.  In this example, you will get a
396    message saying that Bacula will not decend from {\bf /} into {\bf /var}.  But 
397    it is important to realise that Bacula will descend into {\bf /var} from the 
398    second File directive shown above.  In effect, the warning is bogus,
399    but it is supplied to alert you to possible omissions from your FileSet. In 
400    this example, {\bf /var} will be backed up.  If you changed the FileSet such 
401    that it did not specify {\bf /var}, then {\bf /var} will not be backed up.
402
403    
404
405
406 \label{portable}
407 \item [portable=yes|no]
408 \index[dir]{portable}
409 \index[dir]{Directive!portable}
410    If set to {\bf yes} (default is {\bf no}), the Bacula File daemon will
411    backup Win32 files in a portable format, but not all Win32 file
412    attributes will be saved and restored.  By default, this option is set
413    to {\bf no}, which means that on Win32 systems, the data will be backed
414    up using Windows API calls and on WinNT/2K/XP, all the security and
415    ownership attributes will be properly backed up (and restored).  However
416    this format is not portable to other systems -- e.g.  Unix, Win95/98/Me.
417    When backing up Unix systems, this option is ignored, and unless you
418    have a specific need to have portable backups, we recommend accept the
419    default ({\bf no}) so that the maximum information concerning your files
420    is saved.
421
422 \item [recurse=yes|no]
423 \index[dir]{recurse}
424 \index[dir]{Directive!recurse}
425    If set to {\bf yes} (the default), Bacula will recurse (or descend) into
426    all subdirectories found unless the directory is explicitly excluded
427    using an {\bf exclude} definition.  If you set {\bf recurse=no}, Bacula
428    will save the subdirectory entries, but not descend into the
429    subdirectories, and thus will not save the files or directories
430    contained in the subdirectories.  Normally, you will want the default
431    ({\bf yes}).
432
433 \item [sparse=yes|no]
434 \index[dir]{sparse}
435 \index[dir]{Directive!sparse}
436    Enable special code that checks for sparse files such as created by
437    ndbm.  The default is {\bf no}, so no checks are made for sparse files.
438    You may specify {\bf sparse=yes} even on files that are not sparse file.
439    No harm will be done, but there will be a small additional overhead to
440    check for buffers of all zero, and a small additional amount of space on
441    the output archive will be used to save the seek address of each
442    non-zero record read.
443
444    {\bf Restrictions:} Bacula reads files in 32K buffers.  If the whole
445    buffer is zero, it will be treated as a sparse block and not written to
446    tape.  However, if any part of the buffer is non-zero, the whole buffer
447    will be written to tape, possibly including some disk sectors (generally
448    4098 bytes) that are all zero.  As a consequence, Bacula's detection of
449    sparse blocks is in 32K increments rather than the system block size.
450    If anyone considers this to be a real problem, please send in a request
451    for change with the reason.
452
453    If you are not familiar with sparse files, an example is say a file
454    where you wrote 512 bytes at address zero, then 512 bytes at address 1
455    million.  The operating system will allocate only two blocks, and the
456    empty space or hole will have nothing allocated.  However, when you read
457    the sparse file and read the addresses where nothing was written, the OS
458    will return all zeros as if the space were allocated, and if you backup
459    such a file, a lot of space will be used to write zeros to the volume.
460    Worse yet, when you restore the file, all the previously empty space
461    will now be allocated using much more disk space.  By turning on the
462    {\bf sparse} option, Bacula will specifically look for empty space in
463    the file, and any empty space will not be written to the Volume, nor
464    will it be restored.  The price to pay for this is that Bacula must
465    search each block it reads before writing it.  On a slow system, this
466    may be important.  If you suspect you have sparse files, you should
467    benchmark the difference or set sparse for only those files that are
468    really sparse.
469
470 \label{readfifo}
471 \item [readfifo=yes|no]
472 \index[dir]{readfifo}
473 \index[dir]{Directive!readfifo}
474    If enabled, tells the Client to read the data on a backup and write the
475    data on a restore to any FIFO (pipe) that is explicitly mentioned in the
476    FileSet.  In this case, you must have a program already running that
477    writes into the FIFO for a backup or reads from the FIFO on a restore.
478    This can be accomplished with the {\bf RunBeforeJob} directive.  If this
479    is not the case, Bacula will hang indefinitely on reading/writing the
480    FIFO. When this is not enabled (default), the Client simply saves the
481    directory entry for the FIFO.
482
483    Unfortunately, when Bacula runs a RunBeforeJob, it waits until that
484    script terminates, and if the script accesses the FIFO to write   
485    into the it, the Bacula job will block and everything will stall.
486    However, Vladimir Stavrinov as supplied tip that allows this feature   
487    to work correctly.  He simply adds the following to the beginning
488    of the RunBeforeJob script:
489
490 \begin{verbatim}
491    exec > /dev/null
492 \end{verbatim}
493
494 \item [noatime=yes|no]
495 \index[dir]{noatime}
496 \index[dir]{Directive!noatime}
497    If enabled, and if your Operating System supports the O_NOATIME file
498    open flag, Bacula will open all files to be backed up with this option.
499    It makes it possible to read a file without updating the inode atime
500    (and also without the inode ctime update which happens if you try to set
501    the atime back to its previous value).  It also prevents a race
502    condition when two programs are reading the same file, but only one does
503    not want to change the atime.  It's most useful for backup programs and
504    file integrity checkers (and bacula can fit on both categories).
505
506    This option is particularly useful for sites where users are sensitive
507    to their MailBox file access time.  It replaces both the {\bf keepatime}
508    option without the inconvienences of that option (see below).
509
510    If your Operating System does not support this option, it will be
511    silently ignored by Bacula.
512
513
514 \item [mtimeonly=yes|no]
515 \index[dir]{mtimeonly}
516 \index[dir]{Directive!mtimeonly}
517    If enabled, tells the Client that the selection of files during
518    Incremental and Differential backups should based only on the st\_mtime
519    value in the stat() packet.  The default is {\bf no} which means that
520    the selection of files to be backed up will be based on both the
521    st\_mtime and the st\_ctime values.  In general, it is not recommended
522    to use this option.
523
524 \item [keepatime=yes|no]
525 \index[dir]{keepatime}
526 \index[dir]{Directive!keepatime}
527    The default is {\bf no}.  When enabled, Bacula will reset the st\_atime
528    (access time) field of files that it backs up to their value prior to
529    the backup.  This option is not generally recommended as there are very
530    few programs that use st\_atime, and the backup overhead is increased
531    because of the additional system call necessary to reset the times.
532    However, for some files, such as mailboxes, when Bacula backs up the
533    file, the user will notice that someone (Bacula) has accessed the
534    file. In this, case keepatime can be useful.
535    (I'm not sure this works on Win32).
536
537    Note, if you use this feature, when Bacula resets the access time, the
538    change time (st\_ctime) will automatically be modified by the system,
539    so on the next incremental job, the file will be backed up even if
540    it has not changed. As a consequence, you will probably also want
541    to use {\bf mtimeonly = yes} as well as keepatime (thanks to
542    Rudolf Cejka for this tip).
543
544 \item [hardlinks=yes|no]
545 \index[dir]{hardlinks}
546 \index[dir]{Directive!hardlinks}
547    When enabled (default), this directive will cause hard links to be 
548    backed up. However, the File daemon keeps track of hard linked files and
549    will backup the data only once. The process of keeping track of the 
550    hard links can be quite expensive if you have lots of them (tens of
551    thousands or more). This doesn't occur on normal Unix systems, but if
552    you use a program like BackupPC, it can create hundreds of thousands, or
553    even millions of hard links. Backups become very long and the File daemon
554    will consume a lot of CPU power checking hard links.  In such a case,
555    set {\bf hardlinks=no} and hard links will not be backed up.  Note, using
556    this option will most likely backup more data and on a restore the file
557    system will not be restored identically to the original.
558
559 \item [wild=\lt{}string\gt{}]
560 \index[dir]{wild}
561 \index[dir]{Directive!wild}
562    Specifies a wild-card string to be applied to the filenames and
563    directory names.  Note, if {\bf Exclude} is not enabled, the wild-card
564    will select which files are to be included.  If {\bf Exclude=yes} is
565    specified, the wild-card will select which files are to be excluded.
566    Multiple wild-card directives may be specified, and they will be applied
567    in turn until the first one that matches.  Note, if you exclude a
568    directory, no files or directories below it will be matched.
569
570    You may want to test your expressions prior to running your
571    backup by using the bwild program. Please see the
572    \ilink{UtilitiesChapter}{Utilities} chapter of this manual for
573    more. You can also test your full FileSet definition by using
574    the \ilink{estimate}{Estimate} command in the Console        
575    chapter of this manual.
576    It is recommended to enclose the string in double quotes.
577
578 \item [wilddir=\lt{}string\gt{}]
579 \index[dir]{wilddir}
580 \index[dir]{Directive!wilddir}
581    Specifies a wild-card string to be applied to directory names only.  No
582    filenames will be matched by this directive.  Note, if {\bf Exclude} is
583    not enabled, the wild-card will select directories files are to be
584    included.  If {\bf Exclude=yes} is specified, the wild-card will select
585    which files are to be excluded.  Multiple wild-card directives may be
586    specified, and they will be applied in turn until the first one that
587    matches.  Note, if you exclude a directory, no files or directories
588    below it will be matched.
589
590    It is recommended to enclose the string in double quotes.
591
592    You may want to test your expressions prior to running your
593    backup by using the bwild program. Please see the
594    \ilink{UtilitiesChapter}{Utilities} chapter of this manual for
595    more. You can also test your full FileSet definition by using
596    the \ilink{estimate}{Estimate} command in the Console        
597    chapter of this manual.
598    An example of excluding with the WildDir option on Win32 machines is    
599    presented below.
600
601 \item [wildfile=\lt{}string\gt{}]
602 \index[dir]{wildfile}
603 \index[dir]{Directive!wildfile}
604    Specifies a wild-card string to be applied to non-directories. That
605    is no directory entries will be matched by this directive.
606    However, note that the match is done against the full path and filename,
607    so your wild-card string must take into account that filenames
608    are preceded by the full path.
609    If {\bf Exclude}
610    is not enabled, the wild-card will select which files are to be
611    included.  If {\bf Exclude=yes} is specified, the wild-card will select
612    which files are to be excluded.  Multiple wild-card directives may be
613    specified, and they will be applied in turn until the first one that
614    matches.
615
616    It is recommended to enclose the string in double quotes.
617
618    You may want to test your expressions prior to running your
619    backup by using the bwild program. Please see the
620    \ilink{UtilitiesChapter}{Utilities} chapter of this manual for
621    more. You can also test your full FileSet definition by using
622    the \ilink{estimate}{Estimate} command in the Console        
623    chapter of this manual.
624    An example of excluding with the WildFile option on Win32 machines is    
625    presented below.
626
627
628 \item [regex=\lt{}string\gt{}]
629 \index[dir]{regex}
630 \index[dir]{Directive!regex}
631    Specifies a POSIX extended regular expression to be applied to the
632    filenames and directory names, which include the full path.  If {\bf
633    Exclude} is not enabled, the regex will select which files are to be
634    included.  If {\bf Exclude=yes} is specified, the regex will select
635    which files are to be excluded.  Multiple regex directives may be
636    specified within an Options resource, and they will be applied in turn
637    until the first one that matches.  Note, if you exclude a directory, no
638    files or directories below it will be matched.
639
640    It is recommended to enclose the string in double quotes.
641
642    The regex libraries differ from one operating system to
643    another, and in addition, regular expressions are complicated,
644    so you may want to test your expressions prior to running your
645    backup by using the bregex program. Please see the
646    \ilink{UtilitiesChapter}{Utilities} chapter of this manual for
647    more. You can also test your full FileSet definition by using
648    the \ilink{estimate}{Estimate} command in the Console        
649    chapter of this manual.
650
651
652 \item [regexfile=\lt{}string\gt{}]
653 \index[dir]{regexfile}
654 \index[dir]{Directive!regexfile}
655    Specifies a POSIX extended regular expression to be applied to
656    non-directories. No directories will be matched by this directive.  
657    However, note that the match is done against the full path and
658    filename, so your regex string must take into account that filenames
659    are preceded by the full path.
660    If {\bf Exclude} is not enabled, the regex will select which files are
661    to be included.  If {\bf Exclude=yes} is specified, the regex will
662    select which files are to be excluded.  Multiple regex directives may be
663    specified, and they will be applied in turn until the first one that
664    matches.
665
666    It is recommended to enclose the string in double quotes.
667
668    The regex libraries differ from one operating system to
669    another, and in addition, regular expressions are complicated,
670    so you may want to test your expressions prior to running your
671    backup by using the bregex program. Please see the
672    \ilink{UtilitiesChapter}{Utilities} chapter of this manual for
673    more.
674
675
676 \item [regexdir=\lt{}string\gt{}]
677 \index[dir]{regexdir}
678 \index[dir]{Directive!regexdir}
679    Specifies a POSIX extended regular expression to be applied to directory
680    names only.  No filenames will be matched by this directive.  Note, if
681    {\bf Exclude} is not enabled, the regex will select directories
682    files are to be included.  If {\bf Exclude=yes} is specified, the
683    regex will select which files are to be excluded.  Multiple
684    regex directives may be specified, and they will be applied in turn
685    until the first one that matches.  Note, if you exclude a directory, no
686    files or directories below it will be matched.
687
688    It is recommended to enclose the string in double quotes.
689
690    The regex libraries differ from one operating system to
691    another, and in addition, regular expressions are complicated,
692    so you may want to test your expressions prior to running your
693    backup by using the bregex program. Please see the
694    \ilink{UtilitiesChapter}{Utilities} chapter of this manual for
695    more.
696
697
698 \item [exclude=yes|no]
699 \index[dir]{exclude}
700 \index[dir]{Directive!exclude}
701    The default is {\bf no}.  When enabled, any files matched within the
702    Options will be excluded from the backup.
703
704 \label{ACLSupport}
705
706 \item [aclsupport=yes|no]
707 \index[dir]{aclsupport}
708 \index[dir]{Directive!aclsupport}
709    The default is {\bf no}.  If this option is set to yes, and you have the
710    POSIX {\bf libacl} installed on your system, Bacula will backup the file
711    and directory UNIX Access Control Lists (ACL) as defined in IEEE Std
712    1003.1e draft 17 and "POSIX.1e" (abandoned).  This feature is
713    available on UNIX only and depends on the ACL library.  Bacula is
714    automatically compiled with ACL support if the {\bf libacl} library is
715    installed on your system (shown in config.out).  While restoring the
716    files Bacula will try to restore the ACLs, if there is no ACL support
717    available on the system, Bacula restores the files and directories but
718    not the ACL information.  Please note, if you backup an EXT3 or XFS
719    filesystem with ACLs, then you restore them to a different filesystem
720    (perhaps reiserfs) that does not have ACLs, the ACLs will be ignored.
721
722 \item [ignore case=yes|no]
723 \index[dir]{ignore case}
724 \index[dir]{Directive!ignore case}
725    The default is {\bf no}.  On Windows systems, you will almost surely
726    want to set this to {\bf yes}.  When this directive is set to {\bf yes}
727    all the case of character will be ignored in wild-card and regex
728    comparisons.  That is an uppercase A will match a lowercase a.
729
730 \item [fstype=filesystem-type]
731 \index[dir]{fstype}
732 \index[dir]{Directive!fstype}
733    This option allows you to select files and directories by the
734    filesystem type.  The permitted filesystem-type names are:
735
736    ext2, jfs, ntfs, proc, reiserfs, xfs, usbdevfs, sysfs, smbfs,
737    iso9660.  For ext3 systems, use ext2.
738
739    You may have multiple Fstype directives, and thus permit matching
740    of multiple filesystem types within a single Options resource.  If
741    the type specified on the fstype directive does not match the
742    filesystem for a particular directive, that directory will not be
743    backed up.  This directive can be used to prevent backing up
744    non-local filesystems. Normally, when you use this directive, you
745    would also set {\bf onefs=no} so that Bacula will traverse filesystems.
746
747    This option is not implemented in Win32 systems.
748
749
750 \item [hfsplussupport=yes|no]
751 \index[dir]{hfsplussupport}
752 \index[dir]{Directive!hfsplussupport}
753    This option allows you to turn on support for Mac OSX HFS plus 
754    finder information.
755
756 \end{description}
757
758 {\bf \lt{}file-list\gt{}} is a list of directory and/or filename names
759 specified with a {\bf File =} directive. To include names containing spaces,
760 enclose the name between double-quotes. Wild-cards are not interpreted
761 in file-lists. They can only be specified in Options resources.
762
763 There are a number of special cases when specifying directories and files in a
764 {\bf file-list}. They are: 
765
766 \begin{itemize}
767 \item Any name preceded by an at-sign (@) is assumed to be the  name of a
768    file, which contains a list of files each preceded by a "File =".  The
769    named file is read once when the configuration file is parsed during the
770    Director startup.  Note, that the file is read on the Director's machine
771    and not on the Client's.  In fact, the @filename can appear anywhere
772    within the conf file where a token would be read, and the contents of
773    the named file will be logically inserted in the place of the @filename.
774    What must be in the file depends on the location the @filename is
775    specified in the conf file.  For example:
776
777 \footnotesize
778 \begin{verbatim}
779 Include {
780   Options { compression=GZIP }
781   @/home/files/my-files
782 }
783 \end{verbatim}
784 \normalsize
785
786 \item Any name beginning with a vertical bar (|) is  assumed to be the name of
787    a program.  This program will be executed on the Director's machine at
788    the time the Job starts (not when the Director reads the configuration
789    file), and any output from that program will be assumed to be a list of
790    files or directories, one per line, to be included.  
791
792    This allows you to have a job that, for example, includes all the local
793    partitions even if you change the partitioning by adding a disk.  The
794    examples below show you how to do this.  However, please note two
795    things: \\
796    1.  if you want the local filesystems, you probably should be
797    using the new {\bf fstype} directive, which was added in version 1.36.3 
798    and set {\bf onefs=no}.
799    \\
800
801    2.  the exact syntax of the command needed in the examples below is very
802    system dependent.  For example, on recent Linux systems, you may need to
803    add the -P option, on FreeBSD systems, the options will be different as
804    well.
805
806    In general, you will need to prefix your command or commands with a {\bf
807    sh -c} so that they are invoked by a shell.  This will not be the case
808    if you are invoking a script as in the second example below.  Also, you
809    must take care to escape (precede with a \textbackslash{}) wild-cards,
810    shell character, and to ensure that any spaces in your command are
811    escaped as well.  If you use a single quotes (') within a double quote
812    ("), Bacula will treat everything between the single quotes as one field
813    so it will not be necessary to escape the spaces.  In general, getting
814    all the quotes and escapes correct is a real pain as you can see by the
815    next example.  As a consequence, it is often easier to put everything in
816    a file and simply use the file name within Bacula.  In that case the
817    {\bf sh -c} will not be necessary providing the first line of the file
818    is {\bf \#!/bin/sh}.
819
820    As an  example: 
821
822 \footnotesize
823 \begin{verbatim}
824  
825 Include {
826    Options { signature = SHA1 }
827    File = "|sh -c 'df -l | grep \"^/dev/hd[ab]\" | grep -v \".*/tmp\" \
828       | awk \"{print \\$6}\"'"
829 }
830 \end{verbatim}
831 \normalsize
832
833    will produce a list of all the local partitions on a RedHat Linux  system.
834    Note, the above line was split, but should normally  be written on one line. 
835    Quoting is a real problem because you must quote for Bacula  which consists of
836    preceding every \textbackslash{} and every " with a \textbackslash{}, and 
837    you must also quote for the shell command. In the end, it is probably  easier
838    just to execute a small file with: 
839
840
841 \footnotesize
842 \begin{verbatim}
843 Include {
844   Options {
845     signature=MD5
846   }
847   File = "|my_partitions"
848 }
849 \end{verbatim}
850 \normalsize
851
852    where my\_partitions has: 
853
854 \footnotesize
855 \begin{verbatim}
856 #!/bin/sh
857 df -l | grep "^/dev/hd[ab]" | grep -v ".*/tmp" \
858       | awk "{print \$6}"
859 \end{verbatim}
860 \normalsize
861
862    If the vertical bar (|) in front of my\_partitions is preceded by a
863    backslash as in \textbackslash{}|, the program will be executed on the
864    Client's machine instead of on the Director's machine.
865    Please note that if the filename is given within quotes, you
866    will need to use two slashes.  An example, provided by John Donagher,
867    that backs up all the local UFS partitions on a remote system is:
868
869 \footnotesize
870 \begin{verbatim}
871 FileSet {
872   Name = "All local partitions"
873   Include {
874     Options { signature=SHA1; onefs=yes; }
875     File = "\\|bash -c \"df -klF ufs | tail +2 | awk '{print \$6}'\""
876   }
877 }
878 \end{verbatim}
879 \normalsize
880
881    The above requires two backslash characters after the double quote (one
882    preserves  the next one). If you are a Linux user, just change the {\bf ufs}
883    to  {\bf ext3} (or your preferred filesystem type), and you will be in 
884    business.  
885
886    If you know what filesystems you have mounted on your system, e.g. 
887    for RedHat Linux normally only ext2 and ext3, you can backup
888    all local fileystems using something like:
889
890 \footnotesize
891 \begin{verbatim}
892  
893 Include {
894    Options { signature = SHA1; onfs=no; fstype=ext2 }
895    File = /
896 }
897 \end{verbatim}
898 \normalsize
899
900
901 \item Any file-list item preceded by a less-than sign (\lt{})  will be taken
902    to be a file. This file will be read on the  Director's machine at the time
903    the Job starts, and the  data will be assumed to be a list of directories or
904    files,  one per line, to be included. The names should start in  column 1 and
905    should not be quoted even if they contain  spaces. This feature allows you to
906    modify the external  file and change what will be saved without stopping and 
907    restarting Bacula as would be necessary if using the @  modifier noted above.
908    For example: 
909
910 \footnotesize
911 \begin{verbatim}
912 Include {
913   Options { signature = SHA1 }
914   File = "</home/files/local-filelist"
915 }
916 \end{verbatim}
917 \normalsize
918
919    If you precede the less-than sign (\lt{}) with a backslash as in
920    \textbackslash{}\lt{}, the file-list will be read on the Client machine
921    instead of on the Director's machine.  Please note that if the filename
922    is given within quotes, you will need to use two slashes.
923
924 \footnotesize
925 \begin{verbatim}
926 Include {
927   Options { signature = SHA1 }
928   File = "\\</home/xxx/filelist-on-client"
929 }
930 \end{verbatim}
931 \normalsize
932
933 \item If you explicitly specify a block device such as {\bf /dev/hda1},  then
934    Bacula (starting with version 1.28) will assume that this  is a raw partition
935    to be backed up. In this case, you are strongly  urged to specify a {\bf
936    sparse=yes} include option, otherwise, you  will save the whole partition
937    rather than just the actual data that  the partition contains. For example: 
938
939 \footnotesize
940 \begin{verbatim}
941 Include {
942   Options { signature=MD5; sparse=yes }
943   File = /dev/hd6
944 }
945 \end{verbatim}
946 \normalsize
947
948    will backup the data in device /dev/hd6.  
949
950    Ludovic Strappazon has pointed out that this feature can be  used to backup a
951    full Microsoft Windows disk. Simply boot into  the system using a Linux Rescue
952    disk, then load a statically  linked Bacula as described in the 
953    \ilink{ Disaster Recovery Using Bacula}{_ChapterRescue} chapter of
954    this manual. Then  save the whole disk partition. In the case of a disaster,
955    you  can then restore the desired partition by again booting with  the rescue
956    disk and doing a restore of the partition. 
957    \item If you explicitly specify a FIFO device name (created with mkfifo),  and
958    you add the option {\bf readfifo=yes} as an option, Bacula  will read the FIFO
959    and back its data up to the Volume. For  example: 
960
961 \footnotesize
962 \begin{verbatim}
963 Include {
964   Options {
965     signature=SHA1
966     readfifo=yes
967   }
968   File = /home/abc/fifo
969 }
970 \end{verbatim}
971 \normalsize
972
973    if {\bf /home/abc/fifo} is a fifo device, Bacula will open the fifo,
974    read it, and store all data thus obtained on the Volume.  Please note,
975    you must have a process on the system that is writing into the fifo, or
976    Bacula will hang, and after one minute of waiting, Bacula will give up
977    and go on to the next file.  The data read can be anything since Bacula
978    treats it as a stream.
979
980    This feature can be an excellent way to do a "hot" backup of a very
981    large database.  You can use the {\bf RunBeforeJob} to create the fifo
982    and to start a program that dynamically reads your database and writes
983    it to the fifo.  Bacula will then write it to the Volume.  Be sure to
984    read the \ilink{readfifo section}{readfifo} that gives a
985    tip to ensure that the RunBeforeJob does not block Bacula.
986
987    During the restore operation, the inverse is true, after Bacula creates
988    the fifo if there was any data stored with it (no need to explicitly
989    list it or add any options), that data will be written back to the fifo.
990    As a consequence, if any such FIFOs exist in the fileset to be restored,
991    you must ensure that there is a reader program or Bacula will block, and
992    after one minute, Bacula will time out the write to the fifo and move on
993    to the next file.
994
995 \item A file-list may not contain wild-cards. Use directives in the
996    Options resource if you wish to specify wild-cards or regular expression
997    matching.
998 \end{itemize}
999
1000 \subsubsection*{FileSet Examples}
1001 \index[general]{Examples!FileSet }
1002 \index[general]{FileSet Examples}
1003 \addcontentsline{toc}{subsection}{FileSet Examples}
1004
1005 The following is an example of a valid FileSet resource definition.  Note,
1006 the first Include pulls in the contents of the file {\bf /etc/backup.list}
1007 when Bacula is started (i.e.  the @), and that file must have each filename
1008 to be backed up preceded by a {\bf File =} and on a separate line.
1009
1010 \footnotesize
1011 \begin{verbatim}
1012 FileSet {
1013   Name = "Full Set"
1014   Include {
1015     Options {
1016       Compression=GZIP
1017       signature=SHA1
1018       Sparse = yes
1019     }
1020     @/etc/backup.list
1021   }
1022   Include {
1023      Options {
1024         wildfile = "*.o"
1025         wildfile = "*.exe"
1026         Exclude = yes
1027      }
1028      File = /root/myfile
1029      File = /usr/lib/another_file
1030   }
1031 }
1032 \end{verbatim}
1033 \normalsize
1034
1035 In the above example, all the files contained in /etc/backup.list will
1036 be compressed with GZIP compression, an SHA1 signature will be computed on the
1037 file's contents (its data), and sparse file handling will apply. 
1038
1039 The two directories /root/myfile and /usr/lib/another\_file will also be saved
1040 without any options, but all files in those directories with the extensions
1041 {\bf .o} and {\bf .exe} will be excluded. 
1042
1043 Let's say that you now want to exclude the directory /tmp. The simplest way
1044 to do so is to add an exclude directive that lists /tmp.  The example
1045 above would then become:
1046
1047 \footnotesize 
1048 \begin{verbatim}
1049 FileSet {
1050   Name = "Full Set"
1051   Include {
1052     Options {
1053       Compression=GZIP
1054       signature=SHA1
1055       Sparse = yes
1056     }
1057     @/etc/backup.list
1058   }
1059   Include {
1060      Options {
1061         wildfile = "*.o"
1062         wildfile = "*.exe"
1063         Exclude = yes
1064      }
1065      File = /root/myfile
1066      File = /usr/lib/another_file
1067   }
1068   Exclude {
1069      File = /tmp
1070   }
1071 }
1072 \end{verbatim}
1073 \normalsize
1074
1075
1076 You can add wild-cards to the File directives listed in the Exclude
1077 directory, but you need to take care because if you exclude a directory,
1078 it and all files and directories below it will also be excluded.
1079
1080 Now lets take a slight variation on the above and suppose
1081 you want to save all your whole filesystem except {\bf /tmp}. 
1082 The problem that comes up is that Bacula will not normally
1083 cross from one filesystem to another.
1084 Doing a {\bf df} command, you get the following output: 
1085
1086 \footnotesize
1087 \begin{verbatim}
1088 [kern@rufus k]$ df
1089 Filesystem      1k-blocks      Used Available Use% Mounted on
1090 /dev/hda5         5044156    439232   4348692  10% /
1091 /dev/hda1           62193      4935     54047   9% /boot
1092 /dev/hda9        20161172   5524660  13612372  29% /home
1093 /dev/hda2           62217      6843     52161  12% /rescue
1094 /dev/hda8         5044156     42548   4745376   1% /tmp
1095 /dev/hda6         5044156   2613132   2174792  55% /usr
1096 none               127708         0    127708   0% /dev/shm
1097 //minimatou/c$   14099200   9895424   4203776  71% /mnt/mmatou
1098 lmatou:/          1554264    215884   1258056  15% /mnt/matou
1099 lmatou:/home      2478140   1589952    760072  68% /mnt/matou/home
1100 lmatou:/usr       1981000   1199960    678628  64% /mnt/matou/usr
1101 lpmatou:/          995116    484112    459596  52% /mnt/pmatou
1102 lpmatou:/home    19222656   2787880  15458228  16% /mnt/pmatou/home
1103 lpmatou:/usr      2478140   2038764    311260  87% /mnt/pmatou/usr
1104 deuter:/          4806936     97684   4465064   3% /mnt/deuter
1105 deuter:/home      4806904    280100   4282620   7% /mnt/deuter/home
1106 deuter:/files    44133352  27652876  14238608  67% /mnt/deuter/files
1107 \end{verbatim}
1108 \normalsize
1109
1110 And we see that there are a number of separate filesystems (/ /boot
1111 /home /rescue /tmp and /usr not to mention mounted systems).
1112 If you specify only {\bf /} in your Include list, Bacula will only save the
1113 Filesystem {\bf /dev/hda5}. To save all filesystems except {\bf /tmp} with
1114 out including any of the Samba or NFS mounted systems, and explicitly
1115 excluding a /tmp, /proc, .journal, and .autofsck, which you will not want to
1116 be saved and restored, you can use the following: 
1117
1118 \footnotesize
1119 \begin{verbatim}
1120 FileSet {
1121   Name = Include_example
1122   Include {
1123     Options {
1124        wilddir = /proc
1125        wilddir = /tmp
1126        wildfile = "/.journal"
1127        wildfile = "/.autofsck"
1128        exclude = yes
1129     }
1130     File = /
1131     File = /boot
1132     File = /home
1133     File = /rescue
1134     File = /usr
1135   }
1136 }
1137 \end{verbatim}
1138 \normalsize
1139
1140 Since /tmp is on its own filesystem and it was not explicitly named in the
1141 Include list, it is not really needed in the exclude list. It is better to
1142 list it in the Exclude list for clarity, and in case the disks are changed so
1143 that it is no longer in its own partition. 
1144
1145 Now, lets assume you only want to backup .Z and .gz files and nothing 
1146 else. This is a bit trickier because Bacula by default will select 
1147 everything to backup, so we must exclude everything but .Z and .gz files.
1148 If we take the first example above and make the obvious modifications
1149 to it, we might come up with a FileSet that looks like this:
1150
1151 \footnotesize 
1152 \begin{verbatim}
1153 FileSet {
1154   Name = "Full Set"
1155   Include {                    !!!!!!!!!!!!
1156      Options {                    This
1157         wildfile = "*.Z"          example
1158         wildfile = "*.gz"         doesn't
1159                                   work
1160      }                          !!!!!!!!!!!!
1161      File = /myfile
1162   }
1163 }
1164 \end{verbatim}
1165 \normalsize
1166
1167 The *.Z and *.gz files will indeed be backed up, but all other files
1168 that are not matched by the Options directives will automatically
1169 be backed up too (i.e. that is the default rule).
1170
1171 To accomplish what we want, we must explicitly exclude all other files.
1172 We do this with the following:
1173
1174 \footnotesize
1175 \begin{verbatim}
1176 FileSet {
1177   Name = "Full Set"
1178   Include {
1179      Options {
1180         wildfile = "*.Z"
1181         wildfile = "*.gz"
1182      }
1183      Options {
1184         Exclude = yes
1185         RegexFile = ".*"
1186      }
1187      File = /myfile
1188   }
1189 }
1190 \end{verbatim}
1191 \normalsize
1192
1193 The "trick" here was to add a RegexFile expression that matches
1194 all files. It does not match directory names, so all directories in
1195 /myfile will be backed up (the directory entry) and any *.Z and *.gz
1196 files contained in them. If you know that certain directories do
1197 not contain any *.Z or *.gz files and you do not want the directory
1198 entries backed up, you will need to explicitly exclude those directories.
1199 Backing up a directory entries is not very expensive.
1200
1201 Bacula uses the system regex library and some of them are
1202 different on different OSes. The above has been reported not to work
1203 on FreeBSD. This can be tested by using the {\bf estimate job=job-name
1204 listing} command in the console and adapting the RegexFile expression
1205 appropriately. In a future version of Bacula, we will supply our own
1206 Regex code to avoid such system dependencies.
1207
1208 Please be aware that allowing Bacula to traverse or change file systems can be
1209 {\bf very} dangerous. For example, with the following: 
1210
1211 \footnotesize
1212 \begin{verbatim}
1213 FileSet {
1214   Name = "Bad example"
1215   Include {
1216     Options { onefs=no }
1217     File = /mnt/matou
1218   }
1219 }
1220 \end{verbatim}
1221 \normalsize
1222
1223 you will be backing up an NFS mounted partition ({\bf /mnt/matou}), and since
1224 {\bf onefs} is set to {\bf no}, Bacula will traverse file systems. Now if {\bf
1225 /mnt/matou} has the current machine's file systems mounted, as is often the
1226 case, you will get yourself into a recursive loop and the backup will never
1227 end. 
1228
1229 As a final example, let's say that you have only one or two 
1230 subdirectories of /home that you want to backup.  For example,
1231 you want to backup only subdirectories beginning with the letter
1232 a and the letter b -- i.e. /home/a* and /home/b*.  Now, you might first
1233 try:
1234 \footnotesize
1235 \begin{verbatim}
1236 FileSet {
1237   Name = "Full Set"
1238   Include {
1239      Options {
1240         wilddir = "/home/a*"
1241         wilddir = "/home/b*"
1242      }
1243      File = /home
1244   }
1245 }
1246 \end{verbatim}
1247 \normalsize
1248
1249 The problem is that the above will include everything in /home.  To get
1250 things to work correctly, you need to start with the idea of exclusion
1251 instead of inclusion.  So, you could simply exclude all directories
1252 except the two you want to use:
1253 \footnotesize
1254 \begin{verbatim}
1255 FileSet {
1256   Name = "Full Set"
1257   Include {
1258      Options {
1259         RegexDir = "^/home/[c-z]"
1260         exclude = yes
1261      }
1262      File = /home
1263   }
1264 }
1265 \end{verbatim}
1266 \normalsize
1267
1268 And assuming that all subdirectories start with a lowercase letter, this
1269 would work.
1270
1271 An alternative would be to include the two subdirectories desired and
1272 exclude everything else:
1273 \footnotesize
1274 \begin{verbatim}
1275 FileSet {
1276   Name = "Full Set"
1277   Include {
1278      Options {
1279         wilddir = "/home/a*"
1280         wilddir = "/home/b*"
1281      }
1282      Options {
1283         RegexDir = ".*"
1284         exclude = yes
1285      }
1286      File = /home
1287   }
1288 }
1289 \end{verbatim}
1290 \normalsize
1291
1292 \subsubsection*{Backing up Raw Partitions}
1293 \index[general]{Backing up!Partitions }
1294 \index[general]{Backing up Raw Partitions }
1295 \addcontentsline{toc}{subsection}{Backing up Raw Partitions}
1296
1297 The following FileSet definition will backup a raw partition: 
1298
1299 \footnotesize
1300 \begin{verbatim}
1301 FileSet {
1302   Name = "RawPartition"
1303   Include {
1304     Options { sparse=yes }
1305     File = /dev/hda2
1306   }
1307 }
1308 \end{verbatim}
1309 \normalsize
1310
1311 While backing up and restoring a raw partition, you should ensure that no
1312 other process including the system is writing to that partition. As a
1313 precaution, you are strongly urged to ensure that the raw partition is not
1314 mounted or is mounted read-only. If necessary, this can be done using the {\bf
1315 RunBeforeJob} directive. 
1316
1317
1318 \subsubsection*{Excluding Files and Directories}
1319 \index[general]{Directories!Excluding Files and }
1320 \index[general]{Excluding Files and Directories }
1321 \addcontentsline{toc}{subsubsection}{Excluding Files and Directories}
1322
1323 You may also include full filenames or directory names in addition to using
1324 wild-cards and {\bf Exclude=yes} in the Options resource as specified above by
1325 simply including the files to be excluded in an Exclude resource within the
1326 FileSet. For example: 
1327
1328 \footnotesize
1329 \begin{verbatim}
1330 FileSet {
1331   Name = Exclusion_example
1332   Include {
1333     Options {
1334       Signature = SHA1
1335     }
1336     File = /
1337     File = /boot
1338     File = /home
1339     File = /rescue
1340     File = /usr
1341   }
1342   Exclude {
1343     File = /proc
1344     File = /tmp
1345     File = .journal
1346     File = .autofsck
1347   }
1348 }
1349 \end{verbatim}
1350 \normalsize
1351
1352 \label{win32}
1353 \subsubsection*{Windows FileSets}
1354 \index[general]{Windows FileSets }
1355 \index[general]{FileSets!Windows }
1356 \addcontentsline{toc}{subsection}{Windows FileSets}
1357 If you are entering Windows file names, the directory path may be preceded by
1358 the drive and a colon (as in c:). However, the path separators must be
1359 specified in Unix convention (i.e. forward slash (/)). If you wish to include
1360 a quote in a file name, precede the quote with a backslash
1361 (\textbackslash{}). For example you might use the following
1362 for a Windows machine to backup the "My Documents" directory: 
1363
1364 \footnotesize
1365 \begin{verbatim}
1366 FileSet {
1367   Name = "Windows Set"
1368   Include {
1369     Options {
1370        WildFile = "*.obj"
1371        WildFile = "*.exe"
1372        exclude = yes
1373      }
1374      File = "c:/My Documents"
1375   }
1376 }
1377 \end{verbatim}
1378 \normalsize
1379
1380 For exclude lists to work correctly on Windows, you must observe the following
1381 rules: 
1382
1383 \begin{itemize}
1384 \item Filenames are case sensitive, so you must use the correct case.  
1385 \item To 2~exclude a directory, you must not have a trailing slash on the 
1386    directory name.  
1387 \item I2~f you have spaces in your filename, you must enclose the entire name 
1388    in double-quote characters ("). Trying to use a backslash before  the space
1389    will not work.  
1390 \item If you are using the old Exclude syntax (noted below), you may not
1391    specify a drive letter in the exclude.  The new syntax noted above
1392    should work fine including driver letters.
1393 \end{itemize}
1394
1395 Thanks to Thiago Lima for summarizing the above items for us. If you are
1396 having difficulties getting includes or excludes to work, you might want to
1397 try using the {\bf estimate job=xxx listing} command documented in the 
1398 \ilink{Console chapter}{estimate} of this manual. 
1399
1400 On Win32 systems, if you move a directory or file or rename a file into the
1401 set of files being backed up, and a Full backup has already been made, Bacula
1402 will not know there are new files to be saved during an Incremental or
1403 Differential backup (blame Microsoft, not me). To avoid this problem, please
1404 {\bf copy} any new directory or files into the backup area. If you do not have
1405 enough disk to copy the directory or files, move them, but then initiate a
1406 Full backup. 
1407
1408
1409 \paragraph*{A Windows Example FileSet}
1410 \index[general]{FileSet!Windows Example }
1411 \index[general]{Windows Example FileSet }
1412 \addcontentsline{toc}{paragraph}{Windows Example FileSet}
1413
1414 The following example was contributed by Russell Howe. Please note that
1415 for presentation purposes, the lines beginning with Data and Internet 
1416 have been wrapped and should included on the previous line with one
1417 space.
1418
1419 \footnotesize
1420 \begin{verbatim}
1421 This is my Windows 2000 fileset:
1422 FileSet {
1423  Name = "Windows 2000"
1424  Include {
1425   Options {
1426    signature = MD5
1427    Exclude = yes
1428    IgnoreCase = yes
1429    # Exclude Mozilla-based programs' file caches
1430    WildDir = "[A-Z]:/Documents and Settings/*/Application 
1431 Data/*/Profiles/*/*/Cache"
1432    WildDir = "[A-Z]:/Documents and Settings/*/Application 
1433 Data/*/Profiles/*/*/Cache.Trash"
1434    WildDir = "[A-Z]:/Documents and Settings/*/Application
1435 Data/*/Profiles/*/*/ImapMail"
1436
1437    # Exclude user's registry files - they're always in use anyway.
1438    WildFile = "[A-Z]:/Documents and Settings/*/Local Settings/Application
1439 Data/Microsoft/Windows/usrclass.*"
1440    WildFile = "[A-Z]:/Documents and Settings/*/ntuser.*"
1441
1442    # Exclude directories full of lots and lots of useless little files
1443    WildDir = "[A-Z]:/Documents and Settings/*/Cookies"
1444    WildDir = "[A-Z]:/Documents and Settings/*/Recent"
1445    WildDir = "[A-Z]:/Documents and Settings/*/Local Settings/History"
1446    WildDir = "[A-Z]:/Documents and Settings/*/Local Settings/Temp"
1447    WildDir = "[A-Z]:/Documents and Settings/*/Local Settings/Temporary
1448 Internet Files"
1449
1450    # These are always open and unable to be backed up
1451    WildFile = "[A-Z]:/Documents and Settings/All Users/Application
1452 Data/Microsoft/Network/Downloader/qmgr[01].dat"
1453
1454    # Some random bits of Windows we want to ignore
1455    WildFile = "[A-Z]:/WINNT/security/logs/scepol.log"
1456    WildDir = "[A-Z]:/WINNT/system32/config"
1457    WildDir = "[A-Z]:/WINNT/msdownld.tmp"
1458    WildDir = "[A-Z]:/WINNT/Internet Logs"
1459    WildDir = "[A-Z]:/WINNT/$Nt*Uninstall*"
1460    WildDir = "[A-Z]:/WINNT/sysvol"
1461    WildFile = "[A-Z]:/WINNT/cluster/CLUSDB"
1462    WildFile = "[A-Z]:/WINNT/cluster/CLUSDB.LOG"
1463    WildFile = "[A-Z]:/WINNT/NTDS/edb.log"
1464    WildFile = "[A-Z]:/WINNT/NTDS/ntds.dit"
1465    WildFile = "[A-Z]:/WINNT/NTDS/temp.edb"
1466    WildFile = "[A-Z]:/WINNT/ntfrs/jet/log/edb.log"
1467    WildFile = "[A-Z]:/WINNT/ntfrs/jet/ntfrs.jdb"
1468    WildFile = "[A-Z]:/WINNT/ntfrs/jet/temp/tmp.edb"
1469    WildFile = "[A-Z]:/WINNT/system32/CPL.CFG"
1470    WildFile = "[A-Z]:/WINNT/system32/dhcp/dhcp.mdb"
1471    WildFile = "[A-Z]:/WINNT/system32/dhcp/j50.log"
1472    WildFile = "[A-Z]:/WINNT/system32/dhcp/tmp.edb"
1473    WildFile = "[A-Z]:/WINNT/system32/LServer/edb.log"
1474    WildFile = "[A-Z]:/WINNT/system32/LServer/TLSLic.edb"
1475    WildFile = "[A-Z]:/WINNT/system32/LServer/tmp.edb"
1476    WildFile = "[A-Z]:/WINNT/system32/wins/j50.log"
1477    WildFile = "[A-Z]:/WINNT/system32/wins/wins.mdb"
1478    WildFile = "[A-Z]:/WINNT/system32/wins/winstmp.mdb"
1479
1480    # Temporary directories & files
1481    WildDir = "[A-Z]:/WINNT/Temp"
1482    WildDir = "[A-Z]:/temp"
1483    WildFile = "*.tmp"
1484    WildDir = "[A-Z]:/tmp"
1485    WildDir = "[A-Z]:/var/tmp"
1486
1487    # Recycle bins
1488    WildDir = "[A-Z]:/RECYCLER"
1489
1490    # Swap files
1491    WildFile = "[A-Z]:/pagefile.sys"
1492
1493    # These are programs and are easier to reinstall than restore from
1494    # backup
1495    WildDir = "[A-Z]:/cygwin"
1496    WildDir = "[A-Z]:/Program Files/Grisoft"
1497    WildDir = "[A-Z]:/Program Files/Java"
1498    WildDir = "[A-Z]:/Program Files/Java Web Start"
1499    WildDir = "[A-Z]:/Program Files/JavaSoft"
1500    WildDir = "[A-Z]:/Program Files/Microsoft Office"
1501    WildDir = "[A-Z]:/Program Files/Mozilla Firefox"
1502    WildDir = "[A-Z]:/Program Files/Mozilla Thunderbird"
1503    WildDir = "[A-Z]:/Program Files/mozilla.org"
1504    WildDir = "[A-Z]:/Program Files/OpenOffice*"
1505   }
1506
1507   # Our Win2k boxen all have C: and D: as the main hard drives.
1508   File = "C:/"
1509   File = "D:/"
1510  }
1511 }
1512 \end{verbatim}
1513 \normalsize
1514
1515 Note, the three line of the above Exclude were split to fit on the document
1516 page, they should be written on a single line in real use. 
1517
1518 \paragraph*{Windows NTFS Naming Considerations}
1519 \index[general]{Windows NTFS Naming Considerations }
1520 \index[general]{Considerations!Windows NTFS Naming }
1521 \addcontentsline{toc}{paragraph}{Windows NTFS Naming Considerations}
1522
1523 NTFS filenames containing Unicode characters should now be supported
1524 as of version 1.37.30 or later.
1525
1526 \subsubsection*{Testing Your FileSet}
1527 \index[general]{FileSet!Testing Your }
1528 \index[general]{Testing Your FileSet }
1529 \addcontentsline{toc}{subsection}{Testing Your FileSet}
1530
1531 If you wish to get an idea of what your FileSet will really backup or if your
1532 exclusion rules will work correctly, you can test it by using the {\bf
1533 estimate} command in the Console program. See the 
1534 \ilink{estimate command}{estimate} in the Console chapter of this
1535 manual.
1536
1537 As an example, suppose you add the following test FileSet:
1538
1539 \footnotesize
1540 \begin{verbatim}
1541 FileSet {
1542   Name = Test
1543   Include {
1544     File = /home/xxx/test
1545     Options {
1546        regex = ".*\.c$"
1547     }
1548   }
1549 }
1550 \end{verbatim}
1551 \normalsize
1552
1553 You could then add some test files to the directory {\bf /home/xxx/test}
1554 and use the following command in the console:
1555
1556 \footnotesize
1557 \begin{verbatim}
1558 estimate job=<any-job-name> listing client=<desired-client> fileset=Test
1559 \end{verbatim}
1560 \normalsize
1561
1562 to give you a listing of all files that match.