Go to main content

Oracle® Solaris Zones Configuration Resources

Exit Print View

Updated: August 2019
 
 

zonecfg Command

Before you can install a non-global zone and use it on your system, the zone must be configured. The zonecfg command is used to create and verify the configuration.

    The check performed by zonecfg for a given configuration verifies the following:

  • Any required properties for a resource are specified.

  • The configuration is free from conflicts.

    For example, if a zpool resource type with a given storage property already exists, there will be a conflict on the name of the zpool. An invalid-syntax error will be displayed. If you have an anet resource, the zone is an exclusive-IP type and cannot be a shared-IP zone. Additionally, the zonecfg command displays a warning if an aliased dataset has a potential conflict with devices.

  • No invalid parameter is specified.

    If an invalid parameter is specified in the zonecfg command for a zone, the zone is not configured.

    The zonecfg command can be used in interactive mode, in command-line mode, or in command-file mode. The following operations can be performed using this command:

  • Create or delete (destroy) a zone configuration

  • Add resources to a particular configuration

  • Set properties for resources added to a configuration

  • Remove resources from a particular configuration

  • Query or verify a configuration

  • Commit to a configuration

  • Revert to a previous configuration

  • Rename a zone

  • Exit from a zonecfg session

The zonecfg prompt is of the following form:

zonecfg:zonename>

When you are configuring a specific resource type, such as a file system, that resource type name is also included in the prompt:

zonecfg:zonename:fs>

For more information about the zonecfg command, see the zonecfg(8) man page.

zonecfg and the Global Zone

The zonecfg command can also be used to persistently specify resources for the global zone. For example, you can use the command to configure the global zone to use a dedicated CPU by setting a value for the dedicated-cpu resource type.

For more information, including procedures that show how to use the zonecfg command, see Chapter 2, Setting Up a Non-Global Zone in Creating and Using Oracle Solaris Zones.

zonecfg Templates

You can use different zonecfg templates to get a specific brand, to get an empty configuration, or to create a zone configuration similar to another zone that is already configured.

    Use the zonecfg template property to define whether, and how, properties are changed in the following cases:

  • When new resource instances are added to a configuration.

  • During configuration cloning, when some properties must have unique values. Tokens in the template property can provide these unique values.

    You can configure a solaris-kz branded zone by using the following templates:

  • SYSsolaris-kz template – The default zone template configures a zone with 4 virtual CPUs and 4GB of memory.

  • SYSsolaris-kz-minimal template – Configures a minimal kernel zone with 1 virtual CPU and 2GB of memory.

The zone remote administration daemon (RAD) module provides a systemic way to express, enforce, or implement changes by using the property templates. For more information, see the zonemgr-1(3rad) man page.


Tip  - If the rad-zonemgr package was not initially installed on your system and you installed it later by using the pkg install command, you must use the svcadm command to restart rad:local and to restart rad:remote if it was running. Ensure that the RAD daemon loaded the module.
Table 1  zonecfg Template Tokens
Token
Description
Usage
%{zonename}
The name of the zone.
Can be used by zonecfg as input from the user, or input from a template value.
%{id}
A unique instance number that is the resource type's id property value.
Can be used by zonecfg as input from the user, or input from a template value. Evaluates to the id property of a particular resource type. Use within a resource scope that supports the id property.
%{global-rootzpool}
Evaluates to the name of the root pool in the global zone.
Used in the default solaris-kz device resource type.
%%
Evaluates to %.
Can be used by zonecfg as input from the user.
Table 2  Supported Tokens by Resource Type Property or Global Property
Resource Type
Property
Supported Tokens
global property
zonepath
%{zonename}
anet
linkname
%{id}
dataset
name
%{zonename}
device
match
storage
%{zonename}, %{id}, %{global-rootzpool}
%{zonename}, %{id}, %{global-rootzpool}
fs
dir
%{zonename}
net
physical
%{id}
rootzpool
storage
%{zonename}, %{global-rootzpool}
suspend
storage
path
%{zonename}, %{global-rootzpool}
%{zonename}
zpool
storage
%{zonename}, %{global-rootzpool}
Example 1  %{zonename} Token in the Zonepath

This example demonstrates how the %{zonename} token enables the zonepath to be automatically updated when the zone name is changed.

zonecfg:ngz> info zonepath
	zonepath.template: /system/zones/%{zonename}
	zonepath: /system/zones/ngz

	zonecfg:ngz> set zonename=new-zone
	zonecfg:new-zone> info zonepath
	zonepath.template: /system/zones/%{zonename}
	zonepath: /system/zones/new-zone
Example 2  Token Used for the storage Property of the device Resource Type for a Kernel Zone
device 0:
		 storage.template: dev:/dev/zvol/dsk/%{global-rootzpool}/VARSHARE/zones/%{zonename}/disk%{id}
		 storage: dev:/dev/zvol/dsk/rpool/VARSHARE/zones/kernel-zone1/disk0
		 id: 0
		 bootpri: 0

zonecfg Command-Line Editing

The Tecla command-line editing library is available to the zonecfg command. The library provides a mechanism for command-line history and editing support.

For more information, see the tecla(7) man page.