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.
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.
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.
Infos
- Unison: https://www.cis.upenn.edu/~bcpierce/unison/
- OpenSSH: https://www.openssh.com
- Unison 2.48.4 (source code): https://github.com/bcpierce00/unison/archive/2.48.4.tar.gz
- Profiles: https://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#profile
- Path specification: https://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#pathspec
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.