by Kevin Klapak
This article describes how to move non-global Oracle Solaris Zones to another system, whether that system is on premises or off premises in the cloud.
Table of Contents
In my previous article, "Transform Your Oracle Solaris Servers into a Modern Cloud by Using Oracle Solaris Zones," we looked at the benefits of using Oracle Solaris Zones and how to convert your current Oracle Solaris system into a non-global zone. In this article, I show how easy it is to move non-global zones to different systems. The same process can be used to make backups of your zones.
A future release of Oracle Solaris might remove support for ZFS streaming archives and other legacy archive types. Oracle Solaris Unified Archives are recommended as an archive zone conversion strategy for systems running Oracle Solaris 11.2 or higher, but I will also go through a ZFS archive example as well for use with legacy source systems.
These examples assume 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—a secure, 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.
How to Move a Non-Global Zone by Using Unified Archives
As an administrator, do the following:
1. Create a recovery archive.
source# archiveadm create -r -z zone1 /net/server_ip/zone1-archive.uar
2. Uninstall the zone on the source global zone, or set
autoboot on the zone to
source# zonecfg -z zone1 set autoboot=false
3. Configure the target destination global zone from the archive.
target# zonecfg -z newzone1 create -a /net/server_ip/zone1-archive.uar
4. Install the zone using the archive.
target# zoneadm -z newzone1 install -a /net/server_ip/zone1-archive.uar
5. Boot the migrated zone.
target# zoneadm -z newzone1 boot
How to Move a Non-Global Zone by Using ZFS Archives
As an administrator, do the following:
1. Shut down the zone to be migrated, which is called zone1 in this procedure.
source# zoneadm -z zone1 shutdown
2. (Optional) Detach the zone.
source# zoneadm -z zone1 detach
The detached zone is now in the configured state. The zone will not automatically boot when the global zone next boots.
3. Export the zone configuration.
source# mkdir /net/server_ip/zonearchives/zone1
source# zonecfg -z zone1 export> /net/server_ip/zonearchives/zone1/zone1.config
4. Create a gzip ZFS archive.
source# zfs list -H -o name /zones/zone1 rpool/zones/zone1
source# zfs snapshot -r rpool/zones/zone1@v2v
source# zfs send -rc rpool/zones/zone1@v2v | gzip > /net/server_ip/zonearchives/zone1/zone1.zfs.gz
- For this example we are assuming that the zone's ZFS file system is the default rpool/zones location.
- Use of compression is optional, but it is generally faster because fewer I/O operations are performed while writing and subsequently reading the archive.
5. On the target system, configure the zone.
target# zonecfg -z zone1 -f /net/server_ip/zonearchives/zone1/zone1.config
You will see the following system message:
zone1: No such zone configured
Use 'create' to begin configuring a new zone.
6. (Optional) View the configuration.
target# zonecfg:zone1> info
7. Make any required adjustments to the configuration.
For example, adjustments might be needed if the network physical device is different on the target system or if devices that are part of the configuration have different names on the target system, and so on.
target# zonecfg -z zone1
zonecfg:zone1> select net physical=net0
zonecfg:zone1:net> set physical=net100
8. Commit the configuration and exit.
9. Install the zone on the target destination by using one of the following methods. Use of the
install subcommand is recommended.
- Install the zone, performing the minimum updates required to allow the installation to succeed:
target# zoneadm -z zone1 install -p -a /net/server_ip/zonearchives/zone1/zone1.zfs.gz
In this release, you can also attach the zone, performing the minimum updates required to allow the attach operation to succeed. If updates are allowed, catalogs from publishers are refreshed during a
target# zoneadm -z zone1 attach -u -a /net/server_ip/zonearchives/zone1/zone1.zfs.gz
- Install the zone, updating all packages in the zone to the latest version that is compatible with the global zone:
target# zoneadm -z zone1 install -U -p -a /net/server_ip/zonearchives/zone1/zone1.zfs.gz
In this release, you can also attach the zone, updating all packages in the zone to the latest version that is compatible with the global zone:
target# zoneadm -z zone1 install -U -a /net/server_ip/zonearchives/zone1/zone1.zfs.gz
- Attach the zone to the new host without updating any software:
target# zoneadm -z zone1 attach -a /net/server_ip/zonearchives/zone1/zone1.zfs.gz
As you can see from the examples provided above, it is very easy to move Oracle Solaris Zones around. Whether it's on premises to new a server or off premises to the cloud, this process has been verified to work.
- Oracle Solaris 11 download page
- Oracle Solaris 11 product documentation
- Oracle Solaris 11 how-to articles
- Oracle Solaris 11 lifecycle management page
- Oracle Solaris 11 training and support
- The official Oracle Solaris blog
- The Observatory blog, which provides Oracle Solaris tips and tricks
- Oracle Solaris on Facebook and Twitter
About the Author
Kevin Klapak is a technical product manager on the Oracle Optimized Solutions team. He has a computer science background, and since joining Oracle, he has been working on projects related to data migration, systems security, and cloud computing.