I'm trying to setup rsync to work with symlinks.

Client to Server: For example on my client machine I have a symlink, when I sync to server, it syncs the actual file, which is what I want.

Server to Client: On the server, if I update the file and sync from server to client, it's replacing my symlink with the file, this is not what I want.

Problem: I need the client symlink to remain intact, and rsync to update the actual file on the client instead.

I've been messing around with the options and can't get it right

Any ideas?



I think if you simply do rsync -a client/ server/ and rsync -a server/ client/ you should be OK. I tested this with a symlink to a file, and every edit of my file on both sides resulted in an updated file and the symlink was left intact.

  • I tried using the -a option, but when syncing from client to server, I have a broken symlink on the server side. – makstaks Feb 24 '11 at 0:13
  • hmak - you are not using the -L option as well? Can we see your actual rsync commands on both systems? – timd Feb 24 '11 at 0:24
  • after trying -L, the symlink resolves properly and on my server side, I have the actual file. Now when I try to sync from server to client it overwrites my symlink, i'm using -aL – makstaks Feb 24 '11 at 0:32
  • You probably don't want the -L option, just -a. Are your symlinks relative (->../foo/bar) or absolute (->/foo/bar). Transferring absolute links to a different directory will probably break things. Can you modify your links to be relative? – Zoredache Feb 24 '11 at 3:04
  • You definitely want to drop the -L option and use just -a. – timd Feb 24 '11 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.