Rescue your server with a little magic

What to do when your server just started malfunctioning with disk errors and the filesystem switches to read only mode? You may also find various files disappearing before your eyes as you try to copy them to another machine (even though you do of course have a proper backup, right?? 😉 )

You decide to reboot and hope it comes back online in a more useful state so issue the appropriate command like so..

[root@server ~]# reboot

*crickets*

What happened? Nothing. It refused to boot  (but hopefully it didn’t actually print *crickets*) and it just sits there ignoring you. Well there’s still a (somewhat risky) way you can recover from this with magic!

The wikipedia page says..

“The magic SysRq key is a key combination understood by the Linux kernel, which allows the user to perform various low level commands regardless of the system’s state. It is often used to recover from freezes, or to reboot a computer without corrupting the filesystem.”

To wield this magic you just have to switch it on first..

echo 1 > /proc/sys/kernel/sysrq

Then you just pass the magic incantation ‘b’ (equivalent to Alt + SysRq + B) like so..

echo b > /proc/sysrq-trigger

The full list of commands is listed on the aforementioned wiki page.

Now with a bit of luck your server will actually reboot and with even more luck it will actually start functioning again, saving you an urgent trip (or call) to the datacenter! Or it may not.. YMMV.

Get BUSIER for more.

 

 

 

You may also like...