wiki/运维/操作系统/Linux/笔记/3.硬件管理.md
2025-01-02 10:46:09 +08:00

176 lines
7.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### 查看硬件信息
##### 查看CPU
###### lscpu命令
```shell
[root@tencentos ~]# lscpu
Architecture: x86_64 #CPU架构及位数
CPU op-mode(s): 32-bit, 64-bit #CPU可以运行的操作系统位数
Byte Order: Little Endian #数据存储方式
CPU(s): 2 #系统有两个核心
On-line CPU(s) list: 0,1 #可用的CPU列表
Thread(s) per core: 1 #每个核心有1个线程
Core(s) per socket: 2 #每个插槽物理CPU有2个核心
Socket(s): 1 #有1个物理CPU
NUMA node(s): 1 #有1个NUMA节点
Vendor ID: GenuineIntel #CPU的制造商是Intel
BIOS Vendor ID: Smdbmds
CPU family: 6 #CPU的家族编号是6
Model: 85 #CPU的型号编号是85
Model name: Intel(R) Xeon(R) Platinum 8255C CPU @ 2.50GHz #CPU的型号名称是Intel Xeon Platinum 8255C主频为2.50GHz。
BIOS Model name: 3.0
Stepping: 5 #CPU的步进值是5这是CPU版本的一种标识
CPU MHz: 2494.140 #CPU的实际运行速度是2494.140 MHz
BogoMIPS: 4988.28 #BogoMIPS是一种测量CPU速度的方法但并不总是准确的
Hypervisor vendor: KVM #虚拟化软件的供应商是KVM
Virtualization type: full #支持全虚拟化
L1d cache: 32K #CPU的不同级别的缓存大小
L1i cache: 32K
L2 cache: 4096K
L3 cache: 36608K
NUMA node0 CPU(s): 0,1 #NUMA节点0包含CPU 0和1。
Flags这是CPU支持的各种特性和指令集: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 arat avx512_vnni
```
###### /proc/cpuinfo
```shell
[root@tencentos ~]# cat /proc/cpuinfo
processor : 0 #处理器编号这里有两个处理器编号分别为0和1
vendor_id : GenuineIntel #CPU制造商这里是GenuineIntel表示是英特尔的CPU
cpu family : 6 #CPU家族这里是6表示属于第6代CPU
model : 85 #CPU型号这里是85
model name : Intel(R) Xeon(R) Platinum 8255C CPU @ 2.50GHz
stepping : 5
microcode : 0x1
cpu MHz : 2494.140
cache size : 36608 KB #CPU缓存大小这里是36608 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 arat avx512_vnni
bugsCPU的已知问题和漏洞 : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit
bogomips : 4988.28
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Platinum 8255C CPU @ 2.50GHz
stepping : 5
microcode : 0x1
cpu MHz : 2494.140
cache size : 36608 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 arat avx512_vnni
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit
bogomips : 4988.28
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
[root@tencentos ~]#
```
##### 查看内存
###### free命令
```shell
[root@tencentos ~]# free -h
total used free shared buff/cache available
Mem: 1.7Gi 323Mi 341Mi 35Mi 1.0Gi 1.2Gi
Swap: 0B 0B 0B
```
###### /proc/meminfo
```shell
[root@tencentos ~]# cat /proc/meminfo
MemTotal: 1762908 kB
MemFree: 353604 kB
MemAvailable: 1229960 kB
Buffers: 100912 kB
Cached: 902816 kB
SwapCached: 0 kB
Active: 810564 kB
Inactive: 425712 kB
Active(anon): 235464 kB
Inactive(anon): 32936 kB
Active(file): 575100 kB
Inactive(file): 392776 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 188 kB
Writeback: 0 kB
AnonPages: 212480 kB
Mapped: 121384 kB
Shmem: 35860 kB
KReclaimable: 78132 kB
Slab: 130264 kB
SReclaimable: 78132 kB
SUnreclaim: 52132 kB
KernelStack: 2784 kB
PageTables: 6572 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 881452 kB
Committed_AS: 1222084 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 8032 kB
VmallocChunk: 0 kB
Percpu: 2320 kB
HardwareCorrupted: 0 kB
AnonHugePages: 118784 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
FileHugePages: 0 kB
FilePmdMapped: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
DirectMap4k: 122744 kB
DirectMap2M: 1974272 kB
DirectMap1G: 0 kB
```
##### 查看硬盘
###### lsblk命令
```shell
[root@tencentos ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 50G 0 disk
└─vda1 253:1 0 50G 0 part /
```
###### /proc/partitions
```shell
[root@tencentos ~]# cat /proc/partitions
major minor #blocks name
253 0 52428800 vda
253 1 52427759 vda1
```
###### blkid命令
```shell
[root@tencentos ~]# blkid
/dev/vda1: UUID="ded6c45d-0699-43e5-bc44-f31c21449dcc" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="5f3d9d70-01"
```