Linux查看系统硬件信息:内存和硬盘

1. 内存

# 查看内存使用情况,参数 -m 以 megabytes 为单位输出 
$ free -m
              total        used        free      shared  buff/cache   available
Mem:         128343       51772        4333         186       72237       75399
Swap:          4095           0        4095

# /proc/meminfo 包含了内存的详细使用信息
$ cat /proc/meminfo
MemTotal:       131423944 kB
MemFree:         2672916 kB
MemAvailable:   76649028 kB
Buffers:             152 kB
Cached:         70588932 kB
SwapCached:          100 kB
Active:         78479944 kB
Inactive:       43857400 kB
Active(anon):   43494740 kB
Inactive(anon):  8445316 kB
Active(file):   34985204 kB
......

# 查看内存硬件信息,参数 -t 指定类型
$ dmidecode -t memory
# dmidecode 3.2
# SMBIOS entry point at 0x68e3b000
Found SMBIOS entry point in EFI, reading table from /dev/mem.
SMBIOS 3.2 present.

Handle 0x1000, DMI type 16, 23 bytes
Physical Memory Array
        Location: System Board Or Motherboard
        Use: System Memory
        Error Correction Type: Multi-bit ECC
        Maximum Capacity: 7680 GB
        Error Information Handle: Not Provided
        Number Of Devices: 24

Handle 0x1100, DMI type 17, 84 bytes
Memory Device
        Array Handle: 0x1000
        Error Information Handle: Not Provided
        Total Width: 72 bits
        Data Width: 64 bits
        Size: 16384 MB
        Form Factor: DIMM
        Set: 1
        Locator: A1
        Bank Locator: Not Specified
        Type: DDR4
        Type Detail: Synchronous Registered (Buffered)
        Speed: 2933 MT/s
        Manufacturer: 00AD00B300AD
        Serial Number: 93440CDD
        Asset Tag: 01193161
......

2. 硬盘

# 列出硬盘和分区情况
$ lsblk
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda    8:0    0  256G  0 disk
sdb    8:16   0  256G  0 disk /

# 查看硬盘和分区的详细信息
$ fdisk -l
Disk /dev/sda: 1919.7 GB, 1919716163584 bytes, 3749445632 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt


#         Start          End    Size  Type            Name
 1         2048       411647    200M  EFI System      EFI System Partition
 2       411648      1435647    500M  Microsoft basic
 3      1435648   3749443583    1.8T  linux LVM
 ......
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《Linux查看系统硬件信息:内存和硬盘》
文章链接:https://zhuji.vsping.com/3446.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。