Rclone - How to mount google drive on boot?


I'm using rclone to access my google drive folders from my router, I can mount my GD to my router's directory just fine with this command rclone mount --daemon GD: /mnt/GD

When I use that command as a crontab, the crontab line of that command always gets removed after every reboot and then my crontab is empty, here's my crontab configuration:

@reboot /usr/bin/rclone mount --daemon GD: /mnt/GD

My only question is how do I mount my Google Drive account successfully on every boot ?

Try your local start up script.

1 Like

putting that command in /etc/rc.local still doesn't mount the google drive

Try adding a sleep, it might be a race condition.

Although @reboot is not working in OpenWrt, are you certain that you don't have any other issues causing the removal of the entry? Some read-only filesystem for example?

How do I detect if my partitions are read-only ?

Issue a mount from terminal.

I have the same problem. I read on the rclone site that you can do the classic mount command and ateobuir in fstab. (sftp1:subdir /mnt/data rclone rw,noauto,nofail,_netdev,x-systemd.automount,args2env,vfs_cache_mode=writes,config=/etc/rclone.conf,cache_dir=/var/cache/rclone 0 0) but the explanation is for systemd . In the openwrt fstab I had doubts about how to do it. Can anyone shed some light? (rclone link: https://rclone.org/commands/rclone_mount/)

This is what I use:

#!/bin/sh /etc/rc.common

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
export HOME=/root

exec &> /tmp/mount-onedrive.log


start() {
        rclone mkdir /tmp/OneDrive
        rclone mount "OneDrive:/Scanned Documents/" /tmp/OneDrive/ --use-mmap --buffer-size 0 --cache-dir /tmp --vfs-cache-mode writes --vfs-cache-max-age 0s --umask 000 --allow-other --daemon

stop() {
        fusermount -zu /tmp/OneDrive
        rclone rmdir /tmp/OneDrive

Setting the path correctly is important. See the following thread for how to work out what to set for a given environment:

I presume the path not being set correctly is the reason for the failures experienced above.