2011年8月30日 星期二

Printk 的 log level

printk的訊息優先權定義在linux/kernel.h

節錄在下面:

1 KERN_EMERG
2 KERN_ALET
3 KERN_CRIT
4 KERN_ERR
5 KERN_WARNIN
6 KERN_NOTICE
7 KERN_INFO
8 KERN_DEBUG
printk沒有指定時,預設的訊息優先權為 DEFAULT_MESSAGE_LOGLEVEL為/proc/sys/kernel/printk的第二項



log level 數字越低表示印出的訊息越少




printk 會輸出至cirrular buffer
buffer variable : log_buf
len : LOG_BUF_LEN



/proc/sys/kernel/printk檔案分別定義了
console_loglevel
default_message_loglevel
minimum_console_level
default_console_loglevel
printk的log level( Default message loglevel )要大於 console_loglevel這樣一來字才會印出 來


Man /proc的定義如下

  1. Messages with a higher priority than console_loglevel will be printed to the console.
  2. Messages without an explicit priority will be printed with priority default_message_level.
  3. Minimum_console_loglevel is the minimum (highest) value to which console_loglevel can be set.
  4. default_console_loglevel is the default value for console_loglevel
    例如: echo "8" > /proc/sys/kernel/printk
LDD 上有說我們只關心前兩項,因此只要2大於1所有printk的訊息就印得出來,因此將1的值調到八,這樣就可印出所有message

How to repair and clone disk with ddrescue

  ddrescue  is a tool that can be used to repair and clone disks on a  Linux system . This includes hard drives, partitions, DVD discs, flas...