I have (at the moment) three mobile USB mass storage devices (flash drive, phone, e-reader). I'd like to always have the latest versions of all my files with me (such as CV, passport, research papers, source code, etc.)

My files change often, so manually copying them every day is not feasible. Ideally, I'd like to plug in my flash drive (for example), have my PC automatically recognize it, mount it, sync it and unmount it.

And the following features 'would be nice':

  • GUI
  • Notification through Xorg/KDE/Gnome when syncing starts / stops.
  • And, why not: two way syncing. But that's not a priority.

I've found some questions that are related to this one:

But none of them answer my question completely. I suppose I could hack something together myself using udev, rsync, etc., given enough time. But I'd hate to reinvent the wheel. And time is something I don't have to spare right now. Ideally I'd like to use an existing solution, but I can't find one.

So, what would be the quickest way to set something like this up?

  • I think with udev you're on the right track. But I would suggest to replace rsync with unison. It's designed for a two-way sync in contrast to rsync.
    – Marco
    Mar 3, 2013 at 23:02
  • 2
    I hacked together just what you're looking for with udev and rsync.
    – Maros
    Jun 8, 2013 at 16:58
  • Cool! Nicely written.
    – mhelvens
    Jun 9, 2013 at 11:20
  • 1
    link broken, now at mhluska.com/blog/2013/05/26/… Apr 13, 2015 at 8:35

2 Answers 2


You can go the udev/rsync route but you will need to do some scripting. Check out inotify-tools in any case, these are very useful for sending filesystem change notifications to applications.

I know of three GUI (quick to set up) tools for synchronizing local filesystems.

  1. Unison is mature and well-documented. Monitoring methods are slightly outdated but it could be automated by inotify (still requires some scripting).

  2. DirSync Pro doesn't sound like free software, but it is.

  3. FreeFileSync is recently released but looks promising. It has an option to save directory comparisons as a batch and trigger synchronization on events, such as mounting an external drive.

  • I've quickly checked out your links, and they look promising! It's a very busy week for me, but I'll have a closer look and get back to you asap.
    – mhelvens
    Mar 4, 2013 at 12:24
  • I've just installed dirsync and found that it is a good solution sourceforge.net/projects/directorysync/?source=dlp
    – Yurij73
    May 4, 2013 at 8:01
  • Don't use Unison unless you are fine with losing your data [#262]. May 26, 2019 at 15:07

In addition to good @dartonw 's answer if you like to use bash script to do simlpe two-way syncro you can use rsync this way

#do check if usb flash is mounted
if test -e '/your_path_to_usb_mountpoint';then 
#from folder to usb if the files are newers
rsync -avun --inplace  /your_folder_wich_you_want_to_syncronize/ /your_path_to_usb_mountpoint ;
#from usb to folder if the files are newers
rsync -avun --inplace /your_path_to_usb_mountpoint/ /your_folder_wich_you_want_to_syncronize/ 
#if the flash is not mounted exit with exitcode=1 
exit $exitcode
  • The -n option to rsync makes this a dry-run. Remove the -n (-avu) once you feel you've got the paths right and are ready to deploy.
    – Daniel
    May 16, 2015 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.