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.
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.
$ sudo add-apt-repository ppa:alessandro-strada/ppa $ sudo apt-get update $ sudo apt-get install google-drive-ocamlfuse
$ yarout -S google-drive-ocamlfuse or $ packer -S google-drive-ocamlfuse
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
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
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
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.
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
To add more than one account, use the following format. By default the configuration file is first created in
~/.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
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