Yeah, the reinstall would likely not be the best way.
- the device persistent data cannot really be saved/restored on another device easily. I believe this is on the roadmap as well, but further down
- the device ID (and thus the device) you can preserve, by generating a new
config.jsonwith the same UUID such as
balena config generate --device UUID --generate-device-api-key(see
balena config generate --helpfor more info) and adding that configuration to your image you are using to reinstall the device (e.g. with a preloaded image, so it runs your updated application). Note that the wifi settings of that option are legacy (for balenaOS 2.x need to have separate NetworkManager config files added, tose options by the cli are not effective, we are trying to make this clearer)
For further investigation, though:
- you can add an ssh key to the config.json https://github.com/balena-os/meta-balena#sshkeys so you can have access to the device even if production device, with your own key locally
- probably manually / with some scripting, could get the persistent data out of the device
- if I recall, there was some work being done preloading data out of the device, will have to confirm whether that’s working and if does, how exactly?
With these pieces at hand, with an on the spot preloaded image generation might work as you describe. Will be checking it with our team and get back to you with more details.