Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


HPR1643: Unison Syncing Utility

Hosted by FiftyOneFifty (R.I.P.) on 2014-11-19 00:00:00
Download or Listen

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



More Information...


Copyright Information

Unless otherwise stated, our shows are released under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.

The HPR Website Design is released to the Public Domain.