I was recently asked the following question:
How could you reboot the linux server if your root filesystem is not mounted and you cannot mount it (it is lost) and you do not have any binary - you have only root shell.
It has something to do with /proc I assume, but maybe it is not possible at all. Could anyone provide some guidance on what I should do in that situation?
You can reboot with magic sysrq key:
For more information read wiki or kernel documentation.
echo
is also a shell built-in command (known in bash and dash for me) and used if/bin/echo
is not available.If you don't have the root file system, and as it was specified in the question, you don't neither have binary, I think that echo will not work, so the only solution is a hardware keyboard interrupt using indeed as said it @Pazi the SysRQ Magic Keys.
To do so, you should do: Alt+Print Screen / SysRq+some key
Here, it would be: Alt+Print Screen / SysRq+b (where b will immediately reboot the system, without unmounting or syncing filesystems).
For additional magic keys and what they do, see Wikipedia: Magic SysRq key. Also note that non-QWERTY layouts may use other physical keys.