Tiny Core Linux
General TC => General TC Talk => Topic started by: LazyLarry on August 22, 2013, 12:48:57 PM
-
bit of a noob here, but i have some hopefully simple questions. I need an embedded system that will survive a powerfail and am looking at ram based linux. TC seems particularly sweet. I have my own application that writes to a mysql DB and i wonder if TC is the correct platform for me. Having everything in RAM is great, but how are any changes to the DB saved if the power is unplugged from the motherboard? (ie not an orderly shutdown). THe problem we've been having running ubuntu from a CF card is that we sometimes get a corrupted CF card when the plug is pulled.
Thanks.
-
There is nothing magical about TC. It is not immune to the laws of physics nor safe computing practices.
Not everything is in RAM.
Loaded extensions are loop mounted ( Read Only ) from persistent storage.
Likewise, you would have to have your MySQL database reside another server, or on persistent storage
and deal with possible database corruption that may occur during a power failure.
-
FWIW, I run TC apps in RAM only (no persistent home/opt) booting from and saving to a USB stick (no hard disk). I've been through several power failures with no apparent corruption of the stick. HOWEVER, I've also been lucky that none of them happened while I was actually accessing the stick. And of course I lost whatever was in RAM at the time.
If you've got something that critical maybe a UPS would be a better solution?
-
What sort of embedded system is it? I'm using one that has internal battery backed RAM, though it's only one meg. The company has Linux drivers available as source code. If you had something like that, you could put the transaction log files there. You would also want to disable write caching system wide. That's where your corruption comes in. Use journaling where you can. This is exactly the sort of situation that it is made for.
-
A RAM-based system won't help if the power cuts in the middle of your writing to the DB. It would only help with not corrupting the system (if the DB was on a separate partition/media).
As others suggest, you need UPS or some other method of guaranteeing the power won't cut when you're writing.
-
Thanks for the replies so far.
I've only ever had corruption with the linux system files, not DB, so I'm prepared to run that risk. DB writes are minimal in any case.
OK, I'm not sure if this is possible, but can mysql running in RAM access the DB if I keep the DB on the CF card? Can I mount the CF card seperately ? There will be no network access on the pcb when installed, therefore no remote DB. A UPS is too expensive, so has already been ruled out.
Secondly, is there a procedure for getting my own app into RAM? It's not jumping out at me from the forum.
-
Your first choice should be to make your app into an extension. There are other options, but try that first. TC is very read-only media friendly, so you shouldn't be having corruption with system files like you would with one of the fat distros. Is the CF card your only media, or could you have a separate boot source like a USB stick?
-
I have 256MB of RAM and then the CF card (4GB). TC currently boots from the CF card into RAM