Shami's Blog

DevOps because uptime is not optional

Simulate Pressing the Reset Button

We’ve all been there, something gets stuck and there is no way to fix it except for a reboot, but even rebooting through SSH isn’t working and you don’t have physical access to the server or an out-of-bound way to power cycle. This has mostly bit me while working on NFS but there has been other cases. Adding it here for reference.

Disclaimer

Doing this might result in data loss. The commands below cause an instant power cycle similar to pressing the reset switch or unplugging/replugging the power cord. Any dirty buffers will not be saved to disk. Do not use unless you absolutely have to and know what you are doing.

For FreeBSD:

1sysctl debug.kdb.panic=1

For Linux:

1echo b > /proc/sysrq-trigger
2
3# Some documentation mentions you need to enable sysrq first, but it was never the case for me
4# Adding it here for reference
5echo 1 > /proc/sys/kernel/sysrq

About Me

Dev gone Ops gone DevOps. Any views expressed on this blog are mine alone and do not necessarily reflect the views of my employer.

Categories