Files already uploaded, but locally deleted before restic backup finish to run

Hi all,

I’m using restic for more than a year and I love it.

I was running restic backup via sftp, and while running, I mistakenly deleted some files in one directory on my local laptop.

At first I was not worried because files were already uploaded, and I was thinking to use restic restore to get them back, as soon as the snapshot will be created on the repository.

Unfortunately, restic backup failed before finishing (network down), and the snapshot is not created.

If I relaunch restic backup I’m afraid that the recently deleted files will not be included in the snapshot. Because restic will rescan files to upload, and as they are no more there, it will (maybe?) miss them, even if they are already uploaded.

What can you suggest me to avoid losing these files ?

Thanks !


In case I was not clear in my first post, here is the timeline of actions:

$ restic backup

In the meantime, I deleted some files (my mistake), but they were already uploaded and indexed to the remote repository.

Then, some hours after, restic backup command failed:

subprocess ssh: client_loop: send disconnect: Broken pipe81.608 GiB, 51 errors
Save(<data/f504823e33>) returned error, retrying after 381.176248ms: Write: connection lost
Save(<data/5e6d3ae091>) returned error, retrying after 483.731868ms: Write: connection lost
Save(<data/63c6750a48>) returned error, retrying after 339.18647ms: Write: connection lost
Save(<data/6ef6f6fd14>) returned error, retrying after 525.17288ms: Write: connection lost
Save(<data/63c6750a48>) returned error, retrying after 339.18647ms: Write: connection lost
Save(<data/bb8a7a5b22>) returned error, retrying after 745.774442ms: Write: connection lost
error: no result
error: context canceled
Fatal: unable to save snapshot: ssh command exited: exit status 255

And now, if I run another “restic backup” to finish the snapshot, I want to know if the deleted files will be included in the next snapshot or not. And if not, how I will be able to restore theses files.

On one hand, these deleted files were already uploaded and indexed, so they are in the repository.
On the other hand, I fear that if I run a new “restic backup”, restic will not see the deleted files and it will maybe not include them in the snapshot list of files.

I hope I’m as clear as possible in the description of my case,

Thank you for your help :slight_smile:

A new backup run will start listing files from scratch and thus won’t include the files that were removed in the meantime.

You can try to run restic rebuild-index followed by restic recover. This will create a new snapshot to which restic adds all already uploaded directories that are not part of an existing snapshot. With a bit of luck that also includes the deleted files.