From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 20:58, 23 February 2008 by Ramuk (Talk | contribs)

Jump to: navigation, search


This document describes how to install and run the Unison file synchronisation software on Linkstation LS2(MIPS) with OpenLink firmware or using apt-get with FreeLink firmware

From the Unison website: Unison is a file-synchronization tool for Unix and Windows (and now the Linkstation ;-). 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.

It offers bi-directional sync unlike the mirroring capability of tools like rsync. All in all it's a great tool for linkstation users!


There are a number of ways to use Unison but the way described here (and recommended on unison website) is to run the unison application as a server on the linkstation. Data is then transferred using the client application over SSH.

Installation Instructions



You will need:

  • Linkstation LS2(MIPS)
  • MIPSel development tools
  • Openlink 0.52 firmware
  • OCAML compiler source (I used 3.10.1)
  • Unison binaries (I used 2.27.57)

Install Openlink

This is the first step as documented elsewhere on this site. You need to enable dropbear access for SSH.

Install development tools

Again, this is documented elsewhere. It provides the critical binaries such as gcc and make for the linkstation.

Unpack and build the OCAML compiler

Unison is written in OCAML. To build unison you must first compile the OCAML toolchain. Latest source code is available as a tar from here: http://caml.inria.fr/

  • Copy tar to a temp directory on linkstation hda (main file storage area)
  • Unpack the tar
  • Get root access to linkstation through SSH or telnet. Type "./configure -prefix"
  • Type "make world" - this makes the byte code compiler. It might be possible to install the full native compiler but I didn't get this working
  • Type "make install"
  • Type "make clean" - this cleans up all the rubbish made during install
  • Should all be installed now! Type "ocaml -version" to check everything has built. "The Objective Caml toplevel, version 3.10.1" should appear.

Make the Unison tool

  • Grab the Unison source code from http://www.cis.upenn.edu/~bcpierce/unison
  • It's important to use the same version on client and server. I run ubuntu which has Unison 2.13.16 available in the package manager. However I couldn't get this version running on linkstation. I eventually installed version 2.27.57 on the linkstation and my ubuntu PC.
  • Unpack the tar into a temp directory on the linkstation.
  • Again using SSH or telnet, get shell access to linkstation and type "make UISTYLE=text NATIVE=false". This builds the text version (rather than GTK) and uses the OCAML bytecode compiler rather than the native compiler.
  • There will be a warning at the end of the build about "etags" (?) I think this can be safely ignored.
  • Copy the "unison" executable into the "/usr/bin" directory on the linkstation
  • To test the build now type "unison - version." It should respond with "unison version 2.27.57"
  • Great! The real hard work is over.


Use apt-get to install unison

apt-get install unison

Testing Unison

  • You should now install the Unison tool to your PC if you haven't done so already. Windows, Mac and various Linux binaries are available - just make sure you use the same version as on the linkstation or it won't work.
  • From your PC, you're now going to test the communication with the linkstation. Make a directory a.tmp and populate it with a couple of small files. Create a new empty directory on the linkstation. We'll use unison to copy the new files to it!
  • Open up a terminal window and type "unison -testserver /mnt/local/tmp.a ssh://root@". The "-testserver" option means nothing is copied, it's just a test. "/mnt/local/tmp.a" is the absolute path to my new local directory. "ssh://root@" describes the directory on the linkstation. Replace with your linkstation name/IP as appropriate.
  • If this is successful it should respond with ... Try this command again but remove the -testserver switch. The files should be synced to the linkstation.

Next Steps

I've only just got this working myself but it seems pretty good. There are command line options to automate the sync, so I'm thinking of setting up a regular cron on my ubuntu PC to sync my local data with linkstation as a backup. As I tend to work directly with the files on the linkstation when I'm using my laptop a one-way sync isn't much good but I think unison could be.

Another potentially great use would be to have two linkstations running unison. They could automatically sync to each other. Because it uses SSH these two devices could be in separate locations and communicate over the internet.