User Tools

Site Tools


bacula_devel:fileset_refactoring

Bacule FileSet Refactoring

This page is to gather information and ideas about how the FileSet syntax in bacula can be overhauled in a future version of bacula to make it easier to understand and more logical.

Rules and Definitions

  • There are two possible sections in “FileSet”: “Include” and “Exclude”.
  • There can be one or more Include and zero or one Exclude statements.
  • FileWild and FileRegex, not only File can be used to select files in Include and Exclude
  • All files matching one of the File* statements will be included into or excluded from the backup accordingly.
  • Any of the File/FileRegex/FileWild statements can begin with a “!” to negate it.
  • What will be backed up or not can never be controlled from within an “Options” section.
  • Options sections will always only set/change parameters of files being selected for that particular include statement.
  • All Include sections are evaluated before the Exclude section.
  • When an Exclude statement matches a directory, it will not be recursed into.
  • If more than one Include section matches, all their Options are applied. If the options conflict, the setting which comes last in the configuration file has presedence. (e.g., “is compression on or off?”)

List Of All Valid Statements

  • Name: The name of the Statement, Option or Modifier
  • Type: The type of the object, one of: Section, Boolean, String, Wildcard, Regex (FIXME: what else?)
  • Scope: Where this object is allowed
  • Default: The default value if applicable
  • Mandatory: Must this be defined for the fileset to be valid?
  • Multiple: May this object be defined more than once in its scope?
  • Description: What will this object do?
Name FileSet{}
Type Section
Scope bacula-dir.conf
Default none
Mandatory yes
Multiple yes
Description Defines a new Fileset
Name Name
Type String
Scope FileSet{}
Default none
Mandatory yes
Multiple no
Description Defines the unique name of
this fileset
Name Ignore FileSet Changes
Type Boolean
Scope FileSet{}
Default false
Mandatory no
Multiple no
Description See manual
Name Enable VSS
Type Boolean
Scope FileSet{}
Default true
Mandatory no
Multiple no
Description See manual
Name Include{}
Type Section
Scope FileSet{}
Default none
Mandatory yes
Multiple yes
Description Section to define what will be included
into the FileSet
Name Exclude{}
Type Section
Scope FileSet{}
Default none
Mandatory yes
Multiple no
Description Section to defines what will be excluded
from items selected by
all previous Include{}
sections
Name File
Type String
Scope Include{} or Exclude{}
Default none
Mandatory no
Multiple yes
Description Specify a File or Directory
to be matched for the
current scope
Name FileWild
Type Wildcard
Scope Include{} or Exclude{}
Default none
Mandatory no
Multiple yes
Description Specify a Wildcard for Files
or Directories to be
selected for the
current scope
Name FileRegEx
Type RegEx
Scope Include{} or Exclude{}
Default none
Mandatory no
Multiple yes
Description Specify a regular Expression
for Files or Directories
to be selected for the
current scope
:!:Name Flag File
Type String
Scope Include{} or Exclude{}
Default none
Mandatory no
Multiple no
Description Specify a filename that will be looked for while selecting files.
If it is found, the directory containing it and all
subdirectories will match the current section
(Thus including or excluding that directory
depending on which section this statement occurs in(Scope).
Name Options{}
Type Section
Scope Include{}
Default none
Mandatory no
Multiple yes
Description Defines options that apply to
all items matching this
Include{} statement or a subset
thereof
Name Sparse
Type Boolean
Scope Options{}
Default false
Mandatory no
Multiple no
Description See manual
Name Wild
Type Wildcard
Scope Options{}
Default none
Mandatory no
Multiple yes
Description Apply options only to
a subset of files or
directories mathing this
wildcard
:!: Same for wilddir, wildfile, regex
matching for what it is supposed to match.
Name
Type *
Scope Options{}
Default -
Mandatory -
Multiple -
Description all other options currently present in bacula

Sample FileSets

Example fileset with comments:

FileSet {
  Name = "MyFileSet"
 
  Ignore FileSet Changes = "yes"    # no change
  Enable VSS = "no"                 # no change
 
  Include {          # include /dev/sdf raw with sparse option
    Options {        # this option matches all File* statements
      Sparse = "yes" # within this Include statement
    }
    File = "/dev/sdf"
  }
 
  # include some dirs, SHA1 for every file,
  # compress all files not matching ".*\.(gz|bz2|tgz|tbz2)"
  Include {
    Options {            # this option matches all File* statements
      Signature   = SHA1 # within this Include statement
    }
 
    # compress all files in this include section
    # _not_ matching ".*\.(gz|bz2|tgz|tbz2)"
    Options {
      WildRegex      = !".*\.(gz|bz2|tgz|tbz2)"
      Compression = GZIP
    }
    File      = "/"             # begin at root, stay in FS
    File      = "/usr"          # additional FS mounted on /usr
    FileWild  = "/lib*"         # include /lib, /lib32, /lib64, ...
    FileWild  = "/usr/lib*"     # include /usr/lib, /usr/lib64, ...
    FileRegex = "/home/[a-f]*"  # include all home dirs beginning
                                # with one of a,b,c,d,e,f
  }
 
  # exclude some of the previous selected files that we do not want
  # to backup:
  # everything in /tmp and every cache dir in user home dirs
  # this applies to any files that matched previously because this
  # section is at the end
  Exclude {
    File = /tmp
    FileRegex = "/home/*/[Cc]ache"
  }
}
bacula_devel/fileset_refactoring.txt · Last modified: 2008/10/15 20:51 (external edit)