Backup guide

Restic backup to S3: from first snapshot to tested restore

Use restic when you want encrypted snapshots of your files in cloud storage. This walkthrough connects restic to NordenVault, backs up a small test folder and restores it before you automate the job.

What you need before starting

Install a current restic release using the official installation instructions. In NordenVault, create a backup source and copy its bucket name, access key and secret key. Use a dedicated source for this machine or workload so its credentials can be managed separately.

The examples use a Unix-like shell on Linux or macOS. Replace every uppercase placeholder. Windows users can run restic too, but PowerShell uses different environment-variable syntax. Keep credentials out of screenshots, shared scripts and source control.

1. Connect to your S3 repository

export AWS_ACCESS_KEY_ID="YOUR_ACCESS_KEY"
export AWS_SECRET_ACCESS_KEY="YOUR_SECRET_KEY"
export RESTIC_REPOSITORY="s3:https://s3.nordenvault.com/YOUR_BUCKET/restic"
restic init

Restic asks you to create a repository password. Save it in a password manager and keep a recovery copy that you can reach if this computer is lost. The repository password and your NordenVault login serve different purposes. Losing the restic password can make the repository unreadable.

The restic S3 documentation describes this endpoint format and authentication. A repository is a set of objects managed by restic. Give it a dedicated prefix, and keep ordinary file uploads out of that prefix.

2. Back up a small folder first

restic backup /path/to/test-folder
restic snapshots

Choose a folder containing a few files you can recognise. Check that the completed snapshot lists the expected path. Restic creates snapshots and can reuse data already in the repository on subsequent runs. Storage use still depends on your file changes and the snapshots you retain.

Read the job output. An exit status of 0 means success; status 3 means some source files could not be read, even though a partial snapshot may exist. A scheduled job must report that condition. See restic backup exit codes.

3. Check the repository and restore the files

restic check
restic restore latest --target /path/to/empty-restore-test

Use a new destination directory. Open several restored files and compare them with the originals. Record the snapshot ID, the date and how long recovery took. This tests the steps you would need on another computer, including access to the repository password.

The normal repository check validates its structure. For a deeper data-integrity check, restic supports check --read-data. That reads repository data and can take substantial time and network transfer. Consult repository checks and the restore reference when planning larger tests.

4. Schedule backups and set retention deliberately

After the test, replace the sample source with the directories you need. Schedule restic using your operating system’s scheduler. Store unattended-job secrets in a protected file or credential store accessible only to the account running the job. Monitor failures and prevent overlapping runs.

Decide how far back you need to recover before enabling deletion or pruning. Restic snapshot retention and the storage provider’s object-version or retention settings are separate controls. Review them together. We have deliberately left destructive cleanup commands out of the first-backup steps.

Files, databases and recovery scope

A file backup of an actively changing database directory may not be a consistent database backup. Create an application-consistent export or use the database’s backup tooling first. NordenVault has separate guides for PostgreSQL and MySQL.

Restic encrypts backup contents on the client. That does not by itself make the repository immutable, and a working file restore does not prove a complete server can be rebuilt. Keep an independent recovery plan for operating systems, applications, keys and configuration.

Common connection problems

  • Access denied: confirm the bucket and source credentials, including permission to read and write the repository.
  • Wrong password: confirm you are opening the intended repository with its restic password.
  • Endpoint or region error: use the S3 endpoint from your source configuration and review restic’s S3 options.
  • Missing files: check source paths, filesystem permissions and backup output before relying on the schedule.