Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at


hpr1643 :: Unison Syncing Utility

Review of the Unison graphical Syncing Utility

<< First, < Previous, , Latest >>

Thumbnail of FiftyOneFifty (R.I.P.)
Hosted by FiftyOneFifty (R.I.P.) on Wednesday, 2014-11-19 is flagged as Clean and is released under a CC-BY-SA license.
Unison, file synchronisation, rsync. 4.
The show is available on the Internet Archive at: https://archive.org/details/hpr1643

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:34:44

general.

Unison is a file syncing/backup utility, similar to SyncBack on Windows, available in most repros.

  1. The graphical interface requires the installation of unison, and unison-gtk.. Unison may be installed w/o the graphical component, but all operations must be initiated from a system running the GUI.
    • Network backups require RSH or SSH to be installed on both machines
  2. The standard wisdom seems to be the rsync does not do a true 2 way sync, i.e., to sync to the newest file version going both ways you would have to do rsync ~/LocalFolder you@server:/home/you/RemoteFolder then turn around and do rsync you@server:/home/you/RemoteFolder ~/LocalFolder. Add that to the fact that like cp, or scp, rsync requires separate commands for files with extensions, files without, and hidden files, creating a bash script for syncing files is more complex than creating a Unison profile.
  3. Step One: If, like me you are syncing only Documents, make your subfolder structure the same on both machines, ergo, if one PC has /home/you/Documents/recipe and second PC has /home/you/Documents/Recipes, edit your folder structure to be the same on both PCs to avoid duplicate files and folders
  4. Launch Unison and create a backup profile First use, create a profile
    • Name of profile
    • Synchronization kind (Local, SSH, RSH, TCP)
    • "First" Directory (you can browse your mounted volumes)
    • "Second" Directory, if you chose Local
    • Host Machine Name (or IP Address)
    • User Name (If you haven't registered SSH keys, you will be prompted for a password on every synchronization.
    • Check whether you want to use compression, (on fast networks or slow processors, compression may create more overhead than it's worth).
    • Target directory (If it's on a remote server, you will need to type the full path, there is no browsing to the folder.)
    • Tell Unison if either folder uses FAT (say an un-reformatted USB stick)
    • If you are backing up to another system, Unison needs to be installed on both. If you are backing up to a server with no GUI desktop manager, you can install just the unison package without unison-gtk, but all the syncs will have to be initiated from the machine with a GUI. (Of course, if you back up to a remote volume that is mounted locally, it should be completely transparent to Unison). If you choose to sync via ssh (recommended), you will need ssh and ssh-server installed appropriately on each machine.
  5. Select and run your profile.
    • The first time, expect to get a warning that no archive files (index files that speed up the synchronization scan) were found. They will be created on the first sync.
    • Unison will look for differences between the files in the two selected directories. The differences will be displayed graphically, with arrows pointing left or right, indicating which directory contains the most current version of the file (by modification date). You can choose to merge files either left or right (a conventional backup), do a merge (i.e., Unison itself decides how to combine data from files with the same name (obviously, that could be messy), or to do a sync (ergo, the most current version of a file overwrites older version, regardless of location). Click "Go" to do a true sync.

Comments

Subscribe to the comments RSS feed.

Comment #1 posted on 2014-11-20 20:03:01 by 0xf10e

Have you ever tried `rsync --recursive ~/LocalFolder/. you@server:/home/you/RemoteFolder/.`?
The '/.' tells `rsync` "this directory" and combined with '--recursive' (or an option enabling '--recursive' like '--archive') you can easily (r)sync a directory with all possible filenames without worrying about "extensions".
Won't create the target directory but works nicely if it's already created.

And there's actually a text/console interface for unison (package "unison240-text" on Fedora 20) so you /can/ initiate a sync without the GUI ;)

Comment #2 posted on 2014-11-21 21:57:47 by Frank

Two supplements on Unison

Unison is really neat, I’ve been using it for a long time now to sync between several machines. I would like to make two additions to your explanations.

1) Unison in fact does *not* need the GUI installed. To set up the profile, you can also use an editor with the help of the (admittedly longish) documentation. And if used with the options -auto -ui text (it may select -ui text automatically, if no GUI is installed), it will show you the file list on the terminal and ask you for input there if needed.

2) To be more flexible in what can be synced (and to address your problem of capitalisation), I use the following trick:
- Create a new subdirectory in ~/.unison for each profile (I call them "-links" with being the ssh hostname for the remote sync partner). This subdirectory becomes the root directory for your profile.
- Fill that subdir with symbolic links to the items you want to sync. E.g. cd ~/.unison/laptop-links && ln -s /home/myname/Documents docs
- That way the directory to be synced can be called whatever you like, as long as the two symlinks have the same name on both sides.
- This also allows me to sync single files within a directory (e.g. ~/.vimrc) but not the dir itself, and also to sync directories that don’t share the same root, such as ~/docs and /mnt/data/music.
- Lastly, to make it all work, you must tell Unison to follow the symlinks you made. For this, add this to the profile config:
follow = Regex [^/]+
The Regex (regular expression) simply matches any character that is not a slash, hence everything on the topmost directory level (until the first slash).

Cheers.

Comment #3 posted on 2014-12-04 22:16:44 by bort

hi fiftyonefifty

thanks for your podcast on Unison.

one thing i would add to what you said is both backends need to be the *exact* same version.

when i tried to get it working between two ubuntu machines (10.something and 12.something) they installed different versions by default and therefore wouldnt talk to each other. It took me AGES to work out what i was doing wrong.

cheers

Comment #4 posted on 2015-01-06 13:25:55 by Ken Fallon

Workaround to my unison issues

On Fedora you can install different versions. So now I have the following versions installed.

unison-2.13
unison-2.27
unison-2.40

First I create the profile in unison-2.13, which fails to sync.

Then I open the existing profile with unison-2.40 and it syncs.

A hack.

Ken.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
Who is the host of this show?
What does HPR mean to you?