Skip to content

Restoring Data

Vecta records Restic snapshots and provides a command for restoring them from Logs or a job's Snapshots page. Restores are manual: you run the command on the agent machine, where the repository credentials are available.

Note

Vecta does not copy restored data for you or provide a one-click restore.

Restore a filesystem backup

  1. Open Logs and find the run, or open Jobs → Snapshots for the job. Choose Restore for the snapshot you want.
  2. Copy the command from the dialog. Change its target to a writable, preferably empty directory separate from live data.
  3. Run it on the agent machine with the Restic repository password and destination credentials available to that user.
  4. Check the restored files before using them in production.

The command has this form:

sudo restic restore <SNAPSHOT_ID> --repo "<DESTINATION>" --target ./restore/<SNAPSHOT_ID>

The dialog fills in the snapshot and repository values. Avoid restoring over live data: existing files in the target can be overwritten. Use sudo when the files need root ownership or permissions.

The job's Snapshots page lists snapshot IDs reported by that job, not every snapshot in the repository. Snapshots reported as pruned by a retention policy are marked Pruned and cannot be restored from Vecta. If you need to inspect other repository snapshots, use restic snapshots on the agent machine.

Restore a PostgreSQL snapshot

A PostgreSQL snapshot contains a custom-format dump archive, not a live database. In Logs, choose the restore action for a run with a completed PostgreSQL dump and Restic snapshot. Vecta uses that run's recorded archive filename, so editing the job later does not change the restore command for an older snapshot.

The dialog asks for the target database and generates a command like this:

sudo restic --repo '<REPOSITORY>' dump '<SNAPSHOT_ID>' '<STDIN_FILENAME>' | pg_restore --dbname='<TARGET_DATABASE>'

Run it on the agent machine with Restic repository credentials and PostgreSQL credentials available to the user running pg_restore. Install pg_restore on that machine and create the target database first if it does not exist. The password file created by vecta-agent setup is for backup runs; restore authentication must be configured for the local user and target database separately.

Use a Bash-compatible shell and enable pipeline failure reporting before running the copied command:

set -o pipefail

Then paste and run the command from the dashboard. This makes the shell report an extraction failure from Restic as well as a restore failure from pg_restore. Quote every substituted value as shown by the dashboard.

Vecta does not offer a restore command for a failed or incomplete database capture. If the dump and Restic snapshot completed but a later post-hook failed, the overall run can show Failed; the completed archive remains restorable and the restore action is still available.

Restore without the dashboard

Deleting a job or agent removes its run history and snapshot-ID records from Vecta, but does not delete repository data. On the agent machine, list snapshots and restore by ID:

restic snapshots -r <DESTINATION>
sudo restic restore <SNAPSHOT_ID> --repo "<DESTINATION>" --target /path/to/restore

Replace the placeholders and provide the repository password and destination credentials through your normal Restic setup. Snapshot IDs shown in Vecta may be an eight-character prefix; Restic accepts a prefix when it identifies only one snapshot.

Test your recovery process

After the first successful backup, restore a small set of files or a database into a test target and check the result. Repeat periodically and test a recent snapshot. A backup you have never restored is an unverified recovery path.

What's next

Read Your repository password to understand how to protect the key needed for recovery, or return to Jobs.