--copy-links and --hard-links

Dieter Stüken D.Stueken at conterra.de
Tue May 12 15:18:07 GMT 2009


Hi,

I want to use rsync in a may be unusual way:

I have a source tree containing lots of symbolic links and I use
the option "--copy-links" to get the physical files (the referents of the symlinks)
on the target host.

As the host uses the synchronized files in a read-only fashion, I also want to get
hardlinks for all identical files, to save space. Thus I also use "--hard-links".

Because managing hardlinks is hard to handle (some lookup table is needed),
only inodes with a hardlink count >1 are considered (flink.c:1250 "st.st_nlink > 1").
Unfortunately most of my symlinked files have a link count of 1 and thus they are copied
twice. If, however, the source file accidentally has a link count > 1 (which is not related
to the multiple symlinks) rsync will create a hard link on the target host, as supposed.

To handle this situation I simply disabled the (st.st_nlink > 1) filter if "copy_links" is true, too.
This seems to work for me, but I don't know if this is a sufficient solution for others.
May be a special option should be considered to disable the (st.st_nlink > 1) optimization explicitly.

Or my situation is too exotic to be considered to fix.

Dieter.

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the rsync mailing list