I have found my Raspberry Pi running the root file system off a USB flash drive in no good state this morning, the following error showing up on emoncms that was installed locally:
Can't connect to database, please verify credentials/configuration in settings.php Error message: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Obviously my MySQL installation was damaged, I tried to repair based on the first couple pages that Google returned on this error, but to no avail. I wasn’t putting in too much effort into it either, as this will keep happening over and over in the power outage conditions I have here.
Anyway, this wasn’t unexpected as the USB flash drive isn’t much different from a SD card when it comes to unexpected power outages and improper shut downs, probably an external USB HDD will also suffer from this sort of abuse. Obviously I need something else, the comments to my previous post suggested that I try read-only root fs. I did research a bit then on the options, the easiest way to go is simply to use the IPE by NutCom, here is what grabbed me:
It’s aim is to provide a solid OS for using in environments where blackouts are common.
IPE achieves it’s goal by using a full read-only file system with slightly modified tools.
IPE will fit on a 1GB SD card, or can be automatically expanded to use any size.
Use the “firstboot” command to automatically expand to the size of the SD card, and do some basic configuration.
Also, use “ipe-rw” and “ipe-ro” to switch the root file system to writeable or read-only mode.
Looks promising and easy to set, I have downloaded the SD card image to try out. My next steps are to have the RFM2Pi board run in forward mode to external emoncms, that should be a bullet-proof gateway solution.