Mounting Google Drive in Linux
Google Drive is an indispensable part of our life nowadays. From sharing almost every type of file to anyone/anywhere around the world has reduced our cost and time tremendously from self-hosting an FTP server and taking care of its security.
From DevOps perspective, it becomes even more convenient if we could have our google drive(s) synced on our server(s) as its saves the time for downloading the files and uploading it to the server.
For mounting the google drive, there is a package named: “google-drive-ocamlfuse” available in Linux that does this task for us.
To install this package on Ubuntu follow the steps:
[sourcecode language=”bash”]
sudo add-apt-repository ppa:alessandro-strada/ppa
sudo apt-get update
sudo apt-get install google-drive-ocamlfuse
[/sourcecode]
To authorize the google drive to the local machine, use:
[sourcecode language=”bash”]
mkdir <mount_point>
google-drive-ocamlfuse <mount_point>
[/sourcecode]
This will open the default browser of your machine, ask for your Google credentials, then Authorization request and finally allow it to access your drive.
For mounting google drive on a Linux Server:
[sourcecode language=”bash”]
mkdir <mount_point>
google-drive-ocamlfuse -headless <mount_point>
[/sourcecode]
Instead of opening and asking for authorization in the browser, it will give you a URL for authorization, which you can open in any browser, provide authorization and copy the verification code.
To unmount the google drive:
[sourcecode language=”bash”]
fusermount -u <mount_point>
[/sourcecode]
Hope after following the blog and implementing this in your project your client will be happy with your work 🙂