Preserving printing history - Phil1988/FreeDi GitHub Wiki

Preserving Printing History

This section is only for users who want to keep their print history and statistics. If it's not important to you, simply skip this step :)

Thanks @MarkusKgit for big parts of the following guide!

There are 2 ways to back up your printing history:

  1. Manual backup (recommended)
  2. Moonraker backup script

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/database/

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 script, 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:

cd ~

Run the Moonraker backup script:

~/moonraker/scripts/backup-database.sh

This creates a compressed archive file like:

moonraker-db-2026-01-20_14-32-10.tar.gz

Step 3: Download the Backup Archive

Connect via SFTP client (like WinSCP or MobaXterm).

Navigate to your home directory (~/ or /home/mks/) and 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:

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:

~/moonraker/scripts/restore-database.sh ~/moonraker-db-2026-01-20_14-32-10.tar.gz

(Replace the filename with your actual backup file name)

Step 3: Restart Moonraker Service

sudo service moonraker start

Your print history and statistics should now be fully restored!


Next Steps

Choose your installation path: