DRestic
Automated encrypted backups to MEGA using restic.
Setup
git clone https://github.com/casparvitch/drestic
cd drestic
make install-deps
make setup-user # or setup-system for servers
Enter MEGA credentials and restic password when prompted. Store the restic password safely.
Usage
make help # see all commands
make status # check backup status
make backup-now # run backup immediately
make snapshots # list backups
Recover files:
mkdir ~/restore
# Replace with your repo path from ~/.config/restic/env
RESTIC_PASSWORD_FILE=~/.config/restic/password restic mount ~/restore --repo rclone:backup_remote:/drestic_backups_hostname
# Browse ~/restore/snapshots/latest/
umount ~/restore
Configuration
Edit backup paths: ~/.config/restic/paths (user) or /etc/restic/paths (system)
Edit excludes: ~/.config/restic/excludes
Add notifications: make update-gotify
Manual Checks
Automated: Metadata-only weekly checks (catches 95% of issues)
Manual verification:
# Quick metadata check (~50MB RAM, 1-2 min)
source ~/.config/restic/env && restic check --repo "$RESTIC_REPOSITORY" --password-file "$RESTIC_PASSWORD_FILE"
# Light data check (~200MB RAM, 5-15 min)
source ~/.config/restic/env && restic check --repo "$RESTIC_REPOSITORY" --password-file "$RESTIC_PASSWORD_FILE" --read-data-subset 0.1%
# Heavy data check (~500MB+ RAM, 30+ min)
source ~/.config/restic/env && restic check --repo "$RESTIC_REPOSITORY" --password-file "$RESTIC_PASSWORD_FILE" --read-data-subset 1%
From another machine:
# Setup: install restic, rclone
rclone config create backup_remote mega user EMAIL pass PASSWORD
echo "PASSWORD" > ~/.restic_password && chmod 600 ~/.restic_password
restic check --repo rclone:backup_remote:/drestic_backups_HOSTNAME --password-file ~/.restic_password --read-data-subset 0.1%
When: Monthly 0.1% checks, quarterly 1% checks, or troubleshooting.
Troubleshooting
make unlock-repo # fix locked repository
make logs # check recent logs
rclone ls backup_remote: # test MEGA connection
