97 lines
2.1 KiB
Markdown
97 lines
2.1 KiB
Markdown
# rclone google drive
|
|
|
|
Related: [[homelab]]
|
|
|
|
## Current setup
|
|
|
|
This machine (`lifebalance`) is configured to access Google Drive through `rclone`.
|
|
|
|
* Remote name: `gdrive`
|
|
* Config file: `~/.config/rclone/rclone.conf`
|
|
* Mount point: `~/gdrive`
|
|
* Auth flow used: local browser OAuth on the machine during `rclone config create`
|
|
|
|
## Installation
|
|
|
|
Installed from Debian packages:
|
|
|
|
```bash
|
|
sudo apt-get update
|
|
sudo apt-get install -y rclone
|
|
```
|
|
|
|
## Remote configuration
|
|
|
|
The Google Drive remote was created with full-drive scope and verified successfully.
|
|
|
|
Useful commands:
|
|
|
|
```bash
|
|
rclone listremotes
|
|
rclone lsd gdrive:
|
|
rclone ls gdrive:docs
|
|
```
|
|
|
|
## Persistent mount
|
|
|
|
The Drive mount is managed by a user systemd service.
|
|
|
|
* Service file: `~/.config/systemd/user/rclone-gdrive.service`
|
|
* Mount command:
|
|
|
|
```bash
|
|
/usr/bin/rclone mount gdrive: /home/ben/gdrive --config=/home/ben/.config/rclone/rclone.conf --vfs-cache-mode=writes
|
|
```
|
|
|
|
Service contents:
|
|
|
|
```ini
|
|
[Unit]
|
|
Description=Rclone mount for Google Drive
|
|
Wants=network-online.target
|
|
After=network-online.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
ExecStart=/usr/bin/rclone mount gdrive: /home/ben/gdrive --config=/home/ben/.config/rclone/rclone.conf --vfs-cache-mode=writes
|
|
ExecStop=/usr/bin/fusermount3 -uz /home/ben/gdrive
|
|
Restart=on-failure
|
|
RestartSec=10
|
|
|
|
[Install]
|
|
WantedBy=default.target
|
|
```
|
|
|
|
## Service management
|
|
|
|
```bash
|
|
systemctl --user daemon-reload
|
|
systemctl --user enable --now rclone-gdrive.service
|
|
systemctl --user status rclone-gdrive.service
|
|
systemctl --user restart rclone-gdrive.service
|
|
systemctl --user stop rclone-gdrive.service
|
|
systemctl --user start rclone-gdrive.service
|
|
```
|
|
|
|
Note: this mount starts automatically when the user session starts. If it should start before login after reboot, enable lingering for the user.
|
|
|
|
## Verification
|
|
|
|
These checks succeeded:
|
|
|
|
```bash
|
|
mountpoint ~/gdrive
|
|
ls ~/gdrive
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
If the mount stops working:
|
|
|
|
```bash
|
|
systemctl --user status rclone-gdrive.service
|
|
journalctl --user -u rclone-gdrive.service -n 100 --no-pager
|
|
fusermount3 -uz ~/gdrive
|
|
systemctl --user restart rclone-gdrive.service
|
|
```
|