Backup module script (beta)

Tags: #<Tag:0x00007fc924a7c6b0>

After reading through @mjseeley’s thread on migrating from an old 2015 image to the latest (LCD Screen says "Updating - Do Not Unplug") it got me thinking again about an idea for migrating that would avoid the need to update software or run a script on the original image.

The idea is to take the original SD card and mount it as a ‘USB drive’ on to the Pi running the latest image, then run an import script on the new image to copy the files across directly.

I’ve got a preliminary version of this to work here and tested migration from emonSD-30Oct18 and emonSD-17Jun2015 images. I’ve uploaded the script to the master branch of the backup module for testing:, see:

Inputs and feeds imported fine on the emonSD-17Jun2015 image, a basic dashboard with one widget needed clicking on the widget and re-configuring. The import tool copied the old emonhub.conf which was not compatible with the new image so I had to restore with a new default copy from

How to use the script

1. SSH into the Pi running the new image
2. Place the old SD card in a SD card reader and plug into any of the USB ports on the Pi running the new image.
3. Navigate to directory /opt/emoncms/modules/backup

cd /opt/emoncms/modules/backup

4. Run the import script:


5. Logout and log back into your emoncms account with your original credentials.

Note: The script assumes that the USB reader and old SD card is mounted on /dev/sda which appears to be consistent over 2 different systems and 3 migration tests that I’ve performed so far.

Next steps: I’d like to make this script runnable from a button click in the emoncms UI to remove the need to use SSH.

Can anyone see any obvious issues with this approach that I may be missing?

1 Like

I think it is a good idea and most useful to those without the backup module installed, but…

  1. Not everyone will have a reader so the backup file method should not be abandoned.
  2. Some installations are not on SD Cards - might be on a VM or a HDD.

I also think being able to import (either file or mounted filesystem) at the ‘register’ point of a new install would make migration much easier as well.

All progress :grin:.

1 Like