BackupPC-users

[BackupPC-users] BackupFilesExclude strips trailing / on patterns for rsync

2008-10-08 16:10:25
Subject: [BackupPC-users] BackupFilesExclude strips trailing / on patterns for rsync
From: John Rouillard <rouilj-backuppc AT renesys DOT com>
To: Backuppc Users <BackupPC-users AT lists.sourceforge DOT net>
Date: Wed, 8 Oct 2008 20:06:21 +0000
Hi Folks:

On Sat, Aug 23, 2008 at 02:45:42AM +0200, Holger Parplies wrote:
> I would implement this like BackupPC does, though it's
> perhaps not intuitive :-). If you are using rsync(d), that is. It won't work
> with tar or smb.
> 
> $Conf {BackupFilesExclude} =
>   [ '/proc', '/sys', '/mnt',
>     '+ /opt/zimbra', '/opt/*',
>     '+ /opt/zimbra/backup', '/opt/zimbra/*' ];
> 
> The trick is that all of BackupFilesExclude gets passed to rsync as
> '--exclude=/...' arguments. Rsync treats '--exclude=+ /something' as an
> include. Thus you're including /opt/zimbra, excluding the rest of /opt, and
> likewise including /opt/zimbra/backup and excluding the rest of /opt/zimbra.
> That should get you what you want. For a better explanation see
> BackupPC::Xfer::Rsync, lines 156 and following.
> 
> Note that the order matters: '+ /opt/zimbra' needs to be before '/opt/*' and
> likewise for '.../backup'. If it feels more comprehensible, you may change
> '/opt/*' to '- /opt/*' (and likewise for other excludes). You need a single
> space character between +/- and the path.

I have set up a rule like this to eliminate many gigbaytes of files
with the following config file entries:

  $Conf {BackupFilesExclude} =
   ...,
   '/home/yum' => [
       "+ /bin/**",
       "+ /SRPMS/**",
       "+ /install/kickstart/**",
       "+ /solaris_software/**",
       "- **/.svn/",
       "- /repository/**/core/**",
       "- /repository/**/core.orig/**",
       "- /repository/**/updates/",
       "- /repository/**/updates-test/**",
       "- /repository/**/babbledog*/**",
       "- /repository/**/monkeyowl-dev/**",
       "+ /repository/**/RPMS/**.rpm",
       "+ */",
       "- *",
     ],
  };

After starting and stopping a full backup after 5 minutes I saw
(annotated with @ signs):

  Sent include: /bin/**
  Sent include: /SRPMS/**
  Sent include: /install/kickstart/**
  Sent include: /solaris_software/**
@  Sent exclude: **/.svn
  Sent exclude: /repository/**/core/**
  Sent exclude: /repository/**/core.orig/**
  Sent exclude: /repository/**/updates
  Sent exclude: /repository/**/updates-test/**
  Sent exclude: /repository/**/babbledog*/**
  Sent exclude: /repository/**/monkeyowl-dev/**
  Sent include: /repository/**/RPMS/**.rpm
@  Sent include: *
  Sent exclude: *

Note the lines marked with @'s. It looks like the trailing /'s from
the exclude list for those items is being removed ( "= **/.svn/" is
sent as "**/.svn" and "+ */" is sent as "*"). The trailing / is
supposed to force these patterns to be interpreted only for
directories.

So is this doing the right thing, and the message:

  Sent include: *

should really read:

  Sent include directories only: *

Or am I going to get a huge backup of everything?

I looked in RsyncP.pm to try to get some insight to what's happening
there and it looks like the exclude list is munged by the time it
arrives, so I think I am going to get a huge backup.

Anybody got a fix/idea on how to solve this?

Also I had to stop the backup to see any output at all on the
XferLOG.z. This is really annoying, is there some flag that can be
turned on to get it to flush after every output line?

(As a side note, I guess this is somewhat expected since it is named
"BackupFilesExclude" not not BackupPatternsExclude or
BackupPathsExclude, but I still claim it's broke.)

-- 
                                -- rouilj

John Rouillard
System Administrator
Renesys Corporation
603-244-9084 (cell)
603-643-9300 x 111

-------------------------------------------------------------------------
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=/
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>