google drive ocamlfuse
There are many ways to use Google Drive on Linux

We’ve written before how easy it is to access Google Drive on Ubuntu (or any GNOME-toting Linux) thanks to GNOME Online Accounts and Nautilus.

But power users of Google’s cloud storage service say they’re less than impressed with the performance of that go-to gvfs (Gnome Virtual File System) approach.

So here’s an alternative way to use Google Drive on Linux using google-drive-ocamlfuse.

This method has all the same benefits of the GOA approach, but is (in my testing, at least) more performant meaning the reward more than outweighs the initial outlay of effort.

Google Drive Ocamlfuse

Google-drive-ocamlfus is a FUSE-based file system powered by Google Drive. It lets you mount your Google Drive on Linux so that you can access your files and folders, either via the command line or through a traditional GUI file manager, like Nautilus, Nemo or Caja.

Google Drive Ocamlfuse on Ubuntu 16.04 nautilus

You can interact with these files directly. Open them. Edit them. Delete them.

Double-clicking on, for example, an image will open it in the default image viewer:

Nemo file manager and google drive

Video files can be streamed directly from Google Drive (you don’t need to download them first); and most other files will open in their logical apps.

Features include:

  • Full read/write access to ordinary files and folders
  • Read-only access to Google Docs, Sheets, and Slides
  • Multiple account support
  • Duplicate file handling
  • Access to trash (.Trash directory)
  • Unix permissions and ownership
  • Symbolic links
  • Read-ahead buffers when streaming

A Note on What This Isn’t

This method is not an alternative to a native Google Drive sync client like InSync or OverGrive, which creates and local copies of your files for offline access.

With thus FUSE method all your Google Drive files remain remote. If your internet connection dips out, so does access to files you haven’t made local copies of.

But what it does allow you to open most files in local apps and write changes to the file direct to Google Drive. Think of it this as a remote USB thumb drive: you can copy, edit, write and open files while it’s attached.

Install Google Drive Ocamlfuse

Google Drive Ocamlfuse is available to install on Ubuntu 16.04 LTS and up by using the following dedicated PPA:

sudo add-apt-repository ppa:alessandro-strada/ppa
sudo apt update && sudo apt install google-drive-ocamlfuse

Arch Linux users can install google-drive-ocamlfuse from AUR.

How to use Google Drive Ocamlfuse

With the install complete you can go ahead and set up the app to work with your Google Drive account. While there isn’t a fancy-pants GUI front-end for setting things up don’t feel put. GDO is super simple to use via the CLI.

To get started run the app from the command line using this command:

google-drive-ocamlfuse

The first time you do this the utility will create all the relevant config files and folders it needs to mount your Google Drive account. It will also launch your default web browser so that you sign in and authorize access to your Google Drive files.

Sign in with your Google username and password and, when the screen above appears, grant the utility permission to access your files and folders.

That’s it; you’re pretty much good to go!

All that’s left is to create an empty folder in which to mount Google Drive on your system.

mkdir ~/googledrive

Once created go ahead and mount it there by running this command:

google-drive-ocamlfuse ~/googledrive

Pop open Nautilus (or whichever modern file manager you use) and you will see your Google Drive mount listed in the sidebar as a device.

When you’re finished editing, adding or copying files you can unmount the fuse filesystem with this command:

fusermount -u ~/google-drive

You can try to unmount it using the eject button you’ll see in Nautilus, Nemo, etc but this won’t work; you’ll get a permissions error.

More Options & Configuration

See the official wiki for more details on installation, authorisation, and advanced usage. You can also run google-drive-ocamlfuse --help from the command line to see the various arguments and flags you can use.

Thanks Karl K.