dmesg
(display message或者driver message)是Linux系统中用于显示内核启动信息和运行时状态的命令。通过分析dmesg
日志,可以帮助我们诊断CentOS系统中的各种问题。以下是一些常见的步骤和方法:
首先,你可以直接运行dmesg
命令来查看内核消息:
dmesg
这个命令会显示内核环缓冲区中的所有消息。由于消息很多,通常建议使用less
或more
来分页查看:
dmesg | less
你可以使用grep
命令来过滤出特定的关键字,例如:
dmesg | grep -i error
dmesg | grep -i warning
dmesg | grep -i failed
如果你怀疑某个设备或驱动有问题,可以过滤出相关的消息。例如,查看网卡信息:
dmesg | grep -i eth
或者查看硬盘信息:
dmesg | grep -i sda
如果系统出现硬件错误,dmesg
日志中通常会有相关的错误信息。例如,内存错误可能会显示类似以下的信息:
[ 0.000000] Memory: 8177M/16384M available (8192K kernel code, 1316K rwdata, 4096K rodata, 2208K init, 944K bss, 227888K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Size=1.00MB, MinObjects=16, CPUs=8, Nodes=1, Order=0, MinPartitions=0, Lazy, Prefetch=1, Spinlocks=1, Migrate=1, Owner-registers, Debug=0, NOSMT
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] NR_IRQS: 1024, nr_irqs: 1024, preallocated irqs: 1024
[ 0.000000] rcu: Hierarchical SRCU implementation.
[ 0.000000] NET: Registered protocol family 2
[ 0.000000] tcp_listen_portaddr_hash hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.000000] TCP established hash table entries: 65536 (order: 7, 524288 bytes)
[ 0.000000] TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
[ 0.000000] TCP: Hash tables configured (established 65536 bind 65536)
[ 0.000000] MPTCP hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP rbuf hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP subflow hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP bhash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP socket hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP KAM table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP recovery socket hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP smux hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP rto table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP pmtu discovery hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP fastopen hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP data hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0.000000] MPTCP control block array hash table entries: 131072 (order: 8, 1048576)
[ 0