How to force shutdown when the hard disk fails: Input/output error

If the hard disk may be locked or bad, it will cause the SHELL command to fail, including reboot, powoff, and shutdown. It is impossible to use normal commands. Complete the reboot.

Execute these commands, the following IO error will occur:

# reboot
bash:/sbin/reboot:Input/output error
# shurdown -r now
bash:/sbin/shutdown:Input/output error

It is obvious that the kernel cannot read the binary programs /sbin/reboot and /sbin/shutdown from the disk to execute, so the command fails. . The system automatically fsck may correct the disk error at the next startup, but the system needs to be restarted first. Pulling the power off may cause damage to the hard disk.

can let the kernel restart directly, do not need to read (already locked or broken) hard disk, as follows:

1, execute:


"magic SysRq key" provides a pass /proc A way to send commands directly to the kernel. To enable this feature, simply enable the "CONFIG_MAGIC_SYSRQ" option when the kernel is compiled, and the standard distribution of the standard distribution is already enabled.

So, just execute the first step to activate this option.

2, then execute the following command


The device will restart immediately.