Renaming paths in snapshots?

I performed a backup of a large photo library after manually mounting the disk. In the normal course of events, the disk is mounted automatically when it connects at a different location. In other words, I originally ran restic backup /mnt/photos, but in the future I will want to run restic backup /run/media/myname/photos.

Is there a way to tell restic that these two paths are really the same thing? I understand that in theory a subsequent backup shouldn’t end up consuming any additional space, but it will result in two paths that are actually pointing to the same data.

If you restore the first one (from your restic backup /mnt/photos command), that will produce a folder named photos, with the contents from the original folder in it.

If you restore the second one (from your restic backup /run/media/myname/photos command), that too will produce a folder named photos, with the contents from the original folder in it.

So in the end, there’s no difference in terms of restoring. And as you say, it will not consume any more storage in the repository, as it’s all deduplicated.

Does that help?

No, I understand that. I was (a) trying to reduce clutter in the list of snapshots, and (b) it sounds like backing up the same data, but with a different name, means that restic will at least need to re-read everything. From the docs:

Please be aware that when you backup different directories (or the directories to be saved have a variable name component like a time/date), restic always needs to read all files and only afterwards can compute which parts of the files need to be saved. When you backup the same directory again (maybe with new or changed files) restic will find the old snapshot in the repo and by default only reads those files that are new or have been modified since the last snapshot. This is decided based on the modify date of the file in the file system.

That seems to suggest that being able to tell restic, “hey, this is the same directory” would lead to some efficiencies such as not having to re-read 100+ GB.

Indeed. But you’ll only have to re-read it all once, since after that you’ll have both paths in one or more snapshots.

I am not aware of a way to rewrite paths like you ask, sorry. Doesn’t have to mean there isn’t one though, but I highly doubt it.

Perhaps you can mount the second path in a way such that it looks like the first path, using some loopback mount or similar?

Oh sure, that’s certainly an option, but it requires manual intervention (or udev rules, I guess). It’s obviously not a big deal. I’ll just live with extra paths in my repository for now :).