[PLUG] flushing buffers?

chris (fool) mccraw gently at gmail.com
Thu Jan 6 20:07:24 UTC 2011


On Thu, Jan 6, 2011 at 10:21, Denis Heidtmann <denis.heidtmann at gmail.com> wrote:

> The system does the shutdown.  You are saying that the system will NOT
> bother with dirty buffers; that if the system shuts down due to running out
> of battery power any applications running are on their own.

If the system shuts down in an orderly fashion (which it should do if
you are running a power manager that shuts it down rather than quite
literally just running out of batteries?) it will flush the buffers
before doing so.  the signal handler that larry mentioned is something
you can put into your script, since again as the system shuts down
normally all programs are warned before they are killed, and as a
result of the warning you could choose to sync your files.

however, your ssd saves you some worry here--just sync the file every
time you write it.  use a command called 'sync' that you can add to
the script generating the file.  since there is no disk spinup cost
[of power usage] (the major reason not to sync constantly on a laptop)
and you are very concerned with getting all the data saved, i'd just
do it every time you write the file.  or every 5th time.  or whatever.



> This may explain a failure I had with this machine shortly after I received
> it:  I ran it 'till it shut down.  When it came back up the some parts of X
> were hosed.  There are other explanations for the failure, but this may top
> the list if in fact the system behaves as you say.

it's not supposed to shut down like someone hit the power switch for 4
seconds.  my eeepc running ubuntu goes into hibernation at around 5%
battery remaining.  of course even hibernation will run the battery
down eventually (takes about 36 hours on mine from the 5% full
mandatory shutdown point).  i'm gonna blame the blinking LED's =)


> I will have a bash loop running.  All I would need to do is force a write to
> the disk in the loop as it nears the shutdown voltage.  How do I force a
> write?

'sync'



More information about the PLUG mailing list