Go to main content

Creating and Using Oracle® Solaris Zones

Exit Print View

Updated: August 2019

Performing Zone Configuration From the Global Zone

Using the zonecfg tool interactively is the safest way to configure zone properties and resources. As an alternative, you can configure zones directly from the global zone with the following syntax:

global$ zonecfg -z zonename "zonecfg-subcommands"

Separate zone subcommands with semi-colons.

In the following example, zoneA is being configured with 4 shared CPUs and a new anet resource. At the same time, the zone's ZFS pool is being reset to its default value. The configuration is being performed in default mode and the changes are persistent.

global$ zonecfg -z zoneA "set cpu-shares=4;clear pool;add anet;set linkname=net2;end"
global$ zoneadm -z zoneA apply
Checking: Setting property cpu-shares=4
Checking: Clearing property pool
Checking: Adding anet linkname=net2
Applying the changes

This example shows how to make temporary changes to a zone's setting by using the live mode.

global$ zonecfg -z zoneA -r \
    "remove anet linkname=net2;add dataset;set name=rpool/zonefs;end"
Checking: Removing anet linkname=net2
Checking: Adding dataset name=rpool/zonefs
Applying the changes

Rebooting the zone restores the zone to its original settings.

Note -  Direct configuration from the global zone is risky because errors can easily occur when you type lengthy commands. Use this method with caution and only if you thoroughly understand the effects of zonecfg subcommands.