Table of Contents
Today I was cleaning up some old files on my home computer and found my local backup setup script. I set it up more than a year ago using restic and Backblaze B2 for cloud storage.
- Restic is a fast, secure backup program for Linux that uses encryption and deduplication to create efficient snapshots of your files to local or remote storage.
- Backblaze B2 is an S3-compatible cloud storage service designed for backups and archives, offers cheaper storage than AWS or Google Cloud.
I’m a believer in the setup once and forget mentality. The script backs up selected files and directories from my computer to B2 cloud storage every 2 weeks and sends me a notification once the backup operation is done and the restic checks pass. Every 6 months or so I’ll poke at it to make sure backups are actually there and working.
Luckily I’ve never had to do a full restore, but the setup works and I’m not worried about losing my stuff if my hard drive dies tomorrow. This is just for my main computer, nothing server-related. Just personal files that I’d be annoyed to lose.
Why Restic and B2?
Yes, I could use Microsoft’s OneDrive, Google Drive, Dropbox, etc. but I don’t like their privacy practices and the fact they are constantly running. I just need a simple automated backup solution with minimal footprint on my machine.

Restic encrypts everything with AES-256, deduplicates data automatically, and works with basically any storage backend.
Backblaze B2 is I believe the cheapest cloud storage option (compared to Cloudflare R2, AWS S3, or Google Cloud) and is pretty reliable. I trust the Backblaze team. For personal backups where I’m hopefully never downloading anything, this works out great. First 3x your storage is free for downloads, then it’s $0.01/GB after that.
Plus B2 is S3-compatible, which means if I ever want to switch to Cloudflare R2 or whatever, I just change the repository URL. Same script, different backend (I’m not locked into any provider).

The Setup
The setup is just a shell script that checks that config files exist, loads the credentials, and verifies the backup is done correctly by running restic check at the end.
Script: restic-backup.sh
What Gets Backed Up?
Configuration files specify which directories should be backed up and which patterns should be excluded. If I need to modify the existing backup paths just edit the file.
# Example backup path config file
~/Documents
~/Pictures
~/.ssh
Secrets Management
Secrets (B2 API keys and restic repository password) are stored in a file with 0600 permissions, so only my local user has access to it. This is not the most secure way to handle secrets, but I’ve been lazy to migrate to a more secure option.
# Example secrets
B2_ACCOUNT_ID="0123456789abcdef01234567"
B2_ACCOUNT_KEY="K001aBcDeFgHiJkLmNoPqRsTuVwXyZ"
RESTIC_REPOSITORY="b2:my-backup-bucket:restic"
Automation
Systemd makes things easy. I just created a .service unit for executing the script and a .timer unit to run the service at regular intervals.
The service runs as my regular user account so no root access is needed, but you can run as root if needed.
OnCalendar=*-*-01,15 02:30:00
Persistent=true
RandomizedDelaySec=30min
Once the service is executed, I have a custom binary that notifies me over Signal the backup details and execution status. This is optional, but convenient step. You can also see the output in the systemd journal.
Output
The resulting output looks something like this
=============================================
BACKUP SUCCESSFUL
=============================================
Timestamp: 2026-01-12 01:26:01
Repository: b2:MyBucket:repo_dir
Source Dirs: /home/user/.bashrc.d/ /home/user/Backup/
-------------- Restic Summary ---------------
Files: 0 new, 1 changed, 12831 unmodified
Dirs: 0 new, 4 changed, 4701 unmodified
Data Added: 180KiB
Total Processed: 232MiB
Duration: 0m 6s
Snapshot ID: e6011222
---------------------------------------------
Verifying backup integrity...
✓ Backup verification successful
Why This?
This is not the best backup management system but I don’t need web interfaces, GUI, synchronization across devices, or many other features. Backing up a single main computer should be simple, with minimal dependencies, and invisible. This has it all, even if there are more secure and fully featured options out there.
Would I migrate to another backup solution? In the future, yes. Secret security needs to improve and some QoL features would be nice, hopefully I can make time to improve the script. Hope I don’t forget.