One of the nice features about Solaris zones (available in Oracle Solaris 10 and later) is the ability to migrate them from one Solaris system to another. In most cases, it is a very easy process with little risk of problems. As long as a few precautions are taken prior to the move, most Solaris system administrators should not have any problems with moving zones.
Matching Solaris Release Levels Prior to Zone Migration
It is important to make sure that both the source and target systems for zone migration are at the same Solaris release and operating system patch level. If the target system has a newer release or patch level of Solaris, the source system will need to be upgraded as well prior to the migration. It is not necessary to worry about the patch levels for third party products when it comes to the Solaris zone migration itself. For example, if one system has an older version of Oracle database or Weblogic, it does not matter with regards to the migration.
If upgrading the Solaris release is part of the zone migration, it is best to perform the upgrade prior to the zone migration if Live Upgrade is used. Live Upgrade will allow system administrators to revert to the previous version of the operating system if there is a failure during the upgrade. However, it is also possible to wait until after the migration to perform the Solaris OS upgrade.
Migrating a Solaris Zone from One System to Another
Now it is time to migrate the zone. First thing to do is to halt the zone with the command:
zoneadm -z original_zone halt
Then prepare the zone for migration by detaching it from the source system with the following:
zoneadm -z original_done detach
The next step is to move the zone from one Solaris system to another. This can be done by any method. Most people will simply create a tar archive of the zone and move it over the network via SSH's scp command.
After the zone has been moved to another system. It is now time to tell the target Solaris system to configure the newly copied zone with the following command:
zonecfg -z original_zone
Solaris will mention that the zone does not exist. It will be necessary to tell the operating system where the new zone is with the following command inside zonecfg:
zonecfg:original_zone> create -a /export/home/original_zone
From here, it is possible to configure the zone for the new server. This would be a good time to change the IP, default router, or any other settings that need to be modified. When all changes have been made, don't forget to execute the "commit" command in zonecfg prior to exiting.
Now it is time to attach the zone to the new system and boot it up with the following two commands:
zoneadm -z original_zone attach
zoneadm -z original_zone boot
It should take only a few seconds at the very most for the zone to boot. Use the zlogin command to verify that the migration was completely successful. In most cases, the procedure to migrate a zone should run very smoothly. It is definitely possible to script this entire procedure to move many Oracle Solaris zones at once.