ddvk / rmfakecloud

host your own cloud for the remarkable
GNU Affero General Public License v3.0
788 stars 68 forks source link

Recovering with Relink - Question #288

Closed iMarv closed 10 months ago

iMarv commented 10 months ago

Hey,

We randomly lost a whole bunch of files but thanks to this tool I am able to look into recovering the files with the git history and relink binaries.

The docs state You need to make sure the parent directory still exists (as we said the hierarchy is handle by metadata, not by indexes), does this mean it requires the "original" directories, or can I just create directories with the same name on the device and recreate/relink the files into them?

Eeems commented 10 months ago

Which doc are you referencing?

iMarv commented 10 months ago

My bad, the one of relinkfile https://ddvk.github.io/rmfakecloud/usage/diff-sync/#relinkfile15

Eeems commented 10 months ago

My guess would be that it requires directories with the same guid/hash, although I'm not entirely sure how the metadata is structured. It may actually require other data.

nemunaire commented 10 months ago

Hi @iMarv!

First, if you lost a lot of files (maybe all of them?), an simpler solution could be to go back to an older index, instead of relinking XXX files. I made this tool because I lost a few files on several weeks, too much files have been modified since the first lost. If this happen recently to you, I suggest to go back to the latest working index to save you time.

  1. Save the current .root.history, eg. as .root.history.bak.
  2. Unpair the tablet from your cloud account.
  3. Insert a new line at the end of the .root.history, with the last known sane hash (given by the git history, as commit message; you should also have this hash earlier in the file, as this is an ancient index).
  4. Pair the tablet again: it should drop new files, but revert all your ancients files at the time.
  5. On the tablet, remove the files you modified since.
  6. Use the relink tool to relink your new files, using the latest index as seen by .root.history.bak.

Otherwise, this is indeed the "original" directory that is required, not a directory with the same name. As I can see in the code, it should be able to relink directories as well, given their original name.

iMarv commented 10 months ago

This makes a lot of sense and will save me a bunch of time and headeaches, thank you!

Will try it out when I am home later today, closing the issue if it works out 😄

iMarv commented 10 months ago

@nemunaire Also needed to replace the hash in the root file with the historical one, which then then made the tablet sync back properly. Thank you for the hint, kept looking at the hashes but just did not make the connection that I may just be able to point to a point in the past.

I may contribute a doc entry on this in the coming days