oow solaris zone cloning demo

At our OpenWorld kiosk we want to show a few of the unique Solaris features that we use every day. One of them is cloning of zones or containers. So I set up a simple demo that I want to share so you can try this at home. You would script all of the steps (and more) to automate the whole process but for the demo I want to show all the steps manually so you get an idea of how simple this is instead of just acknowledging that a script can clone an environment in a few seconds. I prepared this by installing Solaris 11, creating a network bond interface called aggr1 (but you can use your interface of choice) and a zpool called zp01 that will hold my zone roots.

I am using shared IP networking for this example which is not the default with Solaris 11 any more but it does simplify the demo case. Normally, you would do exclusive networking which means that each zone is getting it’s own virtual network interface and network stack which allows for more flexibility in routing (the zone can be in a different subnet or vlan and use a different router) and management and monitoring. The reason I am using the shared model is it is much easier to set the IP address from the global zone. Also, you can set IPv4 and IPv6 in one step. If you wonder why I am adding two addresses for ipv6, check out this explanation by Florian.

root@pls3:~# zonecfg -z oow01
oow01: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:oow01> create
create: Using system default template 'SYSdefault'
zonecfg:oow01> set zonepath=/zp01/oow01
zonecfg:oow01> set ip-type=shared
zonecfg:oow01> remove anet
zonecfg:oow01> add net
zonecfg:oow01:net> set address=46.30.26.11
zonecfg:oow01:net> set physical=aggr1
zonecfg:oow01:net> end
zonecfg:oow01> add net
zonecfg:oow01:net> set address= 2a02:22f0:3:fa30::11/64
zonecfg:oow01:net> set physical=aggr1
zonecfg:oow01:net> end
zonecfg:oow01> add net
zonecfg:oow01:net> set address=fe80::11/64
zonecfg:oow01:net> set physical=aggr1
zonecfg:oow01:net> end
zonecfg:oow01> info
zonename: oow01
zonepath: /zp01/oow01
brand: solaris
autoboot: false
bootargs: 
file-mac-profile: 
pool: 
limitpriv: 
scheduling-class: 
ip-type: shared
hostid: 
fs-allowed: 
net:
	address: 46.30.26.11
	allowed-address not specified
	configure-allowed-address: true
	physical: aggr1
	defrouter not specified
net:
	address: 2a02:22f0:3:fa30::11/64
	allowed-address not specified
	configure-allowed-address: true
	physical: aggr1
	defrouter not specified
net:
	address: fe80::11/64
	allowed-address not specified
	configure-allowed-address: true
	physical: aggr1
	defrouter not specified
zonecfg:oow01> verify
zonecfg:oow01> commit
zonecfg:oow01> exit

root@pls3:~# zoneadm -z oow01 install
A ZFS file system has been created for this zone.
Progress being logged to /var/log/zones/zoneadm.20120929T235816Z.oow01.install
       Image: Preparing at /zp01/oow01/root.

 Install Log: /system/volatile/install.18146/install_log
 AI Manifest: /tmp/manifest.xml.ZLaaBJ
  SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml
    Zonename: oow01
Installation: Starting ...

              Creating IPS image
              Installing packages from:
                  solaris
                      origin:  http://pkg.oracle.com/solaris/release/
DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                              167/167 32062/32062  175.8/175.8$<3>

PHASE                                        ACTIONS
Install Phase                            44313/44313 

PHASE                                          ITEMS
Package State Update Phase                   167/167 
Image State Update Phase                         2/2 
Installation: Succeeded

        Note: Man pages can be obtained by installing pkg:/system/manual

 done.

        Done: Installation completed in 132.482 seconds.


  Next Steps: Boot the zone, then log into the zone console (zlogin -C)

              to complete the configuration process.

Log saved in non-global zone as /zp01/oow01/root/var/log/zones/zoneadm.20120929T235816Z.oow01.install

root@pls3:~# zoneadm -z oow01 boot
root@pls3:~# zlogin -C oow01

Now go through the setup dialog. If it does not come up on your screen, hit F2 and you should be good to go. I have previously blogged about how to clone a running zone on Solaris 10. Unfortunately, things have changed in Solaris 11 and are a bit more complicated and I won’t go through it at this point and simply show the supported way of cloning a halted zone. At the end, you’ll have to go through the same sysid setup dialog as before – but with a little bit of scripting you can get around that aswell.

root@pls3:~# zonecfg -z oow01 export > oow01.txt
root@pls3:~# cp oow01.txt oow02.txt
root@pls3:~# vi oow02.txt <--- modify IPs and zonepath
root@pls3:~# zonecfg -z oow02 -f oow02.txt
root@pls3:~# zoneadm -z oow02 clone oow01
root@pls3:~# zoneadm -z oow02 boot
root@pls3:~# zlogin -C oow02

While this is all very basic and I would like to show some more advanced things like cloning a running zone I feel like this is actually something that we can show and demo. And it does not stop there, we will take these cloned zones to demonstrate resource management with containers which is even more interesting in terms of Oracle database hard partitioning which can save a lot of money in database licenses by reducing the number of cores that actually need licenses.

Leave a Reply

Your email address will not be published. Required fields are marked *