Google Drive does not synchronize properly with rclone

What is the problem you are having with rclone?

I would like rclone to synchronize my google drive files automatically. In other words, as if I were using the Google Drive Windows client.

I followed some guides for rclone and now have two crontabs running. One for the startup:

(crontab -l 2>/dev/null; echo "@reboot rclone mount gdrive: $HOME/gdrive") | crontab -

and one for bisync:
Bisync every minute

*/1 * * * * ~/.config/rclonescipt.sh

Do this every minute

#!/bin/bash
# Copy from Google drive to Local Folder
rclone bisync gdrive: ~/gdrive --resync --progress --log-file ~/.config/rclone.log

Unfortunately, it does not work as desired. When I create a test file on my cell phone, it does not appear in my Google Drive folder on my Linux PC until I restart the PC. When I delete a file on my cell phone, it is not deleted on my Linux PC.
I think the Linux PC and Google Drive only synchronize at the start.

What am I doing wrong? Why is bisync not working as intended?

Run the command 'rclone version' and share the full output of the command.

rclone v1.68.0

  • os/version: linuxmint 22 (64 bit)
  • os/kernel: 6.8.0-44-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.23.1
  • go/linking: static
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Google Drive

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[gdrive]
type = drive
scope = drive
token = XXX
team_drive = 
### Double check the config for sensitive info before posting publicly

If you look closely at these steps you are doing, you are copying from your Google Drive to your Google Drive again, the difference is that first you mount it, then you copy from the remote to the mount.

If the proposal is to work on your Google Drive as a local drive, just like in the Google Drive Windows application, you would need a systemd file to mount Google Drive through this service and work directly from it, taking into account that the mounting itself may take a while for the new files to appear, both those that you saved on your cell phone to appear on the local drive and for the file saved there and you view it on your cell phone.

Example

[Unit]
Description=RClone Mount Backup
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/root/.config/rclone/rclone.conf
RestartSec=5
ExecStart=/usr/bin/rclone mount GoogleDrive:Backup /mnt/Rclone/Backup \
--allow-other \
--dir-cache-time 9999h \
--log-level DEBUG \
--log-file /var/log/Rclone/Backup.log \
--poll-interval 15s \
--user-agent "ISV|rclone.org|rclone/v1.68.0" \
--rc \
--rc-addr=:55555 \
--rc-no-auth \
--cache-dir=/root/.cache/rclone \
--drive-use-trash \
--vfs-cache-mode full \
--vfs-cache-max-size 100G \
--vfs-read-ahead 256M \
--vfs-cache-max-age 1h \
--vfs-cache-poll-interval 5m  
ExecStartPost=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr 127.0.0.1:55555 _async=true
ExecStop=/bin/fusermount -uz /mnt/Rclone/Backup
Restart=on-failure
User=edson
Group=edson

[Install]
WantedBy=default.target

Change this example to match your settings.

Now if the intention is to have a local "copy" of your Google Drive, what I recommend is to create a $HOME/GDrive folder and then you would synchronize Google Drive with the local folder.

Example

rclone bisync gdrive: ~/gdrive 
1 Like

@edsonsbj Thank you very much Sir! After two hours spinning circles with chatgpt and your answer I finally did it!

I had to install fuse and decomment user_allow_other in /etc/fuse.conf

Since I have large Volumens on my Drive I don't want a local copy on my Linux PC. I only wanted the Drive folder in my personal folder. In Windows, the Drive folder was basically an extra hard disk.

I deactivated my crontabs, do I need any crontabs for this to automatically work on start up?

You don't need to just follow the steps suggested above regarding creating a systemd service.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.