GDrive in Linux
This document describes how to use GDrive in Linux
Follow the steps in https://linuxhint.com/mount_google_drive_linux_mint/↗ ↗ to the dot for ocamlfuse. Ocamlfuse URL: https://astrada.github.io/google-drive-ocamlfuse/↗ ↗
Used PPA of the author to allow easier installation and updates of google-drive-ocamlfuse.
$sudo add-apt-repository ppa:alessandro-strada/ppa
$sudo apt update
$sudo apt install google-drive-ocamlfuse
$google-drive-ocamlfuse #Authentication with validity of 30 days to access GDrive#
$mkdir LDrive
$google-drive-ocamlfuse LDrive
$df -h #To test listing of GDrive locally#
$fusermount -u LDrive #To unmount GDrive#
Filesystem Size Used Avail Use% Mounted on
google-drive-ocamlfuse 15G 6.6G 8.5G 44% /home/prabu/LDrive
google-drive-ocamlfuse with the -cc #To clear the cache, if config changes made#
Location of the config file : ~/.gdfuse/default/config
With ocamlfuse Google Drive can be accessed directly using the file explorer. Biggest advantage of ocamlfuse over rclone is its ability to handle Gdocs files properly. Unlike rclone, ocamlfuse cannot access other cloud providers.
https://www.linuxuprising.com/2019/06/how-to-speed-up-google-drive-ocamlfuse.html↗ ↗
How to use rclone with GDrive
*Documentation : * https://rclone.org/drive/↗ ↗
Summary: Due to issues with handling of gdocs, still mount is quite useless. However, sync is good to use for upload/download etc..
Installed originally with sudo apt-get. Realized that the version was quite old. So went to rclone website and downloaded the latest deb package rclone-v1.52.1-linux-amd64.deb
Command to install
$sudo dpkg -i rclone-v1.52.1-linux-amd64.deb
$ rclone -V
rclone v1.52.1
os/arch: linux/amd64
go version: go1.14.4
sudo apt-get install rclone*
rclone config
2020/06/16 23:17:57 NOTICE: Config file “home/prabu.config/rclone/rclone.conf” not found - using defaults
No remotes found - make a new one
n) New remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
n/r/c/s/q> n
name> GDrive
Type of storage to configure.
Choose a number from below, or type in your own value
1 / Amazon Drive
\ “amazon cloud drive”
….
6 / Google Cloud Storage (this is not Google Drive)
\ “google cloud storage”
7 / Google Drive
\ “drive”
…
Storage> 7
Google Application Client Id - leave blank normally.
client_id>
Google Application Client Secret - leave blank normally.
client_secret>
Remote config
Use auto config?
Say Y if not sure
Say N if you are working on a remote or headless machine or Y didn’t
work
y) Yes
n) No
y/n> y
If your browser doesn’t open automatically go to the following link: http://127.0.0.1:53682/auth↗
Log in and authorize rclone for access
Waiting for code…
Got code
[GDrive]
client_id =
client_secret =
token = {“access_token”:“ya29.a0AfH6SMC_NxIHTH2pbSUeUcKbIils4VXkzSPTO4pK32T1ujFdnRBPQQEwwnyVwX5Xgr1U8_LEmHk5UhSM888qGcCofE_K9xwy3lZ1OKqRiJJAP5uh_B1E6G-HDkKf7zBGEW-LmoL2SrceoXK2wnNopHBN5wkdcKGk9LU”,“token_type”:“Bearer”,“refresh_token”:“1//0gT2oQX1yKTewCgYIARAAGBASNwF-L9IrORcgaDKFTmM4vgej_KeWKIxIHp7G4T66HVK9pEicUpP544C4nrfjocIxGQmXr_qiQPA”,“expiry”:“2020-06-17T00:18:57.442863191+05:30”}
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
== ==
GDrive drive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
To list every file in GDrive
$ rclone ls GDrive:
To mount Gdrive as local folder :- unusable due to issues with Gdocs files
Start the mount like this to run mount in background (daemon) mode.
$rclone mount remote:path/to/files /path/to/local/mount –daemon
$rclone mount GDrive: GDrive –vfs-cache-mode full –drive-skip-gdocs –daemon
When running in background mode the user will have to stop the mount manually (specified below). Stopping the mount manually:
$fusermount -u /path/to/local/mount
*Flags to be used *
–vfs-cache-mode full/writes/minimal/off
To clear Trash on GDrive
$rclone cleanup GDrive:
$rclone about GDrive:
Total: 15G
Used:2.767G
Free:8.460G
Trashed: 0
Other: 3.773G
To download/export or upload to GDrive
Important: Since this can cause data loss, test first with the –dry-run flag to see exactly what would be copied and deleted.
To download everything from GDrive to local folder.. Note: Default gdocs changes to docx…
To download
rclone sync GDrive: /media/DDrive/prabu/GDrive –drive-export-formats ods,odt,odp
To upload (rclone will not convert any files by default, since the conversion is a lossy process.)
rclone sync /media/DDrive/prabu/GDrive GDrive:
Document format conversion
When rclone downloads a Google doc it chooses a format to download depending upon the –drive-export-formats setting. By default the export formats are docx,xlsx,pptx,svg which are a sensible default for an editable document.
–drive-skip-gdocs (very much needed if mounting)
–drive-export-formats pdf (if backup is being taken)
–drive-export-formats ods,odt,odp (useful for sync option
Source: https://rclone.org/commands/rclone_mount/↗ ↗
Check here further ..
https://www.labnol.org/internet/direct-links-for-google-drive/28356/↗ ↗
© Prabu Anand K 2020-2026