Please document (better) how to recover notes

At first: I did recover notes successfully ...this thread did help me: discourse joplinapp_org.t.how-to-recover-deleted-notes.17907 (no links allowed)

But its confusing like hell. Because there is no documentation out there and reading the threads for the topic ...these are not pointing in the same direction to solve this (some of them are outdated or wrong).

In my case and in the current state of joplin "how to recover notes" this worked:
0. Do a backup like in 2. as soon as possible after realizing you are missing notes (...the database in 4. will be easier to read and you remember better 'what you did before or after the mistake of deleting the note' and ...to find the right note_id)

  1. Find the joplin directoryand the database.sqlite
    In my case (having installed via snap and ubuntu 20.01) it is ~/snap/joplin-desktop/17/.config/joplin-desktop
    (there is a second database.sqlite: ~/snap/joplin-desktop/16/.config/joplin-desktop ...but this doesnt seem to matter)
  2. Save the whole joplin directory (for backup reason ...didn't have to use it)
  3. Open the database with (for example) sqlite3 ~/snap/joplin-desktop/17/.config/joplin-desktop/database.sqlite and there do select item_id, body_diff from revisions order by created_time;
  4. Finding the missing note is difficult ...the best way is to remember (parts of) the text in the note (the name or title of the note wont help you much).
    You should now find the whole text of the notes with a lot of \nRemoved in it, like this:
35ce2306b8f4a20bfe83ba546d0d951|[{"diffs":[[0,"8973\n```\n\n\n\n"],[-1,"\n\n\n"],[1,"#### Nun als Script fuer alle Ordner\n`./bashScript_DeleteDuplicats `\n```\n#!/bin/bash\nfor d in */; do\n    echo \"$d \" && rdfind -deleteduplicates true -checksum md5 $d\ndone\n```\n\n```\nmetamorph@desktop:~/00_data/000_zu_sortieren/002temporaryWork_inOrder$ ./bashScript_DeleteDuplicats \n7z/ \nNow scanning \"7z\", found 111 files.\nNow have 111 files in total.\nRemoved 0 files due to nonunique device and inode.\nTotal size is 69910050 bytes or 67 MiB\nRemoved 0 files due to unique sizes from list.111 files left.\nNow eliminating candidates based on first bytes:removed 0 files from list.111 files left.\nNow eliminating candidates based on last bytes:removed 0 files from list.111 files left.\nNow eliminating candidates based on md5 checksum:removed 0 files from list.111 files left.\nIt seems like you have 111 files that are not unique\nTotally, 64 MiB can be reduced.\nNow making results file results.txt\nNow deleting duplicates:\nDeleted 109 files.\na/ \nNow scanning \"a\", found 942 files.\nNow have 942 files in total.\nRemoved ...............................

The first entry is the item_id, which seems to be the key for the note_id too: 35ce2306b8f4a20bfe83ba546d0d951
This is the information needed, so copy it...
5. Close squlite3 ...go back to Joplin. Do ctrl shift p and restoreNoteRevision item/note_id (restoreNoteRevision 35ce2306b8f4a20bfe83ba546d0d951)
6. The note will be restored ...not in the same place as before, but in (a automatic created) folder 'restored Notes'. So go for this folder an check it. You can restore a lot of item/note_id without getting confused (spawning them into your notebook-tree randomly) and can redo 1. - 5. until you found the right one. After finding the right on, you can move it to the old place in the notebook-tree.

It really took me a while to figure it out ...a better documentation about it could save time and a lot of people from a hearth attack :wink:

3 Likes

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