How does Global State work? (rebuilding local state un-encrypted/encrypted)

As per docs:

Global State

indicates how much data the fully up to date folder contains, which is basically the sum of the newest versions of all files from all connected devices. This is the size of the folder on your computer when it is fully in sync with the remote devices.

Local State

shows how much data the folder actually contains right now. This can be more or less than the global state, if the folder is currently synchronizing with other devices.

What happens if a Send Only device folder gets nuked (say a h/d crash), and one has several “Receive Only” + “Send & Receive” devices folders on the cluster - can one add a new hard drive either using the same syncthing db/software (or even using a new install) and rebuild a local “Send Only” folder from the Global State?

Also how would this work with encryption? If the lost drive had the unencrpted data, and all other devices on the cluster are encrypted (assuming one has the password ofc). Could one setup a new install, use the password and re-build the global to local state from encrypted sources, even tho the existing folder types are currently fixed on “Receive Encrypted” on those clustered devices? Hopefully in a future relase, this can be changed - so one can recover encypted data easily from the cluster.

I noticed there is a console command to decryped data manually - is this the only (current) way? Does it restore the folder structure, and/or .stversions?

syncthing decrypt --to <plaintext-destination> --password <your-password> <encrypted-folder-path>

If you lost the drive with data, you should not use the database state for the folder you don’t have the data for.

It will most likely whine that the folder marker is missing, and if you manually recreate that, it will assume that you have deleted everything (because you had data in the database, so its not a new folder), and based on the folder type, propagate the damage everywhere else.

If you lost the drive, you should remove the folder to clear out the database state, and re-add it back for it to re-sync and rebuild the state.

Obviously, if you add it as send only, it will not sync anything, but I believe will just prompt you with a button that nukes your data everywhere.

I don’t think whether its encrypted or not matters in this case.

If there’s no data corruption, then a fresh install would be the way to go with ‘Receive’ folder type to start with (while it builds back the data)? I’m guessing it’ll be like just adding a new device anyhow, except without the orignal ‘Send Only’ device, it will grab the data from the “Send & Receive” devices (or if I change the “Receive Only” to Send). Just checking the logic on how it would work.

Unfortunately I’m not sure how encrypted data would work when the cluster has the folder type fixed at “receive encrypted” - theres no way to send it from those encrypted devices…

The logic seems correct, bootstrap with send-receive, switch to send only after it’s in sync.

Receive only doesn’t mean it does not propagate the changes it received on others. It just never produces changes itself, but forwards changes and data produced by others.

1 Like

Oh ok, so to confirm “Receive Only” will propagate changes from other devices (where applicable), but it in itself will not update with its own local changes to the cluster?

1 Like

Yes.

2 Likes

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