How to Cold Migrate a solaris Zone

Perform this procedure cold migrate a solaris zone that uses shared storage.

Note:

If the zone uses local storage, you cannot migrate the zone using cold migration. Instead, use Unified Archives to migrate the zone. Go to How to Use Unified Archive to Move a Non-Global Zone to a New System.
  1. Become a zone administrator.
  2. If the zone to be migrated is running, shut it down.

    source-host$  pfbash zoneadm -z zonename shutdown
  3. (Optional) Verify that the state is installed.

    For example:

    global$ zoneadm -z zone1 list -v
      ID NAME             STATUS      PATH      BRAND            IP
       - zone1           installed    -        solaris          excl
  4. (Optional) If you plan to use the ssh:// URI to connect to the target host, test Secure Shell promptless authentication.

    Execute a command such as date through ssh on the target host.

    global1$ ssh global2 date
    Mon Mar  9 13:22:40 PDT 2015

    If you are prompted for a password, you have not configured your key pairs to enable login without interactive authentication.

    See How to Generate a Public/Private Key Pair for Use With Secure Shell in Managing Secure Shell Access in Oracle Solaris 11.4.

  5. (Optional) Perform a dry run of the migration to verify that conditions are set appropriately.
    source-host$ zoneadm -z zonename migrate -n ssh://user@target-host

    For example:

    global$ zoneadm -z zone1 migrate -n ssh://global2
    zoneadm: zone 'zone1': Importing zone configuration.
    zoneadm: zone 'zone1': Attaching zone.
    zoneadm: zone 'zone1': Dry-run migration successful.
    zoneadm: zone 'zone1': Cleaning up.
  6. Perform the migration.

    source-host$ zoneadm -z zonename migrate ssh://user@target-host

    For example:

    global$ zoneadm -z zone1 migrate ssh://global2
    zoneadm: zone 'zone1': Importing zone configuration.
    zoneadm: zone 'zone1': Attaching zone.
    zoneadm: zone 'zone1': Migration successful.
  7. (Optional) Boot the zone on the target host.
    target-host$ zoneadm -z zonename boot

Example 8-3 Failing a Cold Migration Dry Run Due to Local Storage

This example verifies that a zone is not running. A cold migration dry run then fails because of local storage being used in the zone zone2.

root@global3 $ zoneadm list -cv
  ID NAME             STATUS      PATH                         BRAND      IP
   0 global           running     /                            solaris    shared
   - zone2            installed   -                            solaris    excl
root@global3 $ zoneadm -z zone2 migrate -n ssh://global5 
zoneadm: zone 'zone2': configuration check failed: The storage property
dev:/dev/zvol/dsk/rpool/VARSHARE/zones/zone2/disk0  is not a shared storage URI.

Example 8-4 Succeeding at Cold Migration After a Configuration Change

This example shows removal of a non-booting local storage device from the zone configuration for zone zone2, and then a successful migration. The zone configuration used comes from the migrating zone and is imported on the target host.

root@global3 $ zonecfg -z zone2 'remove device id=1;commit;exit' 
root@global3 $ zoneadm -z zone2 migrate ssh://global5 
zoneadm: zone 'zone2': Importing zone configuration.
zoneadm: zone 'zone2': Attaching zone.
zoneadm: zone 'zone2': Migration successful.