Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to synchronize my personal document repository between my different computers in my home. Today this folder is under a dedicated partition of the hard drive of a dual boot workstation.

My configuration is the following one:

  1. Dual boot Workstation running Ubuntu 11 and windows Xp (the documents are simply shared using the dedicated partition)
  2. Laptop running Ubuntu 12.04 (Today no access to the documents)
  3. A freebox with an external hard drive pluged to it

What I want is to be able to synchronize this document folder also with the laptop and in addition to have a "backup" of this on the hard drive attached to the freebox.

What tools should I use for this (rsync, unison, others?)

share|improve this question
    
Should the backup encompass also deleted files? I.e. you want to be able to recover files that you deleted? –  daniel kullmann Jul 17 '12 at 18:01
    
@danielkullmann No –  Manuel Selva Jul 17 '12 at 21:06

3 Answers 3

up vote 4 down vote accepted

If you're always synchronizing in the same direction, use rsync. If you're synchronizing in both directions, use unison. Unison supports both Linux and windows; the documentation explains how to set it up under Windows (you'll need an SSH client as well).

To synchronize between more than two locations, choose one as the master and synchronize every other location with the master. Here, set up both the workstation and the laptop to synchronize with the Freebox.

You'll need to have a unison binary on the Freebox. Since it runs Linux and has an x86 processor, if it doesn't have unison already, you can copy the binary from any 32-bit Linux installation.

share|improve this answer
    
Thanks for the answer. I am not accessing the Freebox over ssh but using Samba (I think) and as a consequence I have my Freebox hard drive mounted on /media. Thus I don't need to install unison on the freebox because I am running it from the Workstation or laptop as if it is operating on 2 local folders. Is it true ? –  Manuel Selva Jul 18 '12 at 7:23
    
@ManuelSelva Right, if you're using Samba, you'll be using Unison locally on the workstation and on the laptop (with files that happen to be stored not on a local disk but on another machine). –  Gilles Jul 18 '12 at 7:31
    
Perfect ! I'll start with this solution, it should feet my needs. –  Manuel Selva Jul 18 '12 at 7:33
    
I confirm that this solution is PERFECT !! Thanks. only little troubles with Linux symbolic links ;-) –  Manuel Selva Aug 10 '12 at 7:48

I don't think rsync fits your bill, because it won't automatically handle updates to the same document in multiple locations. The same is true for file deletions. You can do this manually, but this is bound to become problematic at some point.

I have never used unison, but it seems to be the right tool for your use case.

That said, I'd also like to mention distributed version control systems like Mercurial, Git, Bazaar, etc. They have the additional benefit that you don't lose old versions of your documents. They are, however, best suited for dealing with text files; binaries like LibreOffice documents and such will require more work when the same document is changed on several machines.

Update: If you want to have a real backup on the third machine, you should consider using a separate backup solution, because that will keep old files. rsync can do that as well (if you omit the --delete option), but this will again be problematic at some point: old files will fill up your document folders, and new files that have the same name as old, deleted files will overwrite them.

A simple backup system like dejadup, duplicity, rsnapshot, or rdiff-backup could be used for that.

share|improve this answer
    
I'll never (or rarely) modified a given file in several different place. The use case is adding a file on a given PC and getting every where. –  Manuel Selva Jul 17 '12 at 17:45
    
@ManuelSelva - based on that description, you really want a configuration management solution such as puppet or cfengine. –  jordanm Jul 17 '12 at 17:57
1  
@ManuelSelva unison looks like the right tool for you, then. –  daniel kullmann Jul 17 '12 at 18:00
    
@jordanm How would that work? You should put that into an answer. –  daniel kullmann Jul 17 '12 at 18:02
    
@danielkullmann I am trying unison. I'll just have to run it quite often on each of my computer in the following way unison local/documents freebox/documents –  Manuel Selva Jul 17 '12 at 21:04

I use rsync over ssh. For backups you can do this trick:

http://www.mikerubel.org/computers/rsync_snapshots/

Basically, I have rsync set up with ssh keys and cron jobs. The link above covers most (or all) of that.

I also use duplicity for backups, but I hesitate to recommend it. It works, but it's unwieldy.

share|improve this answer
    
Rsync is a good tool for backups. –  Tim Jul 17 '12 at 20:34
    
Yes but what I want is to rsync from my workstation to the freebox AND rsync from my laptop to the freebox. I can add simulmtaneously 2 files from each computer and as a result I want all the computers AND the freebox having the 2 files. rsync is not the right tool for that, isn't it ? –  Manuel Selva Jul 17 '12 at 20:50
    
If the files never conflict between the two sources, then rsync will work just fine. If there are conflicts between the workstation and the laptop, what do you want it to do? In that case, you need a versioning system (eg git) more than rsync or similar. –  pileofrogs Aug 2 '12 at 23:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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