Clarify conflicting advice regarding db corruption recovery

Hi,

At my office we went through a period of unstable power with multiple successive power failures. From this we experienced some data corruption on few devices including one Syncthing setup.

Now that the power issues have been resolved I am trying to get Syncthing working again.

It will run for several hours and then eventual panic with an input/output error reading db file 003404.ldb.

I have seen advice to delete the entire index-v0. folder and then start syncthing as well as another that suggest you can delete just this one corrupt file.

My question: What is the best course of action, is there any difference doing ether and are there any risks of loosing data or settings when performing ether of these two actions.

I am not entirely sure what is stored in the db, so I cant easily evaluate the risks of performing such actions.

Thanks

An actual I/O error indicates file system corruption or hardware error, which you need to resolve before continuing. After that, it is not safe to just remove a part of the database; full reset or nothing is my suggestion

Thanks @calmh thats helpful.

Just to be clear when you say full reset are mean to delete the dB folder and everything inside it and then start syncthing and just wait for it to re-scan and rebuild the db?

Yes

Sorry, I have more questions.

This weekend I tried looking into this issue. I wanted a period of low activity. But I ran into some issues and more questions.

The first problem I bumped into was that the .config folder where the index db folder is kept has read only permissions drwx------. So you get an error when trying to do anything to it.

This got me thinking, I can change the permission to delete the folder, and then change it back, but then on restart how will the folder be re-created. Possibly leading to another problem or error.

Also could the keys in the folder be affected if there parent folder is left to be read/write. I know keys permissions can be very sensitive depending on the application.

I checked other installations and the permissions are the same. This I found odd, as all common advise including the FAQ mentions deleting index-v0.14.0.db but I don’t seen any other mention of permissions anywhere.

After some searching sent me down another path where I found the --reset-database option, but I was unsure of execution steps and if it was the same thing.

Questions:

  1. Does syncthing handle/manage the .config folder permissions and can handle recreating the index-v0.14.0.db folder in a read only parent folder?
  2. Is it maybe not simpler to delete the contents of the index-v0.14.0.db folder, instead of the folder itself?
  3. Is the reset-database the same as deleting the db folder just as a CLI option?
  4. Do I need to run reset-database as a once off startup option or can I use it on a running syncthing eg: syncthing --reset-database --home=~/path/.config, and this will signal the running syncthing to reset the DB?

Okay, I think I answered my own questions regarding point 1 and 2, but still would like some help with question 3 and 4.

The Syncthing user owns the folder, root can delete the folder but cant rename or own anything in the folder. Hence the ready only file system error.