Mogens Jensen wrote:
> Even after many tries, I have not yet been able to corrupt the
> filesystem so fsck cannot repair it without manual intervention.
> However, if power is removed while the 'reorder_kernel' script runs,
> the system will become completely unbootable. I could do this multiple
> times.
The new kernel is installed like this:
umask 077 && cp bsd /nbsd && mv /nbsd /bsd
So a crash during compilation or linking shouldn't affect reboot. However,
there's a window between cp and mv where some of the new kernel may reside in
unwritten dirty buffers. Then mv will rewrite the directory entry. A crash at
this point will leave you with a broken kernel.
A few possible fixes.
1. Insert a sync call in there. Kinda heavyweight, but works.
2. cp could do an fsync call. There was a thread about this a while ago?
3. mv could do the fsync instead, to make sure it doesn't move incomplete
files.