3

I was wondering whether there's a mechanism to sync two external hard drives, so that the files are updated both ways (and they end up containing the exact same information).

Ideally it could run when once both hard drives are connected.

  • You want to sync files between external hard drives? Sure, we can do that! – Tim Dec 3 '14 at 13:12
  • Yes! I mentioned this in another comment, but can I make it happen automatically once both are connected? – GuyfromAmsterdam Dec 3 '14 at 13:15
  • To run a (any) command if a usb device (or a combination of two) get(s) connected, you can use this askubuntu.com/a/554413/72216, if necessary in an altered version (see further below in the post). You need however to be a bit more specific on your definition on synchronization; what if a file gets deleted on one of the disks when not connected? version conflicts e.g? – Jacob Vlijm Dec 3 '14 at 13:55
  • have you looked into deja dup? i haven't used it but it's installed by default and you can specify to backup to external media or cloud based service. The backups can be set to automatic or in your case you'd probably want to set them to run manually run launchpad.net/deja-dup – mchid Dec 3 '14 at 14:05
3

I would advise Unison (unison-gtk Install unison-gtk)

This is a graphical sync program, and can be installed via the Software Centre, but the easiest way to install is via the terminal:

sudo apt-get install unison unison-gtk

Then it will be in the dash, search for unison. You can create profiles and such like to sync locally between USBs and remotely via SSH.

The best thing is the GUI, it is easy to use because you can see exactly what you want - no messing around with the command line with rsync.

If you want it auto, you do need to use the command line - cron. Have a look here for how to use it and below is an example:

30 17 * * * unison PROFILENAME

That will run at 5:30pm every day. Make sure the profile that you create is 1 word only, and that you remember it.

0

You can do it easily with rsync (for synchronizing) and cron (for scheduling regular calls of rsync).

To just synchronize:

 rsync -rtvu --delete source_folder/ destination_folder/ 

To schedule cron:

sudo crontab -e

# For example, you can run a sync
# at 5 a.m every week with:
0 5 * * 1 rsync -rtvu --delete source_folder/ destination_folder/ 

These commands are really fundamental and usual in Linux; you can learn much more about them by searching the web.

Edit: sorry, rsync command works one way only.

  • Can I make it so that it runs automatically once I plug both hard drives in? – GuyfromAmsterdam Dec 3 '14 at 13:14
  • Could you provide some commands to make it easy? – Tim Dec 3 '14 at 13:16
  • @GuyfromAmsterdam, I don't know how to run on mount; maybe answers to this question can help askubuntu.com/questions/25071/…. – Valentas Dec 3 '14 at 13:27
-1

maybe for beginners conduit would be interesting and very easy to handle with it's GUI... but it isn't developed anymore (like Unison)!

  • Conduit is an application synchronizer, not a File System or hardware synchronizer... – Fabby Dec 4 '14 at 2:16
  • test conduit or even look at it carefully! it can also synchronize folders or single files locally, to external hardware or to network-shares! ...also to some online-storage-services! – DJCrashdummy Dec 4 '14 at 8:06

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.