Mount Google Drive locally in Ubuntu as a virtual filesystem

about mount Google Drive locally

In the following article we will see two ways to mount Google Drive locally as a virtual filesystem. Google Drive is one of the most popular cloud storage providers on the planet.

Every now and then, some developers bring us some clients from Google Drive to Gnu / Linux systems. In this post, we will see two unofficial clients for our Ubuntu system. With these clients we will be able to mount the Google drive locally, as a virtual file system. This will give us the possibility of accessing the files on our unit in a very simple way.

google-drive-ocamlfuse

Google-drive-ocamlfuse is a FUSE file system for Google Drive which is written in OCaml. FUSE is a project that allows users to create virtual file systems. Google-drive-ocamlfuse will allow us to mount our Google Drive on a Gnu / Linux system.

It has read / write access to common files and folders, read-only access to Google sheets and slides. Will provide us support for multiple Google Drive accounts, handling of duplicate files, access to the trash directory and more.

Installing google-drive-ocamlfuse

To install it in Ubuntu 18.04 we will write in the terminal (Ctrl + Alt + T):

sudo add-apt-repository ppa:alessandro-strada/ppa

sudo apt-get install google-drive-ocamlfuse

Use

Once installed, we are going to run the following command to start google-drive-ocamlfuse utility from terminal (Ctrl + Alt + T):

google-drive-ocamlfuse

When run for the first time, the utility will open the web browser and will ask us for permission to access our Google Drive files. Once authorization is granted, all necessary configuration files and folders will be created automatically.

login screen to mount google drive with gdfuse

After successful authentication, we will see the following message in the terminal:

access token retrieved mount google drive locally gdfuse

Now we can close the web browser and create a mount point for our Google Drive files. We will do this by typing in the terminal (Ctrl + Alt + T)

mkdir ~/migoogledrive

Finally, we will mount our google unit using command:

google-drive-ocamlfuse ~/migoogledrive

After this, we can access the files from the Terminal or from the file manager.

google drive gdfuse mounted file system

Once you are done, we will unmount the filesystem FUSE using the command:

fusermount -u ~/migoogledrive

If we need it, we can consult the help with the command:

google-drive-ocamlfuse --help

In addition, we can consult the official wiki and the repository Project GitHub for more details.

GCSF

GCSF is a Google Drive-based FUSE file system, written with the Rust programming language. Using GCSF, we will be able to mount our Google unit as a local virtual file system and access the contents from the Terminal or the file manager.

If you're wondering how it differs from other FUSE projects like google-drive-ocamlfuse, the GCSF developer responded to a similar comment on Reddit: 'GCSF tends to be faster recursively listing files or reading large files from Drive. The caching strategy it uses also leads to very fast reads for files that have been cached, at the cost of using more RAM. '

Installing GCSF

To install it in Ubuntu, we will have to make sure we have installed Rust in our system. Also make sure pkg-config and fuse packages are installed. We will find these available in the default repositories of most Gnu / Linux distributions. On Ubuntu and derivatives, they can be installed using the command:

sudo apt install -y libfuse-dev pkg-config

Once all dependencies are met, run the following command to install GCSF:

cargo install gcsf

Use

First, we must authorize our google drive. To do this run:

gcsf login entreunosyceros

You will have to specify a session name. Replaces entreunosyceros with your own session name. You will see a result similar to the following with a URL to authorize your Google Drive account.

gcsf login url

Copy and paste the above URL into your browser and click allow to give permission to access the contents of your Google Drive. Once authenticated, you will see a result like the following.

login screen to mount google drive locally with gcsf

GCSF will create a configuration file in $ XDG_CONFIG_HOME / gcsf / gcsf.toml, which is generally defined as $ HOME / .config / gcsf / gcsf.toml. The credentials are stored in the same directory.

We continue to create a directory for mount our Google Drive content:

mkdir ~/migoogledrivegcfs

Now we will edit the /etc/fuse.conf file:

sudo vi /etc/fuse.conf

We will uncomment the following line to allow non-root users to specify mount options:

config fuse

user_allow_other

We save and close the file. We continue mounting our google unit with the command:

google drive locally mounted with gcsf

gcsf mount ~/migoogledrivegcfs -s entreunosyceros

Replace entreunosyceros with the name of your session. After this, you can close this terminal.

Now you can view existing sessions with the command:

gcsf list

gcsf list

At this point, we will be able to access the contents of our Google unit from the Terminal or from the file manager.

google drive gcsf mounted as filesystem

If you do not know where is your google drive mounted, use the df command:

df -h

We will be able unmount google drive using command:

fusermount -u ~/ migoogledrivegcfs

We can get more information about GCFS since GitHub repository


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Harold Collazos Urbano said

    Hello, good afternoon, I don't know if I can ask questions around here but hey, here it goes:
    I am trying to use the GCSF option, I already did all the steps, but I have more than 300 GB on my drive, it is a corporate account, and in the step gcsf mount ~ / migoogledrivegcfs -s entreunosyceros, I see that it starts as a "Synchronize" all the data, and the lines INFO gcsf :: gcsf :: drive_facade> Received page 250 containing 460 files begin to pass a lot, this ends after an hour or so and these other lines begin: INFO gcsf :: gcsf :: file_manager> Checking for changes and possibly applying them.
    I started the process yesterday at 3:00 pm and left the computer on all night and this morning there were about 10 lines of that last one that I shared, and I kept working. Until last night when I entered the migoogledrivegcfs folder it did not show anything, (at that time there were like 3 lines of INFO gcsf :: gcsf :: file_manager> Checking for changes and possibly applying them.), This morning I already saw the files in my folder but I had not finished yet and as I had to go and take the laptop I had to cancel, with CRL + C and at that moment everything that was in the folder disappeared, clearly because I interrupted the assembly. Now I just started over and is doing the same thing.
    The question is, is it always time to do this montage or should I only let it finish once? When the complete process is finished, is everything saved? that is, if I restart the computer, whenever I enter the folder again, it will have my Google Drive data mounted and it will automatically synchronize?
    Thanks for the information.

  2.   Jorge LuparDev said

    Hello. Thanks for the guide.
    Google rejects the login with an error 400 (Bad request) because the url is badly formed. Did it happen to someone else? Do you know how to fix it?

    «400. That's an error.

    The server cannot process the request because it is malformed. It should not be retried. That's all we know. »

    Thank you

    1.    Jorge LuparDev said

      This is with gcsf, by doing gcsf login username
      or also (nombreUsuario@gmail.com)