[Dirvish] More than on tree per backup?

dirvish.yklein at spamgourmet.com dirvish.yklein at spamgourmet.com
Fri Feb 9 06:18:33 PST 2007

Dave Howorth - dhoworth at mrc-lmb.cam.ac.uk wrote:
> Kelsey Cummings wrote:
>> I just wanted to check to see if anyone using dirvish had already hacked                          
>> it to allow specification of multiple trees in a single config yet.                               
>> The method outlined in the url below is not so much and would be a real                           
>> issue to maintain over the number of systems that we plan on backing up                           
>> with dirvish.                                                                                     
>> http://www.dirvish.org/pipermail/dirvish/2006-April/000680.html 
> Off the top of my head, isn't the answer to this requirement:
>> I have a Filesystem like this:
>> /etc
>>     1
>>     2
>>     3
>>       3.1
>> /home
>>     4
>>     5
>> I would like to save 1, 3.1, 5.
>> An all in one vault.
> something like this?:
>   tree: /
>   exclude:
> 	+ /etc/1
> 	+ /etc/3/3.1
> 	+ /home/5
> 	- /*
> That doesn't look too difficult to maintain. What am I missing?
> Cheers, Dave

That won't backup anything. Rsync works recursively, so it would exclude 
all of /etc and /home without even checking for /etc/1 and the other 
subdirectories. You need to specifically include /etc/, include /etc/1, 
and so on, and exclude the rest of /etc with - /etc/* . So the proper 
syntax would be:

tree: /
	+ /etc
	+ /etc/1
	+ /etc/3
	+ /etc/3/3.1
	- /etc/3/*
	- /etc/*
	+ /home
	+ /home/5
	- /home/*
	- /*

Note that there must be a space between the + or - and the path. The 
dashes are not necessary, they are assumed if neither is specified, 
since it is an exclude list. I added them for clarity. I'm pretty sure 
that you don't need trailing slashes on the include line, but you may 
need to test that out. Also  note that this is a more realistic solution 
than just excluding 2 and 4. This exclude list makes sure to copy only 
what you want, and nothing else, even if more directories are added to 
/etc, /etc/3, or /home.

You must specifically include each directory in the path to the 
directory to want to include, and then you must specifically exclude 
everything else in each of those directories. So, if you want to include 
the contents of /a/b/c/d/e/f and the contents of /z, you would need to use:

tree: /
	+ /a
	+ /a/b
	+ /a/b/c
	+ /a/b/c/d
	+ /a/b/c/d/e
	- /a/b/c/d/*
	- /a/b/c/*
	- /a/b/*
	- /a/*
	+ /z
	- /*

As far as ease of maintainability, it gets difficult if you need to 
backup things that are "deep" in the filesystem, with a long path. 
Otherwise, it's not too bad.

You should read the "INCLUDE/EXCLUDE PATTERN RULES" section in the rsync 
man page to understand how it really works. See also 

Hope this helps,
Yoav Klein

More information about the Dirvish mailing list