Skip to main content

Google Drive Backup & Sync: Grive

The project is to build a Linux Mint machine to have the identical functionality and ergonomics as the existing Windows 10 machine.

This stage relates to Google Drive.

Environment & required functionality

Google Drive serves as a virtual server for three laptops (!):

  • The Linux Mint Xfce laptop Gandalf;
  • The Windows 10 laptop Legolas;
  • Another Windows 10 machine, name withheld to protect the guilty.

So, in effect, Google Drive is a common fulcrum to a three-way sync of data.

LibreOffice open remote: a cheeky alternative?

In the early stages of initially configuring Gandalf, the inevitable poke around Xfce’s pre-installed software revealed LibreOffice.  Excel is my favourite application of all time, so LibreOffice Calc was (and still is) intriguing.  Loving the promise of power-useability based upon its Excel 2003-style menus.  (Real words instead of insane icons!)

Unfortunately, “File > Open Remote…” turned out to be a false promise.  With a Gmail account locked down with two-factor authentication, Calc was unable to operate Google correctly.  Calc asked for username and password, then realised it needed the two-factor code.  User types it in, Calc error, “The specified device is invalid”.  Smells like the error is a false error (it doesn’t mean what it says).

Turns out that this is long-running issue with LibreOffice, happening in v5.1.6.2, v5.2 and v6.0.3.2. The developers seem to be struggling, even after an indirect reference to answer on 30Mar2018

So what could have been a webdav-like alternative to the Chrome Extension AwesomeDocs for MS Office failed.

The strategy thus had to revert to the existing method of Google Backup & Sync (“GB&S”): copy up, copy down, keep a local cache.

Software selection

A Google search found a well worn path, https://www.fossmint.com/best-google-drive-clients-for-linux/.

Google does not manufacture a Linux equivalent of GB&S.  Not sure why, but it might be down to Google staff using one of two alternatives:



Tossing a coin resulted in Grive2 being the lucky winner for testing.

Installation experience

Followed the installation instructions https://www.fossmint.com/grive2-google-drive-client-for-linux/ using the terminal.  Installed first time. Dead easy.

$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install grive

Grive2 v0.5.1.1 successfully installed.

User experience

Not so straightforward.

Stupid user

Upon first running on 03Apr2018, grive2 synchronises the whole Google Drive account to which it is just connected.

Oops.

I was expecting some initial script to limit the scope of the initial sync.  Apparently not.  And I had done no archiving on my data store.  So that was 5Gb to sync overnight.

Otherwise, the sync was flawless.

On its second session the next day, I screwed up.  When I ran grive, I ended up with authentication errors.  I attempted to re-authenticate, but to no avail.  I then decided to uninstall grive2 and delete the synchronised data.

I ran the re-installation from scratch, then realised my error.  I had forgotten to cd ~/grive before running grive.  Problem solved.  Ah, but still no archiving.  So another 5Gb needed to sync overnight.

On 07Apr2018, I archived tonnes of old data on Legolas, deletions of which GB&S duly synchronised.  This wasn’t a smooth process.  A lot of manual review of files was needed and some needed re-naming.  I didn’t realise what this meant for Google Drive.  In effect, this is a delete-and-re-sync request.  It was to freak me out later.

On 08Apr2018, back on Gandalf, I ran grive and duly freaked out.  Grive is verbose: it lists on-screen what it is doing with which files.  GB&S is silent, it does everything behind the scenes.  According to the screen, Grive was downloading data that I had just archived.  This was going to be a waste of time!  So I interrupted the process, ensured that Google Drive Cloud had genuinely deleted the unnecessary data, then started Grive again.  Grive then synchronised the deletion as expected.

Later that day, I created test files just to Grive them.  Another error.  This time, the esoteric error suggested a limit on the number of transactions within either Google Drive or Grive.  https://github.com/vitalif/grive2/issues/145  The solution was to wait, try again, two or three times.

One corrupted transaction

One file - a password vault - failed to sync via Grive, although it continued to sync normally between the two Windows machines.

GB&S isn’t necessarily the most reliable tool in the box.

The solution was:

  • to copy - not move - the file on Legolas to a location outside the scope of GB&S, then delete the file inside the scope of GB&S, then sync.  On Gandalf, grive repeatedly until grive had run out of differences/transactions to process.
  • On Legolas, to copy the file back from extra-GB&S to intra-GB&S, sync.  On Gandalf, grive.


The file was tested repeatedly over the next few days, with involvement from the other Windows 10 machine, and grive was found to work correctly.

Conclusion

Grive2 does what Google Backup & Sync does, albeit without a GUI.  There are GUI alternatives to consider in the future.

Therefore, the project is on track to build a Linux Mint machine functionally identical to a Windows 10 machine.

The main lessons:

  • reduce (archive) the data prior to using grive for the first time;
  • remember cd ~/grive.

Epilogue

On 09Apr2018, I found GUI versions:


For now, no change.  Grive2 works well enough. Time for the project to move on.

Update 29Apr2018: Linux Mint 18.3 with Cinnamon 3.6 comes pre-installed with GNOME online accounts, which apparently means that Cinnamon's Nemo File Manager can access Google Drive directly (source).

Update 19Jul2018: grive2 has a few limitations, one of which is that it cannot handle symbolic links.  So when a Google Drive object is present in more than one Google Drive folder, grive2 cannot see it, so removed the copy on the local machine.  It is thus time to test Google-drive-ocamlfuse.

Comments

Popular posts from this blog

Scanning & OCRring to PDF: Simple Scan, gimagereader and gscan2pdf v NAPS2 for Windows

The project is to build a Linux Mint machine to have the identical functionality and ergonomics as the existing Windows 10 machine. This stage relates to scanning paper documents to PDF and digitising the scanned text via optical character recognition. Environment & required functionality The scan-and-OCR function needs to run on the following machines: The Linux Mint Xfce 18.3 laptop " Gandalf "; A Linux Mint Xfce 18.3 virtual machine " Gimli "; The Windows 10 laptop " Legolas ". In any modern office - whether at home or at work - some transactional documents and documents from public authorities still arrive by snail-mail. This requires the ability to scan all documents, optionally with the digitisation of scanned text (typically via optical character recognition). The hardware is an old HP OfficeJet Pro 276dw, connected to the LAN instead of directly to a workstation. Alternatives There are two strategies: To use the software pr

An attempt at full-disk encryption: Vera Crypt

The project is to build a Linux Mint machine to have the identical functionality and ergonomics as the existing Windows 10 machine. This stage relates to testing full-disk encryption using VeraCrypt . Environment & required functionality Full-disk encryption needs to run on the following machines: The Linux Mint Xfce 18.3 laptop " Gandalf "; The Windows 10 laptop " Legolas ". The objective requirement is to protect user data from the physical theft of the physical machine, to provide an additional line of defence against data loss. This is probably more important for Windows than for Linux Mint.   Even so, in both cases, the operating system is likely to log activity which can reveal personal data and user (meta)data. Full-disk encryption does not mitigate against Microsoft’s sinister telemetry functionality, for which the main solutions seem to be: Either to use tools whose developers are constantly on the prowl, hunting for t

The Big Bang: Microsoft Windows goes for good, positive adaptations required

On 27Mar2021, Linux Mint ate Microsoft Windows 10 on Legolas. Three months on, I conclude beyond any doubt that wiping out Windows was the best decision I ever made. The second best decision I ever made was to test Linux Mint in Virtual Box five years ago. The third best decision I ever made was to take ownership of the learning curve that migrating in Windows really entails. A quick reminder: what’s Microsoft Windows like nowadays? I still need to use Windows at work. I cannot easily describe how painful it now is to use Windows. So I’ll try to describe it difficultly. My work machine is a powerful beast, but it exhibits constant latency. For a keyboard-orientated power user, this means that some keystrokes go walkabouts when other services on the Windows machine go to nuclear war with each other, scrambling to feed their narcissistic self-importance for besieged system resources wholly at the user’s expense. Something on Windows tends to clear the keyboard buffer randomly, resulting