Bacula-users

Re: [Bacula-users] Backup up just certain directories

2008-09-17 16:10:30
Subject: Re: [Bacula-users] Backup up just certain directories
From: Martin Simmons <martin AT lispworks DOT com>
To: joshua AT eeinternet DOT com
Date: Wed, 17 Sep 2008 21:09:31 +0100
>>>>> On Tue, 16 Sep 2008 12:23:30 -0800, Joshua J Kugler said:
> 
> On Tuesday 16 September 2008, Martin Simmons said something like:
> > >>>>> On Tue, 16 Sep 2008 08:53:58 -0800, Joshua J Kugler said:
> > >
> > > Bumping....anyone familiar enough with Bacula's fileset semantics
> > > to give a hint as to how to accomplish this?
> >
> > I suggest looking at this thread:
> >
> > http://thread.gmane.org/gmane.comp.sysutils.backup.bacula.general/36202/focus=36232
> >
> > __Martin
> 
> Getting closer.  I now get: 
> 
> 2000 OK estimate files=3430 bytes=0
> 
> I have this (truncated for brevity):
> 
> FileSet {
>   Name = "winMedia"
> 
>   Include {
> 
>     File  = "C:/Documents and Settings"
> 
>     Options {
>       Exclude = yes
>       IgnoreCase = yes
>       WildFile = "c:/Documents and Settings/*"
>     }
> 
>     Options {
>       IgnoreCase = yes
>       WildDir = "c:/Documents and Settings/*/My Documents/My Pictures"
>       WildFile = "C:/Documents and Settings/*/My Documents/My Pictures/*"
>     }
> 
>     Options {
>       signature = SHA1
>       verify = s1
>     }
>   }
> }
> 
> If I do WildDir with the above, I get 
> 
> 2000 OK estimate files=1 bytes=0
> 
> If I do WildDir and /*/* I get 
> 
> 2000 OK estimate files=36 bytes=12,736,029
> 
> which is WAAAY less that I know should be there.
> 
> WildFile with /*/* I get 
> 
> 2000 OK estimate files=3430 bytes=0
> 
> again.
> 
> Sigh...this is really frustrating.  It seems like specifying directories 
> to be included (and only those directories) shouldn't be so hard.
> 
> Any other ideas?

The two important points to remember are:

1) Bacula walks over the filesystem depth-first starting from the File= lines.
   It stops descending when a directory is excluded, so you must include all
   ancestor directories of each directory containing files to be included.

2) Each directory and file is compared to the Options clauses in the order
   they appear in the fileset.  When a match is found, no further clauses are
   compared and the directory or file is either included or excluded.

Therefore, you at least need to put the Option clause with Exclude=yes after
the main one, otherwise it will exclude all files.  In addition, you should
use Wild in the Exclude=yes clause, not WildFile which would include all
directories in the whole tree.  After doing that, you need to include the My
Documents directory explicitly.

The following should work:

FileSet {
  Name = "winMedia"

  Include {

    File  = "C:/Documents and Settings"

    Options {
      signature = SHA1
      verify = s1
      IgnoreCase = yes

      # Include all users' directories so we reach the inner ones.  Unlike a
      # WildDir pattern ending in *, this RegExDir only matches the top-level
      # directories and not any inner ones.
      RegExDir = "^C:/Documents and Settings/[^/]+$"

      # Ditto all users' My Documents directories.
      WildDi = "C:/Documents and Settings/*/My Documents"

      # Ditto all users' My Documents/My Pictures directories.
      WildDir = "C:/Documents and Settings/*/My Documents/My Pictures"

      # Include the contents of the My Documents/My Pictures directories and
      # any subdirectories.
      Wild = "C:/Documents and Settings/*/My Documents/My Pictures/*"
    }

    Options {
      Exclude = yes
      IgnoreCase = yes

      # Exclude everything else, in particular any files at the top level and
      # any other directories or files in the users' directories.
      Wild = "C:/Documents and Settings/*"
    }
  }
}

__Martin

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users