Import / Backup
Import data from existing emonPi Emoncms accounts
The Emoncms backup module can be used to backup Emoncms account data and import data from another Emoncms account. This process can also be used to migrate from an older emonPi / emonBase image to the latest image.
Currently the Backup Module can only be used with Local Emoncms not Emoncms.org
Backup / Export
Export from an older emonPi / emonBase
If the Backup module is not visible in the Local Emoncms menu then the emonPi / emonBase is running an older version e.g Emoncms V8.x.
To check what software stack (emonSD pre-built SD card) version an emonPi is running see instructions on emonPi emonSD download repository and changelog
To export data from an older emonPi:
- Install the backup module by running
Admin > emonPi updatein Local Emoncms
- Wait (up to) 60s for the update to begin and then another couple of minutes for it to complete; the update log page can be refreshed to view progress
- Log-out then back into Local Emoncms
- Backup module should now be visible under
Extras > Backup
- Follow Backup instructions below
Create Backup(see screenshot below)
- Wait for backup to be created, then refresh the page to view
Import / Restore
Importing / restoring a backup will overwrite ALL data in the current Emoncms account.
Note: If a new emonSD pre-built-SDcard image has been written to an SD card larger than 4GB the read-write
~/data partition should be expanded to fill the SD card to create sufficient space to import a backup. Do not use Raspbian raspi-config, instead connect via SSH) and run
$ sudo emonSDexpand and follow prompts.
To import a backup:
- Check available disk space in the data partition (
Local Emoncms > Setup > Administration
- Wait for upload to complete
- Check restore log (see below)
- Log out then log back into Local Emocms using the imported account login credentials
Backup tar.gz filename cannot contain any spaces; e.g., if the same backup has been downloaded more than once: rename 'emoncms-backup-2016-04-23 (1).tar' to 'emoncms-backup-2016-04-23.tar' before uploading.
emonSDexpand will run
~/usefulscripts/sdpart/./sdpart_imagefile script, for more info see Useful Scripts Readme
Sat 23 Apr 00:42:28 UTC 2016 Reading ~/backup/config.cfg.... Location of mysql database: /home/pi/data Location of emonhub.conf: /home/pi/data Location of emoncms.conf: /home/pi/data Location of Emoncms: /var/www/emoncms Backup destination: /home/pi/data Backup source path: /home/pi/data/uploads Starting import from /home/pi/data/uploads to /home/pi/data... Image version: emonSD-29Mar16 new image Backup found: emoncms-backup-2016-04-23.tar.gz starting import.. Decompressing backup.. Removing compressed backup to save disk space.. Wipe any current data from account.. Restore phpfina and phptimeseries data folders... Emoncms MYSQL database import... Import emonhub.conf > /home/pi/data/old.emohub.conf Import emoncms.conf > /home/pi/data/old.emoncms.conf Start with fresh config: copy NEW default emonpi.emonhub.conf: cp /home/pi/emonhub/conf/emonpi.default.emonhub.conf /home/pi/data/emonhub.conf OK Update Emoncms Database ["ALTER TABLE dashboard MODIFY `height` int(11) Default '600'","ALTER TABLE dashboard MODIFY `main` tinyint(1) Default '0'","ALTER TABLE dashboard MODIFY `public` tinyint(1) Default '0'","ALTER TABLE dashboard MODIFY `published` tinyint(1) Default '0'","ALTER TABLE dashboard MODIFY `showdescription` tinyint(1) Default '0'","ALTER TABLE `dashboard` ADD `backgroundcolor` varchar(6) NOT NULL DEFAULT 'EDF7FC'","ALTER TABLE feeds MODIFY `time` int(10);","ALTER TABLE feeds MODIFY `value` double;","ALTER TABLE `feeds` ADD `processList` text NOT NULL","ALTER TABLE input MODIFY `time` int(10);","ALTER TABLE users MODIFY `salt` varchar(32);","ALTER TABLE users MODIFY `timezone` varchar(64) Default 'UTC';"] Restarting emonhub... Restarting feedwriter... Sat 23 Apr 00:42:39 UTC 2016 === Emoncms import complete! ===
Included in backup
- Emoncms account credentials
- Historic Feed data
- Input Processing config (only when migrating from Emoncms V9 > V9 setup)
- MyElectric / MySolarPV app settings
- EmonHub config:
* Included in backup but not restored due to potential version conflicts: saved as
~/data for manual restore if required.
Not included in backup
- WiFi passcode & custom network config
- Custom NodeRED flows
- Custom openHAB settings
- Input processing setup if migrating from Emoncms V8, input processing will need to be re-creatred after import and new inputs should be logged to imported feeds
How-to backup items not automatically included
- nodeRED custom flows: select all flows then
menu > export > clipboardcopy the JSON text
- Connect via SSH:
- See Technical > Service Credentials
- WiFi settings & password: backup copy:
- openHAB custom config: copy
If you have any questions or if an error occures during the backup or import process please post in the
Hardware > emonPi category of the Community Forums. Please provide as much infomation as possible e.g. backup / import logs and emonSD version.
Alternatively try and perform a manual import, see Backup Module Readme.