System Administration Guide: Oracle Solaris Containers-Resource Management and Oracle Solaris Zones

ProcedureHow to Clone a Zone

You must configure the new zone before you can install it. The parameter passed to the zoneadm create subcommand is the name of the zone to clone. This source zone must be halted.

You must be the global administrator in the global zone to perform this procedure.

  1. Become superuser, or assume the Primary Administrator role.

    To create the role and assign the role to a user, see Using the Solaris Management Tools With RBAC (Task Map) in System Administration Guide: Basic Administration.

  2. Halt the source zone to be cloned, which is my-zone in this procedure.


    global# zoneadm -z my-zone halt
    
  3. Start configuring the new zone by exporting the configuration of the source zone my-zone to a file, for example, master.


    global# zonecfg -z my-zone export -f /export/zones/master
    

    Note –

    You can also create the new zone configuration using the procedure How to Configure the Zone instead of modifying an existing configuration. If you use this method, skip ahead to Step 6 after you create the zone.


  4. Edit the file master. Set different properties and resources for the components that cannot be identical for different zones. For example, you must set a new zonepath. For a shared-IP zone, the IP addresses in any net resources must be changed. For an exclusive-IP zone, the physical property of any net resources must be changed.

  5. Create the new zone, zone1, by using the commands in the file master.


    global# zonecfg -z zone1 -f /export/zones/master
    
  6. Install the new zone, zone1, by cloning my-zone.


    global# zoneadm -z zone1 clone my-zone
    

    The system displays:


    Cloning zonepath /export/home/my-zone...

    Starting with Solaris 10 5/09, if the source zonepath is on a ZFS pool, for example, zeepool, the system displays:


    Cloning snapshot zeepool/zones/my-zone@SUNWzone1
    Instead of copying, a ZFS clone has been created for this zone.
  7. List the zones on the system.


    ID  NAME     STATUS       PATH                           BRAND      IP
     0  global   running      /                              native     shared
     -  my-zone  installed    /export/home/my-zone           native     shared
     -  zone1    installed    /export/home/zone1             native     shared
Solaris 10 5/09: When a Source zonepath on a ZFS File System Is Cloned

When the zoneadm command clones a source zonepath that is on its own ZFS file system, the following actions are performed: