Skip to content

Cloud Backup with rclone

Set up automatic backups of your DEEPS data to Google Drive using rclone.


Overview

This guide shows how to configure push-only backups to Google Drive. Your local files are uploaded to the cloud, but nothing is downloaded from Google Drive to your computer.

What Gets Backed Up

The DEEPS resources/data/ folder containing:

  • inputs/ - Scoresheets by academic year
  • outputs/ - Generated documents
  • images/ - University logo, signatures
  • rules/ - Engineering rules JSON
  • units/ - Unit codes and assessments JSON

Install rclone

sudo apt install rclone -y
sudo dnf install rclone
brew install rclone

Download from rclone.org/downloads


Configure Google Drive Remote

Step 1: Start Configuration

rclone config

Step 2: Create New Remote

When prompted:

Prompt Enter
n/s/q> n (new remote)
Name gdrive (or any memorable name)
Storage type drive (Google Drive)
Client ID leave blank (press Enter)
Client Secret leave blank (press Enter)
Scope 1 (full access)
Root folder ID leave blank
Service account leave blank
Advanced config n
Auto config y (opens browser to authenticate)
Team Drive n
Confirm y

Step 3: Verify Setup

rclone listremotes
# Should show: gdrive:

Multiple Google Accounts

Run rclone config again with a different name (e.g., gdrive-backup) to add a second Google Drive account for redundant backups.


Manual Backup

Push your DEEPS data folder to Google Drive:

rclone copy /path/to/deeps/resources/data gdrive:DEEPS/backup --progress

Replace /path/to/deeps/resources/data with your actual DEEPS data folder path.

Check What's on Google Drive

# List files
rclone ls gdrive:DEEPS/backup | head -20

# List directories
rclone lsd gdrive:DEEPS/backup

# Check total size
rclone size gdrive:DEEPS/backup

Dry Run (Preview)

See what would be uploaded without actually uploading:

rclone copy /path/to/deeps/resources/data gdrive:DEEPS/backup --dry-run

Automatic Backup (Linux)

Set up systemd services to automatically backup when files change.

Prerequisites

sudo apt install inotify-tools

Create Service File

Create ~/.config/systemd/user/deeps-backup.service:

[Unit]
Description=DEEPS Google Drive Backup (Push Only)
After=network-online.target

[Service]
Type=simple
ExecStart=/bin/bash -c 'while inotifywait -r -e modify,create,delete,move /path/to/deeps/resources/data 2>/dev/null; do sleep 2; rclone copy /path/to/deeps/resources/data gdrive:DEEPS/backup --quiet; done'
Restart=on-failure
RestartSec=5

[Install]
WantedBy=default.target

Update Paths

Replace /path/to/deeps/resources/data with your actual path and gdrive with your remote name.

Create Timer (Alternative)

For periodic backups instead of real-time, create ~/.config/systemd/user/deeps-backup.timer:

[Unit]
Description=DEEPS Backup Timer

[Timer]
OnBootSec=5min
OnUnitActiveSec=30min
Persistent=true

[Install]
WantedBy=timers.target

Enable Services

# Reload systemd
systemctl --user daemon-reload

# Option 1: Real-time (watches for changes)
systemctl --user enable --now deeps-backup.service

# Option 2: Every 30 minutes
systemctl --user enable --now deeps-backup.timer

# Allow services to run at boot
sudo loginctl enable-linger $USER

Check Status

systemctl --user status deeps-backup.service
systemctl --user list-timers
journalctl --user -u deeps-backup.service -f

Deletion Behavior

Action Result
Delete locally File stays on Google Drive
Delete on Drive File gets re-uploaded on next sync

This is intentional - Google Drive acts as an archive. Local deletions don't propagate to the cloud.

To Permanently Delete

  1. Delete the file locally
  2. Delete from Google Drive manually

Maintenance

Reconnect (if auth expires)

rclone config reconnect gdrive:

Test Connection

rclone lsd gdrive: --max-depth 1

Troubleshooting

Authentication Failed

Run rclone config reconnect gdrive: to re-authenticate.

Files Not Uploading
  • Check the path in your service file is correct
  • Verify with rclone copy ... --dry-run first
  • Check logs: journalctl --user -u deeps-backup.service
Service Not Starting
systemctl --user daemon-reload
systemctl --user restart deeps-backup.service

For more rclone options, see rclone.org/docs