분류없음2009/03/29 05:22
추천도서
88만원세대
우석훈 저/박권일 저
파워포인트 블루스
김용석 저
예스24 | 애드온2

키보드에는 캡쳐할 때 흔히 쓰는 Print Screen 키가 있는데, 그 키에는 (현재는 잘 쓰이지 않지만)또다른 기능이 있다.

SysRq (System Request)

아래는 SysRq 키에 대해서 설명한 내용이다.

magic 이라고 표현 할 만큼 멋진 기능을 가지고 있다.

영어지만 시스템 관리자라면 충분히 이해할 만한 쉬운 수준이므로 (귀찮아서) 해석은 생략한다.

 

 

Hack 75. Safe Reboot Of Linux Using Magic SysRq Key


The magic SysRq key is a key combination in 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. The key combination consists of Alt+SysRq+commandkey. In many systems the SysRq key is the printscreen key.


First, you need to enable the SysRq key, as shown below.

echo "1" > /proc/sys/kernel/sysrq

List of SysRq Command Keys

Following are the command keys available for Alt+SysRq+commandkey.

o ‘k’ – Kills all the process running on the current virtual console.
o ’s’ – This will attempt to sync all the mounted file system.
o ‘b’ - Immediately reboot the system, without unmounting partitions or syncing.
o ‘e’ – Sends SIGTERM to all process except init.
o ‘m’ – Output current memory information to the console.
o ‘i’ - Send the SIGKILL signal to all processes except init
o ‘r’ - Switch the keyboard from raw mode (the mode used by programs such as X11), to XLATE mode.
o ’s’ – sync all mounted file system.
o ‘t’ - Output a list of current tasks and their information to the console.
o ‘u’ - Remount all mounted filesystems in readonly mode.
o ‘o’ – Shutdown the system immediately.
o ‘p’ – Print the current registers and flags to the console.
o ‘0-9′ - Sets the console log level, controlling which kernel messages will be printed to your console.
o ‘f’ - Will call oom_kill to kill process which takes more memory.
o ‘h’ – Used to display the help. But any other keys than the above listed will print help.

We can also do this by echoing the keys to the /proc/sysrq-trigger file. For example, to re-boot a system you can perform the following.

echo "b" > /proc/sysrq-trigger

Perform a Safe reboot of Linux using Magic SysRq Key


To perform a safe reboot of a Linux computer which hangs up, do the following. This will avoid the fsck during the next re-booting. i.e Press Alt+SysRq+letter highlighted below.

o unRaw (take control of keyboard back from X11,
o tErminate (send SIGTERM to all processes, allowing them to terminate gracefully),
o kIll (send SIGILL to all processes, forcing them to terminate immediately),
o Sync (flush data to disk),
o Unmount (remount all filesystems read-only),
o reBoot.

 

 

// source – Linux 101 Hacks by Ramesh Natarnajan

// references - http://en.wikipedia.org/wiki/Magic_SysRq_key

저작자 표시 비영리 변경 금지
Posted by 나프로

TRACKBACK http://naproworld.com/trackback/14 관련글 쓰기

댓글을 달아 주세요

  1. 안녕하세요. 댓글 남겨 주셨더라구요.
    일단 진심으로 사과의 말씀 드립니다.
    2년전에 제가 첨으로 블로그란걸 알았을 때
    글의 출처에 대한 개념이 없을 때 작성한게 아직 남아있네요.
    부끄럽습니다. 멋모를때 퍼온 글이 몇개 될텐데
    이참에 정리를 해야겠습니다.
    불쾌하셨을텐데 정말 죄송합니다 ㅠㅠ..

    2009/03/30 19:25 [ ADDR : EDIT/ DEL : REPLY ]