Safe to remove ...-tmp-... files if check --read-data passes?

Hi.

I just noticed that I have some …-tmp-… files in the data directories. As a test, I cloned the repos with these files, removed these files, and run restic check --read-data, with no erros found. I’m running Restic 0.16.0.

It seems I can safely remove these temporary files, but I’d like to confirm if there is any other problem that I may have by removing them, that I can’t see now.

TLDR, is it safe to remove the …-tmp-… files found in the data dirs if restic check --read-data passes with no errors?

Thanks.

Yes, it is safe to remove the *-tmp-* files. These files can be left behind if the upload of a file gets interrupted. Restic first uploads the content of a data file into such a temporary file and once that is complete, renames it to the final filename. By design, this ensures that a file is either written completely or the upload gets retried. This even makes it safe to remove those tmp files while restic is running. Although for peace of mind, I’d recommend to not clean up the tmp files while restic is running.