欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Linux基础:如何找出你的系统所支持的最大内存

程序员文章站 2023-12-17 19:00:16
大多数情况下你可以从bios、产品目录或者干脆手动找出你的系统所持的最大内存。这里,我们介绍一种简单有用的技巧——使用dmidecode来找出系统支持的最大内存,这样你就无...

大多数情况下你可以从bios、产品目录或者干脆手动找出你的系统所持的最大内存。这里,我们介绍一种简单有用的技巧——使用dmidecode来找出系统支持的最大内存,这样你就无需打开机箱或者参照bios和产品目录了。

Linux基础:如何找出你的系统所支持的最大内存

什么是 dmidecode?

就像你可能知道的一样, dmidecode是一个将计算机dmi(又名smbios)表的内容转换为可读格式的工具。这个表包含了系统硬件组件的介绍以及其他一些如序列号和ios版本等有用的信息。使用dmidecode你能够获取此项信息,而无需去探测真实的硬件。

找出你的系统所支持的最大内存

请确定你已经在系统中安装了dmidecode,我觉得你的操作系统应该已经自动安装过了,不过并不非常确定。

在基于deb的系统中安装

sudo apt-get install dmidecode

在基于rpm的系统中安装

sudo yum install dmidecode

在suse/opensuse中安装

sudo zypper in dmidecode

好了,我们已经安装了dmidecode,接下来让我们找出支持的最大内存。输入以下命令:

sudo dmidecode -t 16

输出样本

# dmidecode 2.12
smbios 2.6 present.
 
handle 0x0014, dmi type 16, 15 bytes
physical memory array
 location: system board or motherboard
 use: system memory
 error correction type: none
 maximum capacity: 16 gb
 error information handle: not provided
 number of devices: 2

就像你看到的,我的系统支持最大内存到16g,并且有两个内存插槽,简单吧?

接下来,让我们找出现在已经安装的内存的详细信息。

sudo dmidecode -t 17

输出样本

# dmidecode 2.12
smbios 2.6 present.
 
handle 0x0017, dmi type 17, 28 bytes
memory device
 array handle: 0x0014
 error information handle: 0x0000
 total width: unknown
 data width: unknown
 size: no module installed
 form factor: dimm
 set: none
 locator: dimm_b
 bank locator: bank 2
 type: unknown
 type detail: none
 speed: unknown
 manufacturer: not specified
 serial number: not specified
 asset tag: not specified
 part number: not specified
 rank: unknown
 
handle 0x0015, dmi type 17, 28 bytes
memory device
 array handle: 0x0014
 error information handle: 0x0000
 total width: 64 bits
 data width: 64 bits
 size: 4096 mb
 form factor: sodimm
 set: none
 locator: dimm_a
 bank locator: bank 0
 type: ddr3
 type detail: synchronous
 speed: 1067 mhz
 manufacturer: 014f
 serial number: 00092af2
 asset tag: 54114000  
 part number: jm1066ksn-4g  
 rank: unknown

就像上边输出的一样,我在插槽1里边安装了一个内存条。内存大小为4g,类型为ddr3,速度为1067 mhz

同样的,我们可以通过下边命令得到完整的内存信息。

sudo dmidecode -t memory
sudo dmidecode -t memory | less
sudo dmidecode -t memory | more

输出样本

# dmidecode 2.12
smbios 2.6 present.
 
handle 0x0014, dmi type 16, 15 bytes
physical memory array
 location: system board or motherboard
 use: system memory
 error correction type: none
 maximum capacity: 16 gb
 error information handle: not provided
 number of devices: 2
 
handle 0x0017, dmi type 17, 28 bytes
memory device
 array handle: 0x0014
 error information handle: 0x0000
 total width: unknown
 data width: unknown
 size: no module installed
 form factor: dimm
 set: none
 locator: dimm_b
 bank locator: bank 2
 type: unknown
 type detail: none
 speed: unknown
 manufacturer: not specified
 serial number: not specified
 asset tag: not specified
 part number: not specified
 rank: unknown
 
handle 0x0015, dmi type 17, 28 bytes
memory device
 array handle: 0x0014
 error information handle: 0x0000
 total width: 64 bits
 data width: 64 bits
 size: 4096 mb
 form factor: sodimm
 set: none
 locator: dimm_a
 bank locator: bank 0
 type: ddr3
 type detail: synchronous
 speed: 1067 mhz
 manufacturer: 014f
 serial number: 00092af2
 asset tag: 54114000  
 part number: jm1066ksn-4g  
 rank: unknown

如果你好奇想要知道整个系统的详细信息,例如主板、内存、bios等,那么可以输入以下命令来获取。

sudo dmidecode

输出样本

# dmidecode 2.12
smbios 2.6 present.
48 structures occupying 2173 bytes.
table at 0x000eb840.
 
handle 0xda00, dmi type 218, 251 bytes
oem-specific type
 header and data:
  da fb 00 da b2 00 0d 5f 0f 37 40 7d 00 00 00 00
  00 7e 00 01 00 00 00 dc 01 00 80 02 00 dd 01 00
  80 03 00 75 01 01 80 01 00 76 01 02 80 01 00 2d
  01 03 80 01 00 2e 01 03 80 00 00 81 01 07 80 00
  00 82 01 07 80 01 00 83 01 08 80 00 00 84 01 08
  80 01 00 85 01 06 80 00 00 86 01 06 80 01 00 58
  02 05 80 00 00 57 02 05 80 01 00 9c 00 02 00 01
  00 9b 00 02 00 00 00 8a 01 03 00 01 00 89 01 03
  00 00 00 7f 01 04 00 00 00 80 01 04 00 01 00 53
  01 05 00 00 00 52 01 05 00 01 00 7b 01 06 00 00
  00 7c 01 06 00 01 00 94 01 07 00 00 00 93 01 07
  00 01 00 7d 00 08 00 00 00 2d 00 09 00 01 00 2e
  00 09 00 00 00 6e 00 0a 00 00 00 95 00 0b 00 01
  00 96 00 0b 00 00 00 2f 02 0c 00 01 00 30 02 0c
  00 00 00 50 02 0d 00 00 00 51 02 0d 00 01 00 52
  02 0d 00 02 00 ff ff 00 00 00 00
 
handle 0xda01, dmi type 218, 59 bytes
oem-specific type
 header and data:
  da 3b 01 da b2 00 0d 5f 0f 37 40 53 02 0d 00 03
  00 54 02 0d 00 04 00 56 02 0d 00 05 00 4b 01 0e
  00 01 00 4a 01 0e 00 00 00 ea 00 0f 00 01 00 eb
  00 0f 00 00 00 ff ff 00 00 00 00
 
handle 0x0004, dmi type 4, 42 bytes
processor information
 socket designation: cpu 1
 type: central processor
 family: core i3
 manufacturer: intel   
 id: a7 06 03 01 ff fb ab be
 signature: type 0, family 6, model 42, stepping 7
 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: intel(r) core(tm) i3-2350m cpu @ 2.30ghz  
 voltage: 1.1 v
 external clock: 100 mhz
 max speed: 2300 mhz
 current speed: 2300 mhz
 status: populated, enabled
 upgrade: other
 l1 cache handle: 0x0005
 l2 cache handle: 0x0006
 l3 cache handle: 0x0007
 serial number: to be filled by o.e.m.
 asset tag: to be filled by o.e.m.
 part number: to be filled by o.e.m.
 core count: 2
 core enabled: 1
 thread count: 2
 characteristics:
  64-bit capable
 
handle 0x0005, dmi type 7, 19 bytes
cache information
 socket designation: l1-cache
 configuration: enabled, not socketed, level 1
 operational mode: write back
 location: internal
 installed size: 64 kb
 maximum size: 64 kb
 supported sram types:
  other
 installed sram type: other
 speed: unknown
 error correction type: none
 system type: unified
 associativity: 8-way set-associative
 
handle 0x0006, dmi type 7, 19 bytes
cache information
 socket designation: l2-cache
 configuration: enabled, not socketed, level 2
 operational mode: varies with memory address
 location: internal
 installed size: 512 kb
 maximum size: 512 kb
 supported sram types:
  other
 installed sram type: other
 speed: unknown
 error correction type: none
 system type: unified
 associativity: 8-way set-associative
 
handle 0x0007, dmi type 7, 19 bytes
cache information
 socket designation: l3-cache
 configuration: enabled, not socketed, level 3
 operational mode: varies with memory address
 location: internal
 installed size: 3072 kb
 maximum size: 3072 kb
 supported sram types:
  other
 installed sram type: other
 speed: unknown
 error correction type: none
 system type: unified
 associativity: other
 
handle 0x0008, dmi type 8, 9 bytes
port connector information
 internal reference designator: j1a1
 internal connector type: none
 external reference designator: ps2mouse
 external connector type: ps/2
 port type: mouse port
 
handle 0x0009, dmi type 8, 9 bytes
port connector information
 internal reference designator: j1a1
 internal connector type: none
 external reference designator: keyboard
 external connector type: ps/2
 port type: keyboard port
 
handle 0x000a, dmi type 8, 9 bytes
port connector information
 internal reference designator: j2a2b
 internal connector type: none
 external reference designator: video
 external connector type: db-15 female
 port type: video port
 
handle 0x000b, dmi type 8, 9 bytes
port connector information
 internal reference designator: j3a1
 internal connector type: none
 external reference designator: usb1
 external connector type: access bus (usb)
 port type: usb
 
handle 0x000c, dmi type 8, 9 bytes
port connector information
 internal reference designator: j3a1
 internal connector type: none
 external reference designator: usb2
 external connector type: access bus (usb)
 port type: usb
 
handle 0x000d, dmi type 8, 9 bytes
port connector information
 internal reference designator: j3a1
 internal connector type: none
 external reference designator: usb3
 external connector type: access bus (usb)
 port type: usb
 
handle 0x000e, dmi type 8, 9 bytes
port connector information
 internal reference designator: j5a1
 internal connector type: none
 external reference designator: lan
 external connector type: rj-45
 port type: network port
 
handle 0x000f, dmi type 9, 17 bytes
system slot information
 designation: j6b2
 type: x16 pci express
 current usage: in use
 length: long
 id: 0
 characteristics:
  3.3 v is provided
  opening is shared
  pme signal is supported
 bus address: 0000:00:01.0
 
handle 0x0010, dmi type 9, 17 bytes
system slot information
 designation: j6b1
 type: x1 pci express
 current usage: in use
 length: short
 id: 1
 characteristics:
  3.3 v is provided
  opening is shared
  pme signal is supported
 bus address: 0000:00:1c.3
 
handle 0x0012, dmi type 11, 5 bytes
oem strings
 string 1: dell system
 string 2: 5[0003]
 string 3: 13[p18f]
 
handle 0x0013, dmi type 12, 5 bytes
system configuration options
 option 1: to be filled by o.e.m.
 
handle 0x001c, dmi type 21, 7 bytes
built-in pointing device
 type: touch pad
 interface: bus mouse
 buttons: 2
 
handle 0x001d, dmi type 22, 26 bytes
portable battery
 location: sys. battery bay
 manufacturer: sanyo    
 serial number: 5390  
 name: dell 4yrjh22
 chemistry: lithium ion
 design capacity: 45000 mwh
 design voltage: 10800 mv
 sbds version: 1.0    
 maximum error: 2%
 sbds manufacture date: 2012-02-28
 oem-specific information: 0x00000001
 
handle 0x001e, dmi type 32, 20 bytes
system boot information
 status: no errors detected
 
handle 0x0020, dmi type 27, 12 bytes
cooling device
 type: fan
 status: ok
 oem-specific information: 0x00000000
 
handle 0x0021, dmi type 28, 20 bytes
temperature probe
 description: cpu internal temperature
 location: processor
 status: ok
 maximum value: 127.0 deg c
 minimum value: 0.0 deg c
 resolution: 1.000 deg c
 tolerance: 0.5 deg c
 accuracy: unknown
 oem-specific information: 0x00000000
 
handle 0xb000, dmi type 176, 5 bytes
oem-specific type
 header and data:
  b0 05 00 b0 00
 
handle 0xb100, dmi type 177, 12 bytes
oem-specific type
 header and data:
  b1 0c 00 b1 1a 0e 00 00 00 00 00 00
 
handle 0x0025, dmi type 209, 12 bytes
oem-specific type
 header and data:
  d1 0c 25 00 00 00 00 03 05 01 00 03
 
handle 0x0026, dmi type 210, 12 bytes
oem-specific type
 header and data:
  d2 0c 26 00 00 00 00 03 05 20 01 03
 
handle 0x0027, dmi type 211, 13 bytes
oem-specific type
 header and data:
  d3 0d 27 00 01 00 00 00 00 02 03 04 04
 strings:
  front    
 
handle 0x0028, dmi type 212, 57 bytes
oem-specific type
 header and data:
  d4 39 28 00 70 00 71 00 01 49 50 48 9c 00 49 fc
  01 9b 00 49 fc 00 7f 01 4a fb 04 80 01 4a fb 00
  53 01 4a f7 08 52 01 4a f7 08 7b 01 4a ef 10 7c
  01 4a ef 10 ff ff 00 00 00
 
handle 0x002a, dmi type 217, 8 bytes
oem-specific type
 header and data:
  d9 08 2a 00 01 02 00 00
 strings:          
 
handle 0x002b, dmi type 219, 11 bytes
oem-specific type
 header and data:
  db 0b 2b 00 00 01 02 03 00 04 05
 strings:                         
 
handle 0x002c, dmi type 220, 22 bytes
oem-specific type
 header and data:
  dc 16 2c 00 01 f0 00 00 02 f0 00 00 00 00 03 f0
  04 f0 00 00 00 00
 
handle 0x002d, dmi type 221, 19 bytes
oem-specific type
 header and data:
  dd 13 2d 00 00 00 00 00 00 03 00 00 00 00 00 00
  00 00 00
 
handle 0x002e, dmi type 222, 16 bytes
oem-specific type
 header and data:
  de 10 2e 00 01 08 ff ff 00 00 00 00 00 00 00 00
 
handle 0x0014, dmi type 16, 15 bytes
physical memory array
 location: system board or motherboard
 use: system memory
 error correction type: none
 maximum capacity: 16 gb
 error information handle: not provided
 number of devices: 2
 
handle 0x0016, dmi type 20, 19 bytes
memory device mapped address
 starting address: 0x00000000000
 ending address: 0x000ffffffff
 range size: 4 gb
 physical device handle: 0x0015
 memory array mapped address handle: 0x0018
 partition row position: 1
 interleave position: 1
 interleaved data depth: 1
 
handle 0x0017, dmi type 17, 28 bytes
memory device
 array handle: 0x0014
 error information handle: 0x0000
 total width: unknown
 data width: unknown
 size: no module installed
 form factor: dimm
 set: none
 locator: dimm_b
 bank locator: bank 2
 type: unknown
 type detail: none
 speed: unknown
 manufacturer: not specified
 serial number: not specified
 asset tag: not specified
 part number: not specified
 rank: unknown
 
handle 0x0018, dmi type 19, 15 bytes
memory array mapped address
 starting address: 0x00000000000
 ending address: 0x000ffffffff
 range size: 4 gb
 physical array handle: 0x0014
 partition width: 2
 
handle 0x002f, dmi type 13, 22 bytes
bios language information
 language description format: abbreviated
 installable languages: 1
  eng
  currently installed language: eng
 
handle 0x0030, dmi type 131, 64 bytes
oem-specific type
 header and data:
  83 40 30 00 31 00 00 00 00 00 00 00 00 00 00 00
  f8 00 4b 1c ff ff ff ff 01 00 00 00 00 00 07 00
  ad 04 04 00 00 00 00 00 c8 00 ff ff 00 00 00 00
  00 00 00 00 32 00 00 00 76 50 72 6f 00 00 00 00
 
handle 0x0029, dmi type 216, 9 bytes
oem-specific type
 header and data:
  d8 09 29 00 01 02 01 00 00
 strings:
  intel
  0000
 
handle 0x0000, dmi type 0, 24 bytes
bios information
 vendor: dell inc.
 version: a05
 release date: 08/03/2012
 address: 0xf0000
 runtime size: 64 kb
 rom size: 2048 kb
 characteristics:
  mca is supported
  pci is supported
  bios is upgradeable
  bios shadowing is allowed
  escd support is available
  boot from cd is supported
  selectable boot is supported
  bios rom is socketed
  edd is supported
  5.25"/1.2 mb floppy services are supported (int 13h)
  3.5"/720 kb floppy services are supported (int 13h)
  3.5"/2.88 mb floppy services are supported (int 13h)
  print screen service is supported (int 5h)
  8042 keyboard services are supported (int 9h)
  serial services are supported (int 14h)
  printer services are supported (int 17h)
  cga/mono video services are supported (int 10h)
  acpi is supported
  usb legacy is supported
  atapi zip drive boot is supported
  bios boot specification is supported
  targeted content distribution is supported
 bios revision: 0.5
 firmware revision: 0.5
 
handle 0x0002, dmi type 2, 15 bytes
base board information
 manufacturer: dell inc.
 product name: 01hxxj
 version: a05
 serial number: .jsq7pa1.cn7117623m00j2.
 asset tag: not specified
 features:
  board is a hosting board
  board is replaceable
 location in chassis: to be filled by o.e.m.
 chassis handle: 0x0003
 type: motherboard
 contained object handles: 0
 
handle 0x0003, dmi type 3, 21 bytes
chassis information
 manufacturer: dell inc.
 type: portable
 lock: not present
 version: not specified
 serial number: jsr1
 asset tag: not specified
 boot-up state: safe
 power supply state: safe
 thermal state: safe
 security status: none
 oem information: 0x00000000
 height: unspecified
 number of power cords: 1
 contained elements: 0
 
handle 0x0001, dmi type 1, 27 bytes
system information
 manufacturer: dell inc.
 product name: inspiron n5050
 version: not specified
 serial number: jsr1
 uuid: 4c4c4544-0053-5110-8029-cac05241
 wake-up type: power switch
 sku number: to be filled by o.e.m.
 family:      
 
handle 0x0024, dmi type 208, 12 bytes
oem-specific type
 header and data:
  d0 0c 24 00 02 05 fe 00 04 05 01 02
 strings:
  20120323
  20120323
 
handle 0x0011, dmi type 10, 6 bytes
on board device information
 type: video
 status: enabled
 description: mobile intel sandybridge hd graphics
 
handle 0x0015, dmi type 17, 28 bytes
memory device
 array handle: 0x0014
 error information handle: 0x0000
 total width: 64 bits
 data width: 64 bits
 size: 4096 mb
 form factor: sodimm
 set: none
 locator: dimm_a
 bank locator: bank 0
 type: ddr3
 type detail: synchronous
 speed: 1067 mhz
 manufacturer: 014f
 serial number: 0009f2
 asset tag: 54114000  
 part number: jm1066-4g  
 rank: unknown
 
handle 0x0031, dmi type 127, 4 bytes
end of table

好了,就是这样。


via:

作者:sk 译者: 校对:

本文由 lctt 原创翻译

上一篇:

下一篇: