Backup subset of tree

Is there any way to backup only a subset of the tree saved in a repository?
Every week I backup /mnt/storage1. /mnt/storage1 includes a few directories that are particularly important. I would like to backup those every day.
I tried running the backup with /mnt/storage1/importantdir but it appears that restic has to re-read everything instead of relying on mtime, ctime, etc. data and since it’s a 2 TB directory it takes a long time. This leads me to believe that it treats /mnt/storage1/importantdir as a separate tree instead of using the /mnt/storage1 tree.

If you do a backup of your important folder, it will create an own snapshot with that path. Deduplication will still work. So next time this snapshot will be recognised as parent and it should be fast.

Looks like you are searching for something like

I however don’t know if this gets ever merged as it is more than 2 years old now and I won’t have time to work on it.

@lx30011 i think @betatester77 is correct in stating that when you finish the first backup of that subfolder it should go fast as a new “parent” will be established.

Since i got curious about this scenario i decided to run a little test:

I start a backup of a 100GB subfolder of an existing 700GB backup and i use the backup --parent snapshot_id option once; snapshot_id is from your parent folder backup.
This worked as the 100GB backup took only 1 second (no data was modified and everything was already in the repository via the parent folder backup).

Then i ran a backup of another 100GB subfolder without the --parent option. This caused a "no parent snapshot found, will read all files" and complete scan as expected and lasted 1min 43sec.
Once completed i ran it again and now it completed in 1 second with the prior backup identified as parent.

So in your case to speed it up i would include the --parent snapshot from your /mnt/storage1.
Hope this helps.

2 Likes