--recursive and -H

Matthias Schniedermeyer ms at citd.de
Sat Jun 26 17:33:33 MDT 2010

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