Revert Version Option

This may or may not be within the scope of Syncthing, but it would be excellent to see recently synced files (in the .stversions folder) and have an ability to revert a file if it was accidentally edited.

2 Likes

There is something like this inside Syncthing for a long time… Simple File Versioning If you search more, there is even staggered file versioning now: Staggered File Versioning

I’ve come across the versioning function of Syncthing. Therefore it would be great to have a Gui for this function. There I have some thoughts about it:

Because the versioning is not a real backup solution, I like to call it the “Revert”-function. Even in the Documentation it is not made clear enough, that this function only collects the files, which were deleted by Syncthing itself. Its not like git where you have a shadow copy of each file-version in the background.

However you realise some sort of Recover function, for files which have been synced at least once to a versioning folder. I have such a folder on a NAS and every time I delete a file it is moved to the .stversion folder. This differentiation should also be made in the Gui.

I propose to insert a “Revert” Button next to the “Rescan” and “Edit” buttons of the folders. But only if versioning is enabled in any of the synced devices. This opens a Window (see Pictures):

  1. select Device to revert from. Maybe Default could be last used device for this folder function (for me it would normaly be the NAS, to see which files you could recover from there). As for the first time, the local device should be selected, for the normal revert process (on this device you see the files which have been deleted by syncthing during sync process). !This selection has to be made Clear with text information.

  2. in order of the selected devises versioning-type the following selectionframes could be generated: (this is necessary because you may want only a trashbin on the working labtop for storage capacity reasons, but a full staggered versioning on the backup NAS.): A. Trashcan, just checkboxes to restore. B. Simple and Staggered versioning: first a time filter with a After that, checkboxes of the filtered files with Version chooser by date/time.

  3. for clearance change Button name: Local device = revert Other device = revert/recover

Usecase: with two labtops. I accidentaly make a mistake in a config file. As a result, the file is immediatly synced, before i can pause and correct the situation. Therefore my preveous config on the second labtop (which i could have used to correct) is also deleted. With the versioning funktion i could revert the config file on the second computer, after which it would be synced back. This is what the recover-funktion also does, but with the difference, that it is performed on the other client (computer one), and i do not have to remotelogin to the second computer.

I like the idea of the revert system but it seems like it would be a lot of work and would need a few protocol changes. Unless someone really wants it and has time to implement it I think it could be passed over as too hard.

I disagree. The text in the GUI makes it quite clear how the versioning types work and what they do, as does the docs. Versioning the file system is out of scope of the project and not something users should be expecting from Syncthing.

The idea of full history of files would be scary. Could you imagine the amount of space consumed by OpenOffice/LiberOffice or Office files being scanned every minute. Every time someone hit save on the cluster you would be storing another copy of the file. Even for planned to be “static files” like a large video, if the initial scan catches it while it is being moved into the folder on the first node it could be synced and therefore versioned 2 or three times as it is written to disk.

I think you are after IPFS

I was just wondering, why you have such an extensive Versioning like “Simple versioning” and “Staggered Versioning” but no intuitive way to use it.

I had the problem, when i was working with my colleague on a school project. I accidentally deleted a folder inclusive its subfolders. Through inotify, they were also immediately deleted on his side too. Luckily he had the “Simple Versioning” enabled. So we could copy all the files back from the .stversion folder. But it was HARD work to manually rename all the files back to their original name and to sort the multiple versions out.

It would have been only four or five clicks with a GUI. Just give the order to revert the files (copy the files back to the Sync folder and rename them), which have a timestamp between 13:10 and 13:20.

And at least, I had to ask my Colleague to copy the files back, because they were in his .stversion folder. I couldn’t have done anything from my side.

I just thought it would be a nice feature in usability, to have such a GUI revert function. It would just require a list of the files in .stversion folder to be transfered. After that the list only has to be filtered by the user based on his selection of the timestamp and send back. At least a single command could be emited to fulfil the copy and rename process.

Best regards Eric

Remember, syncthing is not backup, so the fact that you were able to restore it is a sheer coincidence. You should ideally restore files from your backup. If you are relying on versioning as a backup, then you are risking your data.

The fact that you deleted the folder is the core issue, not the fact that we don’t have a UI for versioning restores.

You can make a pull request implementing thr feature if you feel so strongly about it.