Data synchronization over the Internet with Unison

Handling Conflicts

After synchronization, the Unison user interface displays the results in a clear-cut overview (Figure 6). Successfully synchronized files are marked with a green check mark; a summary lists the remaining conflicts. If you now press Rescan and compare the replicas again, all the successfully matched files will disappear and only the conflicts will remain.

Figure 6: Unison showing the results of a comparison and pointing out conflicts that still exist.

Select the conflicts one by one and prepare them for a new sync by selecting Skip, Left to Right, or Right to Left. Unison shows the approach chosen for conflict resolution with blue arrows (Figure 7). Another click on Go then triggers the sync.

Figure 7: Conflicts during synchronization are resolved manually by selecting a suitable direction for each synchronization.

Stationary Operation

The stationary.prf profile (Listing 6) is intended for computers with a permanent network connection, such as the workstations private.myhome.tld and work.myoffice.tld (see Figure 1).

Listing 6

stationary.prf

 

Activating batch mode and other modes in lines 9 to 11 means that Unison runs completely in the background, no longer asks you any questions, and synchronizes everything that it can without a conflict occurring. Line 12 additionally switches on the unison-fsmonitor automatic filesystem monitor in the background, which ensures a quick comparison as soon as something changes in one of the two replicas.

Due to the fact that the connection is established during login and is only closed again at logout time, there is permanent communication between client and server. This is handled by the unison-stationary.sh shell script (Listing 7), which you need to add to the list of autostart scripts. On KDE Plasma, for example, put it in the ~/.config/autostart-scripts/ directory.

Listing 7

unison-stationary.sh

 

Line 6 in Listing 7 activates the SSH certificate – as above for mobile operation – and loads it for the session. Line 7 starts Unison in text mode and as a background process with the profile from Listing 6. From now on and until you log out, every change in the filesystem on one of the two sides triggers a real-time comparison in the background and is logged in the logfile. Conflicts seemingly disappear, but can be detected at any time by calling unison-gtk mobile in the GUI and handled accordingly.

Conclusions

Unison v2.48.4 is a very reliable, powerful, and efficient tool for bidirectional synchronization of filesystems between computers. In combination with SSH, this comparison can also be carried out securely over the Internet with regard to authentication and data transport. Smaller synchronization runs optimize the solution for mobile or stationary operation.

Unison's GUI clearly shows the differences between the two replicas and supports the user in resolving conflicts. With the configuration shown here, databases can be kept up to date across several computers, which allows the user to freely and quickly switch between workstations.

The Author

Werner Hein has been working with Linux in his spare time since 1994 and professionally with the development of modems in mobile phones since 1997. He uses the solution shown here to synchronize his notebook and two PCs at home and at work via a central server in his home LAN.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Charly's Column

    Charly may be a traditionalist with sync-unfriendly duplicate home directories, but a little utility called Unison helps keep his data consistent . This month you’ll learn why Rsync sometimes isn’t enough.

  • Conduit and Unison

    Find out how the Conduit and Unison utilities can keep your documents and files in sync on multiple computers.

  • Shredder_9_Chess_Too..>

    Rsync lets you synchronize your data – on either a local or remote computer. You can even use Rsync with SSH to encrypt your data.

  • Unison Groupware Demo Now Available

    Unison is a groupware product first presented at Cebit 2008 that combines PBX telephony, a groupware server, instant messaging and directory services with its own Windows client. An online trial version is available for anyone interested in the product.

  • Unison as Free, Ad-Supported Version

    The commercial unified communication solution Unison is now available in a free, "sponsor-supported" version whose revenue comes from embedded advertising.

comments powered by Disqus