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: https://github.com/emoncms/backup, see: usb-import.sh.
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 https://github.com/openenergymonitor/emonhub/blob/emon-pi/conf/emonpi.default.emonhub.conf
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
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?