1.dmesg命令简介
本文主要介绍在Linux系统上如何使用dmesg工具集查看服务器硬件信息。dmesg命令是Linux上查询硬件信息的常用工具之一。
安装dmesg工具,以CentOS为例:
[root@zcwyou~]#yum-yinstallutil-linux
2.查看硬件的详细信息
命令:
[root@zcwyou~]#dmesg|more
部分输出结果如下:
[0.000000]Initializingcgroupsubsyscpuset
[0.000000]Initializingcgroupsubsyscpu
[0.000000]Initializingcgroupsubsyscpuacct
[0.000000]Linuxversion3.10.0-862.11.6.el7.x86_64(builder@kbuilder.dev.centos.org)(gccversion4.8.520150623(RedHat4.8.5-28)(GCC))#1SMPTueAug1421:49:04UTC2018
[0.000000]Commandline:BOOT_IMAGE=/vmlinuz-3.10.0-862.11.6.el7.x86_64root=/dev/mapper/centos-rootrocrashkernel=autord.lvm.lv=centos/rootrd.lvm.lv=centos/swaprhgbquietLANG=en_U
S.UTF-8
[0.000000]e820:BIOS-providedphysicalRAMmap:
[0.000000]BIOS-e820:[mem0x0000000000000000-0x000000000009dfff]usable
[0.000000]BIOS-e820:[mem0x0000000000100000-0x00000000cf378fff]usable
[0.000000]BIOS-e820:[mem0x00000000cf379000-0x00000000cf38efff]reserved
[0.000000]BIOS-e820:[mem0x00000000cf38f000-0x00000000cf3cdfff]ACPIdata
[0.000000]BIOS-e820:[mem0x00000000cf3ce000-0x00000000cfffffff]reserved
[0.000000]BIOS-e820:[mem0x00000000e0000000-0x00000000efffffff]reserved
[0.000000]BIOS-e820:[mem0x00000000fe000000-0x00000000ffffffff]reserved
[0.000000]BIOS-e820:[mem0x0000000100000000-0x000000082fffffff]usable
[0.000000]NX(ExecuteDisable)protection:active
linux使用dmesg查看硬件的详细信息
3.查看前面15行信息
命令:
[root@zcwyou~]#dmesg|head-15
输出结果:
[0.000000]Initializingcgroupsubsyscpuset
[0.000000]Initializingcgroupsubsyscpu
[0.000000]Initializingcgroupsubsyscpuacct
[0.000000]Linuxversion3.10.0-862.11.6.el7.x86_64(builder@kbuilder.dev.centos.org)(gccversion4.8.520150623(RedHat4.8.5-28)(GCC))#1SMPTueAug1421:49:04UTC2018
[0.000000]Commandline:BOOT_IMAGE=/vmlinuz-3.10.0-862.11.6.el7.x86_64root=/dev/mapper/centos-rootrocrashkernel=autord.lvm.lv=centos/rootrd.lvm.lv=centos/swaprhgbquietLANG=en_US.UTF-8
[0.000000]e820:BIOS-providedphysicalRAMmap:
[0.000000]BIOS-e820:[mem0x0000000000000000-0x000000000009dfff]usable
[0.000000]BIOS-e820:[mem0x0000000000100000-0x00000000cf378fff]usable
[0.000000]BIOS-e820:[mem0x00000000cf379000-0x00000000cf38efff]reserved
[0.000000]BIOS-e820:[mem0x00000000cf38f000-0x00000000cf3cdfff]ACPIdata
[0.000000]BIOS-e820:[mem0x00000000cf3ce000-0x00000000cfffffff]reserved
[0.000000]BIOS-e820:[mem0x00000000e0000000-0x00000000efffffff]reserved
[0.000000]BIOS-e820:[mem0x00000000fe000000-0x00000000ffffffff]reserved
[0.000000]BIOS-e820:[mem0x0000000100000000-0x000000082fffffff]usable
[0.000000]NX(ExecuteDisable)protection:active
linux使用dmesg命令输出的前15行
4.查看与USB有关的信息
命令:
[root@zcwyou~]#dmesg|grep-iusb
输出结果:
[0.428134]ACPI:bustypeUSBregistered
[0.428152]usbcore:registerednewinterfacedriverusbfs
[0.428161]usbcore:registerednewinterfacedriverhub
[0.428191]usbcore:registerednewdevicedriverusb
[1.046066]ehci_hcd:USB2.0'Enhanced'HostController(EHCI)Driver
[1.046380]ehci-pci0000:00:1a.7:newUSBbusregistered,assignedbusnumber1
[1.055679]ehci-pci0000:00:1a.7:USB2.0started,EHCI1.00
[1.055732]usbusb1:NewUSBdevicefound,idVendor=1d6b,idProduct=0002
[1.055734]usbusb1:NewUSBdevicestrings:Mfr=3,Product=2,SerialNumber=1
[1.055737]usbusb1:Product:EHCIHostController
[1.055739]usbusb1:Manufacturer:Linux3.10.0-862.11.6.el7.x86_64ehci_hcd
linux使用dmesg命令查看USB信息
5.查看与DMA有关的信息
[root@zcwyou~]#dmesg|grep-idma
[0.000000]ACPI:DMAR00000000cf3b3668001C0(v01DELLPE_SC300000001DELL00000001)
[0.000000]DMA[mem0x00001000-0x00ffffff][0.000000]DMA32[mem0x01000000-0xffffffff][0.000000]DMAzone:64pagesusedformemmap
[0.000000]DMAzone:21pagesreserved
[0.000000]DMAzone:3997pages,LIFObatch:0
[0.000000]DMA32zone:13198pagesusedformemmap
[0.000000]DMA32zone:844665pages,LIFObatch:31
[0.044071]DMAR-IR:ThissystemBIOShasenabledinterruptremapping
[0.972056]DMAR:Hostaddress width40
[0.972060]DMAR:DRHDbase:0x000000fed90000flags:0x1
[0.972076]DMAR:dmar0:reg_base_addrfed90000ver1:0capc90780106f0462ecapf020fe
[0.972078]DMAR:RMRRbase:0x000000cf4c8000end:0x000000cf4dffff
[0.972080]DMAR:RMRRbase:0x000000cf4b1000end:0x000000cf4bffff
[0.972081]DMAR:RMRRbase:0x000000cf4a1000end:0x000000cf4a1fff
[0.972083]DMAR:RMRRbase:0x000000cf4a3000end:0x000000cf4a3fff
[0.972084]DMAR:RMRRbase:0x000000cf4a5000end:0x000000cf4a5fff
[0.972085]DMAR:RMRRbase:0x000000cf4a7000end:0x000000cf4a7fff
[0.972087]DMAR:RMRRbase:0x000000cf4a9000end:0x000000cf4a9fff
[0.972088]DMAR:RMRRbase:0x000000cf4c0000end:0x000000cf4c0fff
[0.972090]DMAR:RMRRbase:0x000000cf4c2000end:0x000000cf4c2fff
[0.972091]DMAR:ATSRflags:0x0
[0.972129]PCI-DMA:UsingsoftwarebouncebufferingforIO(SWIOTLB)
[1.432149][TTM]Zonedma32:Availablegraphicsmemory:2097152kiB
[1.432154][TTM]InitializingDMApoolallocator
[1.529806]ata1:SATAmaxUDMA/133cmd0xd8e0ctl0xd8d0bmdma0xdc00irq23
[1.529813]ata2:SATAmaxUDMA/133cmd0xd8e8ctl0xd8d4bmdma0xdc08irq23
[1.681686]ata3:SATAmaxUDMA/133cmd0xd8f0ctl0xd8d8bmdma0xdc20irq22
[1.681689]ata4:SATAmaxUDMA/133cmd0xd8f8ctl0xd8dcbmdma0xdc28irq22
5.查看与内存有关的信息
命令:
[root@zcwyou~]#dmesg|grep-imemory
输出结果:
[0.000000]Basememorytrampolineat[ffff8e6580098000]98000size24576
[0.000000]Reserving162MBofmemoryat688MBforcrashkernel(SystemRAM:32755MB)
[0.000000]Earlymemorynoderanges
[0.000000]PM:Registerednosavememory:[mem0x0009e000-0x000fffff][0.000000]PM:Registerednosavememory:[mem0xcf379000-0xcf38efff][0.000000]PM:Registerednosavememory:[mem0xcf38f000-0xcf3cdfff][0.000000]PM:Registerednosavememory:[mem0xcf3ce000-0xcfffffff][0.000000]PM:Registerednosavememory:[mem0xd0000000-0xdfffffff][0.000000]PM:Registerednosavememory:[mem0xe0000000-0xefffffff][0.000000]PM:Registerednosavememory:[mem0xf0000000-0xfdffffff][0.000000]PM:Registerednosavememory:[mem0xfe000000-0xffffffff][0.000000]Memory:5239464k/34340864kavailable(7348kkernelcode,799656kabsent,800680kreserved,6281kdata,1836kinit)
[0.000000]pleasetry'cgroup_disable=memory'optionifyoudon'twantmemorycgroups
[0.013720]Initializingcgroupsubsysmemory
[0.968797]Freeinginitrdmemory:20796kfreed
[1.045694]Non-volatilememorydriverv1.3
[1.045834]crashmemorydriver:version1.1
[1.080076]memorymemory118:hashmatches
[1.081410]Freeingunusedkernelmemory:1836kfreed
[1.084219]Freeingunusedkernelmemory:832kfreed
[1.086287]Freeingunusedkernelmemory:676kfreed
[1.432146][TTM]Zonekernel:Availablegraphicsmemory:16382346kiB
[1.432149][TTM]Zonedma32:Availablegraphicsmemory:2097152kiB
[23.543146]EDACi7core:Driverloaded,1memorycontroller(s)found.
linux使用dmesg命令查看内存有关的信息
6.查看与CPU有关的信息
命令:
[root@zcwyou~]#dmesg|grep-icpu
输出结果:
[0.000000]Initializingcgroupsubsyscpuset
[0.000000]Initializingcgroupsubsyscpu
[0.000000]Initializingcgroupsubsyscpuacct
[0.000000]smpboot:Allowing32CPUs,24hotplugCPUs
[0.000000]setup_percpu:NR_CPUS:5120nr_cpumask_bits:32nr_cpu_ids:32nr_node_ids:1
[0.000000]PERCPU:Embedded35pages/cpu@ffff8e6d8ee00000s104920r8192d30248u262144
[0.000000]pcpu-alloc:s104920r8192d30248u262144alloc=1*2097152
[0.000000]pcpu-alloc:[0]0001020304050607[0]0809101112131415
[0.000000]pcpu-alloc:[0]1617181920212223[0]2425262728293031
[0.000000]SLUB:HWalign=64,Order=0-3,MinObjects=0,CPUs=32,Nodes=1
[0.000000]RCUrestrictingCPUsfromNR_CPUS=5120tonr_cpu_ids=32.
[0.013773]mce:CPUsupports9MCEbanks
[0.013780]CPU0:Thermalmonitoringenabled(TM1)
[0.044038]smpboot:CPU0Convertingphysical1tologicalpackage0
[0.054625]smpboot:CPU0:Intel(R)Xeon(R)CPUE5620@2.40GHz(fam:06,model:2c,stepping:02)
linux使用dmesg命令查看CPU信息
7.查看与网卡有关的信息
命令:
[root@zcwyou~]#dmesg|grep-inic
输出的结果:
[33.487156]bnx20000:01:00.1em2:NICCopperLinkisUp,1000Mbpsfullduplex
[34.122938]bnx20000:01:00.0em1:NICCopperLinkisUp,1000Mbpsfullduplex
[46.657807]virbr0:port1(virbr0-nic)enteredblockingstate
[46.657812]virbr0:port1(virbr0-nic)entereddisabledstate
[46.657902]devicevirbr0-nicenteredpromiscuousmode
[46.863299]virbr0:port1(virbr0-nic)enteredblockingstate
[46.863306]virbr0:port1(virbr0-nic)enteredlisteningstate
[46.980328]virbr0:port1(virbr0-nic)entereddisabledstate
利用dmesg命令查询各种硬件的配置。
linux使用dmesg命令查看网卡信息