DRestic
Automated, encrypted, and deduplicated backups to MEGA cloud storage using restic.
Setup
- Clone the repository:
git clone https://github.com/casparvitch/drestic
cd drestic
- Install dependencies (supports apt, yum, pacman, zypper):
make install-deps
- Run the setup script:
# For a personal machine (backs up /home/user)
make setup-user
# For a server (backs up /etc, /home, /root, etc.)
# make setup-system
The script will prompt for your MEGA credentials and a new restic repository password. **Store the restic password safely.**
Usage
All common operations are handled via the Makefile. Run make help for a full list.
Check Status
# For user scope
make status
# For system scope
make status-system
Run a Backup Manually
make backup-now
# Monitor with: journalctl --user -fu restic-backup.service
List Snapshots
make snapshots
Recover Files The easiest method is to mount the repository.
- Create a mount point:
mkdir ~/restore
- Mount the backup:
The repository path is now unique per host (e.g.,
drestic_backups_my-server). Find your exact path in~/.config/restic/env.
# For user scope (replace with your unique repo path)
RESTIC_PASSWORD_FILE=~/.config/restic/password restic mount ~/restore --repo rclone:backup_remote:/drestic_backups_my-server
-
Browse
~/restore/snapshots/latest/to find your files. -
Unmount when finished:
umount ~/restore
Configuration
Configuration files are created during setup.
Backup Paths & Exclusions
- User scope: ~/.config/restic/paths and ~/.config/restic/excludes
- System scope: /etc/restic/paths and /etc/restic/excludes
Edit the paths file to change what is backed up. Edit the excludes file to add patterns to ignore. The default files contain a sensible starting point.
Backup Schedule The schedule is managed by systemd timers. To change the daily 3 AM backup time:
-
Edit the timer file:
- User scope:
~/.config/systemd/user/restic-backup.timer - System scope:
/etc/systemd/system/restic-backup.timer
- User scope:
-
Change the
OnCalendar=line. -
Reload systemd:
# For user scope
systemctl --user daemon-reload && systemctl --user restart restic-backup.timer
# For system scope
sudo systemctl daemon-reload && sudo systemctl restart restic-backup.timer
Notifications To add or update Gotify push notifications, run:
make update-gotify
Troubleshooting
Repository is locked?
# Auto-detects scope and unlocks
make unlock-repo
Connection issues? Verify rclone can connect to your MEGA account.
rclone ls backup_remote:
Something else? Check the logs.
# For user scope
make logs
# For system scope
make logs-system
