|Skip Navigation Links|
|Exit Print View|
|Oracle Solaris Administration: Oracle Solaris Zones, Oracle Solaris 10 Zones, and Resource Management Oracle Solaris 11 Information Library|
The zonecfg and zoneadm commands can be used to migrate an existing non-global zone from one system to another. The zone is halted and detached from its current host. The zonepath is moved to the target host, where it is attached.
The following requirements apply to zone migration:
You must remove all inactive BEs on the source system before migration.
The global zone on the target system must be running the same Oracle Solaris 11 release as the original source host.
To ensure that the zone will run properly, the target system must have the same or later versions of the required operating system packages as those installed on the original source host.
Other packages, such as those for third-party products, can be different.
If the new host has later versions of the zone-dependent packages, using zoneadm attach with the -u or -U options updates those packages within the zone to match the new host. The update on attach software looks at the zone that is being migrated and determines which packages must be updated to match the new host. Only those packages are updated. The rest of the packages can vary from zone to zone. Any packages installed inside the zone but not installed in the global zone are ignored and left as-is.
The zoneadm detach process creates the information necessary to attach the zone on a different system. The zoneadm attach process verifies that the target machine has the correct configuration to host the zone.
Because there are several ways to make the zonepath available on the new host, the actual movement of the zonepath from one system to another is a manual process that is performed by the global administrator.
When attached to the new system, the zone is in the installed state.
You must be the global administrator or a user with appropriate authorizations in the global zone to perform this procedure.
This example describes how to create an archive of a zone and then attach that archive to another system. It assumes that the administrator on the source and target hosts are able to access a shared NFS server for temporary file storage. In the event that shared temporary space is not available, other means, such as scp secure copy, a remote file copy program, can be used to copy the files between the source and target machines. The scp program requests passwords or passphrases if they are needed for authentication.
host1# zoneadm -z my-zone shutdown
host1# zoneadm -z my-zone detach
The detached zone is now in the configured state. The zone will not automatically boot when the global zone next boots.
host1# mkdir /net/server/zonearchives/my-zone host1# zonecfg -z my-zone export > /net/nserver/zonearchives/my-zone/my-zone.zonecfg
host1# zfs list -H -o name /zones/my-zone rpool/zones/my-zone host1# zfs snapshot -r rpool/zones/my-zone@v2v host1# zfs send -rc rpool/zones/my-zone@v2v | gzip > /net/server/zonearchives/my-zone/my-zone.zfs.gz
Use of compression is optional, but it is generally faster because less I/O is performed while writing and subsequently reading the archive. For more information, see Oracle Solaris Administration: ZFS File Systems.
host2# zonecfg -z my-zone -f /net/server/zonearchives/my-zone/my-zone.zonecfg
You will see the following system message:
my-zone: No such zone configured Use 'create' to begin configuring a new zone.
zonecfg:my-zone> create -a /zones/my-zone
zonecfg:my-zone> info zonename: my-zone zonepath: /zones/my-zone autoboot: false pool: net: address: 192.168.0.90 physical: bge0
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
zonecfg:my-zone> commit zonecfg:my-zone> exit
host2# zoneadm -z my-zone attach -a /net/server/zonearchives/my-zone/my-zone.zfs.gz
host2# zoneadm -z my-zone attach -u -a /net/server/zonearchives/my-zone/my-zone.zfs.gz
host2# zoneadm -z my-zone attach -U -a /net/server/zonearchives/my-zone/my-zone.zfs.gz
There are also several ways to transfer the archive to the new host. The mechanism used to transfer the zonepath from the source host to the target destination host depends on the local configuration. In some cases, such as a SAN, the zonepath data might not actually move. The SAN can simply be reconfigured to make the zonepath visible on the new host. In other cases, the zonepath might be written to tape, and the tape mailed to a new site.
For these reasons, this step is not automated. The system administrator must choose the most appropriate technique to move the zonepath to the new host.
Example 23-1 Archiving and Moving the zonepath Using the tar Command, and Attaching the Zone
Create a tar file of the zonepath on host1 and transfer it to host2 by using the sftp command.
host1# cd /zones host1# tar cf my-zone.tar my-zone host1# sftp host2 Connecting to host2... Password: sftp> cd /zones sftp> put my-zone.tar Uploading my-zone.tar to /zones/my-zone.tar sftp> quit
On host2, attach the zone:
host2# zoneadm -z my-zone attach -a /zones/my-zone.tar -u
Example 23-2 Archiving the zonepath Using cpio and Compressing the Archive Using gzip
This is an alternative to using the tar command as shown in Example 23-1.
host1# zoneadm -z my-zone halt host1# find my-zone -print | cpio -oP@/ | gzip > my-zone.cpio.gz
If you have used the -a option instead of reconfiguring a SAN, then the zonepath data will still be visible on the source host even though the zone is now in the configured state. You can either manually remove the zonepath from the source host after you have finished moving the data to the new host, or you can reattach the zone to the source host and use the zoneadm uninstall command to remove the zonepath.