How to build a Solaris Branded Zone
Legacy requirements are often the bigest reason for building different branded zones with legacy kernels from older operating system versions. Although Sun has preached binary compatability for years, some developers bypassed the published API's and applications won't work in a Solaris 10 or 11 environment.
In this article we will create a Solaris 9 branded zone (sol9labz) with 2 CPUs and 4GB RAM to mimic an old physical server (sol9lab).
The Branded Zone OS will be installed using a flar from an existing system as part of a virtualisation project. The zone itself will be stored on a ZFS file system that is required to have a legacy mount point.
Solaris Branded Zone Requirements
To build a branded zone for Solaris 8 and 9, the right-to-use patch which is available from Oracle's e-cloud delivery server must be downloaded and installed.
- You need to look for "Oracle Solaris Legacy Containers Media Pack for Oracle Solaris on SPARC".
- You need to install the correct packages for the branded zone you are using. In our example we are using Solaris 9 branded zones so we have to install
SUNWs9brandk
product.
Create two ZFS File Systems
In our example, this server will be hosting several branded zones. Each branded zone with get their own LUN to host the system disk and a separate ZFS scratch disk.
Each branded zone will be stored under the directory structure /brandz/<hostname>
.
Note: For branded zones the ZFS file system must mount in legacy mode.
Below are the commands needed to create the ZFS file system for a host called sol9lab
. The scratch disk is used as an example to show how to add file systems to branded zones.
# mkdir /brandz # zpool create sol9lab c0t600A0B800029065C00007CF54E234013d0 # zfs set mountpoint=/brandz/sol9lab sol9lab # zfs set mountpoint=legacy sol9lab
create scratch disk pool
# zpool create scratch c0t600A0B800026D63A0000A4994E2342D4d0 # zfs create scratch/sol9lab # zfs set quota=20G scratch/sol9lab
Install Branded Zone Package
Install the correct packages for the branded zone you are going to use. In our example we are using Solaris 9 branded zones so we have to install SUNWs9brandk
product.
Note: Install the correct version of the package for the host OS you are using.
In our case we need version 1.0.1. Check the README
for more details.
Below is the output of the software installation.
# pkgadd -d . SUNWs9brandk Processing package instance <SUNWs9brandk> from </root/solarislegacycontainers/Product> Solaris 9 Containers: solaris9 brand support RTU(sparc) 11.10.0,REV=2008.09.20.18.50 Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Using </> as the package base directory. ## Processing package information. ## Processing system information. 8 package pathnames are already properly installed. ## Verifying package dependencies. ## Verifying disk space requirements. ## Checking for conflicts with packages already installed. ## Checking for setuid/setgid programs. Installing Solaris 9 Containers: solaris9 brand support RTU as <SUNWs9brandk> ## Installing part 1 of 1. /usr/lib/brand/solaris9/files/patches/112963-32.zip /usr/lib/brand/solaris9/files/patches/115986-03.zip /usr/lib/brand/solaris9/files/patches/order /usr/share/man/man5/solaris9.5 [ verifying class <none> ] Installation of <SUNWs9brandk> was successful.
Building the Solaris 9 Branded Zone
In this example, will create a branded zone to match the physical server that we are virtualising with 2 CPUs and 4GB of RAM.
To maintain compatibility with installed software the hostid
and machine type
will also be maintained. We are also going to add a ZFS file system for data.
We use the zonecfg
command to create and configure branded zone. For example:
# zonecfg -z sol9labz sol9labz: No such zone configured Use 'create' to begin configuring a new zone. zonecfg:sol9labz> create -t SUNWsolaris9 zonecfg:sol9labz> set zonepath=/brandz/sol9lab zonecfg:sol9labz> set autoboot=true zonecfg:sol9labz> add net zonecfg:sol9labz:net> set physical=ce0 zonecfg:sol9labz:net> set address=192.168.1.80 zonecfg:sol9labz:net> end zonecfg:sol9labz> add fs zonecfg:sol9labz:fs> set type=zfs zonecfg:sol9labz:fs> set special=scratch/sol9lab zonecfg:sol9labz:fs> set dir=/test zonecfg:sol9labz:fs> end zonecfg:sol9labz> add attr zonecfg:sol9labz:attr> set name=hostid zonecfg:sol9labz:attr> set type=string zonecfg:sol9labz:attr> set value=84abe39d zonecfg:sol9labz:attr> end zonecfg:sol9labz> add attr zonecfg:sol9labz:attr> set name=machine zonecfg:sol9labz:attr> set type=string zonecfg:sol9labz:attr> set value=sun4u zonecfg:sol9labz:attr> end zonecfg:sol9labz> add capped-cpu zonecfg:sol9labz:capped-cpu> set ncpus=2 zonecfg:sol9labz:capped-cpu> end zonecfg:sol9labz> add capped-memory zonecfg:sol9labz:capped-memory> set physical=4096m zonecfg:sol9labz:capped-memory> set swap=1024m zonecfg:sol9labz:capped-memory> set locked=512m zonecfg:sol9labz:capped-memory> end zonecfg:sol9labz> verify zonecfg:sol9labz> commit zonecfg:sol9labz> exit
Install OS from flash archive (flar)
To use a flar to install a branded zone, the permissions on the ZFS file system needs to be 700
. For example:
# chmod 700 /brandz/sol9lab # zoneadm -z sol9labz install -p -a /flar/sol9lab.flar Log File: /var/tmp/sol9labz.install.1668.log Source: /flar/sol9lab.flar Installing: This may take several minutes... Postprocessing: This may take several minutes... Result: Installation completed successfully. Log File: /brandz/sol9lab/root/var/log/sol9labz.install.1668.log
Verify new Branded Zone
You will need to boot the zone and log into it to verify everything is OK.
# zoneadm list global # zoneadm -z sol9labz boot # zoneadm list -v ID NAME STATUS PATH BRAND IP 0 global running / native shared 2 sol9labz running /brandz/sol9lab solaris9 shared # zlogin -C sol9labz root@sol9lab # ifconfig -a lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 ce0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 192.168.1.80 netmask ffffff00 broadcast 192.168.1.255 root@sol9lab # df -h Filesystem size used avail capacity Mounted on / 93G 46G 47G 50% / /.SUNWnative/lib 93G 46G 47G 50% /.SUNWnative/lib /.SUNWnative/platform 93G 46G 47G 50% /.SUNWnative/platform /.SUNWnative/usr 93G 46G 47G 50% /.SUNWnative/usr /dev 93G 46G 47G 50% /dev proc 0K 0K 0K 0% /proc mnttab 0K 0K 0K 0% /etc/mnttab swap 3.5G 16K 3.5G 1% /etc/svc/volatile /dev/ksyms 93G 46G 47G 50% /dev/ksyms fd 0K 0K 0K 0% /dev/fd swap 3.5G 64K 3.5G 1% /tmp