No parent snapshot found, will read all files issue

• The output of restic version. < restic 0.16.2 compiled with go1.21.3 on linux/amd64

• The complete commands that you ran (leading up to the problem or to reproduce the problem).

In a bash file:

declare mysource="/home/main/MyData/Backup/256GB"

declare mydestination="/run/media/main/1_TB_Ext4/restic-snapshots-of-main-MyData-Backup-256GB"

(This is an external USB connected hard disk)


restic -r ${mydestination} --verbose backup ${mysource}

• Any environment variables relevant to those commands (including their values, of course). < I did not set any, not sure how to find this

• The complete output of those commands (except any repeated output when obvious it’s not needed for debugging).

no parent snapshot found, will read all files
load index files
[0:01] 100.00% 41 / 41 index files loaded
start scan on [/home/main/MyData/Backup/256GB]
start backup on [/home/main/MyData/Backup/256GB]
scan finished in 100.497s: 57183 files, 175.694 GiB

Files: 57183 new, 0 changed, 0 unmodified
Dirs: 9963 new, 0 changed, 0 unmodified
Data Blobs: 867 new
Tree Blobs: 192 new
Added to the repository: 880.981 MiB (707.667 MiB stored)

processed 57183 files, 175.694 GiB in 1:51:20
snapshot ccad00a7 saved

Hi, as you can see, in the output I got “no parent snapshot found, will read all files”

This has happened a few times.

restic took 1 hour and 51 minutes, which would be the time to backup all files, not incremental files only.

I reran the same command a few minutes later, after having change a few files at source, and restic then only took a few seconds, so it looks like it was a quick incremental backup this time.

I have the following questions.

(PS I am not an IT professional, just a home user of Linux and gratefully of restic, so please answer at a beginner’s level)

==========

1 - My main concern here is that if restic does not find a parent snapshot, then in future I will not be able to ever restore (if needed) to my first ever snapshot made - ie if no parent snapshot is found, restic “starts over” and creates a new snapshot that does not have the ability to revert to old snapshots. Is this true?

I did a test restore and was able to find my 1st snapshot. But I still would like ask the above question to make sure I know what is going on,

==========

2 - I have been searching for similar issues and found posts that say the issue can be due to a change in host name.

I recenly have noticed that my ISP changed my hostname without telling me or asking me :slight_smile: so this could be a likely cause.

So I thought I would change my command to:

restic -r --host main ${mydestination} --verbose backup ${mysource}

Would this work?

Would I still be able to restore to my first ever snapshot made?

==========

3 - I just noticed in:
https://restic.readthedocs.io/en/latest/040_backup.html

The previous backup snapshot, called “parent” snapshot in restic terminology, is determined as follows. By default restic groups snapshots by hostname and backup paths, and then selects the latest snapshot in the group that matches the current backup. You can change the selection criteria using the --group-by option, which defaults to host,paths. To select the latest snapshot with the same paths independent of the hostname, use paths. Or, to only consider the hostname and tags, use host,tags. Alternatively, it is possible to manually specify a specific parent snapshot using the --parent option. Finally, note that one would normally set the --group-by option for the forget command to the same value.

Again, I am just using restic to backup personal files from a Linux laptop to an external USB hard drive.

BUT I am also thinking of changing to a different Linux distro on the same laptop and of course still using restic and the same restic repo on the same USB external hard disk.
IE in general I would like to use restic with the same source data and the same USB external hard disks, regardless of host name and also regardless of user name, and with different distros installed on the same laptop .

In this case, what would be best?

Should I not use
–host
and instead use eg
–group-by paths

The docs say:
Finally, note that one would normally set the --group-by option for the forget command to the same value.
I do not want to forget any snapshots, so would it be ok not to use the forget command?

Would I still be able to restore to my first ever snapshot made using --group-by ?

==========

Thanks ahead of time for any help :slight_smile:

No. Finding a parent snapshot allows restic to compare the modified timestamps of files from the last backup snapshot with the timestamps currently set on your source files. When the modified timestamps on your source files are newer, then those files are re-read, chunked, and added to the repo. If the timestamps remain the same, then the file is recorded as part of the new snapshot, but its contents aren’t read again, because it hasn’t changed, and it is already stored in the repo. This is really all the parent is used for. It records the relationship between parents, but each backup snapshot can stand alone, and isn’t dependent on previous snapshots to exist. If you use forget to remove a parent snapshot, the child snapshot remains complete, and fully restorable.

So when restic says no parent and it is reading all files, this just means that the contents of every file are read for backup, not just the modified ones.

Finding a parent has no affect on past snapshots.

Yes, if this is the cause of your problem, manually setting your host name, as main as you have done for every snapshot will make sure that no matter what your computer is called, it won’t change. This will keep the source path & hostname pair consistent, and parent snapshots will be found, making your backups quicker. And the hostname of all your snapshots for your computer will be consistent too.

Give this a try and see how it goes.

Okay, this makes sense - you are using a laptop. Depending on what network you connect to, your laptop can be assigned a different name. So specifying the hostname for each backup is a sound strategy.

With different distros, the strategy you use will depend on whether its the same partition of your hardware that you are backing up from both distros or not. If the same, then use the same hostname and path. If you are backing up different data stored on a different partition/drive, then what I would do is use a different hostname for the different distros you are running. This I think will offer the greatest clarity for understanding what is in your repo.

3 Likes

@damoclark - Thank you very much for taking the time to share your knowledge and help me out! I now do not have to worry about not being able to restore to my first ever snapshot, and I have a solution for changing distros. Thanks again.