To mount Google Drive on Ubuntu Linux and sync local data to a Google Drive folder using rsync , you can use tools like rclone to create the mount. Here’s a step-by-step guide: Step 1: Install rclone First, install rclone if it’s not already installed. rclone is a popular tool for managing cloud storage on Linux.

Command line execution

Terminalbash
sudo apt update sudo apt install rclone -y Step 2: Configure  rclone  for Google Drive Run the  rclone config  command to set up Google Drive:  rclone config Follow the prompts to create a new remote for Google Drive: Type  n  to create a new remote. Name the remote (e.g.,  gdrive ). Select  drive  as the storage type. Follow the prompts to authenticate with your Google account.  rclone  will guide you through obtaining an authentication token from Google. Once configured, you can verify your setup by listing Google Drive contents:  rclone ls gdrive:  (Replace  gdrive  with whatever name you used for the remote.) Step 3: Mount Google Drive To mount Google Drive to a directory, use  rclone mount . For this example, we’ll mount it to  /mnt/gdrive . Create the mount point:  sudo mkdir /mnt/gdrive Mount Google Drive using  rclone :  rclone mount gdrive: /mnt/gdrive --daemon Note:  If you’re running into permission issues, try running the mount command with  sudo . The  --daemon  option allows the mount to run in the background. Replace  gdrive  with your remote name if different. Confirm that Google Drive is mounted by listing the contents of the directory:  ls /mnt/gdrive Step 4: Use  rsync  to Sync Data to Google Drive Now that Google Drive is mounted, you can use  rsync  to copy or synchronize data to it. For example, to sync a local directory (e.g.,  /path/to/local/data ) to a Google Drive folder (e.g.,  /mnt/gdrive/backup ), use: rsync -avh /path/to/local/data/ /mnt/gdrive/backup Options Explained: -a : Archive mode, which preserves permissions, timestamps, and symlinks. -v : Verbose, so you can see what’s being transferred. -h : Human-readable output. Step 5: Unmount Google Drive When you’re finished, you can unmount Google Drive with: fusermount -u /mnt/gdrive or sudo umount /mnt/gdrive Automating the Process (Optional) To automate the syncing process, you can add this setup to a cron job. For example, to sync every night at midnight, you could add this line to your crontab: crontab -e Then add: 0 0 * * * /usr/bin/rclone mount gdrive: /mnt/gdrive --daemon && /usr/bin/rsync -avh /path/to/local/data/ /mnt/gdrive/backup && /usr/bin/fusermount -u /mnt/gdrive This approach mounts Google Drive, syncs your data, and then unmounts it.

Risk level: destructive. Review the command before running it.

Implementation details

sudo apt update sudo apt install rclone -y Step 2: Configure rclone for Google Drive Run the rclone config command to set up Google Drive: rclone config Follow the prompts to create a new remote for Google Drive: Type n to create a new remote. Name the remote (e.g., gdrive ). Select drive as the storage type. Follow the prompts to authenticate with your Google account. rclone will guide you through obtaining an authentication token from Google.

Gotchas and common issues

  • Permission checks - verify user access rights and sudo privileges before executing system-level operations.

  • Environment configuration - double-check path variables and dependency versions to prevent runtime failures.

  • Backup safeguards - maintain configuration backups before applying system or database modifications.

Following these steps ensures clean configuration and reliable execution for mount google drive on ubuntu and sync data using rsync.