# DRestic Automated, encrypted, and deduplicated backups to MEGA cloud storage using restic. ## Setup 1. Clone the repository: ```sh git clone https://github.com/casparvitch/drestic cd drestic ``` 2. Install dependencies (supports apt, yum, pacman, zypper): ```sh make install-deps ``` 3. Run the setup script: ```sh # 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** ```sh # For user scope make status # For system scope make status-system ``` **Run a Backup Manually** ```sh make backup-now # Monitor with: journalctl --user -fu restic-backup.service ``` **List Snapshots** ```sh make snapshots ``` **Recover Files** The easiest method is to mount the repository. 1. Create a mount point: ```sh mkdir ~/restore ``` 2. 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`. ```sh # 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 ``` 3. Browse `~/restore/snapshots/latest/` to find your files. 4. Unmount when finished: ```sh 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: 1. Edit the timer file: - **User scope:** `~/.config/systemd/user/restic-backup.timer` - **System scope:** `/etc/systemd/system/restic-backup.timer` 2. Change the `OnCalendar=` line. 3. Reload systemd: ```sh # 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: ```sh make update-gotify ``` ## Troubleshooting **Repository is locked?** ```sh # Auto-detects scope and unlocks make unlock-repo ``` **Connection issues?** Verify rclone can connect to your MEGA account. ```sh rclone ls backup_remote: ``` **Something else?** Check the logs. ```sh # For user scope make logs # For system scope make logs-system ```