rsync not copying hard links
Posted
by
A.Ellett
on Super User
See other posts from Super User
or by A.Ellett
Published on 2013-06-29T01:10:04Z
Indexed on
2013/06/29
4:23 UTC
Read the original article
Hit count: 475
I have two computers (both MacBook Airs) for which I sync one directory tree in both, but not the entire hard drive or any other directories.
Let's say on computer A
the directory is /Users/aellett/projects
Let's say on computer B
the directory is /Users/bellett/projects
Generally, I'll log into computer B
and then remotely connect to computer A
as user 'aellett'. As super user I sync the two project directories as follows:
rsync -av /Volumes/aellett/projects/ /Users/bellett/projects/
and this works as expected.
On both computers I have another file letter.txt
in a different directory which is not getting synced.
Let's say on computer A
the file is found in /Users/aellett/letters
On computer B
the file is found in /Users/bellett/correspondence
Generally, I don't want to share what's not included in /Users/<username>/projects
. But I do want to share this particular file.
So on both computer I made a correspondence
directory in projects
.
And then I made hard links as follows
On computer A
:
ln /Users/aellett/letters/letter.txt /Users/aellett/projects/correspondence/letter.txt
On computer B
:
ln /Users/bellett/correspondence/letter.txt /Users/aellett/projects/correspondence/letter.txt
The next time I synced the two computers I did the following
rsync -av -H /Volumes/aellett/projects/ /Users/bellett/projects/
When I checked on computer B
, /Users/bellett/projects/correspondence/letter.txt
was correctly synced. But, the hardlink to /Users/bellett/correspondence/letter.txt
was no longer there. In other words, /Users/bellett/projects/correspondence/letter.txt
was identical to /Users/aellett/projects/correspondence/letter.txt
but it differed from /Users/bellett/correspondence/letter.txt
. Since these two files were hard linked on both computers, I expected them to still have the hard link.
Why are my hard links not being preserved?
© Super User or respective owner