This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

SD-card failure detection
#1
Hi,

After a power outage I discovered, that my LM4 (bought in 2015) only responded to ping and no TCP ports were open (stuck somewhere like 'give root password for maintenance'). From forum I found the recovery image instructions and using a new SD card I was able to get my LM4 back to life.
The original Samsung 4GB SD-card's 3rd partitions filesystem was severely damaged. Partition tables did exist, but e2fsck failed hard. Still I can see the directory listing for /storage/ and the current.db are there.
What puzzles me, is that the newest timestamps in /storage folder are from 2017... but I definetely changed some scripts in 2018. 
Could it be, that already then the filesystem was damaged and changed to read-only before I saved my script?  I can't figure out other ways, why the changes I made didn't appear in /storage/ folder files.

As the SD-cards may fail and same problem occur again, is there a way from LogicMachine GUI to discover such hardware issues?

Most of the stuff I restored from backup, which was 2 years old (not the latest version though). But just for clarification - what files should be rescued from SD-card, to get the latest configuration, which could be used to restore  (current.db looks to be most important)?

PS. What linux utility can handle the db file? It doesn't look to be a well known format.
I used strings command to get textual stuff from the file.

PPS. I can share a full dd image from the failed 4GB card in case it could be any useful (101MB dd img.gz).

After more that 4 years I'm still very happy and satisfied with LM4.
Using Lm4 with KNX, 1-wire and Modbus
Reply
#2
SQLite is used for main database. The file might be corrupted in your case. Some cards switch to read-only state which can only be detected by rebooting the device.

There's no definite way of detecting SD card failures. As with other storage solutions most failures happen unexpectedly so the only way is to keep your data safe is to make backups often.
Reply
#3
The current.db was indeed corrupted. I extracted from my new project backup the ./current.db file, which is correctly detected as "SQLite 3.x database, last written using SQLite version 3019003".

The file from faulted SD is just data
-rw-r--r-- 1 rauno rauno 581632 juuli 11 2017 current.db.katkine

$ file current.db
current.db: data
sqlite3 dump:
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
/**** ERROR: (26) file is encrypted or is not a database *****/
ROLLBACK; -- due to errors

One side note more: after restoring my backup from 2017, all the modbus JSONs and groups were restored, but in configuration the RS485 port remained to default disabled state. I had to manually reconfigure RS485 port and Modbus started to work again.

When I'm all set up again, I'll take the SD from logicMachine and back it up with 'dd if=/dev/sda of=lm4.full-dd.img conv=sparse bs=1M count=4000'. When a SD card failure bothers me again, I just need to copy the image to a new SD card (8GB+) and I'm back in business within 5 minutes Smile

Thanks for the help!
Using Lm4 with KNX, 1-wire and Modbus
Reply


Forum Jump: