Create new repo from a directory within a repo

Is it possible to create a new restic repo that only includes files from a particular directory? Would like the new repo to have all the snapshots that are in the original repo, but just limited to a directory.

As far as I know, this is not possible. Each repository is encrypted and there is no way of creating a sub-repository.
A “snapshot” is already including all the data, and (with deduplication) it might not be logically possible to detach only a subfolder from a snapshot’s data.
But I am curious what are you trying to accomplish? Maybe we can offer an alternative.

Thanks.

The idea is that entire server is backed up into one repo but then if a user wants to restore files, we can make a repo of /home/$user from the big repo and the user can then choose what they want from there.

Mainly to reduce the risk that the user could accidentally get to files outside of their homedir.

Hmm understandable.

One method could be using backup command separately for each home directory with different tags (e.g. username) and when a user needs restoration presenting those snapshots only as restorable (if there is a layer between user and repo). Or just using copy command to push snapshots with that tag into a fresh repo, if users need to access a repository directly (although this might take longer as the data gets bigger).

But maybe someone can give another idea, since I am not following all backends which might have developed since (e.g. rest server).

I personally prefer user data a bit more distinct, so opted for backing up separate buckets in a single minio instance.

It would in principle be possible to use restic rewrite --exclude-file excludes snapshot-id to remove everything from a snapshot except a specific folder and then copy that snapshot to a separate repository.

The excludes file then would have to contain something like the following:

/*
!/home
/home/*
!/home/user