$ cd /tmp $ echo "123" > aaa $ echo "123" > bbb $ ln -s bbb ccc $ ls -la aaa bbb ccc -> bbb $ rsync aaa ccc $ ls -la aaa bbb ccc This example shows that symlink ccc was replaced with a regular file, which implies that during a remote sync the content of the aaa will be downloaded. However, files aaa and bbb have the same content, so I need rsync to skip updating the destination file if it is a symlink that points to a file that is identical to the source file. The rsync manpage has some stuff about symlinks, but I found only arguments related to symlinks on source, not on destination. Any hints about changing rsync behaviour to suit my needs? I'm using rsync version 2.6.9 protocol version 29. Thank you. --------------------------------- Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. -------------- next part -------------- HTML attachment scrubbed and removed
On 9/3/07, aaa aaa aaa aaa <ai_chat_bot@yahoo.com> wrote:> I need > rsync to skip updating the destination file if it is a symlink that > points to a file that is identical to the source file.Rsync doesn't have an option to do that. If the option existed, it would be called --keep-links. Using the current rsync, here are some things you might try: 1. Exclude the offending symlinks. 2. Rearrange the destination so that only symlinks to directories are used, and pass --keep-dirlinks. 3. Instead of following symlinks in the destination, create reverse symlinks in the source and read through those symlinks using --copy-links. 4. If you care only about rsync not mangling destination symlinks pointing to data *identical* to the source data, "diff -q" the source and destination to get a list of paths at which the contents differ and make rsync process only those paths using --files-from. If you explain more concretely what you were hoping to accomplish by having rsync follow symlinks in the destination, I might be able to suggest a better approach. Matt
On 9/4/07, aaa aaa aaa aaa <ai_chat_bot@yahoo.com> wrote:> I keep local mirrors of slackware-current and slackware-12.0 for personal > use (Slackware Linux is one of the oldest Linux distributions). My big issue > is the lack of hdd free space. At the moment of the release the directory > trees are identical. Then differences begin to appear (mostly bugfix package > releases in the stable version and new packages in -current). I'm thinking > to replace all identical files (only files, not directories) in -current > with symlinks to files from 12.0.Use hard links instead! They are generally better for saving space on identical files without confusing tools that manipulate the files. Rsync will leave a destination file identical to the source file alone regardless of whether the destination file is hard-linked but will break the hard link when the source file changes since rsync updates a destination file by writing a temporary file with the new data and then moving it into place. This is exactly what you want, with one exception: if a source file changes attributes but not data, rsync will tweak the hard-linked destination file, writing through to the slackware-12.0 . If this is unacceptable to you, there are two ways to avoid it: (1) receive into a new destination on each run and use --link-dest to the slackware-12.0 and the old destination, or (2) encourage us to implement the --no-tweak-hlinked option I proposed and then pass that option. Matt