Partial repo loss

If I loose/delete all files in restic repo that were created and modified after, for example, 21st October. Can I still restore files from the snapshots taken 21st October and before?

I did simple test - deleted all files modified in October from my repo, the September snapshot files were restored smoothly.
So are there any “guaranties” of such a behavior in repo design?

Hi @Vito and welcome to the restic community :slight_smile:

It is always a good thing to do from time to time is do a restic check on your repository.
I can’t come up with a short answer to your concern - maybe someone else can pitch in.
As I understand your concern: you’re worried about loss of repository metadata files, right? And what happens if part of your repository goes missing - not the files you backup.

Other than that, you can check out the Design part of the restic docs as well as the threat model for restic.

1 Like

Hi, moritzdietz.

I worry about loosing not only metadata but all the data (all the files) which where created after last time the existing files were marked immutable for the restic.

I probably didn’t express it well.

Imagine your machine from which you run restic was missconfigured or bad guy got access to it. I want prevent him from altering and deleting remote backups which he can access looking through restic config. I can set files in remote repo immutable after some time there were created, but all the files that i added to repo between last immutation and bad guy appearence will be altered/erased by him.

This specifically would be out of scope of restics threat model.

There was some discussion on here and on GitHub in regards to such a push only repository.
If you search the forum you will definitely find others.

For example this thread goes into the same area of question regarding data loss: Corrupted repo, how to repair?

I believe this is guaranteed if you never run restic prune.

A prune operation will discard unused data from the repository. To remove data from an existing pack, the still-used objects in that pack are built into a new pack (possibly with still-used objects from other packs containing data to be deleted). This is because packs are never modified, only created and deleted.

The new packs will have a modified time of the moment they were written out. Therefore, it’s entirely possible that a pack with a recent modified time could contain very old data – and, in fact, this is likely if you have recent run restic prune.

Thank you.
I don’t do prune, now i know why. :wink:

Your question isn’t clear, I’m not sure what you’re asking.

If you can’t retain the files that restic keeps the backup data in, there’s nothing much it can do for you.

When you run “restic forget” you tell it what you want to retain. For example I might discard all but the latest version of a file that was backed up 3 months ago.

One thing I wonder is if a file is deleted in the source directory, then a backup / prune is run, is the file still in the backup? I would assume yes it is.