Handling power off with no shutdown

I have a control system that is running Linux. The user will not be "shutting down", he will be simply turn the power off. When this happens, I see "/dev/hda1 was not cleanly unmounted, check forced" and then it scans/repairs the drive.

It seems that I could use some combination of initrd, a ramdisk and remounting the hard drive as read-only to avoid this, but I have no idea where to start.

Can anyone give me a clue? (I'm using SUSE v7.0 with RTAI)

-Brian Rosenthal

Reply to
Brian Rosenthal
Loading thread data ...

In my system i've mounted the whole thing readonly, and only if i have to write something to the disk (or in my case a cf-card) i have to remount it in rw-mode, then i write, then i remount it in ro-mode again. All the temporary stuff which linux will write goes into a ramdisk, so per example /var is mounted in a ramdisk. In this way you can minimize the writings.

This is maybe not the best way, but for me it works.

hth, Jens

--
Die o.a. Adresse ist OK, wird aber nicht gelesen. Für Mails an mich bitte
"usenet" durch "jens.nixdorf" ersetzen.
Reply to
Jens Nixdorf

If nothing is written to the disk it can be mounted as read-only.

If the system writes to the disk at random times the only way is to add a battery to provide power to do a shut down when power is switched off.

Using a journalling file system reduced the boot time after a not clean shout down and enables a cleaner remounting of a not cleanly dismounted partition, but increases the risk of interrupting a write cycles as a lot more writes are done with a single transaction. So it's not recommended when using some kind of flash instead of a disk.

-Michael

Reply to
Michael Schnell

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.