What are repositories?
A repository in Zerobyte is an encrypted storage location where your backup snapshots are stored. Powered by Restic, repositories provide:- End-to-end encryption using AES-256 in counter mode with Poly1305-AES for authentication
- Deduplication at the chunk level to minimize storage usage
- Compression with configurable modes (off, auto, max)
- Immutable snapshots that can’t be modified once created
- Incremental backups that only store changed data
Why repositories matter
Repositories are the “where” in your backup strategy. They separate the backup destination from the source, providing:Data sovereignty
You control where your encrypted data is stored. Choose:- On-premises storage for data that can’t leave your infrastructure
- Cloud storage for offsite protection and disaster recovery
- Hybrid approaches using repository mirrors
Encryption by default
Every repository is encrypted with a password (stored per-organization in Zerobyte). Even if an attacker gains access to your S3 bucket or backup disk, they cannot read your data without the password.Storage efficiency
Restic’s content-defined chunking and deduplication means:- Only changed blocks are stored in incremental backups
- Identical files across different backups share storage
- Moved or renamed files don’t consume additional space
Bandwidth controls
Zerobyte allows you to limit upload and download bandwidth per repository, preventing backups from saturating your network connection.Repository lifecycle
Repositories follow this lifecycle in Zerobyte:Status states
Supported repository backends
Zerobyte supports eight backend types, each optimized for different storage scenarios.Local (filesystem)
Store repositories on locally attached disks or mounted filesystems. Use cases:- Fast local backups to NAS devices
- USB-attached backup drives
- High-speed recovery scenarios
For new repositories, Zerobyte automatically appends the repository’s
shortId to the path to ensure isolation.Amazon S3 (and S3-compatible)
Store backups on Amazon S3 or S3-compatible services (MinIO, Wasabi, Backblaze B2, etc.). Use cases:- Cloud-native backup storage
- Long-term archival with lifecycle policies
- Globally distributed backup targets
- AWS S3 -
s3.amazonaws.comor regional endpoints - MinIO -
https://minio.example.com - Wasabi -
s3.wasabisys.com - Backblaze B2 -
s3.us-west-000.backblazeb2.com - DigitalOcean Spaces -
nyc3.digitaloceanspaces.com
Cloudflare R2
Cloudflare R2 is S3-compatible object storage with zero egress fees, making it ideal for frequent restores. Use cases:- Cost-effective cloud backups
- Frequent restore operations
- Global edge storage
Google Cloud Storage (GCS)
Store backups on Google Cloud Platform’s object storage service. Use cases:- GCP-native backup storage
- Integration with existing GCP infrastructure
- Nearline/Coldline storage classes for cost savings
The
credentialsJson should be a service account key with storage.objects.create, storage.objects.delete, and storage.objects.get permissions.Azure Blob Storage
Microsoft Azure’s object storage service for enterprise backup scenarios. Use cases:- Azure-native backup storage
- Compliance with Microsoft cloud requirements
- Hot/Cool/Archive tier optimization
Rclone (40+ backends)
Access any of rclone’s 40+ supported backends including Dropbox, Google Drive, OneDrive, and more. Use cases:- Exotic cloud storage providers
- Consumer cloud storage (with caveats)
- Cross-cloud backup strategies
REST server
Connect to a Restic REST server for network-based backup storage. Use cases:- Self-hosted backup servers
- Custom backup infrastructure
- REST-based backup appliances
SFTP
Store repositories on remote servers accessible via SSH. Use cases:- Backup to remote Linux servers
- VPS-based offsite storage
- SSH-accessible backup targets
Compression modes
Zerobyte supports three compression modes that control how Restic compresses backup data:Auto (default)
Auto (default)
Restic automatically decides whether to compress based on file type. This provides the best balance of speed and space savings.Recommended for: Most use cases
Off
Off
No compression is applied. Useful when backing up already-compressed data (videos, archives, compressed images) to avoid CPU overhead.Recommended for: Media libraries, pre-compressed archives
Max
Max
Maximum compression using zstd level 15. Provides best space savings at the cost of CPU time.Recommended for: Text-heavy data, source code, databases (when CPU is not a bottleneck)
Bandwidth limiting
Control network usage by configuring upload and download limits per repository.Upload limits
Limit the speed at which Restic sends data to the repository during backup operations:- Prevent backups from saturating production network links
- Comply with ISP bandwidth caps
- Ensure other services remain responsive during backups
Download limits
Limit the speed at which Restic retrieves data during restore or snapshot operations:- Control egress costs on cloud providers
- Prevent restore operations from consuming all available bandwidth
Repository operations
Zerobyte provides several operations for managing repository health and integrity:Health check
Runsrestic check to verify:
- Repository structure is intact
- All pack files are readable
- Index consistency
lastChecked timestamp.
Doctor (maintenance)
A comprehensive maintenance operation that runs:- Check - Verify repository integrity
- Check —read-data - Deep integrity check reading all data
- Rebuild-index - Reconstruct the repository index
- Prune - Remove unused data and reclaim space
Unlock
Removes stale locks from the repository. Useful when:- A backup or restore operation was forcefully terminated
- Zerobyte crashed during a repository operation
- The repository shows “repository is locked” errors
Only run unlock if you’re certain no other Restic operations are accessing the repository.
How repositories work in Zerobyte
Repository initialization
When you create a new repository (not marked as existing), Zerobyte:- Encrypts sensitive credentials using
cryptoUtils.sealSecret() - Generates a unique
shortIdfor the repository - For local backends, appends the
shortIdto the path - Runs
restic initwith the organization’s restic password - Verifies initialization by listing snapshots
- Updates status to “healthy” on success
Credential encryption
All sensitive fields are encrypted before storage:Repository locking (mutex)
Zerobyte uses a repository mutex (repoMutex) to coordinate concurrent access:
- Shared locks - Multiple read operations (backup, snapshots, restore) can run concurrently
- Exclusive locks - Write operations (forget, prune, check, doctor) block all other access
Caching
Zerobyte caches expensive repository operations to improve UI responsiveness:- Snapshot lists - Cached for faster browsing
- Repository stats - Cached to avoid repeated
restic statscalls - Retention categories - Cached retention policy calculations
- New backups complete
- Snapshots are deleted
- Retention policies run
- Repository configuration changes
Database schema
Repositories are stored inrepositories_table:
Snapshots
Each backup creates a snapshot in the repository. Snapshots are:- Immutable - Cannot be modified after creation
- Incremental - Only store changed data
- Tagged - Automatically tagged with backup schedule
shortId - Browsable - File-level browsing via
restic ls
Mirror repositories
Zerobyte supports copying snapshots to mirror repositories for:- Geographic redundancy - Store copies in different regions
- Provider diversification - Don’t rely on a single cloud provider
- Compliance - Meet data locality requirements
Best practices
Use separate repositories for different data classes
Use separate repositories for different data classes
Create distinct repositories for:
- Critical data - Fast, expensive storage with frequent retention
- Archive data - Cheap, slow storage with long retention
- Test/development - Separate from production
Enable bandwidth limits for cloud repositories
Enable bandwidth limits for cloud repositories
Prevent backup operations from saturating your internet connection, especially during business hours.
Run doctor monthly for production repositories
Run doctor monthly for production repositories
Schedule monthly maintenance using the doctor operation to:
- Verify data integrity
- Reclaim storage from deleted snapshots
- Rebuild corrupted indexes
Use custom passwords sparingly
Use custom passwords sparingly
By default, all repositories in an organization share the same Restic password. Only use
customPassword if you need repository-level isolation (increases key management complexity).Test restore operations regularly
Test restore operations regularly
Backups are only as good as your ability to restore. Schedule periodic restore tests to verify:
- Data can be recovered
- Recovery time meets your RTO
- Restored data is complete and consistent
Monitor repository health
Monitor repository health
Set up alerts for:
- Repository status changes to “error”
- Failed doctor operations
- Unexpected growth in repository size
Next steps
Understand backups
Learn how backup schedules create snapshots in repositories
Retention policies
Configure how long snapshots are kept in repositories
Repository setup guide
Step-by-step instructions for creating repositories
Rclone integration
Access 40+ storage backends via rclone
