Mount Google Drive On Linux With Google Drive Ocamlfuse Client

Most of us had a gmail account for email communication, moreover everyone use google drive as well to store documents. Google drive is a traditional cloud storage and offering 15GB is Free of cost.

It allows user to edit documents, spreadsheets, and presentations, share any documents over internet anywhere in the world, and synchronization. This will help you to get a documents whenever you want (on demand) since we can access the drive anywhere, even we can edit the docs from mobile as well. You don’t want to carry a physical hard Drive and USB flash Drive.

Still there is no official google drive client for Linux. So today we are going to teach you about Google Drive Ocamlfuse app, it’s unofficial google drive client which allows us to sync the local files into google drive.

Suggested Read : Mount Google Drive in Linux Using Nautilus File Manager

Google Drive Ocamlfuse is a FUSE-based file system backed by Google Drive, written in OCaml. It lets you mount your Google Drive on Linux and you can access your files and folders, either via command line or GUI file manager.

Google Drive Ocamlfuse Features

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

How to Install Google Drive Ocamlfuse on Linux

As we told in the beginning of the article, there is no official client, so we need to install from third party repository.

For Ubuntu/LinuxMint users add below PPA and use apt-get command or apt command to install Google Drive Ocamlfuse.

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

For Arch Linux based systems, Google Drive Ocamlfuse is available in AUR repository, so use either Yaourt or Packer to install it.

$ yarout -S google-drive-ocamlfuse
or
$ packer -S google-drive-ocamlfuse

For Fedora users add below copr repository and use dnf command to install Google Drive Ocamlfuse.

$ sudo dnf copr enable sergiomb/google-drive-ocamlfuse
$ sudo dnf install google-drive-ocamlfuse

For CentOS/RHEL 7 users add below copr repository and use Yum command to install Google Drive Ocamlfuse. Make sure you have to install/enable EPEL repository too in order to install required dependancy packages.

$ sudo yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/sergiomb/google-drive-ocamlfuse/repo/epel-7/sergiomb-google-drive-ocamlfuse-epel-7.repo
$ sudo yum makecache

For openSUSE 42.3 users add below repository and use Zypper Command to install Google Drive Ocamlfuse.

$ zypper addrepo http://download.opensuse.org/repositories/devel:languages:ocaml/openSUSE_Leap_42.3/devel:languages:ocaml.repo
$ zypper refresh
$ zypper install google-drive-ocamlfuse

For openSUSE 42.2 users add below repository and use Zypper Command to install Google Drive Ocamlfuse.

$ zypper addrepo http://download.opensuse.org/repositories/devel:languages:ocaml/openSUSE_Leap_42.2/devel:languages:ocaml.repo
$ zypper refresh
$ zypper install google-drive-ocamlfuse

How to configure Google Drive Ocamlfuse

Once you have successfully installed Google Drive Ocamlfuse. First, you need to authorize google-drive-ocamlfuse client with your desired Google account using following command.

$ google-drive-ocamlfuse

It will open a google sign-in page in default web browser. Enter your credentials then hit Sign in button.

Hit Allow button to allow google-drive-ocamlfuse to access your Google Drive.

once again, it will ask your Password. Now, Allow gdfuse OAuth2 application to access your Google account.

Finally create a mount point called google-drive in your home directory and mount it.

$ mkdir ~/google-drive
$ google-drive-ocamlfuse ~/google-drive

You can verify the same with df command.

$ df -h

Alternatively, you can verify through file manager.

To test Auto Sync, we are going to upload below file.

The same has been verified in Web browser.

To add more than one account, use the following format. By default the configuration file is first created in ~/.gdfuse/default/config (or ~/.gdfuse/label/config if a label was specified on the command line).

$ google-drive-ocamlfuse -label label [mountpoint]

For testing purpose, we are going to mount one more account. For that create a new mount point then mount it. In my case, we have created a mount point called google-drive-1 in our home directory. Do the same above steps after running the below command to mount successfully.

$ mkdir ~/google-drive-1
$ google-drive-ocamlfuse -magi label ~/google-drive-1

Alternatively, you can verify through file manager. Both account got mounted successfully.

To unmount the Google Drive, run the following command.

$ fusermount -u ~/google-drive

To auto mount Google Drive in Linux. Create a shell script named gdfuse in /usr/bin (as root) with this content.

$ sudo vi /usr/bin/gdfuse

#!/bin/bash
su $USERNAME -l -c "google-drive-ocamlfuse -label $1 $*"
exit 0

Set executable permission.

$ sudo chmod +x /usr/bin/gdfuse

Create a mount point.

$ mkdir ~/gdrive

Assign ownership to user.

$ chown magi.magi ~/gdrive

Add the below entries to /etc/fstab file at the bottom. Make sure the uid & gid should be the above user’s. Finally save and exit.

# vi /etc/fstab

gdfuse#account2  /home/$USERNAME/gdrive2     fuse    uid=1000,gid=1000     0       0

Run the following command to mount your Google Drive.

$ mount ~/gdrive

You may also like...

  • Thanks for sharing this!
    In KDE Neon based on Ubuntu 16.04, I cannot use the ppa:

    $ add-apt-repository ppa:alessandro-strada/ppa
    Cannot add PPA: ‘ppa:~alessandro-strada/ubuntu/ppa’.
    ERROR: ‘~alessandro-strada’ user or team does not exist.

    $ cat /etc/*release*
    DISTRIB_ID=neon
    DISTRIB_RELEASE=16.04
    DISTRIB_CODENAME=xenial
    DISTRIB_DESCRIPTION=”KDE neon User Edition 5.10″
    NAME=”KDE neon”
    VERSION=”5.10″
    ID=neon
    ID_LIKE=”ubuntu debian”
    PRETTY_NAME=”KDE neon User Edition 5.10″
    VERSION_ID=”16.04″
    HOME_URL=”http://neon.kde.org/”
    SUPPORT_URL=”http://neon.kde.org/”
    BUG_REPORT_URL=”http://bugs.kde.org/”
    VERSION_CODENAME=xenial
    UBUNTU_CODENAME=xenial

    Any idea please?

  • Chris Shaw

    What is the point when Google Drive is being discontinued at the end of the current year.

    Do you have any information on the alternative and if there is a linux version, I would rather not resort to drop box.

    • Wilma Fingerdo

      Its not going anywhere, its just the Google Drive Sync plugin is being renamed and redone….

Close
Please support the site
By clicking any of these buttons you help our site to get better