How to Check the Total Physical RAM at Linux OS?


The first thing after I upgraded my VPS to 2G RAM is to check if there is indeed a 2G RAM. The command I use is free -m where it outputs the following:

1
2
3
4
             total       used       free     shared    buffers     cached
Mem:          2001       1614        387         64         96       1011
-/+ buffers/cache:        507       1494
Swap:          255          0        255
             total       used       free     shared    buffers     cached
Mem:          2001       1614        387         64         96       1011
-/+ buffers/cache:        507       1494
Swap:          255          0        255

The htop command also confirms the same amount of RAM.

 Mem[|||||||||||||||###****************************513/2001MB]

The total RAM shown is less than 2048M (1G = 1024M), I once doubted that it is an error then I contacted QuickHostUK and they checked :

1
2
3
4
5
6
7
8
9
10
Hi,
 
Sir system reserves some memory.
Its not an error. 
 
Checking a 4GB (4096MB) vps we see 3820MB.
 
This is kvm virtual server container not a hardware server.
 
Please let us know if you need any further information.
Hi,

Sir system reserves some memory.
Its not an error. 

Checking a 4GB (4096MB) vps we see 3820MB.

This is kvm virtual server container not a hardware server.

Please let us know if you need any further information.

Apparently, it is not the total physical RAM and I looked for solutions, it seems most of them are showing available RAM not the total physical RAM:

1
2
3
4
5
6
7
8
9
10
11
root@uploadbeta:/home# cat /proc/meminfo | head
MemTotal:        2049908 kB
MemFree:          388968 kB
Buffers:           99104 kB
Cached:          1048948 kB
SwapCached:            0 kB
Active:           552664 kB
Inactive:         985708 kB
Active(anon):     220912 kB
Inactive(anon):   235604 kB
Active(file):     331752 kB
root@uploadbeta:/home# cat /proc/meminfo | head
MemTotal:        2049908 kB
MemFree:          388968 kB
Buffers:           99104 kB
Cached:          1048948 kB
SwapCached:            0 kB
Active:           552664 kB
Inactive:         985708 kB
Active(anon):     220912 kB
Inactive(anon):   235604 kB
Active(file):     331752 kB

2049908 kB is 2001M. However, this information is logged in the boot-up messages:

1
2
root@uploadbeta:/home# cat /var/log/dmesg | grep Memory
[    0.000000] Memory: 2041296K/2096748K available (7338K kernel code, 1138K rwdata, 3388K rodata, 1332K init, 1440K bss, 55452K reserved)
root@uploadbeta:/home# cat /var/log/dmesg | grep Memory
[    0.000000] Memory: 2041296K/2096748K available (7338K kernel code, 1138K rwdata, 3388K rodata, 1332K init, 1440K bss, 55452K reserved)

It shows 2048M = 2096748K and clearly some RAM is reserved by system.

Another command dmidecode -t 17 shows the total physical RAM:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
root@uploadbeta:/home# dmidecode -t 17
# dmidecode 2.12
SMBIOS 2.4 present.
 
Handle 0x1100, DMI type 17, 21 bytes
Memory Device
        Array Handle: 0x1000
        Error Information Handle: 0x0000
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 2048 MB
        Form Factor: DIMM
        Set: None
        Locator: DIMM 0
        Bank Locator: Not Specified
        Type: RAM
        Type Detail: None
root@uploadbeta:/home# dmidecode -t 17
# dmidecode 2.12
SMBIOS 2.4 present.

Handle 0x1100, DMI type 17, 21 bytes
Memory Device
        Array Handle: 0x1000
        Error Information Handle: 0x0000
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 2048 MB
        Form Factor: DIMM
        Set: None
        Locator: DIMM 0
        Bank Locator: Not Specified
        Type: RAM
        Type Detail: None

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
392 words
Last Post: Site News: VPS Upgraded Again to Handle Large Traffic.
Next Post: How to Remove Annoying Setup Dialog When Microsoft Office 2000 startup Due to Problematic Add-ons?

The Permanent URL is: How to Check the Total Physical RAM at Linux OS?

Leave a Reply