If you like to tinker, like I do, you may find yourself doing crazy things like loading Klipper on your Linux laptop and running out of time to move it to Raspberry Pi so you end up printing for over 150 hours on it. After getting tired of having to have the laptop hooked up to the printer, you decide it's time to finally finish what you started and move it to the Pi. Simple, right?
I'll cover the big steps here and then I'll delve into a little more detail with regards to the topic of this blog, which is the Moonraker database.
First, to move klipper, you'll need to prep the Pi as normal and then copy over the contents of your klipper_config folder from the other system to the Pi. If the other system is the same architecture (Pi to Pi, 32-bit to 32-bit, 64-bit to 64-bit, etc.) the Moonraker database will copy over without issue. If, however, you're changing architectures completely, you'll need to use some additional steps:
- You'll need to got to your source machine and stop Moonraker (sudo service moonraker stop).
- Next, go to the Moonraker database location, which is usually ~/.moonraker_database (cd ~/.moonraker_database)
- Install the lmdb-tools package: sudo apt-get install lmdb-tools
- Use mdb_dump to dump the database to a file: mdb_dump -f moonraker.txt -a . (the period at the end matters)
- Now, copy moonraker.txt to the new machine and store it in the Moonraker database directory (we won't cover that here)
- On the new machine, stop the Moonraker service
- Rename the data.mdb and lock.mdb to data.old and lock.old (mv data.mdb data.old)
- Now start the Moonraker service and immediately stop it (this creates blank, fresh databases)
- Install the lmdb-tools package on the new machine (see above)
- Use mdb_load to load the data: mdb_load -f moonraker.txt .
- Start the moonraker service and you should be good to go!