对于linux系统硬件信息的查看,主要针对cpu、memory、disk,以及网卡,每一种硬件的信息通常会有多种查看方法。
1.cpu
查看/proc/cpuinfo文件 可查看cpu的详细信息。[root@primary_server ~]# cat /proc/cpuinfo
vendor_id: GenuineIntel
cpu family: 15
model: 4
model name: Intel(R) Xeon(TM) CPU 2.80GHz
stepping: 3
cpu MHz: 2793.385
cache size: 2048 KB
physical id: 0
siblings: 2
core id: 0
cpu cores: 1
apicid: 0
fdiv_bug: no
hlt_bug: no
f00f_bug: no
coma_bug: no
fpu: yes
fpu_exception: yes
cpuid level: 5
wp: yes
flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl cid cx16 xtpr
bogomips: 5586.77
vendor_id: GenuineIntel
cpu family: 15
model: 4
model name: Intel(R) Xeon(TM) CPU 2.80GHz
stepping: 3
cpu MHz: 2793.385
cache size: 2048 KB
physical id: 0
siblings: 2
core id: 0
cpu cores: 1
apicid: 1
fdiv_bug: no
hlt_bug: no
f00f_bug: no
coma_bug: no
fpu: yes
fpu_exception: yes
cpuid level: 5
wp: yes
flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl cid cx16 xtpr
bogomips: 5586.40[root@primary_server ~]# dmidecode -t
dmidecode: option requires an argument -- t
Type number or keyword expected
Valid type keywords are:
bios
system
baseboard
chassis
processor
memory
cache
connector
slot
dmidecode命令功能很全,可以针对bios 系统 cpu 内存 cache等信息进行查看。
[root@primary_server ~]# dmidecode -t processor
# dmidecode 2.11
SMBIOS 2.3 present.
Handle 0x0400, DMI type 4, 40 bytes
Processor Information
Socket Designation: PROC_1
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: 43 0F 00 00 FF FB EB BF
Signature: Type 0, Family 15, Model 4, Stepping 3
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (FXSAVE and FXSTOR instructions supported)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Multi-threading)
TM (Thermal monitor supported)
PBE (Pending break enabled)
Version: Not Specified
Voltage: 1.4 V
External Clock: 800 MHz
Max Speed: 3600 MHz
Current Speed: 2800 MHz
Status: Populated, Enabled
Upgrade: ZIF Socket
L1 Cache Handle: 0x0700
L2 Cache Handle: 0x0701
L3 Cache Handle: 0x0702
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 1
Core Enabled: 1
Thread Count: 2
Characteristics:
64-bit capable
2.内存[root@primary_server ~]# free -m //以MB为单位,总共1010MB,不是太大.
total used free shared buffers cached
Mem: 1010 874 135 0 176 570
-/+ buffers/cache: 127 882
Swap: 2047 0 2047[root@primary_server ~]# cat /proc/meminfo
MemTotal: 1034460 kB
MemFree: 139632 kB
Buffers: 180964 kB
Cached: 584252 kB
SwapCached: 0 kBdmidecode -t memory
# dmidecode 2.11
SMBIOS 2.7 present.
Handle 0x0008, DMI type 16, 23 bytes
Physical Memory Array
Location: System Board Or Motherboard
....
Maximum Capacity: 32 GB
....
Handle 0x000A, DMI type 17, 34 bytes
....
Memory Device
Array Handle: 0x0008
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
.....
3.磁盘
查看硬盘和分区的详细信息[root@primary_server ~]# fdisk -l
Disk /dev/sda: 73.4 GB, 73407820800 bytes
64 heads, 32 sectors/track, 70007 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 100 102384 83 Linux
/dev/sda2 101 70007 71584768 8e Linux LVM
4.网卡
查看网卡硬件信息[root@primary_server ~]# ifconfig // 查看当前所有UP的端口
eth0 Link encap:Ethernet HWaddr 00:13:72:57:78:18
inet addr:61.8.42.250 Bcast:61.8.42.251 Mask:255.255.255.252
inet6 addr: fe80::213:72ff:fe57:7818/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1873816 errors:0 dropped:0 overruns:0 frame:0
TX packets:2121831 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:246357050 (234.9 MiB) TX bytes:513284407 (489.5 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1505716 errors:0 dropped:0 overruns:0 frame:0
TX packets:1505716 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:209398529 (199.6 MiB) TX bytes:209398529 (199.6 MiB)
查看系统的所有网络接口[root@primary_server ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:13:72:57:78:18
inet addr:61.8.42.250 Bcast:61.8.42.251 Mask:255.255.255.252
inet6 addr: fe80::213:72ff:fe57:7818/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1874317 errors:0 dropped:0 overruns:0 frame:0
TX packets:2122385 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:246430249 (235.0 MiB) TX bytes:513372929 (489.5 MiB)
eth1 Link encap:Ethernet HWaddr 00:13:72:57:78:19
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1505820 errors:0 dropped:0 overruns:0 frame:0
TX packets:1505820 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:209409405 (199.7 MiB) TX bytes:209409405 (199.7 MiB)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
查看某个网口的详细信息[root@primary_server ~]# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
.....
Speed: 100Mb/s #现在网卡的速度是100Mb,网卡使用自适应模式,所以推测路由是100Mb,导致网卡从支持千兆,变成要支持百兆
Duplex: Full #全双工
.....
Link detected: yes #表示有网线连接,和路由是通的