如何找出Linux系统所支持的最大内存

大多数情况下你可以从BIOS、产品目录或者干脆手动找出你的系统所持的最大内存。这里,我们介绍一种简单有用的技巧——使用dmidecode来找出系统支持的最大内存,这样你就无需打开机箱或者参照BIOS和产品目录了。
 
什么是 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.
Handle0x0014, DMI type 16,15 bytes
PhysicalMemoryArray
Location:SystemBoardOrMotherboard
Use:SystemMemory
ErrorCorrectionType:None
MaximumCapacity:16 GB
ErrorInformationHandle:NotProvided
NumberOfDevices:2
就像你看到的,我的系统支持最大内存到16G,并且有两个内存插槽,简单吧?
接下来,让我们找出现在已经安装的内存的详细信息。
sudo dmidecode -t 17
输出样本
# dmidecode 2.12
SMBIOS 2.6 present.
Handle0x0017, DMI type 17,28 bytes
MemoryDevice
ArrayHandle:0x0014
ErrorInformationHandle:0x0000
TotalWidth:Unknown
DataWidth:Unknown
Size:NoModuleInstalled
FormFactor: DIMM
Set:None
Locator: DIMM_B
BankLocator: BANK 2
Type:Unknown
TypeDetail:None
Speed:Unknown
Manufacturer:NotSpecified
SerialNumber:NotSpecified
AssetTag:NotSpecified
PartNumber:NotSpecified
Rank:Unknown
Handle0x0015, DMI type 17,28 bytes
MemoryDevice
ArrayHandle:0x0014
ErrorInformationHandle:0x0000
TotalWidth:64 bits
DataWidth:64 bits
Size:4096 MB
FormFactor: SODIMM
Set:None
Locator: DIMM_A
BankLocator: BANK 0
Type: DDR3
TypeDetail:Synchronous
Speed:1067MHz
Manufacturer:014F
SerialNumber:00092AF2
AssetTag:54114000
PartNumber: 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.
Handle0x0014, DMI type 16,15 bytes
PhysicalMemoryArray
Location:SystemBoardOrMotherboard
Use:SystemMemory
ErrorCorrectionType:None
MaximumCapacity:16 GB
ErrorInformationHandle:NotProvided
NumberOfDevices:2
Handle0x0017, DMI type 17,28 bytes
MemoryDevice
ArrayHandle:0x0014
ErrorInformationHandle:0x0000
TotalWidth:Unknown
DataWidth:Unknown
Size:NoModuleInstalled
FormFactor: DIMM
Set:None
Locator: DIMM_B
BankLocator: BANK 2
Type:Unknown
TypeDetail:None
Speed:Unknown
Manufacturer:NotSpecified
SerialNumber:NotSpecified
AssetTag:NotSpecified
PartNumber:NotSpecified
Rank:Unknown
Handle0x0015, DMI type 17,28 bytes
MemoryDevice
ArrayHandle:0x0014
ErrorInformationHandle:0x0000
TotalWidth:64 bits
DataWidth:64 bits
Size:4096 MB
FormFactor: SODIMM
Set:None
Locator: DIMM_A
BankLocator: BANK 0
Type: DDR3
TypeDetail:Synchronous
Speed:1067MHz
Manufacturer:014F
SerialNumber:00092AF2
AssetTag:54114000
PartNumber: JM1066KSN-4G
Rank:Unknown
如果你好奇想要知道整个系统的详细信息,例如主板、内存、BIOS等,那么可以输入以下命令来获取。
sudo dmidecode
输出样本
# dmidecode 2.12
SMBIOS 2.6 present.
48 structures occupying 2173 bytes.
Table at 0x000EB840.
Handle0xDA00, DMI type 218,251 bytes
OEM-specific Type
HeaderandData:
DA FB 00 DA B2 000D5F0F37407D00000000
007E0001000000 DC 0100800200 DD 0100
8003007501018001007601028001002D
01038001002E01038000008101078000
00820107800100830108800000840108
80010085010680000086010680010058
02058000005702058001009C00020001
009B00020000008A0103000100890103
0000007F010400000080010400010053
01050000005201050001007B01060000
007C0106000100940107000000930107
0001007D00080000002D00090001002E
00090000006E000A00000095000B0001
0096000B0000002F020C00010030020C
00000050020D00000051020D00010052
020D000200 FF FF 00000000
Handle0xDA01, DMI type 218,59 bytes
OEM-specific Type
HeaderandData:
DA 3B01 DA B2 000D5F0F374053020D0003
0054020D00040056020D0005004B010E
0001004A010E000000 EA 000F000100 EB
000F000000 FF FF 00000000
Handle0x0004, DMI type 4,42 bytes
ProcessorInformation
SocketDesignation: CPU 1
Type:CentralProcessor
Family:Core i3
Manufacturer:Intel
ID: A7 060301 FF FB AB BE
Signature:Type0,Family6,Model42,Stepping7
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 (Pageglobal 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 (Pendingbreak enabled)
Version:Intel(R)Core(TM) i3-2350M CPU @2.30GHz
Voltage:1.1 V
ExternalClock:100MHz
MaxSpeed:2300MHz
CurrentSpeed:2300MHz
Status:Populated,Enabled
Upgrade:Other
L1 CacheHandle:0x0005
L2 CacheHandle:0x0006
L3 CacheHandle:0x0007
SerialNumber:ToBeFilledBy O.E.M.
AssetTag:ToBeFilledBy O.E.M.
PartNumber:ToBeFilledBy O.E.M.
CoreCount:2
CoreEnabled:1
ThreadCount:2
Characteristics:
64-bit capable
Handle0x0005, DMI type 7,19 bytes
CacheInformation
SocketDesignation: L1-Cache
Configuration:Enabled,NotSocketed,Level1
OperationalMode:WriteBack
Location:Internal
InstalledSize:64 kB
MaximumSize:64 kB
Supported SRAM Types:
Other
Installed SRAM Type:Other
Speed:Unknown
ErrorCorrectionType:None
SystemType:Unified
Associativity:8-way Set-associative
Handle0x0006, DMI type 7,19 bytes
CacheInformation
SocketDesignation: L2-Cache
Configuration:Enabled,NotSocketed,Level2
OperationalMode:VariesWithMemoryAddress
Location:Internal
InstalledSize:512 kB
MaximumSize:512 kB
Supported SRAM Types:
Other
Installed SRAM Type:Other
Speed:Unknown
ErrorCorrectionType:None
SystemType:Unified
Associativity:8-way Set-associative
Handle0x0007, DMI type 7,19 bytes
CacheInformation
SocketDesignation: L3-Cache
Configuration:Enabled,NotSocketed,Level3
OperationalMode:VariesWithMemoryAddress
Location:Internal
InstalledSize:3072 kB
MaximumSize:3072 kB
Supported SRAM Types:
Other
Installed SRAM Type:Other
Speed:Unknown
ErrorCorrectionType:None
SystemType:Unified
Associativity:Other
Handle0x0008, DMI type 8,9 bytes
PortConnectorInformation
InternalReferenceDesignator: J1A1
InternalConnectorType:None
ExternalReferenceDesignator: PS2Mouse
ExternalConnectorType: PS/2
PortType:MousePort
Handle0x0009, DMI type 8,9 bytes
PortConnectorInformation
InternalReferenceDesignator: J1A1
InternalConnectorType:None
ExternalReferenceDesignator:Keyboard
ExternalConnectorType: PS/2
PortType:KeyboardPort
Handle0x000A, DMI type 8,9 bytes
PortConnectorInformation
InternalReferenceDesignator: J2A2B
InternalConnectorType:None
ExternalReferenceDesignator:Video
ExternalConnectorType: DB-15 female
PortType:VideoPort
Handle0x000B, DMI type 8,9 bytes
PortConnectorInformation
InternalReferenceDesignator: J3A1
InternalConnectorType:None
ExternalReferenceDesignator: USB1
ExternalConnectorType:AccessBus(USB)
PortType: USB
Handle0x000C, DMI type 8,9 bytes
PortConnectorInformation
InternalReferenceDesignator: J3A1
InternalConnectorType:None
ExternalReferenceDesignator: USB2
ExternalConnectorType:AccessBus(USB)
PortType: USB
Handle0x000D, DMI type 8,9 bytes
PortConnectorInformation
InternalReferenceDesignator: J3A1
InternalConnectorType:None
ExternalReferenceDesignator: USB3
ExternalConnectorType:AccessBus(USB)
PortType: USB
Handle0x000E, DMI type 8,9 bytes
PortConnectorInformation
InternalReferenceDesignator: J5A1
InternalConnectorType:None
ExternalReferenceDesignator: LAN
ExternalConnectorType: RJ-45
PortType:NetworkPort
Handle0x000F, DMI type 9,17 bytes
SystemSlotInformation
Designation: J6B2
Type: x16 PCI Express
CurrentUsage:InUse
Length:Long
ID:0
Characteristics:
3.3 V is provided
Openingis shared
PME signal is supported
BusAddress:0000:00:01.0
Handle0x0010, DMI type 9,17 bytes
SystemSlotInformation
Designation: J6B1
Type: x1 PCI Express
CurrentUsage:InUse
Length:Short
ID:1
Characteristics:
3.3 V is provided
Openingis shared
PME signal is supported
BusAddress:0000:00:1c.3
Handle0x0012, DMI type 11,5 bytes
OEM Strings
String1:DellSystem
String2:5[0003]
String3:13[P18F]
Handle0x0013, DMI type 12,5 bytes
SystemConfigurationOptions
Option1:ToBeFilledBy O.E.M.
Handle0x001C, DMI type 21,7 bytes
Built-inPointingDevice
Type:TouchPad
Interface:BusMouse
Buttons:2
Handle0x001D, DMI type 22,26 bytes
PortableBattery
Location:Sys.BatteryBay
Manufacturer:Sanyo
SerialNumber:5390
Name: DELL 4YRJH22
Chemistry:LithiumIon
DesignCapacity:45000 mWh
DesignVoltage:10800 mV
SBDS Version:1.0
MaximumError:2%
SBDS ManufactureDate:2012-02-28
OEM-specific Information:0x00000001
Handle0x001E, DMI type 32,20 bytes
SystemBootInformation
Status:No errors detected
Handle0x0020, DMI type 27,12 bytes
CoolingDevice
Type:Fan
Status: OK
OEM-specific Information:0x00000000
Handle0x0021, DMI type 28,20 bytes
TemperatureProbe
Description: CPU InternalTemperature
Location:Processor
Status: OK
MaximumValue:127.0 deg C
MinimumValue:0.0 deg C
Resolution:1.000 deg C
Tolerance:0.5 deg C
Accuracy:Unknown
OEM-specific Information:0x00000000
Handle0xB000, DMI type 176,5 bytes
OEM-specific Type
HeaderandData:
B0 0500 B0 00
Handle0xB100, DMI type 177,12 bytes
OEM-specific Type
HeaderandData:
B1 0C00 B1 1A0E000000000000
Handle0x0025, DMI type 209,12 bytes
OEM-specific Type
HeaderandData:
D1 0C25000000000305010003
Handle0x0026, DMI type 210,12 bytes
OEM-specific Type
HeaderandData:
D2 0C26000000000305200103
Handle0x0027, DMI type 211,13 bytes
OEM-specific Type
HeaderandData:
D3 0D2700010000000002030404
Strings:
Front
Handle0x0028, DMI type 212,57 bytes
OEM-specific Type
HeaderandData:
D4 39280070007100014950489C0049 FC
019B0049 FC 007F014A FB 0480014A FB 00
53014A F7 0852014A F7 087B014A EF 107C
014A EF 10 FF FF 000000
Handle0x002A, DMI type 217,8 bytes
OEM-specific Type
HeaderandData:
D9 082A0001020000
Strings:
Handle0x002B, DMI type 219,11 bytes
OEM-specific Type
HeaderandData:
DB 0B2B0000010203000405
Strings:
Handle0x002C, DMI type 220,22 bytes
OEM-specific Type
HeaderandData:
DC 162C0001 F0 000002 F0 0000000003 F0
04 F0 00000000
Handle0x002D, DMI type 221,19 bytes
OEM-specific Type
HeaderandData:
DD 132D00000000000003000000000000
000000
Handle0x002E, DMI type 222,16 bytes
OEM-specific Type
HeaderandData:
DE 102E000108 FF FF 0000000000000000
Handle0x0014, DMI type 16,15 bytes
PhysicalMemoryArray
Location:SystemBoardOrMotherboard
Use:SystemMemory
ErrorCorrectionType:None
MaximumCapacity:16 GB
ErrorInformationHandle:NotProvided
NumberOfDevices:2
Handle0x0016, DMI type 20,19 bytes
MemoryDeviceMappedAddress
StartingAddress:0x00000000000
EndingAddress:0x000FFFFFFFF
RangeSize:4 GB
PhysicalDeviceHandle:0x0015
MemoryArrayMappedAddressHandle:0x0018
PartitionRowPosition:1
InterleavePosition:1
InterleavedDataDepth:1
Handle0x0017, DMI type 17,28 bytes
MemoryDevice
ArrayHandle:0x0014
ErrorInformationHandle:0x0000
TotalWidth:Unknown
DataWidth:Unknown
Size:NoModuleInstalled
FormFactor: DIMM
Set:None
Locator: DIMM_B
BankLocator: BANK 2
Type:Unknown
TypeDetail:None
Speed:Unknown
Manufacturer:NotSpecified
SerialNumber:NotSpecified
AssetTag:NotSpecified
PartNumber:NotSpecified
Rank:Unknown
Handle0x0018, DMI type 19,15 bytes
MemoryArrayMappedAddress
StartingAddress:0x00000000000
EndingAddress:0x000FFFFFFFF
RangeSize:4 GB
PhysicalArrayHandle:0x0014
PartitionWidth:2
Handle0x002F, DMI type 13,22 bytes
BIOS LanguageInformation
LanguageDescriptionFormat:Abbreviated
InstallableLanguages:1
eng
CurrentlyInstalledLanguage: eng
Handle0x0030, DMI type 131,64 bytes
OEM-specific Type
HeaderandData:
83403000310000000000000000000000
F8 004B1C FF FF FF FF 0100000000000700
AD 04040000000000 C8 00 FF FF 00000000
00000000320000007650726F00000000
Handle0x0029, DMI type 216,9 bytes
OEM-specific Type
HeaderandData:
D8 0929000102010000
Strings:
INTEL
0000
Handle0x0000, DMI type 0,24 bytes
BIOS Information
Vendor:DellInc.
Version: A05
ReleaseDate:08/03/2012
Address:0xF0000
RuntimeSize:64 kB
ROM Size:2048 kB
Characteristics:
MCA is supported
PCI is supported
BIOS is upgradeable
BIOS shadowing is allowed
ESCD support is available
Bootfrom 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 (int13h)
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
好了,就是这样。

你可能感兴趣的:(如何找出Linux系统所支持的最大内存)