I’m new to restic and doing some experimenting with BASH scripts for backup in my home network.
I have something I don’t understand about snapshots that I appear to have created in a backup, but “latest” only shows an older snapshot.
Searching for the snapshot using the ID can’t find it.
~> $ ~/Downloads/Prog/test.sh
open repository
repository 74609cc9 opened (version 2, compression level auto)
no parent snapshot found, will read all files
load index files
[0:00] 100.00% 12 / 12 index files loaded
start scan on [/home/clarence/Documents/politics]
start backup on [/home/clarence/Documents/politics]
scan finished in 0.070s: 6 files, 176.631 KiB
Files: 6 new, 0 changed, 0 unmodified
Dirs: 4 new, 0 changed, 0 unmodified
Data Blobs: 4 new
Tree Blobs: 5 new
Added to the repository: 179.749 KiB (7.022 KiB stored)
processed 6 files, 176.631 KiB in 0:01
snapshot abc5c476 saved
*▀▀ ~> $ restic -v snapshots latest
repository 7805006a opened (version 2, compression level auto)
ID Time Host Tags Paths Size
------------------------------------------------------------------------------------------
e10ccdf6 2025-08-25 16:55:00 NUCbox-k4 /home/clarence/Desktop 371.609 MiB
------------------------------------------------------------------------------------------
1 snapshots
*▀▀ ~> $ restic ls abc5c476
repository 7805006a opened (version 2, compression level auto)
[0:00] 100.00% 15 / 15 index files loaded
no matching ID found for prefix "abc5c476"
*▀▀ ~> $
I’m not sure whether the backup is working without a snapshot to prove it.
We don’t know what is in the script where you hide the restic backup commands, so when asking a question you should always be elaborate and show that too (i.e. the contents of ~/Downloads/Prog/test.sh).
That said, look at the lines repository … opened in the output from ~/Downloads/Prog/test.sh as well as in the output from the other restic commands. You will spot the difference, and this difference is the reason you are seeing the symptoms you describe/show
I just looked at the “snapshots” directory in the repository and see one withe the correct time. I can’t decode the name, but the first 8 characters match the ID from the backup. The snapshot appears to have a life in here somehow, but there are only 12 snapshot files and at least 16 snapshots.
Contain two different repository IDs (74609cc9 and 7805006a). This shows that the first command is opening one repository, and the second and third command is opening another, different, repository.
The restic -v snapshots latest command is not seeing the snapshot from the backup made by the ~/Downloads/Prog/test.sh command simply because they are looking into two different repositories.
I’m not sure how you mean? The repository ID is the one shown in the output I referred to above.
Which repository restic uses is controlled by the RESTIC_REPOSITORY environment variable, or the --repo option or similar to the restic command. You probably have different values for the environment variable in the shell where you run the second and third command, than what’s in the script.
Yeah, although to be more accurate, the ID is really just an identifier for the repository. You don’t specify which repository to use by specifying an ID, you specify a connection string that we call the “repository URL”.