How to Sync Files on a Flash Drive

April 18th, 2008 by steve

For several years I have been keeping my current files on an SD card synchronized with files on two different computers. Early on I tried to keep track of what I’d changed and copy the files using Windows Explorer. Wow — that got old, not to mention confusing, in a hurry.

I began to look for an application that would let me sync a folder without giving it a lot of thought. Initially I used something called Allway Sync, as it was presented as a free file sync via USB. Well, the free version only permitted you to do a few syncs each week. I did many syncs each week — sometimes several each day, so either I had to pay for the application or find something else.

That is when I found Unison, “a file-synchronization tool for UnisonUnix 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.” (from The Unison Page)

Getting Organized

As you think about what files you are planning to sync, you need to arrive at a balance between syncing all the files on your PC and the important files on your PC. If your flash drive was big enough, you could do your entire Documents folder. But why bother? I decided to create a folder inside of Documents that I call Current and keep files and folders in it that I use regularly. My Current folder is about 400 MB in size.

As you prepare to install Unison, now it the time to backup your data. If you’ve created a Current folder, as I mentioned in the previous paragraph, back it up. We will use the Current folder in this scenario.

Getting Unison

You can go to the download page and download the binaries that suit you best. I use the Windows binaries (since I use Vista) found here. You’ll almost certainly have to download the GTK+ 2 runtime libraries, unless you are using other software that has already installed them. You can find links to them on the page with the Windows binaries.

Installing

Install Unison by unzipping the package and running the executable. Then run Unison. If you get errors, you’ll need to install the GTK+ 2 libraries.

Running Unison

As you run Unison, it takes you to the opening screen. Here you can establish your default sync profile. Choosing default prompts you for your local directory. In this field I enter the location of my Current folder:
C:\Users\user name\Documents\Docs\current

Clicking OK takes you to the secondary location. In that field I enter my Flash Drive folder:
E:\current
When these folders have been selected, Unison remembers them and choosing the profile you’ve created syncs the previously selected directory.

Click through and read the warning. It should warn you that this may take some time. Let it. If it warns you that one of the folders will be deleted, abort the process. Something is wrong.

When Unison has compared the folders, it will show you what it is about to do with arrows, pointing to the file that is going to be replaced. You will want to look at these closely and ensure Unison is doing what you want it to do. On the rare occasion that it is not replacing the correct file, clicking the arrow changes what Unison will do.

When the sync is complete, you can take your USB Flash Drive to your second computer, install Unison, and sync there as well.

Troubleshooting

I’ve had three problems with Unison. One relates to the GTK+ 2 libraries. They have to be in a place where Unison can find them. Make sure they have been installed properly.

Second, sometimes I create a sync I didn’t want. To manage your sync profiles in Vista, you need to go here:
C:\Users\user name\.unison
and either delete the problem profile or edit it with Notepad.

Third, on very rare occasions, Unison gets it wrong. It wants to replace a newer file with an older one. I know this is probably not Unison’s fault, but mine. Chances are I have updated the file in both locations and it does what it thinks is best. Frequently Unison will give me a “?” when that happens and let me choose. But on rare occasions, I’ve lost data by improper syncing.

Finally

Unison is free, but there is a place to donate via PayPal. If you find it useful, I encourage you to donate.

Good luck!

As always — this information is provided as-is and without warranty, express or implied. Any damage that comes to your computer, your data, your job or even your life as a result of using this information is your responsibility. This worked on the computer I was using, but it may or may not work on yours.

Tags: ,


4 Responses to “How to Sync Files on a Flash Drive”

  1. alacy Says:

    I hadn’t heard of Unison, after talking to Steve and following the links Steve left it seems like a useful tool. At work we use rsync, but while it has “sync” in the name, it really is a smart mirror tool. You tell it what computer/directory is the main copy and what server directory you want the mirror copy. It will make the mirror identical to the main version. Its main feature over other mirror tools is when it needs to update a file on the copy it only copies the parts of the file that are different. At work we have multiple servers handling our website. To update the website we update what we call a staging server. The staging server can not be accessed from the big bad internet. Then a scheduled job runs rsync every 15 minutes. It then updates the production servers one after another. It also has the benefits that if some hacker defaced one or more of our production servers, the job would come along and fix it. I wouldn’t want a real sync tool like Unison to run as it would pull the changes the hacker made and update our staging server and then update all the production servers.

    But for person taking files from computer to computer and working on them Unison seem like a useful tool. What is interesting to me is while Unison will update either side to have the latest version, it uses the same method as rsync. That is it only sends the differences to make the older copy match.

  2. tom Says:

    Under troubleshooting you mentioned placing the GTK+2 files where Unison can be found. When I tried to install I had that same problem, after some searching I found this site with the following information that solved the problem

    http://alliance.seas.upenn.edu/~bcpierce/wiki/index.php?n=Main.UnisonFAQOSSpecific

    “How do I install under windows? I install GTK and try to run unison and I get “This application has failed to start because libgtk-win32-2.0-0.dll was not found. Re-installing the application may fix this problem.”
    The answer is to include the gtk bin directory in your path. You can do this temporarily in the command-line by typing this:

    set path=;c:\program files\common files\gtk\2.0\bin

    or you can do it permanently by right-clicking on your “my computer” and clicking on properties, going to the “environment variables” button, choosing “path” and adding “;c:\program files\common files\gtk\2.0\bin” (no quotes) to the end of that value.”

  3. steve Says:

    Thanks, Tom — that’s good info.

  4. steve Says:

    I finally dumped Unison. It was very slow as my data increased. I now use FreeFileSync.

    http://freefilesync.sourceforge.net/index.php