Another morning spent trying to get my data backups onto the emonPi, and glad to say succesfully this time.
My first attempt was with the ‘Import from Archive’ option in the emonPi backup menu. This worked well on a backup I made 6 months ago, but sadly not on a recent backup. I think the problem with the recent archive is with the macOS or iPadOS operating systems zipping the .tar.gz backup when I send it to iCloud which makes the file unsuable for import after that. Don’t know why it does that but I will watch out for that going forward.
Luckily, I found a spare of that backup archive actually on the original SD card so I could use that instead for the import (what a lucky find). At this point I had switched to my linux Ubuntu laptop to avoid using the mac.
A fresh install of emonOS meant I registered again with a different username and password to access the backup options. I didn’t make a note of my old username or password needed access the emonPi at the time of the backups.
This means I had to access the emonPi via the SSH backdoor and change the password. The ‘passwd’ command is a bit confusing;
I ddin’t know how to change the user ID so it only changed the password for the backdoor (confusing). Instead I switched to the reset password tool and used that instead.
Import from USB SD Card adapter
Feeling I was now safe with a viable archive backup, I thought I would have a go at importing from the original SD card again. Last time it didn’t work and just bricked the installation. However, I never repaired the SD card before I tried this; (https://guide.openenergymonitor.org/setup/import/)
I thought I would try and run the fsck command using the emonPi so I plugged in the adapter with the old SD card with the potentially corrupted data. Back into the emonPi with SSH, I entered the command fsck.ext4 /dev/sda2 however I got an error saying no such file or directory. Using lsusb or usb-devices I was able to find out that the SD card adapter was connected, however not what the address was. I tried /dev/sdb2 however no good. Back to my linux laptop then to run fsck.
Back on the Ubuntu laptop, I used fdisk -l to list all attached devices. The SD card adapter came up at /dev/sdc. Running the fsck command on partition 2 and 3 on the SD card came back with no errors and both filesystems ‘clean’. Didn’t really believe this , so I added the modifier -f to the fsck command to ‘force’ a deeper check. That check came back with errors in both partitions in 'inode’s.
Great, SD card ‘repaired’. Now repeat the ‘import from USB’ backup back at the emonPi and, what a surprise, it works just fine. The SD card repair might have been the reason for it working the second time.
So now I have, a latest version of the emonOS and all my data on the system. I am back to where I was. This isn’t the end though because now I want to do upgrades. First thing first, make use of the extra space on the SD card by using emonSDexpand script.
A copy from the webpage, because sometimes it’s hard to find the info.
Note for emonSD-30Oct18.img.zip: If the image has been written to an SD card larger than 4GB the 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.
The latest emonSD-17Oct19.img.zip has already been expanded to fit a minimum 16 GB SD card size. To expand the data partition further run:
This page also has links to useful scripts, but sadly no direct mention of emonSDexpander. (https://github.com/emoncms/usefulscripts#sdpart_imagefile)
My plan is to have the new EmonTH I bought to take the place of the old one with the broken humidity sensor (Problem with humidity reading on EmonTh v2). However, the new EmonTH has a different node ID so I have to learn how to ‘serial’ connect to Arduino’s in order to change that setting, so that on the online emonCMS back up it looks like the emonTH was never replaced. I could just remember that the data is now at a different feed, but remembering stuff is fine until you don’t. So best to change it if I can (emonTx / emonTH configure RF settings via serial (released FW: V2.6 / V3.2))
I also want to have a look at a nodered install so I can get battery level warnings. I use eneloop Ni hydride rechargable batteries (that are great) but they do die pretty quickly after they drop to 2.0V. I probably need an alarm warning at 2.1V.