Restic copy creates new snapshot ID

restic version
restic 0.17.3 compiled with go1.23.2 on linux/amd64

I ran the command:

restic -r /srv/restic-repo-copy copy --from-repo /srv/restic-repo 410b18a2

To copy my restic repository snapshot. I expected the copy of the snapshot to have the same snapshot ID as the original, 410b18a2. However the snapshot ID is different. I thought restic copy copies the snapshot and so everything is the same including the state of the snapshot and snapshot ID.

How did you init the destination repository (target repos) ?

The target repository is a copy of the source repository

I thought restic copy copies the snapshot and so everything is the same including the state of the snapshot and snapshot ID.

This is not quite what happens. A new snapshot is created in the destination repository, containing the data from the source snapshot; it gets a new snapshot ID. Someone more knowledgeable about the internals of restic could probably explain the technical reasons behind this. EDIT: Thinking about this some more, it’s probably because the new snapshot has new metadata, and the ID is the checksum of the snapshot.

As an aside, restic copy is smart enough to figure out which snapshots in the source repository correspond to which snapshots in the target repository if you run it again, so they won’t be copied over and over.