Need your scripts, reports or files from Google Drive on a Linux server? The standard tool is rclone. It is free, works on Oracle Linux, RHEL and Ubuntu, and can either mount Google Drive as a folder or copy and sync files to and from it.
Step 1: Install rclone and FUSE
FUSE lets rclone present Google Drive as a normal folder.
# Oracle Linux / RHEL
sudo dnf install -y fuse3
# Ubuntu / Debian
# sudo apt install -y fuse3
curl https://rclone.org/install.sh | sudo bash
rclone version
Step 2: Connect rclone to your Google account
rclone config
Answer the prompts:
- n for a new remote, and name it gdrive.
- Storage: choose drive (Google Drive).
- client_id / client_secret: leave blank, or use your own Google Cloud OAuth client for better speed limits.
- scope: 1 (full access).
- service_account_file: leave blank.
- Edit advanced config: n.
- Use web browser to authenticate: y if the machine has a desktop and browser.
- Shared drive: n (unless you use one), then y to confirm and q to quit.
Servers without a browser
Most database servers have no desktop. In that case answer n to the browser question. rclone prints a command such as rclone authorize "drive" "...".
- Install rclone on your Windows, Mac or Linux desktop.
- Run that exact command there. A browser opens and asks you to sign in to Google.
- Copy the token it prints and paste it back into the prompt on the server.
Test the connection:
rclone lsd gdrive:
You should see the top-level folders of your Google Drive.
Step 3a: Mount Google Drive as a folder
mkdir -p ~/gdrive
rclone mount gdrive: ~/gdrive --vfs-cache-mode writes --daemon
ls ~/gdrive
To unmount it:
fusermount3 -u ~/gdrive
To mount just one folder instead of the whole drive:
rclone mount "gdrive:Work/dba" ~/gdrive --vfs-cache-mode writes --daemon
Step 3b: Or copy and sync files
For scripts and backups, copying is more reliable than working on a mounted drive.
rclone copy ~/scripts "gdrive:dba-scripts" # upload; never deletes anything
rclone copy "gdrive:dba-scripts" ~/scripts # download
rclone sync ~/scripts "gdrive:dba-scripts" --dry-run # make Drive match local; preview first
copy only adds and updates files. sync makes the destination identical to the source, which can delete files, so always run it with --dry-run first and check the output.
Step 4 (optional): Mount automatically at boot
Create the file ~/.config/systemd/user/gdrive.service:
[Unit]
Description=Google Drive (rclone)
After=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/rclone mount gdrive: %h/gdrive --vfs-cache-mode writes
ExecStop=/bin/fusermount3 -u %h/gdrive
Restart=on-failure
[Install]
WantedBy=default.target
Then enable it:
systemctl --user daemon-reload
systemctl --user enable --now gdrive
loginctl enable-linger $USER # keeps it mounted when you are logged out
Good to know
- Use the mount for scripts, documents and file transfers only. Do not put Oracle datafiles, redo logs, RMAN backup destinations or Git repositories directly on Google Drive. It is a network file system with caching and can slow down or corrupt that kind of work. Back up to local disk first, then
rclone copythe finished files to Drive. - Protect your sign-in token. rclone stores it in
~/.config/rclone/rclone.conf. Keep that file private:
chmod 600 ~/.config/rclone/rclone.conf
- Company Google accounts may need approval from your Google Workspace administrator before rclone can connect.
- Check usage limits. Google Drive limits how much you can upload per day, so very large transfers may pause and resume.
Summary
Install rclone and FUSE, run rclone config once to connect your Google account, then either mount Drive as a folder or use rclone copy to move files. For anything database-related, copy finished files to Drive rather than working on the mount directly.
Want more? Read more DBA tutorials and troubleshooting notes on my blog, Oracle DBA Trench.