Repository Format
rustic_core maintains full compatibility with restic repositories, allowing you to use the same repository with both tools. The repository format is well-defined and stable.Repository compatibility means you can:
- Create a repository with rustic and restore with restic (or vice versa)
- Migrate between tools seamlessly
- Use rustic’s performance improvements on existing restic repositories
Directory Structure
A repository consists of several subdirectories, each serving a specific purpose:Configuration File
Theconfig file stores repository-wide settings:
- Repository ID: Unique identifier
- Version: Format version (1 or 2)
- Chunker settings: Polynomial, chunk sizes
- Compression: Level and algorithm (version 2 only)
- Pack sizes: Tree and data pack size parameters
Keys Directory
Stores encrypted master keys, each protected by a password using scrypt key derivation. Multiple keys can exist, allowing different passwords for the same repository.Snapshots Directory
Contains JSON files describing each snapshot’s metadata:- Timestamp
- Hostname and paths
- Tags and labels
- Parent snapshot references
- Root tree ID
Index Directory
Stores index files mapping blob IDs to their location in pack files. The index enables efficient data lookup without scanning all packs.Data Directory
Contains pack files with actual encrypted and compressed data, organized into 256 subdirectories (00-ff) based on the first byte of the pack ID.Repository States
The repository transitions through different states during its lifecycle, represented as type-safe states in Rust:Uninitialized
Initial state before opening. Only basic operations like checking for existence are available.
These states are enforced at compile-time using Rust’s type system, preventing invalid operations.
Hot/Cold Repository Architecture
rustic_core supports a hot/cold split for repositories, enabling tiered storage:Hot Repository
Fast, frequently-accessed storage for:
- Recent snapshots
- Index files
- Tree data
- Small metadata
Cold Repository
Slower, archival storage for:
- All data packs
- Complete backup history
- Long-term retention
How It Works
In a hot/cold setup:- Writes go to both hot and cold backends
- Reads prioritize the hot backend for cacheable data
- Large data blobs are read from cold storage
- Metadata and indexes stay on fast storage
Repository Lifecycle
Initialization
Create a new repository with specified parameters:- Creates the directory structure
- Generates and encrypts a master key
- Saves the configuration file
- Returns an opened repository
Opening
Open an existing repository:- Lists config files (validates single config exists)
- Verifies keys in hot/cold backends match (if applicable)
- Finds the correct key for the password
- Decrypts and loads configuration
- Initializes cache (if enabled)
Indexing
Load the repository index for operations:Repository Options
Key configuration options when creating/opening repositories:| Option | Description | Default |
|---|---|---|
no_cache | Disable local caching | false |
cache_dir | Custom cache directory | System default |
warm_up | Pre-fetch pack files | false |
warm_up_command | Custom warm-up command | None |
See Also
Snapshots
Learn about snapshot metadata and organization
Encryption
Understand repository encryption and security
Backends
Explore storage backend options
Deduplication
See how data deduplication works