Google Drive sync
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 30/100
- Issue type
- Documentation
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- linux
- Domain
- devops, documentation
Research direction
Start by reviewing the repository's existing documentation structure, then use the rclone Google Drive and bisync references in the issue as the source material. The documented result should cover setup, the systemd service and timer paths, periodic execution, and the reported Google Docs limitation without exposing credentials.
Written by the indexing model from the issue text.
Description
Setup
Configure
First setup the rclone config and add your Google Drive account as a remote. The docs are easy to follow but I also included the output from when I set things up below.
rclone config setup
$ rclone config
2023/05/08 13:26:18 NOTICE: Config file "/home/eric/.config/rclone/rclone.conf" not found - using defaults
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
Enter name for new remote.
name> google-drive-remote
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
[...]
18 / Google Drive
\ (drive)
[...]
Storage> 18
Option client_id.
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a value. Press Enter to leave empty.
client_id> xxx
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> xxx
Option scope.
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
1 / Full access all files, excluding Application Data Folder.
\ (drive)
2 / Read-only access to file metadata and file contents.
\ (drive.readonly)
/ Access to files created by rclone only.
3 | These are visible in the drive website.
| File authorization is revoked when the user deauthorizes the app.
\ (drive.file)
/ Allows read and write access to the Application Data folder.
4 | This is not visible in the drive website.
\ (drive.appfolder)
/ Allows read-only access to file metadata but
5 | does not allow any access to read or download file content.
\ (drive.metadata.readonly)
scope> 1
Option service_account_file.
Service Account Credentials JSON file path.
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a value. Press Enter to leave empty.
service_account_file>
Edit advanced config?
y) Yes
n) No (default)
y/n> n
Use web browser to automatically authenticate rclone with remote?
* Say Y if the machine running rclone has a web browser you can use
* Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.
y) Yes (default)
n) No
y/n> y
2023/05/08 13:33:30 NOTICE: Make sure your Redirect URL is set to "http://127.0.0.1:53682/" in your custom config.
2023/05/08 13:33:30 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=xxx
2023/05/08 13:33:30 NOTICE: Log in and authorize rclone for access
2023/05/08 13:33:30 NOTICE: Waiting for code...
2023/05/08 13:35:14 NOTICE: Got code
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> n
Configuration complete.
Options:
- type: drive
- client_id: xxx
- client_secret: xxx
- scope: drive
- token: {"access_token":"xxx","token_type":"Bearer","refresh_token":"xxx","expiry":"2023-05-08T14:35:13.748643158-05:00"}
- team_drive:
Keep this "google-drive-remote" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
google-drive-remote 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
Setup bisync
Then setup rclone bisync between your Google drive remote and a local folder and do an initial sync with the --resync flag to get things started.
A word of warning from the docs:
rclone bisync remote1:path1 remote2:path2 --resyncWarning: Path1 files may overwrite Path2 versions.
Consider using--verboseor--dry-runfirst.
This will effectively make both Path1 and Path2 filesystems contain a matching superset of all files. Path2 files that do not exist in Path1 will be copied to Path1, and the process will then sync the Path1 tree to Path2.
In terms of how to refer to your remote, this notice explained it pretty well:
NOTICE: "google-drive-remote" refers to a local folder, use "google-drive-remote:" to refer to your remote or "./google-drive-remote" to hide this warning
With all that being said, we can use the following command:
$ rclone bisync google-drive-remote: ~/google-drive/ --resync --drive-acknowledge-abuse
# Wait for it to finish...
2023/05/08 14:24:54 INFO : Bisync successful
2023/05/08 14:24:54 INFO :
Transferred: 31.500 KiB / 31.500 KiB, 100%, 117 B/s, ETA 0s
Checks: 6411 / 6411, 100%
Transferred: 1 / 1, 100%
Elapsed time: 6m39.8s
# If it fails, ----------------------------------------------------------------------------------------
# we can double-check what it will do on resync with a dry-run and then do a `--resync` again
$ rclone bisync google-drive-remote: ~/google-drive/ --resync --drive-acknowledge-abuse --dry-run --verbose
# Inspect the output to make sure it's doing sane things
$ rclone bisync google-drive-remote: ~/google-drive/ --resync --drive-acknowledge-abuse
# Wait for it to finish...
Automatically run the sync periodically/regularly
Then we need to setup a scheduled task to run the sync periodically. We're going to be using a systemd timer instead of a cron for a variety of benefits.
-
First create the service and timer unit files:
/etc/systemd/system/eric-rclone-bisync.service[Unit] Description=Run rclone bisync to sync Eric's Google Drive [Service] User=eric Group=eric ExecStart=rclone bisync google-drive-remote: ~/google-drive/ --drive-acknowledge-abuse/etc/systemd/system/eric-rclone-bisync.timer[Unit] Description=rclone bisync service timer [Timer] OnBootSec=0min # Run every 6 hours OnCalendar=*-*-* */6:00:00 Unit=eric-rclone-bisync.service [Install] WantedBy=multi-user.target -
Run
sudo systemctl daemon-reloadto makesystemdaware of the new files (this makessystemdreload all files and re-consider their dependencies) -
Enable the timer unit so the timer is enabled at boot every time:
sudo systemctl enable eric-rclone-bisync.timer -
To start the the timer unit immediately (without booting):
sudo systemctl start eric-rclone-bisync.timer -
To see the status of the timer and service:
sudo systemctl status eric-rclone-bisync.timer eric-rclone-bisync.service
Other references:
Problems
Unable to bisync Google Docs
When trying to sync after --resync, a bunch of Ignoring incorrect line for every file that then turns into Path2 file not found in Path1 later.
- Dominant language
- No language data
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MadLittleMods/linux-notes
-
x-needs-solution
Difficulty 4/5 3-5 days Newbie friendliness 35/100
MadLittleMods/linux-notes#60 ·
-
Setting up TailscaleOpen
Difficulty 5/5 Over a week Newbie friendliness 25/100
MadLittleMods/linux-notes#56 ·
-
A-Gaming x-needs-solution
Difficulty 5/5 Over a week Newbie friendliness 25/100
MadLittleMods/linux-notes#55 · 6 comments ·
-
A-Google-Chrome has-workaround
Difficulty 5/5 Over a week Newbie friendliness 25/100
MadLittleMods/linux-notes#36 ·
-
good-for-a-new-system x-needs-solution
Difficulty 4/5 3-5 days Newbie friendliness 25/100
MadLittleMods/linux-notes#34 ·
All issues in MadLittleMods/linux-notes
Similar issues
-
agent/sec-check hive/hive-school-tunaos security
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Sovereign-Labs/sovereign-sdk#3070 ·
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
gabrielmongefranco/privatium#84 ·
Maintainers usually reply within 1 day
-
reef build auto-fetch passes a lockfile `github://` origin to the ORG/REPO@TAG parser and fails on a cold registryPossibly taken A pull request linked to this issue is open or already merged. Openarea:ecosystem bug cli
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Chelis-Lang/chelis#3314 ·
Maintainers usually reply within 1 day
-
0. to triage
Difficulty 1/5 Under an hour Newbie friendliness 80/100