fully-qualified symlinks & --exclude question - Tools

This is a discussion on fully-qualified symlinks & --exclude question - Tools ; Greetings! I've ran into a couple difficulties for a particular rsync use-case I'm involved in implementing - hoping someone here might be able to clue me in! I've got an existing linux box, with a particular directory that needs to ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: fully-qualified symlinks & --exclude question

  1. fully-qualified symlinks & --exclude question


    Greetings!

    I've ran into a couple difficulties for a particular rsync use-case
    I'm involved in implementing - hoping someone here might be able to
    clue me in!

    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)


    Second question:

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

    For example:

    /var/lib/bar/foo -> /var/lib/bar/base_file1
    /var/lib/bar/blah -> /var/lib/bar/base_file2
    /var/lib/bar/goober -> /var/lib/bar/base_file2

    I want to use an --exclude which specifies: "all symlinks that link to
    /var/lib/bar/base_file1 and /var/lib/bar/base_file2"

    So, --exclude="foo blah" isn't what I'm after, because that will fail
    to contain 'goober'... remember we're talking hundreds of symlinks -
    pointing to just a couple/few target files; my --exclude would simply
    be unmanageable.


    Many thanks for any advice/solutions!

    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


  2. Re: fully-qualified symlinks & --exclude question

    On Tuesday 24 June 2008 12:02:26 am Matt McCutchen wrote:
    > On Sun, 2008-06-22 at 22:26 +0000, Corey wrote:


    > > Is there a way of forcing rsync to link these relatively rather than
    > > fully-qualitive?


    > 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.
    >


    THanks -- I ended up with your suggestion to just change the symlinks
    to relative on my own (using find and readlink); that worked easily
    enough... can't expect rsync to do _everything_ for me...


    > > 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
    >


    I'll add my original use-case to that feature request, in case it's useful -
    but I was able to get around this issue in an entirely different way: luckily
    for me, I was able to simply remove or relocate those other extraneous
    symlinks before setting up the rsync jobs, so that made things easy - rather
    than working with things as they were, I was fortunate enough to be able to
    modify the environment to be more suitable for the rsync.


    Beers!
    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


  3. Re: fully-qualified symlinks & --exclude question

    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

    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.9 (GNU/Linux)

    iEYEABECAAYFAkhgOYoACgkQC+xSYN/RlfvpYACbB4WgQL/iRD/xYTWIU0oG9StT
    nI4An1+l9X2ZQa4LaL7CsfXhNRiPkJ8z
    =e7jp
    -----END PGP SIGNATURE-----


+ Reply to Thread