Preserving printer stats¶
This section is only for users who want to keep their printer's history and statistics.
Flashing FreeDi will delete everything from your system (printing time, filament used...).
If it's not important for you, you can simply skip this step.
If you want to backup your printer's history, here are 2 ways to do this:
Method 1: Manual Backup (Recommended)¶
This is the recommended approach as it's been reported to work flawlessly.
The manual method is straightforward and reliable.
Before Installing/Updating FreeDi
- Step 1: Connect to Your Printer
Power on the printer and connect via SFTP using a client like WinSCP or MobaXterm (they provide convenient file browsers). - Step 2: Back Up the Moonraker Database
Navigate to:/home/mks/printer_data/databasethen download the file: moonraker-sql.db - Step 3: (Optional) Back Up G-code Files
If you want to preserve all uploaded G-code files, navigate to:/home/mks/printer_data/gcodes
Download the entire folder to your PC.
After Installing/Updating FreeDi
- Step 1: Stop Moonraker Service
SSH into the printer and stop the Moonraker service:sudo service moonraker stop - Step 2: Restore the Database
Upload the backed-up moonraker-sql.db file back to:/home/mks/printer_data/database
Overwrite the existing file if present. - Step 3: Restart Moonraker Service
sudo service moonraker start
- Your print history and statistics should now be fully restored!
Method 2: Moonraker Backup Script (Alternative)¶
If you prefer using the official Moonraker backup script1, follow this method.
Note: I'd love to hear your experience with this approach to confirm it works reliably.
Before Installing/Updating FreeDi
- Step 1: Connect via SSH Terminal
Power on the printer and connect using an SSH terminal like PuTTY. - Step 2: Run the Backup Script
Make sure you're in the home directory with:cd - Run the Moonraker backup script:
This creates a compressed archive file like: moonraker-db-2026-01-20_14-32-10.tar.gz
~/moonraker/scripts/backup-database.sh - Step 3: Download the Backup Archive
-Connect via SFTP using a client like WinSCP or MobaXterm
-Navigate to your home directory:/home/mks
-Download the moonraker-db-2026-01-20_14-32-10.tar.gz file (your filename will have a different timestamp). - Step 4: (Optional) Back Up G-code Files
Navigate to:/home/mks/printer_data/gcodes
Download the entire folder to your PC if you want to preserve all uploaded G-code files.
After Installing/Updating FreeDi
- Step 1: Stop Moonraker Service
SSH into the printer and stop Moonraker with:sudo systemctl stop moonraker - Step 2: Upload and Restore the Database
-Upload your backed-up moonraker-db-2026-01-20_14-32-10.tar.gz file to:/home/mks
-Run the restore script: (Replace the filename with your actual backup file name)~/moonraker/scripts/restore-database.sh ~/moonraker-db-YOUR_TIMESTAMP.tar.gz - Step 3: Restart Moonraker Service
sudo service moonraker start
- Your print history and statistics should now be fully restored!
Thanks MarkusKgit for his contribution to big parts of the following guide.