<chapter id="z.inst.ov-1"><title>About Installing, Halting, Cloning, and
Uninstalling Non-Global Zones (Overview)</title><highlights><para>This chapter discusses zone installation on your Solaris system. It
also describes the two processes that manage the virtual platform and the
application environment, <literal>zoneadmd</literal> and <literal>zsched</literal>.
Information about halting, rebooting, cloning, and uninstalling zones is also
provided.</para><para>The following topics are addressed in this chapter:</para><itemizedlist><listitem><para><olink targetptr="z.inst.ov-2" remap="internal">Zone Installation and Administration
Concepts</olink></para>
</listitem><listitem><para><olink targetptr="z.inst.ov-3" remap="internal">Zone Construction</olink></para>
</listitem><listitem><para><olink targetptr="z.inst.ov-12" remap="internal">The zoneadmd Daemon</olink></para>
</listitem><listitem><para><olink targetptr="z.inst.ov-13" remap="internal">The zsched Zone Scheduler</olink></para>
</listitem><listitem><para><olink targetptr="z.inst.ov-4" remap="internal">Zone Application Environment</olink></para>
</listitem><listitem><para><olink targetptr="z.inst.ov-6" remap="internal">About Halting, Rebooting, and
Uninstalling Zones</olink></para>
</listitem><listitem><para><olink targetptr="gcrsy" remap="internal">About Cloning Non-Global Zones</olink></para>
</listitem>
</itemizedlist><para>To clone a non-global zone, install and boot a non-global zone, or to
halt or uninstall a non-global zone, see <olink targetptr="z.inst.task-1" remap="internal">Chapter&nbsp;20,
Installing, Booting, Halting, Uninstalling,  and Cloning Non-Global Zones
(Tasks)</olink>.</para><para>For information about <literal>lx</literal> branded zone installation,
see <olink targetptr="gdbki" remap="internal">Chapter&nbsp;32, About Installing, Booting, Halting,
Cloning, and Uninstalling lx Branded Zones (Overview)</olink> and <olink targetptr="gdduh" remap="internal">Chapter&nbsp;33, Installing, Booting, Halting, Uninstalling
and Cloning lx Branded Zones (Tasks)</olink>.</para>
</highlights><sect1 id="z.inst.ov-2"><title>Zone Installation and Administration Concepts</title><para>The <command>zoneadm</command> command described in the <olink targetdoc="group-refman" targetptr="zoneadm-1m" remap="external"><citerefentry><refentrytitle>zoneadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page
is the primary tool used to install and administer non-global zones. Operations
using the <command>zoneadm</command> command must be run from the global zone.
The following tasks can be performed using the <command>zoneadm</command> command:</para><itemizedlist><listitem><para>Verify a zone</para>
</listitem><listitem><para>Install a zone</para>
</listitem><listitem><para>Change the state of an installed zone to incomplete</para>
</listitem><listitem><para>Boot a zone, which is similar to booting a regular Solaris
system</para>
</listitem><listitem><para>Display information about a running zone</para>
</listitem><listitem><para>Halt a zone</para>
</listitem><listitem><para>Reboot a zone</para>
</listitem><listitem><para>Uninstall a zone</para>
</listitem><listitem><para>Relocate a zone from one point on a system to another point
on the same system</para>
</listitem><listitem><para>Provision a new zone based on the configuration of an existing
zone on the same system</para>
</listitem><listitem><para>Migrate a zone, used with the <command>zonecfg</command> command</para>
</listitem>
</itemizedlist><para>For zone installation and verification procedures, see <olink targetptr="z.inst.task-1" remap="internal">Chapter&nbsp;20, Installing, Booting, Halting, Uninstalling,
 and Cloning Non-Global Zones (Tasks)</olink> and the <olink targetdoc="group-refman" targetptr="zoneadm-1m" remap="external"><citerefentry><refentrytitle>zoneadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.
Also refer to the <citerefentry><refentrytitle>zoneadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry> man page for supported options to
the <command>zoneadm</command> <literal>list</literal> command. For zone configuration
procedures, see <olink targetptr="z.conf.start-1" remap="internal">Chapter&nbsp;18, Planning
and Configuring Non-Global Zones (Tasks)</olink> and the <olink targetdoc="group-refman" targetptr="zonecfg-1m" remap="external"><citerefentry><refentrytitle>zonecfg</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.  Zone
states are described in <olink targetptr="zones.intro-12" remap="internal">Non-Global Zone
State Model</olink>.</para><para>If you plan to produce Solaris auditing records for zones, read <olink targetptr="z.admin.ov-20" remap="internal">Using Solaris Auditing in Zones</olink> before you
install non-global zones.</para>
</sect1><sect1 id="z.inst.ov-3"><title>Zone Construction</title><para>This section applies to initial zone construction, and not to the cloning
of existing zones.</para><para>After
you have configured a non-global zone, you should verify that the zone can
be installed safely on your system's configuration. You can then install the
zone. The files needed for the zone's root file system are installed by the
system under the zone's root path.</para><para>A non-global zone is installed with the limited networking configuration
(<literal>generic_limited_net.xml</literal>). Network configuration types
are described in <olink targetdoc="sysadv1" targetptr="faauf" remap="external">Chapter 16, <citetitle remap="chapter">Managing Services (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>. The
zone administrator can switch the zone to the open, traditional networking
configuration (<literal>generic_open.xml</literal>) by using the <command>netservices</command> command. Specific services can be enabled or disabled  by using
SMF commands. For more information, see <olink targetptr="gdpau" remap="internal">Switching
the Non-Global Zone to a Different Networking Service Configuration</olink>.</para><para>A successfully installed zone is ready for booting and initial login.</para><para>The method used to initially install packages in a Solaris installation
is also the method used to populate a non-global zone.</para><para>The global zone must contain all the data necessary to populate a non-global
zone. Populating a zone includes creating directories, copying files, and
providing configuration information.</para><para>Only the information or data that was created in the global zone from
packages is used to populate the zone from the global zone. For more information,
see the <olink targetdoc="group-refman" targetptr="pkgparam-1" remap="external"><citerefentry><refentrytitle>pkgparam</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="pkginfo-4" remap="external"><citerefentry><refentrytitle>pkginfo</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man pages.</para><para>Data from the following are not referenced or copied when a zone is
installed:</para><itemizedlist><listitem><para>Non-installed packages</para>
</listitem><listitem><para>Patches</para>
</listitem><listitem><para>Data on CDs and DVDs</para>
</listitem><listitem><para>Network installation images</para>
</listitem><listitem><para>Any prototype or other instance of a zone</para>
</listitem>
</itemizedlist><para>In addition, the following types of information, if present in the global
zone, are not copied into a zone that is being installed:</para><itemizedlist><listitem><para>New or changed users in the <filename>/etc/passwd</filename> file</para>
</listitem><listitem><para>New or changed groups in the <filename>/etc/group</filename> file</para>
</listitem><listitem><para>Configurations for networking services such as DHCP address
assignment</para>
</listitem><listitem><para>Customizations for networking services such as UUCP or sendmail</para>
</listitem><listitem><para>Configurations for network services such as naming services</para>
</listitem><listitem><para>New or changed <literal>crontab</literal>, printer, and mail
files</para>
</listitem><listitem><para>System log, message, and accounting files</para>
</listitem>
</itemizedlist><para>If Solaris auditing is used, modifications to auditing files copied
from the global zone might be required. For more information, see <olink targetptr="z.admin.ov-20" remap="internal">Using Solaris Auditing in Zones</olink>.</para><para>The following features cannot be configured in a non-global zone:</para><itemizedlist><listitem><para>Solaris <trademark>Live Upgrade</trademark> boot environments</para>
</listitem><listitem><para>Solaris Volume Manager metadevices</para>
</listitem><listitem><para>DHCP address assignment in a shared-IP zone</para>
</listitem><listitem><para>SSL proxy server</para>
</listitem>
</itemizedlist><para>The resources specified in the configuration file are added when the
zone transitions from installed to ready. A unique zone ID is assigned by
the system. File systems are mounted, network interfaces are set up, and devices
are configured. Transitioning into the ready state prepares the virtual platform
to begin running user processes. In the ready state, the <literal>zsched</literal> and <command>zoneadmd</command> processes are started to manage the virtual platform.</para><itemizedlist><listitem><para><literal>zsched</literal>, a system scheduling process similar
to <command>sched</command>, is used to track kernel resources associated
with the zone.</para>
</listitem><listitem><para><command>zoneadmd</command> is the zones administration daemon.</para>
</listitem>
</itemizedlist><para>A zone in the ready state does not have any user processes executing
in it. The primary difference between a ready zone and a running zone is that
at least one process is executing in a running zone. See the <olink targetdoc="group-refman" targetptr="init-1m" remap="external"><citerefentry><refentrytitle>init</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page for more information.</para>
</sect1><sect1 id="z.inst.ov-12"><title>The <command>zoneadmd</command> Daemon</title><para>The zones administration daemon, <command>zoneadmd</command>,
is the primary process for managing the zone's virtual platform. The daemon
is also responsible for managing zone booting and shutting down. There is
one <command>zoneadmd</command> process running for each active (ready, running,
or shutting down) zone on the system.</para><para>The <command>zoneadmd</command> daemon sets up the zone as specified
in the zone configuration. This process includes the following actions:</para><itemizedlist><listitem><para>Allocating the zone ID and starting the <command>zsched</command> system
process</para>
</listitem><listitem><para>Setting zone-wide resource controls</para>
</listitem><listitem><para>Preparing the zone's devices as specified in the zone configuration</para>
</listitem><listitem><para>Setting up network interfaces</para>
</listitem><listitem><para>Mounting loopback and conventional file systems</para>
</listitem><listitem><para>Instantiating and initializing the zone console device</para>
</listitem>
</itemizedlist><para>Unless the <command>zoneadmd</command> daemon is already running, it
is automatically started by <command>zoneadm</command>. Thus, if the daemon
is not running for any reason, any invocation of <command>zoneadm</command> 
to administer the zone will restart <command>zoneadmd</command>.</para><para>The man page for the <command>zoneadmd</command> daemon is <citerefentry><refentrytitle>zoneadmd</refentrytitle><manvolnum>1M</manvolnum></citerefentry>.</para>
</sect1><sect1 id="z.inst.ov-13"><title>The <literal>zsched</literal> Zone Scheduler</title><para>An active zone is a zone that is in the ready state, the running
state, or the shutting down state. Every active zone has an associated kernel
process, <literal>zsched</literal>. Kernel threads doing work on behalf of
the zone are owned by <literal>zsched</literal>. The <literal>zsched</literal> process
enables the zones subsystem to keep track of per-zone kernel threads.</para>
</sect1><sect1 id="z.inst.ov-4"><title>Zone Application Environment</title><para>The <command>zoneadm</command> command is used to create the zone application
environment.</para><para>After a non-global zone is booted for the first time, the internal configuration
of the zone must be created. The internal configuration specifies a naming
service to use, the default locale and time zone, the zone's root password,
and other aspects of the application environment. For more information, see <olink targetptr="z.login.ov-14" remap="internal">Internal Zone Configuration</olink> and <olink targetptr="z.login.task-31" remap="internal">Performing the Initial Internal Zone Configuration</olink>.
Note that the default locale and time zone for a zone can be configured independently
of the global settings.</para>
</sect1><sect1 id="z.inst.ov-6"><title>About Halting, Rebooting, and Uninstalling
Zones</title><para>This section provides an overview of the procedures for halting, rebooting,
uninstalling, and cloning zones.</para><sect2 id="z.inst.ov-7"><title>Halting a Zone</title><para>The <command>zoneadm</command> <command>halt</command> command
is used to remove both the application environment and the virtual platform
for a zone. The zone is then brought back to the installed state. All processes
are killed, devices are unconfigured, network interfaces are destroyed, file
systems are unmounted, and the kernel data structures are destroyed.</para><para>The <command>halt</command> command does <emphasis>not</emphasis> run
any shutdown scripts within the zone. To shut down a zone, see <olink targetptr="z.login.task-25" remap="internal">How to Use zlogin to Shut Down a Zone</olink>.</para><para>If the halt operation fails, see <olink targetptr="gcrsr" remap="internal">Zone Does
Not Halt</olink>.</para>
</sect2><sect2 id="z.inst.ov-8"><title>Rebooting a Zone</title><para>The <command>zoneadm</command> <command>reboot</command> command is used to reboot a zone. The
zone is halted and then booted again. The zone ID will change when the zone
is rebooted.</para>
</sect2><sect2 id="gdepq"><title>Zone Boot Arguments</title><para>Zones support the following boot arguments used with the <command>zoneadm</command> <literal>boot</literal> and <literal>reboot</literal> commands:</para><itemizedlist><listitem><para><option>i</option> <replaceable>altinit</replaceable></para>
</listitem><listitem><para><option>m</option> <replaceable>smf_options</replaceable></para>
</listitem><listitem><para><option>s</option></para>
</listitem>
</itemizedlist><para>The following definitions apply:</para><variablelist><varlistentry><term><option>i</option> <replaceable>altinit</replaceable></term><listitem><para>Selects an alternative executable to be the first process. <replaceable>altinit</replaceable> must be a valid path to an executable. The default first
process is described in <olink targetdoc="group-refman" targetptr="init-1m" remap="external"><citerefentry><refentrytitle>init</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para>
</listitem>
</varlistentry><varlistentry><term><option>m</option> <replaceable>smf_options</replaceable></term><listitem><para>Controls the boot behavior of SMF. There are two categories
of options, recovery options and messages options. Message options determine
the type and number of messages that displays during boot. Service options
determine the services that are used to boot the system.</para><para>Recovery options include the following:</para><variablelist><varlistentry><term>debug</term><listitem><para>Prints standard per-service output and all <literal>svc.startd</literal> messages
to log.</para>
</listitem>
</varlistentry><varlistentry><term><literal>milestone=</literal><replaceable>milestone</replaceable></term><listitem><para>Boot to the subgraph defined by the given milestone. Legitimate
  milestones are <literal>none</literal>, <literal>single-user</literal>, <literal>multi-user</literal>, <literal>multi-user-server</literal>, and <literal>all</literal>.</para>
</listitem>
</varlistentry>
</variablelist><para>Message options include the following:</para><variablelist><varlistentry><term><literal>quiet</literal></term><listitem><para>Prints standard per-service output and error messages requiring
administrative intervention</para>
</listitem>
</varlistentry><varlistentry><term><literal>verbose</literal></term><listitem><para>Prints standard per-service output and messages providing
more information.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry><varlistentry><term><option>s</option></term><listitem><para>Boots only to milestone <literal>svc:/milestone/single-user:default</literal>. This milestone is equivalent to <literal>init</literal> level <literal>s</literal>.</para>
</listitem>
</varlistentry>
</variablelist><para>For usage examples, see <olink targetptr="z.inst.task-13" remap="internal">How to Boot
a Zone</olink> and <olink targetptr="fnjyv" remap="internal">How to Boot a Zone in Single-User
Mode</olink>. </para><para>For information on the Solaris service management facility (SMF) and <literal>init</literal> , see <olink targetdoc="sysadv1" targetptr="hbrunlevels-25516" remap="external">Chapter 15, <citetitle remap="chapter">Managing Services (Overview),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>, <olink targetdoc="group-refman" targetptr="svc.startd-1m" remap="external"><citerefentry><refentrytitle>svc.startd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="init-1m" remap="external"><citerefentry><refentrytitle>init</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para>
</sect2><sect2 id="z.inst.ov-9"><title>Zone <literal>autoboot</literal></title><para>If you set the <literal>autoboot</literal> resource property in a zone's
configuration to <literal>true</literal>, that zone is automatically booted
when the global zone is booted. The default setting is <literal>false</literal>.</para><para>Note that for zones to autoboot, the zones service <literal>svc:/system/zones:default</literal> must also be enabled.</para>
</sect2><sect2 id="z.inst.ov-10"><title>Uninstalling a Zone</title><para>The <command>zoneadm</command> <command>uninstall</command> command
is used to uninstall all of the files under the zone's root file system. Before
proceeding, the command prompts you to confirm the action, unless the <option>F</option> (force)
option is also used. Use the <command>uninstall</command> command with caution,
because the action is irreversible.</para>
</sect2>
</sect1><sect1 id="gcrsy"><title>About Cloning Non-Global Zones</title><para>Cloning allows you to copy an existing configured and installed zone
on your system to rapidly provision a new zone on the same system. Note that
at a minimum, you must reset properties and resources for the components that
cannot be identical for different zones. Thus, the <literal>zonepath</literal> must
always be changed. In addition, for a shared-IP zone, the IP addresses in
any net resources must be different. For an exclusive-IP zone, the physical
property of any net resources must be different.</para><itemizedlist><listitem><para>Cloning a zone is a faster way to install a zone.</para>
</listitem><listitem><para>The new zone will include any changes that have been made
to customize the source zone, such as added packages or file modifications.</para>
</listitem>
</itemizedlist><para>When the source <literal>zonepath</literal> and the target <literal>zonepath</literal> both reside on ZFS and are in the same pool, the <command>zoneadm</command> <literal>clone</literal> command automatically uses ZFS to clone the zone. When using
ZFS clone, the data is not actually copied until it is modified. Thus, the
initial clone takes very little time. The <command>zoneadm</command> command
takes a ZFS snapshot of the source <literal>zonepath</literal>, and sets up
the target <literal>zonepath</literal>. The system names the snapshot <literal>SUNWzone</literal><replaceable>X</replaceable>, where <replaceable>X</replaceable> is
a unique ID used to distinguish between multiple snapshots. The <literal>zonepath</literal> of the destination zone is used to name the ZFS clone. A software
inventory is performed so that a snapshot used at a future time can be validated
by the system. To clone a source zone multiple times, the <literal>zoneadm</literal> command
allows you to specify that an existing snapshot should be used. The system
validates that the existing snapshot is usable on the target.</para><para>You cannot use manual snapshots, such as the type described in <olink targetdoc="zfsadmin" targetptr="gbcya" remap="external"><citetitle remap="section">Creating and Destroying ZFS Snapshots</citetitle> in <citetitle remap="book">Solaris ZFS Administration Guide</citetitle></olink>. This type of snapshot  lacks the data to perform
a validation.</para><note><para>You can specify that a ZFS <literal>zonepath</literal> be copied
instead of ZFS cloned, even though the source could be cloned in this way.</para>
</note><para>See <olink targetptr="gbwmc" remap="internal">Cloning a Non-Global Zone on the Same System</olink> for
more information.</para>
</sect1>
</chapter>