Temporary files still there, original file missing


I sync two directories from Server 1 to Server 2. Both untrusted as they are in the local network. Server 1: Send only Server 2: Receive only

I have a problem after renaming several thousand files. I have about 200 files now that are named .syncthing…tmp, but the original file is “gone”.

i.e Original file: movie.mp4 Temporary file: .syncthing.movie.mp4.tmp

They won’t sync and I can’t find anything in the logs. I would just like to rename them so that I can have the original file back and then re-sync.

Is this possible? Otherwise, how do I get the original file back?

Both servers says “Up to Date”

You can rename the temp files however you want but please make sure that they are actually usable first. Syncthing creates them while files are being downloaded, and then leaves them on the disk for 24 hours (by default) if the transfer has been interrupted. This means that those temp files are likely incomplete downloads, i.e. they may very well be completely useless without the original data.

“Up to date” and no errors with a bunch of temp files lying around sounds odd, unless files were renamed multiple times (A → B → C) and the temp files are for the middle stage. I’d investigate before making too many changes.

I did a test for a couple of them and they were completely useless. Note, that these tmp files are on Server 1 where they are supposed to be copied from. I would have thought that these would be intact and usable since they are not changed.

Or am I wrong?

I will let it sit for a few hours and see if there is anything in the logs. It might popup something. I can’t remember renaming the files several times; only once. I am unsure if anything happened during the first sync so that some of these files became stale. I renamed several thousand files, and most of them synced fine.

I might try to rescan again to see if they get synced eventually. They have been there for a few days now.

Restarting and rescanning generated no errors or changes.

I guess these files are gone and no way to recover from the tmp-files?

You’ll have to use a recovery tool for whatever operating system in on Server 1 to try to recover the missing files.

But with regards to the .syncthing.*.tmp files, if the Syncthing folder on Server 1 was set to “Send Only”, the host source directory the Syncthing folder points to wouldn’t have had any temporary files as those only occur on a receiving end (e.g., Server 2).

Could you post a screenshot of the Syncthing web GUI (with any relevant expanded folder and/or device panels) from Server 1?

Yeah, I suspect the culprit is my renaming as @calmh mentioned. I did a lot of renaming and probably it got stuck syncing a renamed file while it got renamed again. His scenario was A → B → C. Best to pause sync while I do this and start after everything is done.

But the .tmp files would be on both servers, otherwise they would not be synced to the client side am I right?

The .tmp files only appear on the device receiving the blocks to assemble files being synced. Because “Server 1” was set to “Send only”, there’s no reason for Syncthing to be writing temp files.

Most filesystems treat file renames as a simple metadata update. On Unix/Linux, a file’s inode numbers originally assigned stays the same thru all renames as long as a file remains in the same filesystem. Windows’ NTFS doesn’t have inode numbers, but there’s an equivalent.

When a file is opened for reading, Syncthing receives a file handle. The file handle doesn’t refer to the file’s name, so if the file is renamed while Syncthing is reading it, the read process continues uninterrupted. Even if the file is renamed several more times within a few seconds the file handle is still valid.

So the question is where did those “.syncthing…tmp” files on “Server 1” come from?

Thanks for the clarification. I have no idea where they come from. I added some new files now and they also get a .tmp file on Server 1.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.