How to use multiple link-dest directories?

Matt McCutchen hashproduct at verizon.net
Fri Feb 24 02:43:11 GMT 2006


On Thu, 2006-02-23 at 18:32 -0800, Maynard Handley wrote:
> Hi guys,
> I hope this is not considered a stupid question

"Those who ask stupid questions may appear stupid; those who do not
remain stupid." -- Attribution lost

> * I can have rsync, when told to backup SOME_MACHINE to SOME_MACHINE/ 
> 0, for each file
> ++ first look in SOME_MACHINE/0 for a match (won't exist in the usual  
> case that SOME_MACHINE/0 is created from scratch)
> ++ then look in BASE_OS/1 for a match, to which a hard link will be  
> constructed in SOME_MACHINE/0
> ++ then, if that doesn't work, look in SOME_MACHINE/1 for a match, to  
> which a hard link will be consructed in SOME_MACHINE/0
> ++ then finally if that fails, copy the file over and create it in  
> SOME_MACHINE/0

Exactly, but if you're copying to SOME_MACHINE/0, don't bother listing
it as a link-dest directory.  If it contains a file that looks the same
as a corresponding source file, rsync will leave the file alone; no hard
link needs to be created.

> OK, so assuming my understanding the nature of the feature is correct  
> (ie that it's the obvious extension to link-dest that we've all been  
> using on single directories for a long time; and that it's not subtly  
> different in some weird way) we are faced with the following  
> apparently trivial problem:
> How the fsck do I specify to rsync what I want the two directories to  
> be?

Use several separate --link-dest options:
	rsync --link-dest=BASE_OS/1 --link-dest=SOME_MACHINE/1 <...>
Keep in mind that relative paths to --link-dest directories are
interpreted starting at the destination directory.
-- 
Matt McCutchen
hashproduct at verizon.net
http://hashproduct.metaesthetics.net/



More information about the rsync mailing list