Home / GitHub Page

Best method to backup notes

We use Evernote at work, and I’ve been using it personally as well. As part of researching Joplin as a replacement for work i’m going to use it personally for the next month or so. I have it syncing to Nextcloud running on a personal server.
Currently trying without encryption.
I exported my notebook from Evernote, and imported it, and that all looks good. I see my directory is filled with .md files now, and the pictures are in .resource on the sync target as well.
I was experimenting with how best to automate backups and what I tried doing was using Nextcloud to sync the target directory to a computer. This gives me all of the .md files somewhere else. I then tried importing the “md directory” which works in importing, but all of the notes are the filenames of the .md files. Not really sure what the original note name.
So, I thought, “What’s the best way to back up Joplin?”
Anyone else?

Best way, if you can, is to use the command line tool along with the export command and export at a regular intervals from a cron script. Even better if you can version this in a Git repository.

This is the cron script I use for backup:


# 0 0 10,15/12 * * /home/laurent/scripts/joplin_bak.sh >> /var/log/joplin_bak.log 2>&1


$JOPLIN_BIN e2ee decrypt

rm -f *.md
rm -f resources/*
$JOPLIN_BIN --log-level debug export --format raw "$BACKUP_DIR"
git add .
git commit -m "Update"

I have this running because I often run dev versions of Joplin so I need a robust backup in case I mess up, but for normal use a simple export to JEX format is sufficient. Unlike the ENEX format, JEX is a lossless format so you can export and re-import and get everything back including tags, resources, notebooks, and all metadata.

An alternative to all this is indeed to backup the sync directory. That might be easier to automate and Nextcloud should also keep a history so you get benefits similar to using Git.

1 Like

Thank you for your reply Laurent.

I tried something: Nextcloud has my ‘joplin’ target directory in it, and is synced to computer A. I created a new directory in Nextcloud called ‘testjoplin’. I copied the contents of the ‘joplin’ directory to the ‘testjoplin’ directory, hidden directories included. Then on Computer B I clean installed Joplin, and pointed it at Nextcloud…/testjoplin

It then synced and everything looked just like it should. I have a computer that’s always on, and is syncing Nextcloud, and that directory is getting backed up with versioning. I think this will suffice for me.
The other thing I played with was using Nextcloud’s versioning to restore an individual .md to a previous version. This did not work as expected. Joplin on Windows desktop will keep showing the note as it last was, but using the text viewer on Nextcloud shows that .md file as being a previous version. I’m probably just missing something.

Yes that doesn’t work because when you restore an earlier version it will have a timestamp that’s earlier than the one that’s on your computer. So Joplin compares the versions, see that the one on your computer is more recent and therefore keeps this one.

There’s no simple way to restore just one note from sync at the moment unfortunately. You would need to do it manually - i.e. restore the note, copy the body, and paste it in the note on your computer.

fair enough. Figure if it’s bad enough I need an older version it’s either a one time thing where copy/paste would suffice, or i’m redoing the entire directory in which case my previous test works too.


I am also looking for a way to do periodic automated backups using a cronjob on Linux. But from the Desktop version, not Terminal.

Of course I could point the terminal version to use the database of the Desktop version, but this seems untested (https://github.com/laurent22/joplin/issues/332).
I could of course set the terminal version to sync with the Desktop version, but somehow this seems not right (having the database three times on my harddrive: Desktop-Version, Sync-Directory and Terminal-Version). What would you recommend? Is it enough to just backup the database (database.sqlite file in the Joplin directory)?


You could backup the sync directory as that would give you more control if you ever want to restore only some files. Otherwise backing up the entire profile folder would be fine too, but you can’t restore individual items.

Thanks. I´m gonna use one of these two options.

2 posts were split to a new topic: Export and import while preserving note IDs