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

ProcedureHow to Migrate A Non-Global Zone

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 zone to be migrated, my-zone in this procedure.


    host1# zoneadm -z my-zone halt
    
  3. Detach the zone.


    host1# zoneadm -z my-zone detach
    

    The detached zone is now in the configured state.

  4. Move the zonepath for my-zone to the new host.

    See How to Move the zonepath to a New Host for more information.

  5. On the new host, configure the zone.


    host2# zonecfg -z my-zone
    

    You will see the following system message:


    my-zone: No such zone configured
    Use 'create' to begin configuring a new zone.
  6. To create the zone my-zone on the new host, use the zonecfg command with the -a option and the zonepath on the new host.


    zonecfg:my-zone> create -a /export/zones/my-zone
    
  7. (Optional) View the configuration.


    zonecfg:my-zone> info
    zonename: my-zone
    zonepath: /export/zones/my-zone
    autoboot: false
    pool:
    inherit-pkg-dir:
             dir: /lib
    inherit-pkg-dir:
             dir: /platform
    inherit-pkg-dir:
             dir: /sbin
    inherit-pkg-dir:
             dir: /usr
    net:
             address: 192.168.0.90
             physical: bge0
  8. Make any required adjustments to the configuration.

    For example, the network physical device is different on the new host, or devices that are part of the configuration might have different names on the new host.


    zonecfg:my-zone> select net physical=bge0
    zonecfg:my-zone:net> set physical=e1000g0
    zonecfg:my-zone:net> end
    
  9. Commit the configuration and exit.


    zonecfg:my-zone> commit
    zonecfg:my-zone> exit
    
  10. Attach the zone on the new host using one of the following methods.

    • Attach the zone with a validation check.


      host2# zoneadm -z my-zone attach
      

      The system administrator is notified of required actions to be taken if either or both of the following conditions are present:

      • Required packages and patches are not present on the new machine.

      • The software levels are different between machines.

    • Solaris 10 10/08: Attach the zone with a validation check and update the zone to match a host running later versions of the dependent packages or having a different machine class upon attach.


      host2# zoneadm -z my-zone attach -u
      

      Tip –

      Solaris 10 10/08: If the source system is running an older version of the Solaris system, it might not generate a correct list of packages when the zone is detached. To ensure that the correct package list is generated on the destination, you can remove the SUNWdetached.xml file from the zonepath. Removing this file will cause a new package list to be generated by the destination system.

      This is not necessary with the Solaris 10 5/09 and later releases.


    • Solaris 10 9/10: Attach the zone with a validation check and update all of the packages for the zone, so that these packages match what would be seen with a newly installed non-global zone on this host. Any packages installed inside the zone but not installed in the global zone are ignored and left as-is.


      host2# zoneadm -z my-zone attach -U
      
    • Solaris 10 5/09 and later: Also use the -b option to back out specified patches, either official or IDR, during the attach.


      host2# zoneadm -z my-zone attach -u -b IDR246802-01 -b 123456-08
      

      Note that you can use the -b option independently of the -u or -U options.

    • Force the attach operation without performing the validation.


      host2# zoneadm -z my-zone attach -F
      

      Caution – Caution –

      The -F option allows you to force the attach with no validation performed. This is useful in certain cases, such as in a clustered environment or for backup and restore operations, but it does require that the system be properly configured to host the zone. An incorrect configuration could result in undefined behavior later.