power off keeping filesystem integrity


I am not sure if comp.os.linux.embedded is the best list to explain my question, please point me to another list if this list is not appropriate.

We made a router using a embedded linux system (redhat 7.0) The system could be power off suddenly at any time and we must keep the filesystem integrity. Anybody knows how to archieve this properly? (or point me in the right direction)

Regards, Carlos

Reply to
Carlos Ojea
Loading thread data ...

may be using your flash disk read only, and using a ram disk for the running filesystem ?

then you just have to copy your runnig data from flash to ram and start the services.

on the other way, your flash will be only breakable when you make updates to the system/ system config.

just for fool proof, you can get a second rescue filesystem ready to restore the flash if corrupted in a upgrade.

when you power off, then the actual routing data is lost, but the filesystem will be recreated from the flash clean and unbroken.

just my 2 cents


Reply to
Albert Gonzalez

If it's on a harddisk, a journalling file system can do this. When booting, a journalling file system will "roll back" to a former state of full filesystem integrity, though you can't predict what point of history it will represent. AFAIK, exp3 is not a real journalling file system.

But I suppose you will want to use a flash card or similar. When those devices are powered off while written to, they may get damaged and even might not be usable at all afterwards. You can't help this and there is no specification of what exactly happens in that case by any brand. AFAIK, even the worst case writing-started-to-power-off-alowed time is not specified. So providing some kind of battery power is the only solution.


Reply to
Michael Schnell


As people have mentioned Raiser , or EXT3 file system, can do the job. But if you are using ATX supported power supply than you can use APM to shutdown the system.

Or you can write a simple application,

1)Basically read a pin on parallel port constantly with some usleep delay. 2)If some thing happens on pin (This pin is connected to the power push button) 3)unmount your RW drives nicely 4)and init 0 (Shutdown)

this is a decent way of doing it.

it will switch off/Cut the power if you are using ATX power supply or it will bring you to the init 0 if you are using non ATX power supply.

Let me know if it helps



Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.