--recursive and -H
Matthias Schniedermeyer
ms at citd.de
Sun Jun 27 03:21:42 MDT 2010
On 26.06.2010 21:27, Rob Thompson wrote:
> Aaah, thanks for the insight. RSYNC must transfer the file regardless
> of the link count, but it also takes note of the missing link. So, it
> probably considers an inode with multiple links "resolved" only after
> it finds a brother/sister link and deletes the duplicate.
Yes and no. It is resolved when link-count amount of files have been
encountered. No deleting involved as rsync can't infere that, as another
hard-link can always be in a directory outside your transfer-directory.
And btw. without "--inplace" rsync will create a new file and hard-links
that, when the file differs in source/target. IOW It breaks an existing
hard-link on the target-site in regard to a hard-link outside the target
dir.
> This would be consistent w/ the man page:
>
> "-H, --hard-links
> ...
> If incremental recursion is active (see --recursive), rsync may transfer a missing hard-linked file before it finds that another link for that contents exists elsewhere in the hierarchy. This does not affect the accuracy of the transfer, just its efficiency"
>
> Big props to those who code RSYNC, this stuff gets crazy ;)
Definitly. ;-)
> ----- "Matthias Schniedermeyer" <ms at citd.de> wrote:
>
> > On 26.06.2010 09:01, Rob Thompson wrote:
> > >
> > > Hello,
> > >
> > > I have a question regarding using the --recursive option when
> > > preserving hard link with -H. How is it, that these two options are
> >
> > > compatible when used together? I would think that RSYNC would need
> > to
> > > see all files/inodes before transferring, to preserve hard links.
> > But
> > > yet it still starts transferring before reading the entire file
> > list.
> >
> > That's easy.
> >
> > 'stat'ing a file also gives it's inode-number and the link-count
> > (number
> > of directory entries).
> >
> > When you have link-count == 1 there is nothing special to do.
> >
> > When you have a link-count > 1 you can discard the data as soon as you
> >
> > transferred as many files, with the same inode, as the link-count
> > says.
> > Of course the discarding only works as long as all hard-links are
> > inside
> > the directory-subtree you are transfering, otherwise rsync keeps
> > piling
> > up memory, at least i'm pretty sure that rsync works that way.
--
Bis denn
--
Real Programmers consider "what you see is what you get" to be just as
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated,
cryptic, powerful, unforgiving, dangerous.
More information about the rsync
mailing list