Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Problems with restore from USB

Hi,
I had some problems with backup restore from old SD card emonSD-30Oct18
I followed instruction how to upgrade to a new emonsd image
I downloaded emonSD-24Jul20 image and wite to a new SD card with balenaEtcher
Then I replaced the old SD with the new one and started raspberry with ethernet connected.
I wated for all update, etc. processes completed.
Then login with a new user registered, connected the old SD to USB port and started restore from USB.
Here I see an error: Can’t connect to database, please verify credentials/configuration in settings.ini. Error message: Connection refused
emoncms was not available after that for some time (1-2 mins).
When I logged in again and went to backup USB, I can see some more detailed log.
Looks like the SD card connected to USB recognised as /dev/sdb with 3 partitions /dev/sdb1, /dev/sdb2 and /dev/sdb3
Import from USB procedure tried to mount /dev/sda, /dev/sdb and /dev/sdc instead.
As a result mount points in /media were empty.

So, I decided to mount manually /dev/sdb1,2,3 in /media/old_sd_boot,root,data,
and then run USB import again
Now it also failed with mounts, but as they were mounted already, then the script migrated data successfully.
After that I unmounted devices manually

Please check attachments for details

BR
Dimitar




fdisk-l

having the exact same problem here. Any solution to this?

There are some other threads on this. @TrystanLea, there were some improvements in progress. Have they been merged?

Yes the latest change that checked for the correctly mounted directory before deleting the mysql database has been merged, and is available in both stable and master branches.

That said the above issue by @kazak shows the script exiting at the point where it cannot find the mysql database.

It looks like there are multiple drives connected.

@kazak @ear9mrn do you both have multiple drives connected? Can you do the initial USB import process with only the old SD card in a single USB drive connected and then after completion connect the second?

I tried two card readers. One had I think 4 slots for cards and the other 2 slots. So when connect /dev/sda , b, c, d appeared for the first and sda and b for the second reader.

Hope this helps.

Pete.

@TrystanLea No, I have only one (the old SD card) drive connected and it is recognised as /dev/sdb with partitions /dev/sdb1, /dev/sdb2 and /dev/sdb3 or /dev/sda|1|2|3, depending on which USB slot used.
And the script in my case was trying to mount /dev/sdc1|2|3. Maybe if I have put in the correct USB, which is recognised as /dev/sdc|1|2|3, then it should be OK.

fdisk -l shows only /dev/ram0-15 , /dev/mmcblk0p1|2|3 and /dev/sda or /dev/sdb, depending on which USB slot used.

ls /dev/disk/by-id shows 4 entries with mmc-USDU1* for mmcblk0 and mmcblk0p1|2|3
and 4 entries with usb-Mass_Storage_Device* for sda and sda1|2|3 or sdb, sdb1|2|3 depending on which USB slot used

I use a microSD to USB adapter/reader

BR
Dimitar

Thanks @ear9mrn ok that’s interesting, I’ve been using this with an SD card reader with only one slot.

@kazak is yours a multi slot reader as well?

@TrystanLea No, its like adapter - one miniSD slot and one USB.

I still think the solution is to scan for drives or mount points and offer them as a selectable item for the user.

2 Likes

That would seem to me to be a far better option than to assume a “standard” - even if the choice appears to be limited to one - at least the user then is aware of what’s been used.