F.4 Migrate a Zone to a New Host

You can migrate a zone from one physical host to another by running the following procedure:

Note:

The zone is shut down during the migration process. If you require high availability, ensure you use a clustered software solution.

  1. Log in to the compute node hosting the zone as the root user.
  2. Shutdown the zone by running the following command:
    # zoneadm -z name_of_zone shutdown
    

    Example:

    # zoneadm -z zone04 shutdown 
    
  3. Detach the zone by running the following command:
    # zoneadm -z name_of_zone detach
    

    Example:

    # zoneadm -z zone04 detach
    zoneadm: zone 'zone04': warning(s) occured during processing URI: 'iscsi://192.168.14.133/luname.naa.600144f09c96cca900005190bfc4000a'
    Could not remove one or more iSCSI discovery addresses because logical unit is in use
    Exported zone zpool: zone04_rpool
    Unconfigured zone storage resource(s) from:
            iscsi://192.168.14.133/luname.naa.600144f09c96cca900005190bfc4000a
    # 
    
  4. Create a directory on the storage appliance to which you can export the configuration of the zone:
    # mkdir -p directory
    

    Example:

    # mkdir -p /u01/common/general/zone04
    
  5. Export the configuration of the zone by running the following command:
    # zonecfg -z name_of_zone export > directory/name_of_zone.cfg
    

    Example:

    # zonecfg -z zone04 export > /common/general/zone04/zone04.cfg
    
  6. Log in to the compute node you want to migrate the zone to as the root user.
  7. Import the zone from the configuration file you created in the previous step by running the following command:
    # zonecfg -z name_of_zone -f directory/name_of_zone.cfg
    

    Example:

    # zonecfg -z zone04 -f /common/general/zone04/zone04.cfg
    
  8. Attach the zone by running the following command:
    # zoneadm -z name_of_zone attach
    

    Example:

    # zoneadm -z zone04 attach 
    Configured zone storage resource(s) from:
        iscsi://192.168.14.133/luname.naa.600144f09c96cca900005190bfc4000a
    Imported zone zpool: zone04_rpool
    Progress being logged to /var/log/zones/zoneadm.20130513T135704Z.zone04.attach
        Installing: Using existing zone boot environment
          Zone BE root dataset: zone04_rpool/rpool/ROOT/solaris
                         Cache: Using /var/pkg/publisher.
      Updating non-global zone: Linking to image /.
    Processing linked: 1/1 done
      Updating non-global zone: Auditing packages.
    No updates necessary for this image.
     
      Updating non-global zone: Zone updated.
                        Result: Attach Succeeded.
    Log saved in non-global zone as /zones/zone04/root/var/log/zones/zoneadm.20130513T135704Z.zone04.attach
    
  9. Boot up the zone by running the following command:
    # zoneadm -z name_of_zone boot
    

    Example:

    # zoneadm -z zone04 boot
    

Note:

In some situations, the process of detaching and attaching can cause the server to boot up with the system configuration wizard running.

You can resolve this issue, by logging in to the console and completing the wizard. You can use the following command to log in to the zone:

# zlogin -C name_of_zone