How do I backup my OctoPrint settings on OctoPi?

octopi
backup

#1

Starting with 1.3.10 OctoPrint will ship with a bundled Backup Plugin that should make backing up and restoring settings, files and plugins easy.

For versions prior to that, read on:

OctoPrint stores all its data in ~/.octoprint - uploads, timelapses, configuration, plugin data, etc. That makes backing them up quite easy. Third party plugins are installed into the virtual environment under ~/oprint and a bit trickier to backup since you can't just copy that folder (well, technically you could, but stuff wouldn't necessarily work...).

The following backup/restore procedure should work:

Backup

  • Create a list of installed plugins. This can be done by either going into Settings->Plugin Manager or logging in via SSH and referencing the octoprint log file. If using SSH, open up ~/.octoprint/logs/octoprint.log or ~/.octoprint/logs/octoprint.log-YYYY-MM-DD with a text editor. Somewhere in there should be something that looks like this:

    2017-11-07 12:50:02,100 - octoprint.plugin.core - INFO - 19 plugin(s) registered with the system:
    |  Announcement Plugin (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.5-py2.7.egg/octoprint/plugins/announcements
    |  Core Wizard (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.5-py2.7.egg/octoprint/plugins/corewizard
    |  Cost Plugin (0.1.3) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_cost
    |  CuraEngine (<= 15.04) (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.5-py2.7.egg/octoprint/plugins/cura
    |  Custom Control Editor (0.2.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_customControl
    |  Discovery (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.5-py2.7.egg/octoprint/plugins/discovery
    |  DisplayProgress (0.1.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_displayprogress
    |  FileManager (0.1.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_filemanager
    |  Find My OctoPrint (0.1.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_findmyoctoprint
    |  Firmware Updater (0.2.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_firmwareupdater
    |  Fullscreen Plugin (0.0.3) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_fullscreen
    |  Plugin Manager (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.5-py2.7.egg/octoprint/plugins/pluginmanager
    |  PortLister (0.1.6) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_portlister
    |  Pushbullet (0.1.9) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_octobullet
    |  Software Update (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.5-py2.7.egg/octoprint/plugins/softwareupdate
    |  Telegram Notifications (1.4.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_telegram
    |  TouchUI (0.3.10) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_touchui
    |  Virtual Printer (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.5-py2.7.egg/octoprint/plugins/virtual_printer
    |  Yamlpatcher (0.1.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_yamlpatcher
    

    Note down each plugin that is installed.

  • Shut down your OctoPrint server: sudo service octoprint stop

  • Using an SCP client (e.g. something like scp or WinSCP) on your computer, backup the whole ~/.octoprint folder. If you are using WinSCP, you'll need to first hit Ctrl+Alt+H to make it show up. For your backup, make sure to preserve timestamps, also for directories (scp -p ..., in WinSCP make sure to check "Preserve Timestamps" and "Including Directories" in your transfer profile under Options > Preferences > Transfer).

  • Restart your OctoPrint server: sudo service octoprint start

Restore

  • Log in via SSH, shut down your OctoPrint server: sudo service octoprint stop
  • Using your SCP client, log into the image. Delete the current .octoprint folder. Then copy back your backup of .octoprint that you made earlier. Again, make sure to preserve timestamps of files and directories.
  • Log into the image via SSH, restart your OctoPrint server: sudo service octoprint start
  • You should now be able to open up OctoPrint in your browser and log back in just like before.
  • However, your plugins are still missing. Open Settings > Plugin Manager > Get More... and install all plugins that don't have a bundled next to them from the list created during the backup. Once that's completed, you should be done.

Backup and Restore of Octoprint and plugin and their settings?
New OctoPi Release: 0.15.1
[OctoPi] Is there an upgrade path from jessie to stretch?
New OctoPi Release: 0.15.0
Upgrade-helper script
Reinstalling OctoPrint
OctoPi WiFi/network connection troubleshooting megatopic
Good this morning, won't start tonight
OctoPrint tells me it can't run an update due to my Python environment being outdated, what do I do now?
Access Forbidden?
Server is currently not running (after power outage)
#2

And for those of us who's preference is to backup the entire card to a single local file:

backup
sudo dd if=/dev/sdX of=~/SDCardBackup.img

restore
sudo dd bs=4M if=~/SDCardBackup.img of=/dev/sdX

Cloning the sdcard onto another one is also very effective and simple.


#3

The following command will display the collection of installed plugins from your latest octoprint.log file, making that earlier step easier:

$ cat ~/.octoprint/logs/octoprint.log | grep "|" | grep "= /home/pi/" | sort | uniq
|  Announcement Plugin (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/announcements
|  Bed Visualizer (0.1.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_bedlevelvisualizer
|  Core Wizard (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/corewizard
|  CuraEngine (<= 15.04) (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/cura
|  Discovery (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/discovery
|  EEPROM Marlin Editor Plugin (1.2.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_eeprom_marlin
|  GCODE System Commands (0.1.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_gcodesystemcommands
|  Logging (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/logging
|  OctoPi Support Plugin (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/octopi_support
|  Plugin Manager (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/pluginmanager
|  Printer Safety Check (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/printer_safety_check
|  Software Update (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/softwareupdate
|  Themeify (1.2.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_themeify
|  Virtual Printer (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/virtual_printer