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!
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
Possibly Parallel Threads
- Is there a parameter in rsync to clean $BACKUPDIR before writing to it (--backup-dir=$BACKUPDIR)?
- May I merge several increment backups to one?
- Is there a parameter in rsync to clean $BACKUPDIR before writing to it (--backup-dir=$BACKUPDIR)?
- rsync script from homepage: trouble
- cwrsync and link-dest option