Enjoy exclusive 10% discount for blog readers at BuyLinuxCDs.co.uk with coupon code
christmas2016

 

30 Jun 2015

Jdrivesync: your Google Drive synchronisation client for Linux

Google Drive is an instrument that is used by many. Of course, there are many alternatives to it like Dropbox or Yandex.Drive, but nevertheless many prefer a Google-backed solution. One of the reasons for me was an ability to have several services under one "roof", one account.

Google released clients for its Drive for many platforms: Windows, MacOS, Android, iOS and so on. Unfortunately, an official Linux client is still a missing part of the puzzle. That is why developers worked to create unofficial clients for Google Drive.

Grive was a solution for many. It worked on Ubuntu, Debian and so on... It was distributed in source code only, so you had to compile it for your own OS. Unfortunately, things changed in April 2015. Grive no longer works. The reasons behind this issue are given here.

Is there an alternative to Grive? Yes, there are several options:
  1. Insync. This is a paid option. I leave it for those who interested.
  2. Ocamlfuse. It is a heavy-weight solution. I tried it in the past, and was not 100% happy about it.
  3. Jdrivesync. This is the free option I've never tried before.
Let's explore it!


I must warn you that Jdrivesync is in Beta status now (June 2015), so be careful with your data!

Installation

Installation of Jdrivesync is very simple. All you need to do is to download the Java package from the Github page of developer and place it in the directory you're going to run the program from. It is written on Java, which means it is cross-platform and will work on any Linux distribution. Jdrivesync is distributed as a JAR package with a version number in the filename. In my case it is jdrivesync-0.2.1-jar-with-dependencies.jar.

Once downloaded, you need to check that the program actually works. Run a command

java -jar jdrivesync-0.2.1-jar-with-dependencies.jar

If you are lucky, you get an output with a program help page: list of available options and switches.

If you are not lucky, you may get an error that reads something like

Exception in thread "main" ...
Unsupported major.minor version 52.0...

Issue with a Java version

If you see that Exception error, it is very likely your Java version is not high enough. Jdrivesync requires Java Runtime Environment (JRE) 1.8 or higher. Check this by running a command

java -version

If the result is

java version "1.8..."

then you're OK. If not, you will need to install Java 8.

  • Debian 7 Wheezy comes with Java 6, which you can update to Java 7 via an official repository.
  • Ubuntu 14.04 gives you Java 7 by default.

In both cases you need to update your Java version.

  • Instructions for Debian are given here.
  • Instructions for Ubuntu are given here

For other distributions, please check with your default Java installer or community.

It may take some time to download and install Java 8, since the package is about 160Mb in size.

Once installation is over, check your version once again.

java -version

Using Jdrivesync

Now run the command

java -jar jdrivesync-0.2.1-jar-with-dependencies.jar -d -u -l "/local/directory/for/sync"

During the first run, Jdrivesync will prompt you to follow the link and get an authorisation code. Consecutive runs will simply synchronize your local folder with Google Drive account.

Parameters of Jdrivesync run

There are several parameters that I used in the sample above. Let's explain them.

-l "/local/directory/for/sync" specifies the local folder that should be used for data synchronisation. Please note that path should be given within a pair of quotation marks.

-u tells program to upload the changed files to the remote cloud server.

-d tells program to download the changed files from the remote cloud server.

Please bear in mind that order of the parameters should be "-d -u". Otherwise, system will do the opposite: delete new files on the remote cloud server, if there are no analogues on the local computer, and also delete new local files if there are no analogues on the remote cloud server.

And finally, you can add an option "--html-report" that will create a local file with a list of files and their status during the synchronization.

More parameters are listed in the program help section that you can get by running it with -h parameter or without any parameters at all.

Unfortunately, Jdrivesync does not have an option to monitor file changes on-the-fly. You will need to schedule synchronization yourself, for example with cron or Gnome Schedule programs. For me, I included this in the daily run of my backup routine.

Running Jdrivesync on several machines

I have several machines where I store copies of my cloud data. One of them is in active use. Another is a backup copy.

Unfortunately, there is an issue if you want to use Jdrivesync in this configuration. It works well in the one-system environment. However, the 2nd machine will not understand changes to the cloud storage if you use "-d -u" options there.

The workaround is to schedule not one, but two separate runs of Jdrivesync. One of them goes with "-d" and another with "-u" option. That isn't ideal, but still works.

I tried to find a contact of Jdrivesync's author to discuss this issue with him, but I could not find it. Maybe that is something in the plan for the future release?

Do you use Jdrivesync? Maybe you have other options for Google Drive synchronization?

8 comments:

  1. ...or grive2:

    https://github.com/vitalif/grive2

    ReplyDelete
  2. Thanks for sharing, testing this solution and great that it works on java so works on linux and windows clients. Any feedback on grive2 in comparison?

    ReplyDelete
  3. Thank you for writing about jdrivesync.

    Did you know that you can open the HTML report while the tool is running as some kind of real time monitoring?

    Please also note that jdrivesync does only synchronize in one direction. Here ito behaves by purpose differently to grive. Maybe I will add one day synchronization for both directions at the same time.

    Btw: You can request new features using the issue functionality on the GitHub page.

    Best Regards
    M. Mois

    ReplyDelete
    Replies
    1. I was happy to review your software, Martin. I wish you all the best in the future.

      Delete
  4. ****WARNING****
    This began deleting all my google drive files until I stopped it, even when run as advised. Was able to restore from trash but still not good. This article is inaccurate and you will delete stuff if you follow it.

    ReplyDelete
    Replies
    1. It works for me. I use two runs of the jdrivesync: first with -d, second with -u options.

      Delete