Repository, snapshot, and content-defined chunking are the three pillars of restic's architecture. This episode dissects the repository directory structure, the role of each component (binary, backend, key repository, and command), and the data flow from source files to encrypted blobs in storage.

In episode 1 you understood why restic exists. Now it is time to break down how it works. This episode is the foundation for the entire series: once you understand repository, snapshot, and chunking, all the commands in episodes 3–22 are just variations of these three concepts.
A repository is a collection of encrypted data that holds all snapshots. It can live in a local directory, on an SFTP server, in an S3 bucket, or on a rest-server. Inside it, data is split into small encrypted blobs — nothing can be read without the key.
A snapshot is the state of a directory (or set of directories) at a specific point in time. Think of it like a full-resolution photo: it records the file contents, metadata, and the relationships between files at the moment it was taken. A snapshot does not store physical copies of files — it stores references to the blobs that make up each file's contents. This is what makes restic snapshots efficient and immutable.
For deduplication to work, files are split into chunks using a content-defined chunking algorithm: chunk boundaries are determined by the data content (via a rolling hash), not by byte position. As a result:
Each chunk is then compressed, encrypted, and stored as a blob in the repository.
Let's peek inside an initialized repository:
/backup/restic/
├── config
├── data/
├── index/
├── keys/
└── snapshots/config — repository version and cryptographic parameters (for example: version: 2).data/ — encrypted blobs, split across many sub-directories.index/ — the blob catalog: which file contains which blob.keys/ — encrypted keys (one per repository password).snapshots/ — snapshot metadata stored as small files.restic BinaryA single program (single binary) with no runtime dependencies — one of the reasons restic is easy to install, copy between servers, and containerize.
An abstract storage layer: local, SFTP, S3-compatible, B2, Azure, GCS, and REST server. The same commands work on every backend — only the repository URL (-r) changes. Episode 7 covers this thoroughly.
The repository password is used to decrypt the key that holds the master key. Without this password the repository is impossible to access — which is why storing it safely matters (episodes 3 and 13).
restic init # create a new repository
restic backup # save a new snapshot
restic restore # restore files from a snapshot
restic check # verify repository integrity
restic forget # remove snapshots according to policy
restic prune # remove unused blobsWhen restic backup /data is run:
Note point 3: this is why the second backup onward feels much faster — only the delta is uploaded.
Note
A restic backup is not a mirror — it stores versions. The consequence is that storage grows with the snapshot history, and managing it requires a retention policy (restic forget --prune), which is covered in episode 8.
config, data/, index/, keys/, snapshots/.In the next episode, episode 3, we perform the first action on a real repository: repository initialization — restic init for local and S3 backends, managing the password securely, and the mistakes you should avoid from the very beginning.