Filesystem consistency

Hi,
We have noticed a problem when a PC is shutdown with the power button that
certain files can be corrupted on restart, is there a way to prevent this?

When we start up we run

chkfsys -P -q -s -r /

we use codebase which stores data in two files, .dbf datafiles and .mdx
index files. we have noticed that if these files are being written to whilst
there is a sudden power loss or the use turns off the pc with the power
button these files can be out of sync or corrupted.

Any easy solutions to this?

I thought about implementing a safe shutdown a bit like windows has, that
runs a shutdown -b ?

Best Regards
Darel

“Darel Cullen” <darelj@gmail.com> wrote in message
news:dlka53$gfe$1@inn.qnx.com

Hi,
We have noticed a problem when a PC is shutdown with the power button that
certain files can be corrupted on restart, is there a way to prevent this?

When we start up we run

chkfsys -P -q -s -r /

we use codebase which stores data in two files, .dbf datafiles and .mdx
index files. we have noticed that if these files are being written to
whilst there is a sudden power loss or the use turns off the pc with the
power button these files can be out of sync or corrupted.

Any easy solutions to this?

I thought about implementing a safe shutdown a bit like windows has, that
runs a shutdown -b ?

Yes shutdown would to the trick, and it would be even better if you program
respond to SIGPWR and make sure all data are flushed.

The other option is to open the files with flash tell Fsys to alwys write
the data to disk and not cache the writes.


Best Regards
Darel

I like to give a “sync” before running shutdown, too. Just makes me feel
better.

“Mario Charest” postmaster@127.0.0.1 wrote in message
news:dlki81$llh$1@inn.qnx.com

“Darel Cullen” <> darelj@gmail.com> > wrote in message
news:dlka53$gfe$> 1@inn.qnx.com> …
Hi,
We have noticed a problem when a PC is shutdown with the power button
that certain files can be corrupted on restart, is there a way to prevent
this?

When we start up we run

chkfsys -P -q -s -r /

we use codebase which stores data in two files, .dbf datafiles and .mdx
index files. we have noticed that if these files are being written to
whilst there is a sudden power loss or the use turns off the pc with the
power button these files can be out of sync or corrupted.

Any easy solutions to this?

I thought about implementing a safe shutdown a bit like windows has, that
runs a shutdown -b ?

Yes shutdown would to the trick, and it would be even better if you
program respond to SIGPWR and make sure all data are flushed.

The other option is to open the files with flash tell Fsys to alwys write
the data to disk and not cache the writes.



Best Regards
Darel
\

Hi,
Yes, I had added that too - always good to know anything that is waiting in
some buffer somewhere will flush out. It is a bit of a shame that there is
no way to prevent the user from pressing the power button and ending up with
an inconsistent filesystem (because we have files that refer to each other).
It would be nice to be able to do as windows and catch the power off as an
interrupt and then force a controlled shutdown.

Thanks for your help.

“Kevin Miller” <kevin.miller@transcore.com> wrote in message
news:dll7to$7h2$1@inn.qnx.com

I like to give a “sync” before running shutdown, too. Just makes me feel
better.

“Mario Charest” postmaster@127.0.0.1 wrote in message
news:dlki81$llh$> 1@inn.qnx.com> …

“Darel Cullen” <> darelj@gmail.com> > wrote in message
news:dlka53$gfe$> 1@inn.qnx.com> …
Hi,
We have noticed a problem when a PC is shutdown with the power button
that certain files can be corrupted on restart, is there a way to
prevent this?

When we start up we run

chkfsys -P -q -s -r /

we use codebase which stores data in two files, .dbf datafiles and .mdx
index files. we have noticed that if these files are being written to
whilst there is a sudden power loss or the use turns off the pc with the
power button these files can be out of sync or corrupted.

Any easy solutions to this?

I thought about implementing a safe shutdown a bit like windows has,
that runs a shutdown -b ?

Yes shutdown would to the trick, and it would be even better if you
program respond to SIGPWR and make sure all data are flushed.

The other option is to open the files with flash tell Fsys to alwys write
the data to disk and not cache the writes.



Best Regards
Darel


\

“Darel Cullen” <darelj@gmail.com> wrote in message
news:dlrunj$2a5$1@inn.qnx.com

Hi,
Yes, I had added that too - always good to know anything that is waiting
in some buffer somewhere will flush out. It is a bit of a shame that there
is no way to prevent the user from pressing the power button and ending up
with an inconsistent filesystem (because we have files that refer to each
other). It would be nice to be able to do as windows and catch the power
off as an interrupt and then force a controlled shutdown.

You can, some motherboard use the NMI interrupt to notify of powerfailure.
You only get a few ms before power goes out though.

Thanks for your help.

“Kevin Miller” <> kevin.miller@transcore.com> > wrote in message
news:dll7to$7h2$> 1@inn.qnx.com> …
I like to give a “sync” before running shutdown, too. Just makes me feel
better.

“Mario Charest” postmaster@127.0.0.1 wrote in message
news:dlki81$llh$> 1@inn.qnx.com> …

“Darel Cullen” <> darelj@gmail.com> > wrote in message
news:dlka53$gfe$> 1@inn.qnx.com> …
Hi,
We have noticed a problem when a PC is shutdown with the power button
that certain files can be corrupted on restart, is there a way to
prevent this?

When we start up we run

chkfsys -P -q -s -r /

we use codebase which stores data in two files, .dbf datafiles and .mdx
index files. we have noticed that if these files are being written to
whilst there is a sudden power loss or the use turns off the pc with
the power button these files can be out of sync or corrupted.

Any easy solutions to this?

I thought about implementing a safe shutdown a bit like windows has,
that runs a shutdown -b ?

Yes shutdown would to the trick, and it would be even better if you
program respond to SIGPWR and make sure all data are flushed.

The other option is to open the files with flash tell Fsys to alwys
write the data to disk and not cache the writes.



Best Regards
Darel




\