Can I continue incremental backups if the path changes?

lets say i have /mnt/data_dir/path/to/data. I use restic by doing:
restic -r /mnt/backup init
restic -r /mnt/backup backup /mnt/data_dir/path/to/data

I then create /mnt/data and do:
mv /mnt/data_dir/path/to/data/* /mnt/data

Will restic automatically continue incremental backups of the data dir to the target repo when the path changed?
restic -r /mnt/backup backup /mnt/data

Restic doesn’t have any notion of “incremental” backups. Every snapshot is a full snapshot, albeit enjoying the benefit of deduplication. A change of path will not result in duplication of your data, so it’s safe to change the path without having to perform a long backup afterwards.

Keep in mind that forget groups by path and host name by default, so backups to the previous path may not have older backups removed by forget as expected.

Thanks for that explanation! Is there a way to modify forget manually? If i run restic to the same repo, say a mounted remote dir where I was able to recover from local backup but the host has a new hostname with the same data, will it dedupe between those hosts?

You’re welcome. All data in a repository is deduplicated, irrelevant of the source filesystem, paths or hosts.

forget can be run with whatever parameters you wish, see restic forget --help. To have it ignore paths, you can use --group-by hosts or to disable grouping entirely, use --group-by ''. Note that you could lose snapshots you might otherwise want to keep when you reduce the grouping, if say you’re backing up /home/why_a_penny and /srv/http to the same repo, or more than one host is backing to the same repo.

forget --dry-run displays what will be removed without making changes.

When I have made source path changes in the past I have let my automatic forget run as it always does, with the default grouping, and manually run forget with specific snapshot IDs of the snapshots with the old paths.