Solaris zone memory on the fly

From Lolly's Wiki
Revision as of 15:24, 25 November 2021 by Lollypop (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")
Jump to navigationJump to search

Zone Memory

Setting memory parameter for running zones

You can change memory parameter for running zones. But remember to make it persistent by changing zone config file, too. So I do it always in advance.

Change setting in the config file

<syntaxhighlight lang=bash>

  1. zonecfg -z myzone

zonecfg:myzone> select capped-memory zonecfg:myzone:capped-memory> info capped-memory:

       [swap: 10G]

zonecfg:myzone:capped-memory> set swap=16G zonecfg:myzone:capped-memory> set physical=16G zonecfg:myzone:capped-memory> set locked=10G zonecfg:myzone:capped-memory> info

       physical: 16G
       [swap: 16G]
       [locked: 10G]

zonecfg:myzone:capped-memory> end zonecfg:myzone> verify zonecfg:myzone> commit zonecfg:myzone> exit

</source>

Change settings for the running zone

First take a look

<syntaxhighlight lang=bash>

  1. zlogin myzone prtconf | grep Memory

prtconf: devinfo facility not available Memory size: 65536 Megabytes

  1. prctl -t privileged -i zone myzone

zone: 1: myzone NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT zone.max-swap

       privileged     10.0GB       -   deny                                 -

zone.cpu-shares

       privileged          1       -   none                                 -

</source>

Set the new values

<syntaxhighlight lang=bash>

  1. rcapadm -z myzone -m 16G
  2. prctl -n zone.max-swap -v 16g -t privileged -r -e deny -i zone myzone
  3. prctl -n zone.max-locked-memory -v 16g -t privileged -r -e deny -i zone myzone

</source>

Prove values

<syntaxhighlight lang=bash>

  1. zlogin myzone prtconf | grep Memory

prtconf: devinfo facility not available Memory size: 16384 Megabytes

  1. prctl -t privileged -i zone myzone

zone: 1: myzone NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT zone.max-swap

       privileged     16.0GB       -   deny                                 -

zone.cpu-shares

       privileged          1       -   none                                 -

</source> Done.