Questions tagged [unison]

Unison is a bidirectional, conflict detecting file-synchronization tool for OSX, Unix, and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.

Overview

Unison is a file-synchronization tool for OSX, Unix, and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.

Unison shares a number of features with tools such as configuration management packages (CVS, PRCS, Subversion, BitKeeper, etc.), distributed filesystems (Coda, etc.), uni-directional mirroring utilities (rsync, etc.), and other synchronizers (Intellisync, Reconcile, etc). However, there are several points where it differs:

  • Unison runs on both Windows and many flavors of Unix (Solaris, Linux, OS X, etc.) systems. Moreover, Unison works across platforms, allowing you to synchronize a Windows laptop with a Unix server, for example.

  • Unlike simple mirroring or backup utilities, Unison can deal with updates to both replicas of a distributed directory structure. Updates that do not conflict are propagated automatically. Conflicting updates are detected and displayed.

  • Unlike a distributed filesystem, Unison is a user-level program: there is no need to modify the kernel or to have superuser privileges on either host.

  • Unison works between any pair of machines connected to the internet, communicating over either a direct socket link or tunneling over an encrypted ssh connection. It is careful with network bandwidth, and runs well over slow links such as PPP connections. Transfers of small updates to large files are optimized using a compression protocol similar to rsync.

  • Unison is resilient to failure. It is careful to leave the replicas and its own private structures in a sensible state at all times, even in case of abnormal termination or communication failures.

  • Unison has a clear and precise specification.

  • Unison is free; full source code is available under the GNU Public License.

Usage

The first time Unison is run, it will take some time to fully synchronize the specified directories. It will create archive files in the .unison directory ($HOME/.unison in Unix, $USERPROFILE\.unison in Windows) to store the structure of the sync directories and make future syncs much quicker.

Unison can be run in a very basic way by evoking it as unison [options] root1 root2 where root1 and root2 are the directories to be synced. To more easily run Unison with many options and to more easily evoke Unison from within a script or as a cron job, it is convenient to create a profile to specify the roots of synchronization and other options. If we have a profile profile.prf (stored in the .unison directory), we can use this profile by running unison profile. A simple profile will look something like this:

# profile.prf
root = /home/user
root = ssh://user@198.51.100.42//home/user
path = Documents
path = Files

This will synchronize the local directories /home/user/Documents and /home/user/Files with the corresponding remote directories on 198.51.100.42 over ssh.

A more interesting Unison profile that could be used for automating backups to a remote server could look something like this:

# profile.prf
root = /home/user
root = ssh://user@198.51.100.42//home/user
sshargs = -C -i /path/to/ssh_key

path = Documents
ignore = Path Documents/secrets
ignore = Name *.tmp
ignore = Name {.*,*}.sw[ponx]

auto = true
batch = true
confirmbigdeletes = false

backuplocation = central
backupdir = /home/user/Unison-Backups
maxbackups = 7
backup = Name {.*,*}
backupprefix = .$VERSION

This profile will sync all of /home/user/Documents to the remote server except for the /home/user/Documents/secrets subdirectory, all files with a .tmp extension, and any swap files that vim likes to create. It will also automatically sync files without asking for confirmation (auto = true) and will store backups of files that are overwritten when they are synced in /home/user/Unison-Backups.

Helpful Links

Unison Homepage
User Manual and Reference Guide
A good Unison guide by Philip Guo

102 questions
0
votes
1 answer

Automatically sync using Unison

I am new to unison- the file synchronizing software. I use unison to sync files between my local machine and a remote server. However, I have to do the synchronization manually every time. Is there a way to trigger unison to synchronize…
Rhinocerotidae
  • 855
  • 1
  • 11
  • 26
0
votes
1 answer

Unison sync across more than 2 computers

I am currently using Unison across 2 computers (server and laptop). I need to create another connection where I can timely backup my data from server. laptop <--> server -> backup Here the connection to backup from server can be unidirectional. Is…
user3521099
0
votes
1 answer

Compiling unison for Windows 64 bit

I followed the instructions to compile 64 bit Unison using the MSYS2 toolchain as outlined HERE. Briefly, here are the steps: pacman -Sy --noconfirm base-devel git mingw-w64-x86_64-{glib2,gtk2,ocaml,toolchain} sed -i "s/#include…
RJ-
  • 2,919
  • 3
  • 28
  • 35
0
votes
2 answers

How many times do I need to install unison?

If I need to synch 2 server with unison do I need to install unison on both server or only one in enough? http://www.cis.upenn.edu/~bcpierce/unison/ thank you in advance! cheers daniel
Daniel Gartmann
  • 11,678
  • 12
  • 45
  • 60
0
votes
1 answer

How to have two local folders sync bidirectionally and automatically on OS X?

I am in a workflow where I regularly have to install an application locally, and then sync the folders of that application now installed locally with an SVN repository hosted in another folder on my computer. I have successfully created this…
Anthony
  • 13,434
  • 14
  • 60
  • 80
0
votes
1 answer

What is the best practices of using Docker for front end development on OS X and passthrough ENV from host to container

I am looking for best practices about front-end developing on OSX with docker and I have found number of projects on github. Here they are: docker-osx-dev boot2docker-xhyve coreos-xhyve docker-unison hodor The fact is I need two-way syncing files…
0
votes
1 answer

Unison sync: recovering copy of replaced files

I have configured Unison for synchronising files among servers. It takes a copy of a file from SERVER1 and replaces or copies the file to the other servers. I just added a folder directly onto SERVER2, but SERVER1 (the base server) had an older copy…
Prashant Shukla
  • 329
  • 1
  • 2
  • 17
0
votes
1 answer

Git: validating data and/or recovering from sloppy file synchronization?

I use git, and I synchronize my files, including git's metadata, among several machines using a file synchronization utility (unison). Recently I mistakenly changed different files on two different machines, without properly synchronizing in…
user1142217
0
votes
1 answer

Unison issue on Banana Pi running Lubuntu

I am trying to two-way sync my NAS (running Lubuntu) from my local network to a remote server (running Debian) with Unison CLI. I was using Unison before syncing my laptops files directly with the remote server. I always get an issue when trying to…
Finkes
  • 496
  • 5
  • 16
0
votes
1 answer

maintain older unison 2.40.x via homebrew

I have a perfectly working unsion version (2.48.3) which I installed via homebrew. So far so good. But I want to keep a folder in sync with a remote machine on which unison is installed in version 2.40.x. I do not have root access on this remote…
khx0
  • 41
  • 5
0
votes
2 answers

Sync remote folder with unison

I'm trying to syncrhonize two folders on two different nas. Sadly there is no chance, that the nas can replicate to the other or synchronize with the other nas. By now i synchronize the folder via sftp over a ftp-client which loads the file from one…
simon
  • 3,378
  • 2
  • 22
  • 32
0
votes
3 answers

Getting a SyntaxError on the last line of code in a Unison Merge script

Hey brilliant minds out there, I'm trying to get this Python script that I found working and can't figure out if it's just me or if the original poster didn't get the code right. This script is supposed to enable automatic conflict resolution in…
smithjw
  • 103
  • 4
1 2 3 4 5 6
7