fully-qualified symlinks & --exclude question

Matt McCutchen matt at mattmccutchen.net
Tue Jun 24 00:02:26 GMT 2008


On Sun, 2008-06-22 at 22:26 +0000, Corey wrote:
> I've got an existing linux box, with a particular directory that needs
> to be mirrored onto another server, into a different base path on that
> server - i.e.:
> 
> server1:/var/lib/bar/ to server2:/backupdir/var/lib/bar/
> 
> Now, server1:/var/lib/bar/ contains hundreds of files which are each
> symlink'd to one of a few files in the same directory:
> 
> /var/lib/bar/base_file1
> /var/lib/bar/base_file2
> /var/lib/bar/base_file3
> /var/lib/bar/foo -> /var/lib/bar/base_file1
> /var/lib/bar/bar -> /var/lib/bar/base_file3
> /var/lib/bar/blah -> /var/lib/bar/base_file2
> /var/lib/bar/goober -> /var/lib/bar/base_file2
> 
> The first problem is that these symlinks (on server1) are all using
> the fully-qualified path - which is causing me problems because
> /var/lib/bar/ doesn't exist on server2, but rather in
> /backupdir/var/lib/bar/ ...
> 
> Is there a way of forcing rsync to link these relatively rather than
> fully-qualitive? So that (for an exampe) the rsync from
> server1:/var/lib/bar/foo to server2 ends up like:
> 
> server2:/backupdir/var/lib/bar/foo -> 
> server2:/backupdir/var/lib/bar/base_file1
> 
> rather than (what it's currently doing):
> 
> server2:/backupdir/var/lib/bar/foo -> server2:/var/lib/bar/base_file1
> 
> (...which results in a broken link)

No, rsync does not support this kind of symlink rewriting, unless you
want to hack the "munge symlinks" code to prepend /backupdir instead
of /rsyncd-munged/ and remove the check that the prepended directory
doesn't exist.

In this situation, I would just change the source symlinks to relative
paths.  If there's a reason why you don't want to do that, tell me and I
might be able to figure something out.

> Second question:
> 
> Is there a way of using --exclude to reference symlink _targets_, rather
> than the filename itself?

No.  There's an enhancement request for this capability:

https://bugzilla.samba.org/show_bug.cgi?id=1670

Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/rsync/attachments/20080623/a7420fb2/attachment.bin


More information about the rsync mailing list