Fake Kernel Panic for Testing(Magic SysRq)

Sometimes we need to crash the system for testing of cluster  fencing functionality  and fail-over functionality.  Actually in Linux we can create a fake kernel panic by issuing below commands.

 

root@ankara # echo 1 > /proc/sys/kernel/sysrq  #1 - enable all functions of sysrq
root@ankara # echo "c" > /proc/sysrq-trigger   #

 

c Will perform a system crash by a NULL pointer dereference. A crash dump will be taken if configured.

Reference: https://www.kernel.org/doc/html/v4.11/admin-guide/sysrq.html