Why Is the Memory of an ECS Obtained by Running the free Command Inconsistent with the Actual Memory?
Symptom
After you create an ECS, you run the free -m command to view the ECS memory. The ECS memory is less than the memory configured during ECS creation.
For example:
When you are creating an ECS, the configured memory size is 4,194,304 KB (4,096 MB). After the ECS is created, you run the free -m command to view its memory. The command output is as follows:
[root@localhost ~]# free -mtotal used free shared buff/cache availableMem: 3790 167 3474 8 147 3414Swap: 1022 0 1022
The memory in the command output is 3,790 MB, which is less than the configured 4,096 MB.
Run the dmidecode -t memory command to check the actual memory configured for the ECS. The command output is as follows:
[root@localhost ~]# dmidecode -t memory# dmidecode 3.0Getting SMBIOS data from sysfs.SMBIOS 2.8 present.Handle 0x1000, DMI type 16, 23 bytesPhysical Memory ArrayLocation: OtherUse: System MemoryError Correction Type: Multi-bit ECCMaximum Capacity: 4 GBError Information Handle: Not ProvidedNumber Of Devices: 1Handle 0x1100, DMI type 17, 40 bytesMemory DeviceArray Handle: 0x1000Error Information Handle: Not ProvidedTotal Width: UnknownData Width: UnknownSize: 4,096 MBForm Factor: DIMMSet: NoneLocator: DIMM 0Bank Locator: Not SpecifiedType: RAMType Detail: OtherSpeed: UnknownManufacturer: QEMUSerial Number: Not SpecifiedAsset Tag: Not SpecifiedPart Number: Not SpecifiedRank: UnknownConfigured Clock Speed: UnknownMinimum Voltage: UnknownMaximum Voltage: UnknownConfigured Voltage: Unknown
The memory in the command output is the same as that configured during ECS creation.
Possible Causes
When the OS is started, related devices are initialized, which occupies memory. In addition, when the kernel is started, it also occupies memory. The memory occupied by kdump can be set. Unless otherwise specified, do not change the memory size occupied by kdump.
The command output of free -m shows the available memory of the ECS, and that of dmidecode -t memory shows the hardware memory.
The memory obtained by running the free -m command is less than the memory configured for the ECS. This is a normal phenomenon.
This is a normal phenomenon even for physical servers.
- Symptom
- Possible Causes