How to Mount Google Drive in Linux Using “Google Drive OCamlfuse” Client

10. Now create a mount point say google-drive in your home directory and mount as:

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

You may check the mount point and disk space usages of your mounted Google Drive using df command as shown below.

Mount Google Drive in Linux
Mount Google Drive in Linux

If you have more than one account, you can run use following command.

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

The label options is used to distinguish different accounts under directory ~/.gdfuse/label to host configuration, application state, and file cache.

Do remember no files are shared among different accounts, so that you can have a different configuration for each Google account.

11. To unmount the Google Drive, you have to run:

$ fusermount -u ~/google-drive

For more options and help, run google-drive-ocamlfuse -help command to get all the available commands and switches.

Mount Google Drive Automatically in Linux

You may mount more than one drive at a time and also mount Google drive automatically at boot.

12. create a shell script gdfuse in the directory /usr/bin as root, with the below content.

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

13. Make it executable.

# chmod 755 /usr/bin/gdfuse

14. Create mountpoint say /mnt/gdrive and give ownership to user ‘avi‘.

# mkdir /mnt/gdrive
# chown avi.avi /mnt/gdrive

15. Next, open and edit file /etc/fstab and add below line at the bottom. Save and exit.

gdfuse#default	 /mnt/gdrive 	fuse 	uid=1000,gid=1000 	0 	0

Take extra care of ‘uid‘ and ‘gid‘. Change it as user’s uid and gid.

16. To mount the google drive now, run:

# mount /mnt/gdrive

For more information about how to include and use multiple Google accounts, see the google-drive-ocamlfuse wiki.

That’s all for now. Installing from source is not a big deal as well and it is pretty straight forward, as tested on Debian. What you think about the project and its setup. Also there is no answer from Google on official Drive client even after 3 years, so what do you think. Is Google Drive Ocamlfuse a life savior? Please let us know your valuable thought in the comments below.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Avishek
A Passionate GNU/Linux Enthusiast and Software Developer with over a decade in the field of Linux and Open Source technologies.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

35 Comments

Leave a Reply
  1. I guess this article is pretty old now, but I tried it today and, after installing lots of additional packages on my Debian machine, I got it working. As noted, it’s pretty slow. Also, $USERNAME didn’t seem to exist but maybe this is just shorthand for inserting the real username of the google drive being mounted?

    Reply
  2. Does anyone know how this method compares to eg grive/grive2? The latter methods, I’ve had bad experiences with, so I’ll try this new method now, thanks a lot for the article…

    Reply
  3. Is it possible to edit this to use lynx instead of “xdg-open”, “firefox” or “google-chrome”. Been following this to install on one of my headless servers which has no gui and therefore no graphical browser.

    Reply
  4. Hi,

    I have had to change:
    gdfuse#default /mnt/gdrive fuse uid=1000,gid=1000 0 0
    to:
    gdfuse#default /mnt/google_drive fuse uid=1000,gid=1000,user 0 0

    Reply
    • @Jacques,

      Thanks for sharing the tip, but could you tell us why it needed and how you came to know? it will help us to correct the article with correct explanation. So, that end users will know more better about the command.

      Reply
  5. Thank you very much for this tutorial. It is really very useful.
    The question is what to do if you only have the command line and no GUI (so no browser too ;-).

    Thank you.

    Reply
  6. google-drive-ocamlfuse on Lubuntu 14.04 is too slow. I tried to use vi to edit a text file in google-drive, when I pasted about 2KB text from clipboard, it took around 60 seconds. The same thing works smoothly on pCloud.com, it seems that pCloud do caching well.

    Reply
    • google-drive-ocamlfuse doesn’t allow to change file timestamps. Commands “cp -p” or “rsync -a” always create files with present modification time. Therefore, rsync is useless.

      Reply
  7. i can not install it. have an error. can you help?
    [root@server opam]# opam install google-drive-ocamlfuse
    [WARNING] Running as root is not recommended
    The following actions will be performed:
    ∗ install sqlite3 4.0.3 [required by google-drive-ocamlfuse]
    ∗ install google-drive-ocamlfuse 0.5.22
    ===== ∗ 2 =====
    Do you want to continue ? [Y/n] y

    =-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    [google-drive-ocamlfuse] Archive in cache
    [sqlite3] Archive in cache

    =-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    [ERROR] The compilation of sqlite3 failed at “ocaml setup.ml -build”.
    Processing 1/2: [sqlite3: ocamlfind remove]
    #=== ERROR while installing sqlite3.4.0.3 =====================================#
    # opam-version 1.2.2
    # os linux
    # command ocaml setup.ml -build
    # path /root/.opam/system/build/sqlite3.4.0.3
    # compiler system (4.02.3)
    # exit-code 1
    # env-file /root/.opam/system/build/sqlite3.4.0.3/sqlite3-6418-1872ec.env
    # stdout-file /root/.opam/system/build/sqlite3.4.0.3/sqlite3-6418-1872ec.out
    # stderr-file /root/.opam/system/build/sqlite3.4.0.3/sqlite3-6418-1872ec.err
    ### stdout ###
    # /usr/bin/ocamlopt.opt unix.cmxa -I /usr/lib64/ocaml/ocamlbuild /usr/lib64/ocaml/ocamlbuild/ocamlbuildlib.cmxa myocamlbuild.ml /usr/lib64/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
    # Failure: pkg-config failed for cflags.
    ### stderr ###
    # Package sqlite3 was not found in the pkg-config search path.
    # Perhaps you should add the directory containing `sqlite3.pc’
    # to the PKG_CONFIG_PATH environment variable
    # No package ‘sqlite3′ found
    # E: Failure(“Command ”/usr/bin/ocamlbuild’ lib/libsqlite3_stubs.a lib/dllsqlite3_stubs.so lib/sqlite3.cma lib/sqlite3.cmxa lib/sqlite3.a lib/sqlite3.cmxs -tag debug’ terminated with error code 2″)

    =-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    The following actions were aborted
    ∗ install google-drive-ocamlfuse 0.5.22
    The following actions failed
    ∗ install sqlite3 4.0.3
    No changes have been performed

    =-=- sqlite3.4.0.3 troobleshooting =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    => This package relies on external (system) dependencies that may be missing. `opam depext sqlite3.4.0.3′ may help you find the correct installation for your system.

    Reply
  8. Anothher way for automounting (in KDE)
    I just added the commando ‘google-drive-ocamlfuse ~/google-drive’ to Menu -> System Settings -> Startup & Shutdown -> Autostart

    works great

    Reply
  9. I got many error after $ opam init
    like this

    [WARNING] Errors while parsing flowtype.0.9.1 OPAM file, skipping.
    [ERROR] Your version of OPAM (1.1.1) is not recent enough to read ~/.opam/repo/default/packages/flowtype/flowtype.0.9.2/opam. Upgrade OPAM to a more recent version (at least 1.2) to read this file correctly.

    How to fix it ?

    Reply
  10. Whenever I run the google-drive-ocamlfuse It brings up a webpage that has an error on it..
    400. That’s an error.

    Error: invalid_request

    Invalid response_type: code\\

    Learn more

    Request Details
    That’s all we know.

    Reply
  11. Thanks for sharing the guidelines. I can’t see the Files / Directorties those are shared with me in the mount.
    Please let me know how to view them as well.

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.