Linux硬件资源管理

Linux硬件资源管理

查看系统PCI设备

lspci

此外,可以通过命令"lspci -v"得到更详细的PCI设备信息

执行效果如下

[root@localhost /]# lspci
00:00.0 Host bridge: Intel Corporation Gemini Lake Host Bridge (rev 06)
00:00.1 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor Dynamic Platform and Thermal Framework Processor Participant (rev 06)
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 605 (rev 06)
00:0c.0 Network controller: Intel Corporation Device 31dc (rev 06)
00:0e.0 Multimedia audio controller: Intel Corporation Celeron/Pentium Silver Processor High Definition Audio (rev 06)
00:0f.0 Communication controller: Intel Corporation Celeron/Pentium Silver Processor Trusted Execution Engine Interface (rev 06)
00:12.0 SATA controller: Intel Corporation Device 31e3 (rev 06)
00:13.0 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f6)
00:13.1 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f6)
00:13.2 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f6)
00:13.3 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f6)
00:14.0 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f6)
00:14.1 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f6)
00:15.0 USB controller: Intel Corporation Device 31a8 (rev 06)
00:16.0 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor Serial IO I2C Host Controller (rev 06)
00:16.1 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor Serial IO I2C Host Controller (rev 06)
00:16.2 Signal processing controller: Intel Corporation Device 31b0 (rev 06)
00:16.3 Signal processing controller: Intel Corporation Device 31b2 (rev 06)
00:17.0 Signal processing controller: Intel Corporation Device 31b4 (rev 06)
00:17.1 Signal processing controller: Intel Corporation Device 31b6 (rev 06)
00:17.2 Signal processing controller: Intel Corporation Device 31b8 (rev 06)
00:17.3 Signal processing controller: Intel Corporation Device 31ba (rev 06)
00:1c.0 SD Host controller: Intel Corporation Celeron/Pentium Silver Processor SDA Standard Compliant SD Host Controller (rev 06)
00:1e.0 SD Host controller: Intel Corporation Device 31d0 (rev 06)
00:1f.0 ISA bridge: Intel Corporation Device 31e8 (rev 06)
00:1f.1 SMBus: Intel Corporation Celeron/Pentium Silver Processor Gaussian Mixture Model (rev 06)
02:00.0 Ethernet controller: Intel Corporation Intel(R) Ethernet Controller I225-V (rev 01)

查看CPU信息

more /proc/cpuinfo

部分输出结果如下:

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 122
model name	: Intel(R) Celeron(R) J4125 CPU @ 2.00GHz
stepping	: 8
microcode	: 0x16
cpu MHz		: 800.170
cache size	: 4096 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 4
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 24
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave rdrand lahf_lm 3dnowprefetch cat_l2 intel_pt cdp_l2 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust smep erms mpx rdt_a rdseed smap clflushopt sha_ni xsaveopt xsavec xgetbv1 dtherm ida arat pln pts umip md_clear spec_ctrl intel_stibp arch_capabilities
bogomips	: 3993.60
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

  • processor 是逻辑处理器的唯一标识符。
  • vendor-id 表示处理器类型,如果为英特尔处理器,则字符串为GenuineIntel。
  • physical id 表示每个物理封装的唯一标识符,也就是一个物理CPU。
  • siblings 表示位于相同物理封装中的逻辑处理器的数量。
  • core id 表示每个内核的唯一标识符。
  • cpu cores 表示位于相同物理封装中的内核数量。

  在siblings和cpu cores值之间有个对应关系,如果siblings是cpu cores的两倍,则说明系统支持超线程,并且超线程已打开;如果siblings和cpu cores一致,则说明系统不支持超线程,或者超线程未打开。

查看系统物理CPU的个数
cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
查看系统所有逻辑CPU个数

所有物理CPU中内核的个数加上超线程个数

cat /proc/cpuinfo | grep "processor" | wc -l

查看系统内存信息

more /proc/meminfo

输出结果如下:

MemTotal:        5765172 kB
MemFree:          179764 kB
MemAvailable:    3247784 kB
Buffers:             260 kB
Cached:          3245916 kB
SwapCached:          204 kB
Active:          2644592 kB
Inactive:        2313792 kB
Active(anon):    1500556 kB
Inactive(anon):   276616 kB
Active(file):    1144036 kB
Inactive(file):  2037176 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       6029308 kB
SwapFree:        6027516 kB
Dirty:                24 kB
Writeback:             0 kB
AnonPages:       1712096 kB
Mapped:           186736 kB
Shmem:             64960 kB
Slab:             263808 kB
SReclaimable:     188656 kB
SUnreclaim:        75152 kB
KernelStack:       11552 kB
PageTables:        25352 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     8911892 kB
Committed_AS:    4771428 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      560068 kB
VmallocChunk:   34358423548 kB
Percpu:             1568 kB
HardwareCorrupted:     0 kB
AnonHugePages:   1079296 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      168688 kB
DirectMap2M:     3846144 kB
DirectMap1G:     4194304 kB

查看磁盘分区信息

fdisk -l

执行后效果如下:

[root@localhost proc]# fdisk -l
Disk /dev/sda:128.0 GB, 128035676160 bytes,250069680 sectors
Units = Sector of 1 * 512 = 512 bytes
Sector size(logical/physical):512 bytes / 512 bytes
I/O size(minimum/optimal):512 bytes / 512 bytes
Disklabel type:gpt
Disk identifier: 803B51D8-A805-4AF4-99A9-4C31CDB66DF7


#         Start          End    Size  Type            Name
 1         2048       411647    200M  EFI System      EFI System Partition
 2       411648      2508799      1G  Microsoft basic 
 3      2508800    250068991    118G  Linux LVM       

Disk /dev/mapper/centos-root:53.7 GB, 53687091200 bytes,104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size(logical/physical):512 bytes / 512 bytes
I/O size(minimum/optimal):512 bytes / 512 bytes


Disk /dev/mapper/centos-swap:6174 MB, 6174015488 bytes,12058624 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size(logical/physical):512 bytes / 512 bytes
I/O size(minimum/optimal):512 bytes / 512 bytes


Disk /dev/mapper/centos-home:66.9 GB, 66882371584 bytes,130629632 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size(logical/physical):512 bytes / 512 bytes
I/O size(minimum/optimal):512 bytes / 512 bytes
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值