rclone ile Saatlik Google Drive Yedekleme (CachyOS)

CachyOS üzerinde ~/Desktop ve ~/Downloads klasörlerini tek yönlü olarak Google Drive’a yedekleyen kurulum. Saatte bir otomatik çalışır, sistemi yavaşlatmaz.

Genel Mimari

  • Tek yön: Local → Drive. Local’de silinen Drive’dan da silinir. Drive’daki değişiklikler local’i etkilemez.
  • Hedef: gdrive:Backup/Desktop ve gdrive:Backup/Downloads
  • Tetikleme: systemd user timer, her 1 saatte bir
  • Öncelik: Nice 19 + IO idle (sistemi yavaşlatmaz)

Kurulum Adımları

1. rclone kurulum ve yapılandırma

sudo pacman -S rclone
rclone config

rclone config içinde:

  • n (new remote), name: gdrive
  • Storage: drive (Google Drive)
  • client_id / secret: boş
  • scope: 1 (full access)
  • Auto config: y → tarayıcıda Google ile giriş
  • Shared Drive: n

2. Hedef klasörleri oluştur

rclone mkdir gdrive:Backup/Desktop
rclone mkdir gdrive:Backup/Downloads

3. İlk manuel sync

rclone sync ~/Desktop gdrive:Backup/Desktop -P --exclude '.venv/**' --exclude 'venv/**' --exclude '__pycache__/**' --exclude 'node_modules/**' --exclude '.git/**' --exclude '*.pyc' --exclude '.cache/**' --exclude '.DS_Store'
 
rclone sync ~/Downloads gdrive:Backup/Downloads -P --exclude '*.part' --exclude '*.crdownload' --exclude '.DS_Store'

Not: Fish’te backslash ile satır kırma sorun çıkarıyor, tek satır olarak yaz.

4. Yedekleme script’i

~/.local/bin/rclone-backup.sh:

#!/bin/sh
set -e
LOG="$HOME/.local/state/rclone-backup.log"
mkdir -p "$(dirname "$LOG")"
echo "=== $(date -Iseconds) backup started ===" >> "$LOG"
 
rclone sync "$HOME/Desktop" gdrive:Backup/Desktop \
  --exclude '.venv/**' --exclude 'venv/**' --exclude '__pycache__/**' \
  --exclude 'node_modules/**' --exclude '.git/**' --exclude '*.pyc' \
  --exclude '.cache/**' --exclude '.DS_Store' \
  --log-file="$LOG" --log-level INFO
 
rclone sync "$HOME/Downloads" gdrive:Backup/Downloads \
  --exclude '*.part' --exclude '*.crdownload' --exclude '.DS_Store' \
  --log-file="$LOG" --log-level INFO
 
echo "=== $(date -Iseconds) backup finished ===" >> "$LOG"
chmod +x ~/.local/bin/rclone-backup.sh

5. systemd service

~/.config/systemd/user/rclone-backup.service:

[Unit]
Description=rclone Desktop+Downloads -> Google Drive backup
After=network-online.target
Wants=network-online.target
 
[Service]
Type=oneshot
ExecStart=%h/.local/bin/rclone-backup.sh
Nice=19
IOSchedulingClass=idle

6. systemd timer

~/.config/systemd/user/rclone-backup.timer:

[Unit]
Description=Hourly rclone backup (Desktop+Downloads -> gdrive)
 
[Timer]
OnBootSec=10min
OnUnitActiveSec=1h
Persistent=true
 
[Install]
WantedBy=timers.target

7. Etkinleştir

systemctl --user daemon-reload
systemctl --user enable --now rclone-backup.timer

Günlük Komutlar

NeKomut
Timer durumunu görsystemctl --user list-timers rclone-backup.timer
Servis durumunu görsystemctl --user status rclone-backup.service
Manuel tetiklesystemctl --user start rclone-backup.service
Durdur (geçici)systemctl --user stop rclone-backup.service
Timer’ı kapatsystemctl --user disable --now rclone-backup.timer
Logtail -f ~/.local/state/rclone-backup.log
Çalışan rclone’ları görpgrep -a rclone
Drive disk durumurclone about gdrive:

Sıklığı Değiştirmek

~/.config/systemd/user/rclone-backup.timer içinde OnUnitActiveSec=1h değerini 3h, 6h, 12h gibi değiştir, sonra:

systemctl --user daemon-reload
systemctl --user restart rclone-backup.timer

Dikkat Edilenler / Öğrenilenler

  • Symlink’ler: .venv içindeki Python symlink’leri rclone’u uyarıyor — zaten exclude’luyoruz.
  • Yarım indirmeler: *.part ve *.crdownload exclude’landı.
  • Çakışma: Manuel rclone sync çalışırken timer da tetiklerse iki process aynı anda Drive’a yazmaya çalışır. Manuel sync bitene kadar servisi durdur: systemctl --user stop rclone-backup.service (timer açık kalabilir).
  • Vault yedekleme: Bu kurulum sadece Desktop + Downloads içindir. Obsidian vault’unu bu yöntemle yedekleme — conflict riski yüksek, ayrıca çözülmeli (Syncthing / Obsidian Sync).
  • Insync alternatifi: Ücretli (~30$) gerçek iki yönlü sync istersen yay -S insync. Bu kurulumu kullanıyorsan gerek yok.

İlk Sync Boyutları

  • Desktop: ~19.5 GiB (exclude’lar sonrası daha az)
  • Downloads: ~21.9 GiB, 7m52s sürdü (~50 MiB/s)