rsync replaces symlinks on destination

Matt McCutchen hashproduct+rsync at gmail.com
Tue Sep 4 12:28:39 GMT 2007


On 9/4/07, aaa aaa aaa aaa <ai_chat_bot at 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


More information about the rsync mailing list