In the previous post, we covered a brief introduction to the magic SysRq key and dropped some hints about what it can do. In this post, we will actually learn how to perform one of the many functions it can be used to execute.
When your server becomes unresponsive, the first instinct is to check to see if any of your services, such as your web server, have gone down. Upon accessing your console, however, you may discover that your system is completely unreachable. If you have a remote server, there may be little you can do other than to request a reboot from the data center, but if you have local access, the SysRq key can be very valuable.
To gracefully restart your system without a hard reboot, simply hold Alt+SysRq(PrintScreen) and press the following keys in order, one after another, pausing in between each: R-E-I-S-U-B.
R – will put the keyboard into raw mode, taking away control from anything else
E – will tell all processes to terminate
I – sends a kill signal to processes that have not yet terminated on their own
S – Flushes all data from the disk cache
U – Remounts all file systems as read only
B – Restarts the system
If you have trouble remembering this sequence, you can use the mnemonic device: “Raising Elephants Is So Utterly Boring”.