Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to switch between working on a laptop with a debian vm and a desktop pc running debian while carrying all my work files in a usb. Is there a robust way to automatically start caching the content of the usb (for fast access and search) on the computer I'm using? Both computers have ssds and the extra storage space this (presumably) would require is not a concern, what I want is the speed of ssds and the portability of a usbs without any significant risk of destroying all my files.

share|improve this question
up vote 2 down vote accepted

Depending on the kind of files you are working with, you could use a git repository on the stick.

Just push your work to the stick, move it to the other box and pull all the changes. - Version control and Backup included. :)

share|improve this answer
... or any other DVCS. :) – peterph Apr 8 '13 at 12:36

You can use Unison. From the home page:

Unison is a file-synchronization tool for Unix 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.

Each of the three data storages (laptop disk, desktop disk and USB stick) can be used independently. Before and after use, the USB drive has to be synced. This can be done using the command line tool or one of the available GUIs.

Either you kick off the syncronisation step manually when you mount/unmount the USB disk or you can write an udev rule which does this automatically. On the laptop you sync to a VM shared directory, this allows easy access. Or you can pass the USB stick straight to the guest and sync from within the Debian system.

share|improve this answer

Another option is rsync. But it doesn't really do caching - the data is guaranteed to be identical only when the program finishes (and I do have doubts about the other solutions in this regard - Unison seems to need syncing as well).

You might want to update the question to reflect whether you want caching in the sense, that once you access files in local copy, they are automatically updated before their contents is made available into user-space.

You might be interested in How to auto-sync with a plugged-in USB mass storage device?.

share|improve this answer
thanks for your answer, what you describe in the second paragraph would be nice, do you know of anything that does that? – user36719 Apr 8 '13 at 15:03
No, and I'm actually not sure whether something like that can actually be implemented fully in userspace. You may try to search for something inotify-based, though. – peterph Apr 8 '13 at 15:58

Another options is git-annex. It's designed to do this exact thing, but I've found it clumsy atm from the command line and the webapp. I continue to watch it as it improves.

Git-annex uses git for managing metadata about files and then can use whatever backend you want to avoid storing the actual files in the git repo (which doesn't scale well with file size.)

Checkout these pages:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.