2

So my situation is that I want to my development files - Ruby & PHP - available to all of my machines when I am home and away. When I asked the question before (Mount my Webserver as a drive in Win7/8) I was told to use version control software but I don't want to be downloading a local copy and working on it so that I then have to upload the new version and re-download the new version to all the machines. There's no group of developers here just me and most of my dev/debug issues come from writing code and testing it one machine but then forgetting to update my other machines. Thus I want a sync'd copy of the files on all of my machines.

I was considering using ownCloud on one of my webservers for other reason anyways and gives my Win machines easy access to the files. My Win machines have the ownCloud update client that works like Google Drive's or DropBox's with sync'ing happening on what appears to be a timer. The ownCloud update client on my Ubuntu machines didn't want to install and I'm using a mix of desktop and server versions. So my Ubuntu machines simply mount the ownCloud directory via davfs2 and (in once I get this worked out) they will use rsync on a cron to create a local copy - that way my machines can continue to work if the server with the ownCloud files goes down.

But then I ran across mention of Unison which I'd never heard of before. It seems that Unison is a program meant to do the same thing as differential rsync. Have I misunderstood?

Unison sounds like it is built for syncing files across servers so I wouldn't have to worry about keeping the remote server's mount up and running or re-establishing the mount before executing a differential rsync. However, all of the tutorials I'm finding on Unison suggest that you have to open up SSH to root logins. Maybe I'm worried about nothing but that seems like a bad idea.

Questions:

  1. Am I correct that allowing a root login on SSH is a bad idea for security reasons?
  2. Are there advantages to Unison that I've overlooked?
  3. Are there issues with rsync that I've overlooked? Such as wiping out my local copy if the mount of the remote server goes down and now the directory looks empty.
  4. Are there performance advantages to Unison over rsync or vice versa?
  5. Finally, is there a way to monitor mounts and re-establish automatically if they die? I could use write something to check for specific contents on the mount but that seems prone to problems.

Thanks

2

Choose Unison if what you want is two way synchronization, it is better suited for those scenarios; although achievable in rsync as well.

  1. It's a bad idea, but a root login is not required. You need a login to the other machine which has permissions to write to the folders you want to sync. Since this is your personal stuff, you can use your normal login or create a special login on all machines specifically for Unison and grant that login permissions on those folders.

  2. The two way binding and ease of setup mainly, but it comes down to preference. You could try both to see which one you end up liking more.

  3. You can perform checks before actually invoking the rsync or Unison sync. For example, you can mount the remote machine's directory via sshfs. If it fails, don't kick off the sync. This can be part of your sync script.

  4. The main bottleneck will be network speed, and Unison can be slower if you have huge amounts of data to sync (~100GB or so). Otherwise, the differences are negligible, YMMV. Everyone's setup is different. You should also read this post as part of your considerations.

  5. If you're using sshfs, try the reconnect option.

Having said all this, if this is just for code, it's still a good idea to consider a version control system as others have said. You can host a git server on a machine at home and synchronizing code only takes a minute or less with one command, without the overhead of maintaining mounts, logins, connections, etc.

  • 1
    I don't have GBs worth of data to sync - at least not yet. I intend to sync my code but keep items like log files local only. So that really means less than 1 GB. However, my use case is such that the files will get called via cron on a timespan of 1 to 10 min. This means that edge case (file in use) mentioned in your reference seems to be much more likely and thus more maintenance with Unison. The way around a 2 way sync with rsync I think will be to simply edit the files in the mounted drive directly and run the tool files from the rsync'd local folder. – Gabe Spradlin Jan 16 '14 at 22:54

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.