Suppose we are working in environment where you can't be sure that your computer won't just suddenly shut off. What measures can be taken to improve system's (unix) resist to such failures? And how to ensure that risk of data loss (on hard drive) is as low as possible?
Use a journaling file system and make sure the flush to disk frequency is set pretty high.
If you are having frequent kernel panics, don't use the machine for anything important! It's broken. Fix it. Remove whatever modules or hardware is a problem before using it in a production environment.
If power or other physical issues are present, get a UPS or fix the environment.