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