Synchronization Deleted most of my Notes

Operating system

Linux

Joplin version

2.12.19

Desktop version info

Joplin 2.12.19 (prod, linux)

Client-ID: f375b100d5f64d08a39927faed58d4e8
Sync-Version: 3
Profil-Version: 43
Unterstützter Schlüsselbund: Nein

Sync target

File system

What issue do you have?

A while ago i had set up file system synchronization to backup my notes. It didn't work that well (tried to backup into a mounted NAS directory), but whenever it failed i got the fail-save error message that prevented the (empty) remote directory to overwrite my files. Until today. I created two more notes and then shutdown my PC. When i booted it up later, the two notes were still there, but everything else was gone. I traced the logfile and it seems to me that for some reason the backup sync decided to actually overwrite my local files with the empty remote directory this time. I checked my config, but the checkbox preventing an empty overwrite is still set. So my question is: Is there anything i can do to retrieve all the notes i collected in the last 18 months or are they gone forever?

Log file

log.txt (6.51 MB)

Current versions of Joplin have a backup plugin build into them, which is enabled by default, making it possible to restore accidentally deleted notes. The problem is that your Joplin version is heavily outdated, and judging by the posted information, you've got no plugins installed whatsoever, so unfortunately, I don't think you can restore the notes :frowning: (unless you go into data recovery and manage to recover actual MD files, but even then, unless you restore literally everything in its original state, you will likely need to open them in a text editor and copy the content manually).

Even with older versions of Joplin, it may be possible to recover recently deleted items from the database.

This requires the sqlite3 command and a Joplin profile in ~/.config/joplin-desktop/.

From a terminal:

  1. Important: Create a backup of the Joplin profile directory
    bash$ cp -r ~/.config/joplin-desktop/ ~/.config/joplin-desktop.backup/
    
  2. Open the Joplin profile directory.
    bash$ cd ~/.config/joplin-desktop/
    
  3. Make a copy of the database:
    bash$ cp ./database.sqlite ./db-copy.sqlite
    
  4. If Joplin is running, fully quit Joplin.
  5. Run the SQLite3 recovery tool (see the relevant SQLite documentation):
    bash$ sqlite3 db-copy.sqlite ".recover --ignore-freelist" > recovered.sql
    
  6. Inspect recovered.sql. Some of the INSERT INTO queries may include text from the deleted items.
  7. Either:
    • Manually copy/paste the deleted items from recovered.sql into a new location or,
    • Attempt to reconstruct the database:
      bash$ sqlite3 recovered.sqlite <recovered.sql
      bash$ mv database.sqlite database.old.sqlite && mv recovered.sqlite database.sqlite
      
      Then start Joplin.
1 Like

Also please check this post as several other methods to recover notes are described:

(I've just added the one mentioned by personalizedrefrigerator)

1 Like

FYI, in future if you are able to upgrade to at least Joplin version 3.3, the fail-safe mechanism has been improved in that version. See Desktop, Mobile: Harden failsafe logic to check for the presence of info.json, rather than just the item count by mrjo118 · Pull Request #11750 · laurent22/joplin · GitHub

It took a while, but i was able to recover 98% of my notes! Thank you very much everybody, who suggested methods and especially @personalizedrefriger. The DB recovery log contained most of the missing pieces. I also updated Joplin to the newest version and inserted some extra backup steps to prevent something like this in the future. Again, thank you to everyone!

2 Likes