Issue
At least as of Solaris 10 10/09 (Update 8), Solaris Flash Archive technology is not compatible with Solaris Zones, making systems with zones more difficult to clone and deploy.
See Solaris Flash (Planning) for details
Workaround
The solution is to handle the zones separately using the zone clone/migration features. In the example below, we will be cloning a single zone, zone1, so that we can leave the clone detached and accessible. Newly flashed systems, on first boot, will copy the detached, cloned zone data to their primary zone1 root, then they will attach the copied data to their preconfigured zone1.
1. Start by storing the desired zone configuration and sysidcfg answer file for the destination zone’s initial boot.
# mkdir -p /export/configs/hostname1/zones/zone1
# zonecfg -z zone1 export -f /export/configs/destination_hostname/zones/zone1/zone1.cfg
# vi /export/configs/hostname1/zones/zone1/zone1.cfg
Change IP address if using shared-IP zone (otherwise set the IP in the sysidcfg file below). Also update zonepath to reflect a different zone name if desired. A shortcut is to use “sed”:
# zonecfg -z zone1 export | sed ‘s/OLD_IP/NEW_IP/’ > /export/configs/destination_hostname/zones/zone1/zone1.cfg
CAUTION: If a new zone hostname is desired, the zone auto-configuration should pick it up from the IP address if it is specified in the sysidcfg file. This means either the source zone should have name services (/etc/nsswitch.conf and related files, depending on the name service used) configured so that reverse lookups succeed (example: include IP/hostname combination in the zone’s /etc/hosts file or ensure the DNS nameserver defined in /etc/resolv.conf is capable of responding to reverse lookups).
Example sysidcfg file:
# vi /export/configs/hostname1/zones/zone1/sysidcfg
security_policy=none
name_service=DNS
{
domain_name=localdomain
name_server=dnserver1
}
timezone=US/Eastern
system_locale=en_US
timeserver=localhost
root_password=8goRumdmbv1Sg
terminal=vt100
nfs4_domain=dynamic
See http://docs.sun.com/app/docs/doc/817-5504/6mkv4nh2r?a=view for a list of possible sysidcfg keywords
# share -o ro /export/configs
Create a one-time boot script for the destination system(s) to create, copy and attach the zone data
# vi /export/configs/hostname1/S99zone_attach
#!/sbin/sh
/usr/bin/ls /net/master/export/configs/`usr/bin/hostname`/zones | while read ZONE
do
/usr/bin/test -d /zones/$ZONE || /usr/bin/mkdir -p /zones/$ZONE
/usr/bin/chmod 700 /zones/$ZONE
/usr/sbin/zonecfg -z $ZONE -f /net/master/export/configs/`/usr/bin/hostname`/zones/$ZONE/$ZONE.cfg
/usr/bin/cp -rp /net/master/zones/$ZONE_clone /zones/$ZONE/
/usr/sbin/zoneadm -z $ZONE attach
/usr/bin/cp -p /net/master/export/zones/$ZONE/sysidcfg /zones/$ZONE/root/etc/
/usr/sbin/zoneadm -z $ZONE boot
done
/usr/bin/rm -f /etc/rc3.d/S99zone_attach
exit 0# chmod a+x /export/configs/hostname1/S99zone_attach
# ln -s /net/master/export/configs/hostname1/S99zone_attach /etc/rc3.d/S99zone_attach
NOTE: This is just a simplified example. Be sure to modify the above script to account for changes in the flar master server and zone names. Additional modifications may also be necessary to account for alternate zone data locations or other changes to the zone configuration.
Detach the primary zone
# zoneadm -z zone1 detach
Create the flash archive
# flarcreate -n s10zones -x /zones /var/archives/s10zones.flar
This archive will contain a link to the one-time first-boot script necessary for obtaining and attaching the cloned zone data below.
Re-attach the zone
# zoneadm -z zone1 attach
Set up the new zone, copy the configuration and clone the install data
# mkdir /zones/zone1_clone; chmod 700 /zones/zone1_clone
# zonecfg -z zone1 export | sed -n ‘s/\/zones\/zone1/\/zones/\zone1_clone/’ | zonecfg -z zone1_clone -f -
# zoneadm -z zone1_clone clone zone1
Detach the new zone
# zoneadm -z zone1_clone detach
Delete the cloned zone configuration
# zonecfg -z zone1_clone delete
Export the detached, cloned zone filesystem
# share -o ro /zones/zone1_clone
Now, when the flar destination system boots for the first time, it will automatically obtain the files needed to configure, copy, and attach the data for all zones listed under its hostname directory under /export/configs on the master server, using zonenames and hostnames from the directory names and IP address config info respectively.
- More information about cloning zones is here: Installing, Booting, Halting, Uninstalling, and Cloning Non-Global Zones
- More information about zone migration is here: Moving and Migrating Non-Global Zones
- More information about flash archives is here: Solaris 10 10/09 Installation Guide: Solaris Flash Archives (Creation and Installation)
ABOUT US
Seeds of Genius, Inc. offers a full range of IT solutions including hardware and software products in addition to consulting, installation and support services. For more information, please visit our main web site at http://www.seedsofgenius.com or contact our Technical Sales department at (410) 312-9806.