How to clean spurious files on server?

That’s the sort of thing.

This is the one I have used where you basically delete everything and start over again. I have padded out the descriptions a bit for any who happen across this post in the future.

  1. On a desktop client export all notes / resources as a single JEX export file (File > Export > JEX - Joplin Export File). After this do not add or edit any notes - an obvious point but worth mentioning
  2. Save any custom templates or CSS files you have as they are not included in the JEX export
  3. Save copies of these files (including the JEX file) in a couple of locations “just in case”
  4. Completely shut down all Joplin clients (File > Quit)
  5. Delete the .config/joplin-desktop folder on all clients (flush data / cache on mobile apps)
  6. Go to the server / sync target and delete anything in the folder making sure not to delete the folder itself
  7. Start up a desktop client which will now be “as new”
  8. Set Joplin up as required, adding the sync settings and let it sync the default notes
  9. If using E2EE, set it up now before importing any notes (I have found it far quicker to get E2EE setup correctly before restoring all the notes rather than after)
  10. Set up the Joplin clients on the other devices and allow them to sync the default notes.
  11. If using E2EE, wait for the encryption key prompt on the other clients and enter the shared key
  12. Check that all is working OK
  13. Fully shut down (File > Quit) all clients apart from the one on the computer that has the JEX file for importing (I prefer the importing client to finish the first full sync without other clients simultaneously trying to pull down files from the server (also see below))
  14. On the desktop client that has the JEX file, delete the default notes, sync and then import the JEX file back in
  15. Sync the import desktop client to the server / sync target and allow it time to complete
  16. Start the other clients and let them sync as well (if you have a lower power server like a Raspberry Pi you may wish to do this consecutively rather than concurrently as it may stress the CPU and IO being hit by many clients downloading everything all at once)

The benefits are that this also clears out any files from the previous setup in your clients’ local resources folders (they were deleted at (5) along with everything else in .config/joplin-desktop). The downside is that it involves setting up all clients from “fresh”, and if there are many notes and many clients this process could take quite a while to complete.

I would suggest that anyone only tries this if they really, really need to clean out “orphaned” data on their clients and server. This is not exactly a simple spring-cleaning exercise.

5 Likes