0

How to check exact amount of memory installed in server? MemTotal from /proc/meminfo show something a bit less. I.e. I have 2097152K and meminfo says 2054348K.

I can sum all banks reported by dmidecode but it requires reboot to update - I don't like it.

Any other ideas? I'm writing test for automated provisioning in vmware environment and I want to do it right. :)

  • using the "top" command should show you the amount of physical memory that is available. – Mox Aug 14 '18 at 13:39
  • you can use below command to get total available memory for system at hardware level {$ sudo dmidecode -t memory |grep -i size} – asktyagi May 03 '19 at 03:28

1 Answers1

1

As to why MemTotal is missing some memory: https://serverfault.com/a/219990/37681

 MemTotal: Total usable ram (i.e. physical ram minus a few reserved
      bits and the kernel binary code)

As long as the kernel message buffer hasn't been filled with more recent events: look for a line starting with Memory in dmesg:

# dmesg |grep " Memory:"
[    0.000000] Memory: 8125008K/8388088K available (8546K kernel code, 1313K rwdata, 4000K rodata, 1516K init, 1316K bss, 263080K reserved, 0K cma-reserved)

which shows the physical ram: 8388088K and the "few reserved bits and the kernel binary code" 263080K and the rest is available for the applications 8125008K and what will be shown as MemTotal in /proc/meminfo.

(Later stages in the boot process will free up some additional memory, increasing MemTotal, btw dmesg |grep Freeing)

HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • Yes, but dmesg doesn't say anything interesting without reboot. I have this: https://gist.github.com/khorlodemchok/5516ec017cba33a2c7d193251d627f6c Not very useful... – Maciej Wawrzyńczuk Aug 14 '18 at 14:14