Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rsync & Symbolic Links

Status
Not open for further replies.

lzdkng438

MIS
Dec 23, 2004
19
0
0
US
Syncing directories between 2 Linux boxes I have noticed a problem with symbolic links. Even with the -l option, when the original directory is replicated to the destination, the destination link is broken. If the original link points to "/directory/subfolder" the replicated link on the destination box points to "directory/subfolder"

I have never noticed this behavior before, any ideas?
 
What is the exact command that you're using? Usually -a (archive) will preserve the exact links, I'm not sure why yours would be stripping the leading /, that's not something I've seen before. Read the man page for rsync, -a implies several switches, one of which is preserve symlinks.
 
Sorry for the delay in answering. Current command as follows:

rsync -vogptrlP --delete
 
Think I might have found the problem:

[from rsync.samba.org]
Symbolic links are considered unsafe if they are absolute symlinks (start with /), empty, or if they contain enough ".." components to ascend from the directory being copied.


Since that link has path referring outside of the structure and to the root of the drive, rsync must try to recreate the link as a "safe" link.
 
Very good find. I had not heard of that. We always try to use correct relative symlinks (ie not to many ../ in the path) and never absolute symlinks, so have never run across this problem.

Congrats on finding the reason!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top