Synchronization Deleted most of my Notes

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.