How to mount Google Drive on Linux

As I speak, more than 22,000 people signed up for a petition, desperately wanting to have an official native Linux client for Google Drive, and yet their voice is still being ignored by Google. Perhaps when it comes to boosting their bottom line, Linux desktop market is not a priority for Google.

They can ignore Linux desktop market all they want, but they cannot ignore the power of FOSS. Faced with the frustration, the open-source community responded, producing unofficial Google Drive clients such as Grive or SyncDrive. These clients are file synchronization tools which sync files and folders between local file system and remote Google Drive. As such, you cannot mount Google Drive using these tools.

If you want to mount Google Drive on Linux, you can try google-drive-ocamlfuse, which is a FUSE-based file system backed by Google Drive. Using this user-space file system, you can mount your Google Drive account on Linux, and have full read/write access to files/folders in Google Drive as if they were local files/folders.

In this tutorial, I will describe how to mount Google Drive on Linux with google-drive-ocamlfuse.

Install google-drive-ocamlfuse on Linux

google-drive-ocamlfuse is written in OCaml, and you can use OPAM (OCaml package manager) to build and install google-drive-ocamlfuse from its source. In this case, you need to install prerequisites such as FUSE. The following are distro-specific such instructions.

To install google-drive-ocamlfuse on Debian:

$ sudo apt-get install ocaml camlp4-extra
$ git clone
$ cd opam
$ ./configure
$ make
$ sudo make install
$ sudo apt-get install m4 libcurl4-gnutls-dev libfuse-dev libsqlite3-dev
$ opam init
$ opam update
$ opam install google-drive-ocamlfuse

After successful build, the google-drive-ocamlfuse binary will be found in ~/.opam/system/bin. Add this path to your PATH environment variable as follows.

$ vi ~/.bashrc
PATH= $PATH:$HOME/.opam/system/bin
export PATH 
$ source ~/.bashrc

To install google-drive-ocamlfuse on Ubuntu or Linux Mint, you can use its official PPA as follows.

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

To install google-drive-ocamlfuse on Fedora:

$ sudo yum install ocaml ocaml-camlp4-devel ocaml-ocamldoc
$ git clone
$ cd opam
$ ./configure
$ make
$ sudo make install
$ sudo yum install m4 fuse fuse-devel libcurl-devel libsqlite3x-devel zlib-devel
$ opam init
$ opam update
$ opam install google-drive-ocamlfuse

After successful build, the google-drive-ocamlfuse binary will be found in ~/.opam/system/bin. Add this path to your PATH environment variable as follows.

$ vi ~/.bashrc
export PATH 
$ source ~/.bashrc

To install google-drive-ocamlfuse on CentOS or RHEL, you can follow the above Fedora instructions. However, the default version of OCaml installed on CentOS/RHEL does not meet the minimum version requirement (3.12.1) for building OPAM. Therefore you need to upgrade OCaml by installing it from source.

Mount Google Drive with google-drive-ocamlfuse

The first step is to add your user name to Linux group named fuse as follows, so that Google Drive can be mounted by you (i.e., a non-root user).

$ sudo usermod -a -G fuse <user_name>
$ exec su -l $USER

Next, configure google-drive-ocamlfuse by running it without any argument:

$ google-drive-ocamlfuse

This will open up a web browser window, asking you to log in to your Google account. After logging in, you will see the following screen, requesting for permission. Click on "Accept".

Next you have to grant "gdfuse OAuth2 Endpoint" access to your Google account. For that, log in to your Google account again.

Click on "Allow" button.

Then you should see a message saying that google-drive-ocamlfuse was successfully granted access. Close the browser tab / window to finalize.

At this point, the initial configuration is completed. You should see a new directory named ~/.gdfuse/default created, which contains the configuration file "config", application state and file cache.

Now proceed to create a mount point, and mount Google Drive as follows.

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

Use mount command to check if Google Drive is mounted successfully.

$ mount
google-drive-ocamlfuse on /home/dev/googledrive type (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

You can also check how much space is left on your Google Drive account by using df command.

$ df
google-drive-ocamlfuse  15728640     304  15728336   1% /home/dev/googledrive

To unmount the Google Drive file system, simply run:

$ fusermount -u ~/googledrive

Mount Multiple Google Drive Accounts Simultaneously

If you have more than one Google Drive account, you can mount them simultaneously. In this case, use "-label" option to distinguish between them as follows.

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

The first time you run google-drive-ocamlfuse with a given label, you will need to go through the same Google authentication procedure as before, but for a different Google account. After that, ~/.gdfuse/[label] will be created to store configuration data for the different Google account.

Auto-mount Google Drive upon Boot

If you want to have Google Drive mounted automatically upon boot, you can follow the steps below. The credit goes to Alessandro Strada, the original author of google-drive-ocamlfuse.

Create a shell script named "gdfuse" in /usr/bin (as root) with this content:

$ sudo vi /usr/bin/gdfuse

google-drive-ocamlfuse -label $1 $*
exit 0

Give it exec permissions:

$ sudo chmod +x /usr/bin/gdfuse

Copy your directory ~/.gdfuse in root home (that's because mount is executed by root)

$ sudo cp -r /home/[user]/.gdfuse /root/

Edit /etc/fstab adding a line like this:

gdfuse#default  /mnt/gdrive     fuse    allow_other     0       0

And then you can use mount command to run google-drive-ocamlfuse:

$ sudo mount /mnt/gdrive

If you want, you can change the owner of the filesystem by adding a line to /etc/fstab (if the user id is 1000):

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

If you have more than one Google drive accounts, you can also mount them by adding their corresponding label after the # (in /etc/fstab):

gdfuse#label  /mnt/gdrive     fuse    allow_other     0       0

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

72 thoughts on “How to mount Google Drive on Linux

    • but why will one use a paid application where the service endpoint is already free, and there are already alternatives?

  1. Thanks for the post, also re: Insync is a paid service to sync your free google drive to linux. I honestly don't understand the concept of charging for something like this since the endpoints are open and free to use. Glad an alternative exist in the form of google-drive-ocamlfuse.

      • Google provides service (for free), and inSync built a paid frontend around it. You are right we cannot blame inSync for charging for their effort. But we as end users are also entitled to complaining of their pricing, given that there are other reasonably good free alternatives.

        • I'm always surprised that people consider google services free. You are not a costumer of google, you are the product. The services aren't free you just don't pay with money for them... a 3rd party developer won't get any money from google and won't get anything useful from you so why should he run the service for free?

          • But ... , But ... Google said they are free. It says it on the ads settings page "Ads enable free web services and content. These settings help control the types of ads you see." It's right before they show how they have profiled you so their real customers receive a better service and you also get the opportunity to make their service even better by correcting any inaccuracies about your interests, we really are fucking ourselves and yet no one leaves, lol....

            • I don't consider myself being fucked by google, if I were I would leave.... Just let's not pretend that they give us gmail for free because they are a bunch of philanthropists :)

          • I don't agree. inSync does good business because there are many Google users. Google builds business around our privacy. So we have right to complain about inSync's pricing.

  2. It is certainly a long walk for drinking a water; but still the best way I've seen to get this working. Great guide, thanks much!

        • Syncdrive is not open-source. That page does not contain any of the Syncdrive source code. Just because Syncdrive is a front end for Grive and Grive is open-source, does not mean that Syncdrive is open-source. For example, OS X (not open-source) is a front end for Darwin (open-source).

          Can you provide a download link for the actual source code of Syncdrive itself? If so, then I will (happily) be wrong. Incidentally, I believe that Syncdrive violates the GPL license of Grive, since it is clearly a derived work of Grive, but the source code of Syncdrive is not available under the GPL, as required by the GPL. However, I can't do anything about it. It would be up to the copyright holder(s) of Grive to pursue any legal action.

  3. This is what I've been after! Hopefully I won't have to reboot the machine and will be able to install remotely, otherwise it'll have to wait.

      • I already have fuse installed but there's no Gentoo/Sabayon package so I'm going to have to go straight to github. That will have to wait until I get home. I'll follow up here.

      • I use the native Google Drive client on both Windows and Mac, and as far as I understand these are "sync" clients as well. They aren't mounts (in the way that Windows and Mac understand fs mounts), and when you kill off the Drive app, the files in your Google Drive folder remain.

        In any case, cool post.

    • because even Google doesn't have infinite resources. Obviously they've decided they have better ways to spend their time and money right now.

      • You are aware that most of the computers at Google run Linux right? A customized version of Ubuntu to be exact. And you are aware that Google could just use a Wine wrapper to make this work right? Just like they did with Picasa! You are aware that Google initially promised a version for Linux when they introduced a desktop client for Windows and Mac right? Please think before making comments that you think are funny when someone asks a serious question!

    • <rant>I know lets petition google...... oh some did that already. because it was a good use of time+energy instead of sitting down an actually figuring it out for themselves. I like to think that Google looked at the Linux community and thought , They don't really need our help they'll sort it out themselves, It ( used ) to be a community of hackers getting stuff done and solving the problem, Not Couting E-Tears because those windows and osx lot got an official one and we want one too</rant>

      A bit of a rant but that ought to do it lol -p

  4. That doesn't make sense to me. How can Google ignore the Linux desktop market and have their own Linux version on laptops (chromebooks)? Myself, I'd love to try out the chromebook OS, because I'm considering buying one.

  5. Only one issue... there is a requirement for zlib-devel on Fedora to build and install cryptolib:

    # ...[truncated]
    # mv stubs-misc.o src/stubs-misc.o
    # ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-rng.c
    # mv stubs-rng.o src/stubs-rng.o
    # ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-zlib.c
    # + ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-zlib.c
    # src/stubs-zlib.c:19:18: fatal error: zlib.h: No such file or directory
    # #include
    # ^
    # compilation terminated.
    # Command exited with code 2.
    ### stderr ###
    # E: Failure("Command ''/usr/bin/ocamlbuild' src/libcryptokit_stubs.a src/ src/cryptokit.cma src/cryptokit.cmxa src/cryptokit.a src/cryptokit.cmxs test/test.byte -tag debug -classic-display' terminated with error code 10")
    # make: *** [build] Error 1

    I simply installed zlib-devel and all worked.
    Please change your yum install line to:

    sudo yum install m4 fuse fuse-devel libcurl-devel libsqlite3x-devel zlib-devel

  6. Why do people write filesystems in non-native languages? This is in OCaml, and Dropbox is in obfuscated python. Portability? Non-performance? or that is all they know?

    • It's also a f**king pain in the arse to compile for source if you're not an ocaml developer ( and who is ) I know of 1. Maybe we could start a petition demanding he rewrite it in a sensible language like C. ;)

      • i am trying to follow your tutorial but unfortunately i am not getting a good result... how can i fix this error
        bash: /usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/momo/.local/bin:/home/momo/bin:/home/momo/.opam/system/bin: No such file or directory
        in this STEP: After successful build, the google-drive-ocamlfuse binary will be found in ~/.opam/system/bin. Add this path to your PATH environment variable as follows.

  7. chmod 0666 fuse is not a good idea. It destroys the security model , and may be undone at reboot (when udev may recreate it)

    the correct way would be
    $ sudo adduser THEUSER fuse
    (after that the user should logout and login again)

  8. After granting access to “gdfuse OAuth2 Endpoint” access to your Google account, you need to close the browser tab / window at this stage. Only then, will you see "Access token retrieved correctly." in the terminal window.

  9. OK - thanks for this. However I don't have a ton of linux experience and don't know how to add a the path to my environment variable (Fedora 19). Step-by-step instructions on this too would be helpful, if possible. I did search Google and found many different sets of instructions, none very clear to a new user. Thanks in advance.

  10. Google ignored a petition for keeping Google Reader running, which was signed by more than 150k users. Why would they bother for a product that would only be used by 20k people?

  11. Por si a alguien pudiera ayudar.

    Realizado en Ubuntu 12.04.3.

    Tras mucho pelearme con diferentes métodos para el AUTOMONTAJE y NO conseguirlo. Esto fue lo que realicé...con éxito:

    En cada reinicio el montaje se pierde, por lo que habrá que hacer que se monte tras iniciar con la cuenta de usuario

    Crear un script llamado en la misma carpeta del usuario (se puede anteponer . para que quede oculto)

    $ gedit

    Meter estas secuencias de comandos

    google-drive-ocamlfuse -label $1 $*
    exit 0

    Darle permisos de ejecución (mejor a todos los grupos)

    $ sudo chmod 777

    Para realizar la tarea automática utilizamos el crontab. Pero para ayudarme a realizarlo con "otros ojos" instalé el editor gráfico para el crontab

    Instalar el editor de cron

    $ sudo apt-get install gnome-schedule

    Ejecutar el crontab con la aplicación gráfica

    $ gnome-schedule

    Configurar tarea para que se ejecute el script cada vez que se reinicie el equipo con ese usuario
    apuntar en el comando al


    Espero haber ayudado a dar otras opciones.

    Y sobre todo agradecer todo este POST de Dan Danni que me ha ayudado a mí. Pues lo intenté con SyncDrive y no me ejecutaba (y eso que lo tengo funcionando en otro equipo con UBUNTU también)

  12. Looking to mount this folder for an SMB share. Seem that I am half-broken by FUSE and this. Managed to find where I need to allow others via the gdfuse conf.. but how can I get this app to pass that option when mounting? I see the -o allow_other specifically, but saw no params I could pass to google-drive-ocamlfuse in particular to this param I need.. any ideas?

    This was a general Ubuntu install.. perhaps take the Debian route and check the sources to mod? Ew..

  13. Just wanted to note that in ubuntu in addition to "make install" I had to execute "make" with sudo privs. Otherwise I would receive errors during "make" execution and of course errors during "make install".

    from make:
    tar xfj cmdliner-0.9.3.tbz
    tar (child): cmdliner-0.9.3.tbz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now

    from sudo make install:
    _obuild/opam/opam.byte: No such file or directory

  14. Having troube with the "auto-mount upon boot" part - I think I got everything to work up until the "sudo mount /mnt/gdrive" command. I'm getting the following error message:

    "google-drive-ocamlfuse: command not found"

    I'm using Fedora 19. Any ideas?

  15. I'm having a little trouble wtih the google-drive-ocamlfuse here:

    When I try to open google drive the mounted device, the system displays a message lijke 'you don't have the required permission to acces this device'.

    I'm having trouble with the automatic mounting upon boot too. I tried to use the absolute path as described, but it does not work.

  16. Hi,

    For me the automount on reboot worked just by adding the option _netdev in /etc/fstab :
    gdfuse#default /mnt/gdrive fuse _netdev,allow_other,uid=1000,gid=1000 0 0

    Hope it will work for others.


    • the fuse group has to be manually created

      sudo groupadd fuse

      should do the trick. Then do the usermod command

  17. Installed on Mint using instructions for Ubuntu. Did the Oauth2 authorization in GDrive for a selected label. A member of the fuse group.

    When trying to mount (with -d for debug messages) I see the message "Cannot refresh access token. Quitting.".

    Any ideas on how to solve this?

  18. I am trying to install on Cubian for Cubietruck which is an ARM board, all good until the final installation step where I get errors like:

    make install BINDIR=/home/catfish/.opam/system/bin OCAMLLIB=/home/catfish/.opam/system/lib/camlidl
    [ERROR] The compilation of camlidl.1.05 failed.
    Removing camlidl.1.05.

    and so on for the rest of the items to be installed. Any way around this?

    I installed make and bzip2 with apt-get which helped with earlier problems in the installation.

  19. There is an error in the instructions.... you have a space in the PATH that breaks the tutorial

    PATH= $PATH:$HOME/.opam/system/bin
    export PATH

    should be

    export PATH

Leave a comment

Your email address will not be published. Required fields are marked *

Current day month ye@r *