Add files to repo

Hi, suppose I have a local file tree, such as /opt/myfiles, which I backup with restic in the usual way, to a backup drive. Let’s call this Day 1.

Then on Day 2 I need to remove all of /opt/myfiles/* locally (bec. they are not encrypted, or I don’t have local disk space, or some other reason).

Then on Day 27, I put some new files/dirs in the empty /opt/myfiles.

Can I add the new files to the original restic backup? The idea would be to then mount or restore that backup and see all the files starting from Day 1. It should look like a backup of /opt/files as if I had never removed any files locally.

In this way I can do backups and then remove the local files. (True, the resIic repo would not be a backup anymore – it would be the “source”. So I would also copy the restic repo files to somewhere else as a backup.)

restic makes a new snapshot each time you run a backup.
If you remove data and add new data to a dir and run another restic backup, a new and different snapshot is created.

As long as you don’t remove a snapshot (via forget and prune), its contents can be accessed with restic restore or restic mount.

But please be aware that a restic repo is not desiged to be accessed frequently via restic mount and - depending on you use case - this might be too slow. Also other tools may be better suited for your use case than restic.

I see, thanks.

So in the above example, if I wanted to view the Day 27 files, I would need to locate the specific snapshot that contains them. In that case, I should use --tag on the command line to name each snapshot and find it easily later.

As for mounting, I find this to be one of restic’s great features – direct mounting of the snapshot, enabling use of local file manager and other tools to view, read, and copy. So far it’s been quite fast for me.

Exactly. You can use --tag to tag your snapshots. But the time and date is already saved within the snapshot. You can run restic snapshots to get the list and even use --json to get a detailed JSON output that you can process.

If you don’t run into any issues there is no reason not to use restic for your specific requirements :wink: