Jump to content

Backing up the Moonraker database (printing history, etc.)


DennisM

Recommended Posts

Any thoughts on this? When I recently had to rebuild my printer I was able to backup and restore my moonraker DB to migrate my printer's history, etc. to the new SD card / setup. Same printer so I wanted to preserve this data.

I was thinking, on the new system, I'd like to occasionally (either manually or automagically) backup the database by exporting the SQL into a file and then copying that to my NAS.

However, this command, which I thought is what I need to do, doesn't work on the new system:

root@mainsailos:/home/pi#  mdb_dump -f backup.txt -a .moonraker_database
mdb_env_open failed, error -30793 MDB_INVALID: File is not an LMDB file

And yes, I tried it as the `pi` user with the same results.

Any ideas what's going on?

Link to comment
Share on other sites

Oops... figured this out. I had the old DB directory "~/.moonraker_database" from some previous work and that's not the right DB.

Trying from the correct directory yielded success:

pi@mainsailos:~/printer_data $ mdb_dump -f backup.txt -a database/

drwxr-xr-x 11 pi pi    4096 Feb 25 10:29 .
drwxr-xr-x 23 pi pi    4096 Feb 10 15:29 ..
drwxr-xr-x  5 pi pi    4096 Feb 10 15:33 backup
-rw-r--r--  1 pi pi 1070153 Feb 25 10:29 backup.txt  <-- new backup file
drwxr-xr-x  2 pi pi    4096 Jun 18  2023 certs
drwxr-xr-x  2 pi pi    4096 Feb 23 11:41 comms
drwxr-xr-x  2 pi pi    4096 Feb 14 08:24 config
drwxr-xr-x  2 pi pi    4096 Feb 10 15:59 database
drwxr-xr-x  6 pi pi    4096 Feb 23 08:42 gcodes
drwxr-xr-x  2 pi pi    4096 Feb 25 09:22 logs
drwxr-xr-x  2 pi pi    4096 Feb 10 12:26 misc
-rw-r--r--  1 pi pi     131 Jun 18  2023 moonraker.asvc
-rw-r--r--  1 pi pi     115 Feb 10 12:46 moonraker_secrets
-rw-r--r--  1 pi pi      32 Jun 18  2023 .moonraker.uuid
drwxr-xr-x  2 pi pi    4096 Jan 20 11:17 systemd

pi@mainsailos:~/printer_data $ pwd
/home/pi/printer_data

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...