Bacula-users

Re: [Bacula-users] losing directory permissions and ownership

2009-10-27 18:38:41
Subject: Re: [Bacula-users] losing directory permissions and ownership
From: Martin Simmons <martin AT lispworks DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Tue, 27 Oct 2009 22:34:49 GMT
>>>>> On Tue, 27 Oct 2009 00:22:37 +0200, Avi Rozen said:
> 
> Martin Simmons wrote:
> >>
> >> I'd like to cherry pick directories to backup and have them restored
> >> with correct ownership and permissions...
> >>
> >> What am I doing wrong? Is this the expected behavior?
> >>     
> >
> > Yes, this is the expected behavior.
> >
> > During a backup, Bacula looks inside the directories you give in the 'File 
> > ='
> > lines and doesn't save any information about the parents.
> >
> >   
> 
> Would be nice if it did...
> 
> > It is difficult to get the cherry picking behaviour, but I think it is
> > possible.  You need to start higher up the tree and use two Options clauses 
> > to
> > select the files to include and exclude.  The first Options clause must 
> > match
> > only what you want to back up (the parent directories themselves plus the
> > cherry picked files/directories, but not other contents of the parent
> > directories).  The second Options clause should use wild = "*" and 
> > Exclude=yes
> > to remove everything else.
> >   
> 
> Thanks for the explanation and tips.
> 
> I tried it and a few other file set configurations, based on the
> examples in [1], specifically the following, which is supposed to
> include only home directories of users whose usernames start with either
> 'a' or 'b':
> 
> FileSet {
>   Name = "Full Set"
>   Include {
>      Options {
>         wilddir = "/home/a*"
>         wilddir = "/home/b*"
>      }
>      Options {
>         RegexDir = ".*"
>         exclude = yes
>      }
>      File = /home
>   }
> }
> 
> But I can't get bacula to do what I want. I tried  the following file
> set to backup files in my test directory, but it excludes everything
> except for files in the root directory:
> 
> FileSet {
>   Name = test-fileset
>   Include {
>     Options {
>         wilddir =
> "/home/avrozen/temp/bacula-test/owned-by-root/owned-by-avrozen/owned-by-bacula"
>     }
>     Options {
>         regexdir = ".*"
>         Exclude = yes
>     }
>     File = /
>   }
> }
> 
> Any ideas? What am I missing?

You need to match the parent directories themselves and then the contents of
owned-by-bacula:

FileSet {
  Name = test-fileset
  Include {
    Options {
        # Match all directories leading up to the cherry picked directory
        regexdir = "^/home$"
        regexdir = "^/home/avrozen$"
        regexdir = "^/home/avrozen/temp$"
        regexdir = "^/home/avrozen/temp/bacula-test$"
        regexdir = "^/home/avrozen/temp/bacula-test/owned-by-root$"
        regexdir = 
"^/home/avrozen/temp/bacula-test/owned-by-root/owned-by-avrozen$"
        # Match the cherry picked directory itself
        regexdir = 
"^/home/avrozen/temp/bacula-test/owned-by-root/owned-by-avrozen/owned-by-bacula$"
        # Match the contents of the cherry picked directory
        wild = 
"/home/avrozen/temp/bacula-test/owned-by-root/owned-by-avrozen/owned-by-bacula/*"
    }
    Options {
        # Skip everything else
        wild = "*"
        Exclude = yes
    }
    File = /
  }
}

Note the $ at the end of each regexdir to make it match only the directory and
nothing else with that prefix.

__Martin

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users