Solaris sun4v - how do you determine physical RAM?

I have a Sun T5120, and I want to programmatically determine how much RAM it has.

# uname -a 
SunOS myhost 5.10 Generic_141444-09 sun4v sparc SUNW,SPARC-Enterprise-T5120

The box has 64Gb; I tried prtdiag and prtconf, but they give me bogus info

prtconf gives me:

# prtconf |grep -i "memory size"
Memory size: 1024 Megabytes

prtdiag gives me:

System Configuration:  Sun Microsystems  sun4v SPARC Enterprise T5120
Memory size: 1024 Megabytes

================================ Virtual CPUs ================================


CPU ID Frequency Implementation         Status
------ --------- ---------------------- -------
0      1415 MHz  SUNW,UltraSPARC-T2     on-line  
1      1415 MHz  SUNW,UltraSPARC-T2     on-line  

======================= Physical Memory Configuration ========================
Segment Table:
--------------------------------------------------------------
Base           Segment  Interleave  Bank     Contains
Address        Size     Factor      Size     Modules
--------------------------------------------------------------
0x0            64 GB    4           16 GB    MB/CMP0/BR0/CH0/D0
                                             MB/CMP0/BR0/CH1/D0
                                    16 GB    MB/CMP0/BR1/CH0/D0
                                             MB/CMP0/BR1/CH1/D0
                                    16 GB    MB/CMP0/BR2/CH0/D0
                                             MB/CMP0/BR2/CH1/D0
                                    16 GB    MB/CMP0/BR3/CH0/D0
                                             MB/CMP0/BR3/CH1/D0

What does

banner

say at the OpenBoot "ok " prompt?

1 Like

Commands from the ok prompt won't help me here; I need to do this in a shell script.

Well if those two commands show that Solaris detected 1GB of RAM then there is nothing else what you can do. Maybe your server was partitioned using LDoms, and that is why amount of RAM is so low in this instance of the system, but I don't have much knowledge about that subject.

1 Like

You might be onto something there; this box does have LDOMs, and the primary partition is only 1Gb, so that makes sense. I would still expect prtconf/prtdiag to tell me how much physical RAM is in the box, though.

# ldm list
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  SP      2     1G       1.3%  23h 31m
litsun01-d01     active     -n----  5000    4     2G       0.4%  1d 22m
litsun01-d02     active     -n----  5001    4     2G       0.2%  1d 22m
litsun01-d03     active     -t----  5002    4     2G        25%  1d 22m
litsun01-d04     active     -n----  5003    4     2G       0.2%  1d 22m
litsun01-d05     active     -t----  5004    4     2G        25%  19h 41m
litsun01-d06     inactive   ------          4     2G             
litsun01-d07     inactive   ------          4     2G             
litsun01-d08     inactive   ------          4     2G

In output that you provided, prtdiag shows 64GB of memory in "Physical Memory Configuration" section.

1 Like

Yup, but the script that I have for collecting this info uses the "memory size" line at the moment; LDOM broke it. I need to come up with a new way to do this, which will work on either an LDOM or non-LDOM system.

I don't have access to Solaris box right now so I don't know if this solution is very reliable:

mem=`prtdiag | tr -s "\t" " " | awk '/^0x0/{print $2}'`

This will put number of gigabytes of RAM into "mem" variable.

1 Like

That's nice and clean, but I don't know if this will work on all systems of this type. I'll have to try this on similar boxes in our other data centers.

It won't work if there will be more memory segments in the server. I think something like this could work in that case:

mem=`prtdiag | tr -s "\t" " " | awk '/^0x[0-9a-f]/{x+=$2}END{print x}'`

Anyway let me know how did it go :wink:

1 Like

The 'lgrpinfo' utility might do it. I don't recall offhand when that was rolled into Solaris 10 so you may not have it, and it may not work under LDOMs, but it's designed to show physical RAM configuration.

It's not in the 10/09 release.

try using:

UNIX memconf utility