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.
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:
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.
- 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
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 16.10 using the following dedicated PPA:
sudo add-apt-repository ppa:alessandro-strada/ppa
sudo apt update && sudo apt install google-drive-ocamlfuse
At the time of writing this the PPA is yet to add support for Ubuntu 17.04.
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:
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.
Once created go ahead and mount it there by running this command:
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.