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