J
J
JosikDrained2017-05-23 17:34:30
linux
JosikDrained, 2017-05-23 17:34:30

How to prevent Linux from working when the hard drive fails?

Linux starts up and works. Then, in the process of work, the disk stops writing the log to the database too, but Linux continues to work. And I don't want it to work in this case. I want it to freeze, turn off or reboot. How to make this Linux work correctly?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Burov, 2017-05-23
@BuriK666

add to fstaberrors=panic

errors=panic Panic and halt the machine if an error occurs.
(These mount options override the errors behavior
specified in the superblock, which can be configured
using tune2fs)

https://www.kernel.org/doc/Documentation/filesystem...

D
Dmitry Shitskov, 2017-05-23
@Zarom

JosikDrained : Well, you are a programmer!
Write something like this, replacing the path to the file with your own:

#!/bin/sh

TESTPATH=/путь/к/любому/каталогу/на/диске/где/будет/создан/файл/имя_файла
if [ `touch $TESTPATH` ]
then
  rm $TESTPATH
else
  reboot
fi

And add a script to Cron to run every 5 minutes. Or every minute. Google will tell you how to do this - there are a lot of ready-made answers "how to add a task to cron". Do not forget to make the script so chmod +xthat it can be executed.

E
Erelecano Oioraen, 2017-05-24
@Erelecano

In a panic, change the drive, and not look for crutches.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question