how to find the right memory size

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
we have linux machine with 32G
we capture the mem as the follwing
mem=` cat /proc/meminfo | grep MemTotal | awk 'print $2' `
echo $mem
32767184
and now we convert it to GIGA
mem_in_giga=` echo $(( $mem / 1024 / 1024)) `
echo $mem_in_giga
31
but from results we get 31 and not 32G
the same story with free command
free -g
total used free shared buff/cache available
Mem: 31 9 17 0 4 20
Swap: 7 0 7
so how to get the 32G by any command solution?
linux memory meminfo
add a comment |Â
up vote
0
down vote
favorite
we have linux machine with 32G
we capture the mem as the follwing
mem=` cat /proc/meminfo | grep MemTotal | awk 'print $2' `
echo $mem
32767184
and now we convert it to GIGA
mem_in_giga=` echo $(( $mem / 1024 / 1024)) `
echo $mem_in_giga
31
but from results we get 31 and not 32G
the same story with free command
free -g
total used free shared buff/cache available
Mem: 31 9 17 0 4 20
Swap: 7 0 7
so how to get the 32G by any command solution?
linux memory meminfo
1
You don't have a machine with 32 GB RAM. You have machine with approximately 32 GB RAM. If you really want32:echo $((32767184/1000/1000)).
â muru
Feb 1 at 12:39
1
Also, it's unclear what numbers are GB and what number may be GiB.
â Kusalananda
Feb 1 at 12:47
1
free -goutputs gibibytes, all the values quoted from output in the question are gibibytes. ThatâÂÂs appropriate since RAM capacities are bought in gibibyte or tebibyte increments...
â Stephen Kitt
Feb 1 at 12:53
1
Just FYI, you can get rid of thecat,grep, andecho:awk '$1 == "MemTotal:" print $2 / 1024 / 1024 ' /proc/meminfo
â Patrick
Feb 1 at 13:20
1
For future reference on converting byte values, see unix.stackexchange.com/q/44040/85039
â Sergiy Kolodyazhnyy
Feb 1 at 15:52
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
we have linux machine with 32G
we capture the mem as the follwing
mem=` cat /proc/meminfo | grep MemTotal | awk 'print $2' `
echo $mem
32767184
and now we convert it to GIGA
mem_in_giga=` echo $(( $mem / 1024 / 1024)) `
echo $mem_in_giga
31
but from results we get 31 and not 32G
the same story with free command
free -g
total used free shared buff/cache available
Mem: 31 9 17 0 4 20
Swap: 7 0 7
so how to get the 32G by any command solution?
linux memory meminfo
we have linux machine with 32G
we capture the mem as the follwing
mem=` cat /proc/meminfo | grep MemTotal | awk 'print $2' `
echo $mem
32767184
and now we convert it to GIGA
mem_in_giga=` echo $(( $mem / 1024 / 1024)) `
echo $mem_in_giga
31
but from results we get 31 and not 32G
the same story with free command
free -g
total used free shared buff/cache available
Mem: 31 9 17 0 4 20
Swap: 7 0 7
so how to get the 32G by any command solution?
linux memory meminfo
edited Feb 1 at 12:43
Jeff Schaller
31.4k846105
31.4k846105
asked Feb 1 at 12:33
yael
1,9871145
1,9871145
1
You don't have a machine with 32 GB RAM. You have machine with approximately 32 GB RAM. If you really want32:echo $((32767184/1000/1000)).
â muru
Feb 1 at 12:39
1
Also, it's unclear what numbers are GB and what number may be GiB.
â Kusalananda
Feb 1 at 12:47
1
free -goutputs gibibytes, all the values quoted from output in the question are gibibytes. ThatâÂÂs appropriate since RAM capacities are bought in gibibyte or tebibyte increments...
â Stephen Kitt
Feb 1 at 12:53
1
Just FYI, you can get rid of thecat,grep, andecho:awk '$1 == "MemTotal:" print $2 / 1024 / 1024 ' /proc/meminfo
â Patrick
Feb 1 at 13:20
1
For future reference on converting byte values, see unix.stackexchange.com/q/44040/85039
â Sergiy Kolodyazhnyy
Feb 1 at 15:52
add a comment |Â
1
You don't have a machine with 32 GB RAM. You have machine with approximately 32 GB RAM. If you really want32:echo $((32767184/1000/1000)).
â muru
Feb 1 at 12:39
1
Also, it's unclear what numbers are GB and what number may be GiB.
â Kusalananda
Feb 1 at 12:47
1
free -goutputs gibibytes, all the values quoted from output in the question are gibibytes. ThatâÂÂs appropriate since RAM capacities are bought in gibibyte or tebibyte increments...
â Stephen Kitt
Feb 1 at 12:53
1
Just FYI, you can get rid of thecat,grep, andecho:awk '$1 == "MemTotal:" print $2 / 1024 / 1024 ' /proc/meminfo
â Patrick
Feb 1 at 13:20
1
For future reference on converting byte values, see unix.stackexchange.com/q/44040/85039
â Sergiy Kolodyazhnyy
Feb 1 at 15:52
1
1
You don't have a machine with 32 GB RAM. You have machine with approximately 32 GB RAM. If you really want
32: echo $((32767184/1000/1000)).â muru
Feb 1 at 12:39
You don't have a machine with 32 GB RAM. You have machine with approximately 32 GB RAM. If you really want
32: echo $((32767184/1000/1000)).â muru
Feb 1 at 12:39
1
1
Also, it's unclear what numbers are GB and what number may be GiB.
â Kusalananda
Feb 1 at 12:47
Also, it's unclear what numbers are GB and what number may be GiB.
â Kusalananda
Feb 1 at 12:47
1
1
free -g outputs gibibytes, all the values quoted from output in the question are gibibytes. ThatâÂÂs appropriate since RAM capacities are bought in gibibyte or tebibyte increments...â Stephen Kitt
Feb 1 at 12:53
free -g outputs gibibytes, all the values quoted from output in the question are gibibytes. ThatâÂÂs appropriate since RAM capacities are bought in gibibyte or tebibyte increments...â Stephen Kitt
Feb 1 at 12:53
1
1
Just FYI, you can get rid of the
cat, grep, and echo: awk '$1 == "MemTotal:" print $2 / 1024 / 1024 ' /proc/meminfoâ Patrick
Feb 1 at 13:20
Just FYI, you can get rid of the
cat, grep, and echo: awk '$1 == "MemTotal:" print $2 / 1024 / 1024 ' /proc/meminfoâ Patrick
Feb 1 at 13:20
1
1
For future reference on converting byte values, see unix.stackexchange.com/q/44040/85039
â Sergiy Kolodyazhnyy
Feb 1 at 15:52
For future reference on converting byte values, see unix.stackexchange.com/q/44040/85039
â Sergiy Kolodyazhnyy
Feb 1 at 15:52
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
7
down vote
accepted
MemTotal shows
Total usable RAM (i.e., physical RAM minus a few reserved bits and the kernel binary
code).
You canâÂÂt use that to determine the exact installed memory, except by using heuristics...
To determine the actual installed memory, you should use lshw or dmidecode which will show the size of the installed modules; e.g. from lshw:
*-memory
description: System Memory
physical id: 4c
slot: System board or motherboard
size: 32GiB
capabilities: ecc
configuration: errordetection=ecc
or in more compact form (lshw -class memory -short):
H/W path Device Class Description
=========================================================
/0/0 memory 64KiB BIOS
/0/47/48 memory 256KiB L1 cache
/0/47/49 memory 1MiB L2 cache
/0/47/4a memory 8MiB L3 cache
/0/4c memory 32GiB System Memory
/0/4c/0 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/1 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/2 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/3 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
MemTotal shows
Total usable RAM (i.e., physical RAM minus a few reserved bits and the kernel binary
code).
You canâÂÂt use that to determine the exact installed memory, except by using heuristics...
To determine the actual installed memory, you should use lshw or dmidecode which will show the size of the installed modules; e.g. from lshw:
*-memory
description: System Memory
physical id: 4c
slot: System board or motherboard
size: 32GiB
capabilities: ecc
configuration: errordetection=ecc
or in more compact form (lshw -class memory -short):
H/W path Device Class Description
=========================================================
/0/0 memory 64KiB BIOS
/0/47/48 memory 256KiB L1 cache
/0/47/49 memory 1MiB L2 cache
/0/47/4a memory 8MiB L3 cache
/0/4c memory 32GiB System Memory
/0/4c/0 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/1 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/2 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/3 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
add a comment |Â
up vote
7
down vote
accepted
MemTotal shows
Total usable RAM (i.e., physical RAM minus a few reserved bits and the kernel binary
code).
You canâÂÂt use that to determine the exact installed memory, except by using heuristics...
To determine the actual installed memory, you should use lshw or dmidecode which will show the size of the installed modules; e.g. from lshw:
*-memory
description: System Memory
physical id: 4c
slot: System board or motherboard
size: 32GiB
capabilities: ecc
configuration: errordetection=ecc
or in more compact form (lshw -class memory -short):
H/W path Device Class Description
=========================================================
/0/0 memory 64KiB BIOS
/0/47/48 memory 256KiB L1 cache
/0/47/49 memory 1MiB L2 cache
/0/47/4a memory 8MiB L3 cache
/0/4c memory 32GiB System Memory
/0/4c/0 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/1 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/2 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/3 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
add a comment |Â
up vote
7
down vote
accepted
up vote
7
down vote
accepted
MemTotal shows
Total usable RAM (i.e., physical RAM minus a few reserved bits and the kernel binary
code).
You canâÂÂt use that to determine the exact installed memory, except by using heuristics...
To determine the actual installed memory, you should use lshw or dmidecode which will show the size of the installed modules; e.g. from lshw:
*-memory
description: System Memory
physical id: 4c
slot: System board or motherboard
size: 32GiB
capabilities: ecc
configuration: errordetection=ecc
or in more compact form (lshw -class memory -short):
H/W path Device Class Description
=========================================================
/0/0 memory 64KiB BIOS
/0/47/48 memory 256KiB L1 cache
/0/47/49 memory 1MiB L2 cache
/0/47/4a memory 8MiB L3 cache
/0/4c memory 32GiB System Memory
/0/4c/0 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/1 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/2 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/3 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
MemTotal shows
Total usable RAM (i.e., physical RAM minus a few reserved bits and the kernel binary
code).
You canâÂÂt use that to determine the exact installed memory, except by using heuristics...
To determine the actual installed memory, you should use lshw or dmidecode which will show the size of the installed modules; e.g. from lshw:
*-memory
description: System Memory
physical id: 4c
slot: System board or motherboard
size: 32GiB
capabilities: ecc
configuration: errordetection=ecc
or in more compact form (lshw -class memory -short):
H/W path Device Class Description
=========================================================
/0/0 memory 64KiB BIOS
/0/47/48 memory 256KiB L1 cache
/0/47/49 memory 1MiB L2 cache
/0/47/4a memory 8MiB L3 cache
/0/4c memory 32GiB System Memory
/0/4c/0 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/1 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/2 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/4c/3 memory 8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
edited Feb 1 at 12:57
ilkkachu
49.8k674137
49.8k674137
answered Feb 1 at 12:42
Stephen Kitt
142k22308370
142k22308370
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f421193%2fhow-to-find-the-right-memory-size%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
You don't have a machine with 32 GB RAM. You have machine with approximately 32 GB RAM. If you really want
32:echo $((32767184/1000/1000)).â muru
Feb 1 at 12:39
1
Also, it's unclear what numbers are GB and what number may be GiB.
â Kusalananda
Feb 1 at 12:47
1
free -goutputs gibibytes, all the values quoted from output in the question are gibibytes. ThatâÂÂs appropriate since RAM capacities are bought in gibibyte or tebibyte increments...â Stephen Kitt
Feb 1 at 12:53
1
Just FYI, you can get rid of the
cat,grep, andecho:awk '$1 == "MemTotal:" print $2 / 1024 / 1024 ' /proc/meminfoâ Patrick
Feb 1 at 13:20
1
For future reference on converting byte values, see unix.stackexchange.com/q/44040/85039
â Sergiy Kolodyazhnyy
Feb 1 at 15:52