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