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